Skip to content

armgit / kwant

Public Imported from GitHub
0

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.

Sidebar: hovering a bot row no longer wraps its name or changes the row's height (#290)

Oleksandr Ivanchenko4049325ddcd0
diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx
index 2aa539d6..49058505 100644
--- a/frontend/src/components/Sidebar.tsx
+++ b/frontend/src/components/Sidebar.tsx
@@ -362,6 +362,9 @@ export const Sidebar: React.FC<SidebarProps> = ({
const isLead = !!team && k.id === team.lead_kwant_id;
const canRemove = !!team && !isLead && !!onUpdateTeamMembers;
const hasRowActions = !!onEditKwant || canRemove;
+ // Desktop: the one-line status under the name makes room for Edit and Remove on hover or focus.
+ // It never wraps, so the room costs a few letters of the status, never the row's height.
+ const actionRoom = !phone && hasRowActions ? ' group-hover/fleet:pr-9 group-focus-within/fleet:pr-9' : '';
return (
<div
key={`${team?.id ?? 'none'}:${k.id}`}
@@ -379,8 +382,8 @@ export const Sidebar: React.FC<SidebarProps> = ({
<ModernAvatar role={k.avatar_sprite} name={k.name} size={28} status={status} kwantId={k.id} />
</span>
<div className="flex-1 min-w-0">
- {/* Desktop: on hover or focus the name makes room for Edit and Remove instead of sitting under them */}
- <div data-bot-name-line className={`flex items-start gap-1 ${!phone && hasRowActions ? 'group-hover/fleet:pr-9 group-focus-within/fleet:pr-9' : ''}`}>
+ {/* The name line never changes on hover: padding it here made the name wrap and the row jump */}
+ <div data-bot-name-line className="flex items-start gap-1">
{/* The full name, on up to two lines (QA a); what it runs on is 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:anywhere]" title={`${k.name} · ${engineTip(k.preferred_model)}`}>
{k.name}
@@ -410,9 +413,10 @@ export const Sidebar: React.FC<SidebarProps> = ({
<span className="sr-only">Asks before acting</span>
</span>
))}
- {/* Over the row's right edge, so a long name gets the full width until you hover */}
+ {/* Edit and Remove sit at the right end of the one-line status below the name, which makes room
+ for them on hover: the name keeps its width and the row its height */}
{!phone && (
- <span className="absolute right-1.5 top-1.5 flex items-center gap-0.5 rounded-md bg-zinc-800/95 opacity-0 group-hover/fleet:opacity-100 group-focus-within/fleet:opacity-100 empty:hidden">
+ <span data-bot-row-actions className="absolute right-1.5 bottom-2 flex items-center gap-0.5 rounded-md bg-zinc-800/95 opacity-0 group-hover/fleet:opacity-100 group-focus-within/fleet:opacity-100 empty:hidden">
{onEditKwant && (
<button
type="button"
@@ -448,12 +452,12 @@ export const Sidebar: React.FC<SidebarProps> = ({
)}
</div>
{busyKwants[k.id] ? (
- <p className={`flex items-center gap-1.5 text-meta truncate ${status === 'needs_you' ? 'text-warn' : status === 'queued' ? 'text-zinc-300' : 'text-[#b8adff]'}`} title={busyKwants[k.id]} data-bot-busy>
+ <p className={`flex items-center gap-1.5 text-meta truncate${actionRoom} ${status === 'needs_you' ? 'text-warn' : status === 'queued' ? 'text-zinc-300' : 'text-[#b8adff]'}`} title={busyKwants[k.id]} data-bot-busy>
<span className={`kw-status-dot !h-1.5 !w-1.5 ${status === 'needs_you' ? 'kw-status-warn' : status === 'queued' ? 'kw-status-idle' : 'bg-[#9d8fff] kw-pulse'}`} aria-hidden="true" />
<span className="truncate">{busyKwants[k.id]}</span>
</p>
) : (
- <p className="text-meta text-zinc-400 truncate">{k.title}</p>
+ <p className={`text-meta text-zinc-400 truncate${actionRoom}`}>{k.title}</p>
)}
</div>
{/* Phones: one button at the row's end; in a team it opens the member's actions */}
diff --git a/frontend/tests/polish063.test.mjs b/frontend/tests/polish063.test.mjs
index ad896e6b..5175d129 100644
--- a/frontend/tests/polish063.test.mjs
+++ b/frontend/tests/polish063.test.mjs
@@ -134,16 +134,30 @@ test('2: Back after a switch inside Settings steps back to the old space, then o
// ---------------------------------------------------------------------------
// 3. Room for Edit and Remove
-test('3: on desktop the name line makes room for the hover buttons; phone rows are unchanged', () => {
+test('3: on desktop the one-line status makes room for the hover buttons, never the name line; phone rows are unchanged', () => {
const desk = m.renderToStaticMarkup(React.createElement(m.Sidebar, sidebarProps({ onUpdateTeamMembers: noop })));
+ // Padding the name line on hover squeezed the name onto a second line, so the row grew and flickered.
const lines = [...desk.matchAll(/<div data-bot-name-line="[^"]*" class="([^"]*)"/g)].map((x) => x[1]);
assert.ok(lines.length >= 3);
- for (const cls of lines) {
+ for (const cls of lines) assert.doesNotMatch(cls, /group-hover|group-focus-within|pr-9/, 'the name line looks the same with and without hover');
+ // The buttons sit at the end of the status line, which is one line and only loses a few letters.
+ const actions = [...desk.matchAll(/<span data-bot-row-actions="[^"]*" class="([^"]*)"/g)].map((x) => x[1]);
+ assert.equal(actions.length, lines.length);
+ for (const cls of actions) {
+ assert.match(cls, /\babsolute\b/);
+ assert.match(cls, /\bbottom-2\b/);
+ assert.doesNotMatch(cls, /\btop-/);
+ }
+ const status = [...desk.matchAll(/<div data-bot-name-line[\s\S]*?<\/div><p class="([^"]*)"/g)].map((x) => x[1]);
+ assert.equal(status.length, lines.length);
+ for (const cls of status) {
+ assert.match(cls, /\btruncate\b/, 'one line, so its padding never changes the row height');
assert.match(cls, /group-hover\/fleet:pr-9/);
assert.match(cls, /group-focus-within\/fleet:pr-9/);
}
const phone = m.renderToStaticMarkup(React.createElement(m.Sidebar, sidebarProps({ onUpdateTeamMembers: noop, phone: true })));
- for (const [, cls] of phone.matchAll(/<div data-bot-name-line="[^"]*" class="([^"]*)"/g)) assert.doesNotMatch(cls, /pr-9/);
+ assert.doesNotMatch(phone, /pr-9/);
+ assert.doesNotMatch(phone, /data-bot-row-actions/);
});
// ---------------------------------------------------------------------------