Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
Add member picker: a bot's name wraps only between words (#305)
Oleksandr Ivanchenko1fd54226b888
diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsxindex 27bb14a0..5d007c8d 100644--- a/frontend/src/components/Sidebar.tsx+++ b/frontend/src/components/Sidebar.tsx@@ -128,6 +128,11 @@ export interface SidebarProps {export const approvalsDiffers = (k: { approvals_effective?: string | null }, spaceApprovals: string | undefined): boolean =>!!k.approvals_effective && !!spaceApprovals && k.approvals_effective !== spaceApprovals;+// A bot's name wraps only between words or after a hyphen, on up to two lines, never inside a word+// ("Researche / r"); a word too long for its line ends in "…". Used by the sidebar row and the+// Add member picker. Prose, results and errors keep [overflow-wrap:anywhere] for long URLs.+const NAME_WRAP = 'line-clamp-2 [overflow-wrap:normal] [word-break:normal] text-ellipsis';+const navRow = (active: boolean) =>`w-full flex items-center gap-2.5 px-2.5 py-1.5 rounded-xl text-body font-medium transition-colors text-left focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400 ${active ? 'bg-accent-soft text-zinc-50 shadow-card border border-sky-300/25' : 'text-zinc-300 hover:text-zinc-50 hover:bg-white/[0.05] border border-transparent'@@ -392,7 +397,7 @@ export const Sidebar: React.FC<SidebarProps> = ({{/* The full name, on up to two lines (QA a), wrapping only between words or after a hyphen:never inside a word ("Researche / r"). A word too long for the line ends in "…"; thewhole name and what it runs on are in the tooltip */}- <span data-bot-name className="min-w-0 text-body font-semibold leading-5 text-zinc-100 line-clamp-2 [overflow-wrap:normal] [word-break:normal] text-ellipsis" title={`${k.name} · ${engineTip(k.preferred_model)}`}>+ <span data-bot-name className={`min-w-0 text-body font-semibold leading-5 text-zinc-100 ${NAME_WRAP}`} title={`${k.name} · ${engineTip(k.preferred_model)}`}>{k.name}</span>{isLead && (@@ -610,7 +615,7 @@ export const Sidebar: React.FC<SidebarProps> = ({className="w-full flex items-center gap-2 px-1.5 py-1 rounded-md text-[11px] text-zinc-300 hover:bg-sky-500/10 hover:text-zinc-100 text-left"><ModernAvatar role={k.avatar_sprite} name={k.name} size={18} kwantId={k.id} />- <span className="flex-1 min-w-0 line-clamp-2 [overflow-wrap:anywhere]" title={k.name}>{k.name}</span>+ <span data-pick-name className={`flex-1 min-w-0 ${NAME_WRAP}`} title={k.name}>{k.name}</span><span className="shrink-0 text-[10px] text-zinc-500 truncate max-w-[80px]">{k.title}</span></button>))}diff --git a/frontend/tests/nameWrap.test.mjs b/frontend/tests/nameWrap.test.mjsindex 5bde94a8..e119b673 100644--- a/frontend/tests/nameWrap.test.mjs+++ b/frontend/tests/nameWrap.test.mjs@@ -16,6 +16,7 @@ for (const k of ['window', 'document', 'navigator', 'HTMLElement', 'Node', 'DOMPconst m = await loadBundled(`export { default as React } from 'react';export { renderToStaticMarkup } from 'react-dom/server.browser';+ export { createRoot } from 'react-dom/client';export { Sidebar } from './src/components/Sidebar';`);const { React } = m;@@ -102,3 +103,39 @@ test('hover and focus never change the name line, and a bot with no title stillconst src = readFileSync(new URL('../tailwind.config.js', import.meta.url), 'utf8');assert.match(src, /meta: \['0\.75rem', \{ lineHeight: '1\.125rem' \}\]/, 'the reserved height is text-meta\'s line height');});++test('the Add member picker wraps a name the same way: between words or after a hyphen, never inside a word', async () => {+ const host = document.createElement('div');+ document.body.appendChild(host);+ const root = m.createRoot(host);+ const settle = async () => { for (let i = 0; i < 30; i++) await new Promise((r) => setTimeout(r, 0)); };+ root.render(React.createElement(m.Sidebar, {+ space, spaces: [space], onSwitchSpace: noop, onCreateSpace: noop, onOpenSpaceSettings: noop, onOpenArchived: noop, onOpenSearch: noop,+ kwants, channels: [], teams: [team], selectedId: '', isChannel: true, onSelectKwant: noop, onSelectChannel: noop, onSelectTeam: noop,+ onSummonKwant: noop, onCreateTeam: noop, onOpenInbox: noop, onOpenParallel: noop, onOpenMissions: noop, missionBoard: true,+ onEditKwant: noop, onUpdateTeamMembers: noop,+ }));+ try {+ await settle();+ const add = [...host.querySelectorAll('button')].find((b) => b.textContent.trim() === 'Add member');+ assert.ok(add, 'the team has an Add member button');+ add.dispatchEvent(new window.MouseEvent('click', { bubbles: true }));+ await settle();+ const names = [...host.querySelectorAll('[data-pick-name]')];+ assert.deepEqual(names.map((el) => el.textContent).sort(), [NAMES[2], NAMES[3]].sort(), 'the bots not yet in the team are offered');+ const rowCls = host.querySelector('[data-bot-name]').getAttribute('class');+ for (const el of names) {+ const cls = el.getAttribute('class');+ assert.doesNotMatch(cls, MID_WORD, `${el.textContent}: no mid-word break class`);+ for (const c of ['line-clamp-2', '[overflow-wrap:normal]', '[word-break:normal]', 'text-ellipsis']) {+ assert.ok(cls.split(' ').includes(c), `${el.textContent}: ${c}`);+ assert.ok(rowCls.split(' ').includes(c), `the sidebar row name shares ${c}`);+ }+ assert.equal(el.getAttribute('title'), el.textContent, 'the whole name is in the tooltip');+ assert.doesNotMatch(el.closest('button').getAttribute('class'), MID_WORD);+ }+ } finally {+ root.unmount();+ host.remove();+ }+});