Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

fix(sidebar): the agent name outranks the button labels in a narrow header

Chaitanya Giri9505e5ed7e48
diff --git a/src/renderer/src/components/AgentDetailPanel.tsx b/src/renderer/src/components/AgentDetailPanel.tsx
index 12513c73..8628e312 100644
--- a/src/renderer/src/components/AgentDetailPanel.tsx
+++ b/src/renderer/src/components/AgentDetailPanel.tsx
@@ -1,4 +1,4 @@
-import { useState } from 'react';
+import { useEffect, useRef, useState } from 'react';
import { PixelPanel } from './PixelPanel';
import { PixelBadge } from './PixelBadge';
import { PixelButton } from './PixelButton';
@@ -27,6 +27,52 @@ export function AgentDetailPanel({ agent }: AgentDetailPanelProps) {
const [openTerminalState, setOpenTerminalState] = useState<'idle' | 'opening' | 'ok' | 'error'>('idle');
const [openTerminalError, setOpenTerminalError] = useState<string | undefined>();
const [editOpen, setEditOpen] = useState(false);
+
+ /**
+ * THE HEADER STRIP HAS TO GIVE SOMETHING UP WHEN THE SIDEBAR IS DRAGGED IN.
+ *
+ * Four buttons with icon+label need about 246px on their own, and the
+ * portrait and gaps take another 72. The sidebar can be dragged down to
+ * 320px total (SidebarSplitter's `min`), so past a point there is simply
+ * not enough room for the labels AND the agent's name.
+ *
+ * Something has to yield, and the name is the one thing in this row that
+ * cannot: it is how you know WHICH agent you are looking at. So below the
+ * threshold the buttons drop their words and keep their icons — the tooltip
+ * and aria-label on each already carry the full explanation, so nothing is
+ * actually lost, and the ~110px that frees goes back to the name.
+ *
+ * Measured on the strip itself rather than on `sidebarWidth`, because the
+ * strip's width is set by its container and NOT by what is inside it. That
+ * is what makes a single threshold safe here: swapping labels for icons
+ * cannot change the number being compared, so the row cannot oscillate.
+ *
+ * WHERE 440 COMES FROM. Everything that is not the name costs ~318px: the
+ * four buttons measure ~246 at Inter 13px, the portrait 32, and the five
+ * 8px gaps another 40. The name is set in Press Start 2P, which is a
+ * fixed-advance pixel font — at fontSize 10 that is a flat 10px per
+ * character, plus 17 for the rename pencil beside it. Ten readable
+ * characters therefore need 117, and 318 + 117 rounds to 440.
+ *
+ * That threshold deliberately puts the DEFAULT 420px sidebar in compact
+ * mode. It has to: at 420 the labelled row leaves the name about 67px,
+ * which is six pixel-font characters — the "DWIGHT S." truncation this was
+ * reported as. Icons at the default width is the fix, not a side effect.
+ *
+ * Recompute the number if a fifth button lands in this row or a label grows.
+ */
+ const headerRef = useRef<HTMLDivElement | null>(null);
+ const [compactHeader, setCompactHeader] = useState(false);
+ useEffect(() => {
+ const el = headerRef.current;
+ if (!el) return;
+ const ro = new ResizeObserver((entries) => {
+ const w = entries[0]?.contentRect.width ?? 0;
+ if (w > 0) setCompactHeader(w < 440);
+ });
+ ro.observe(el);
+ return () => ro.disconnect();
+ }, []);
const archiveAgent = useStore(s => s.archiveAgent);
const updateAgent = useStore(s => s.updateAgent);
const renameAgent = useStore(s => s.renameAgent);
@@ -88,7 +134,7 @@ export function AgentDetailPanel({ agent }: AgentDetailPanelProps) {
noPadding
>
{/* Thin header strip */}
- <div style={{
+ <div ref={headerRef} style={{
display: 'flex', alignItems: 'center', gap: 8,
padding: '6px 8px',
background: 'var(--cth-cream-100)',
@@ -131,7 +177,7 @@ export function AgentDetailPanel({ agent }: AgentDetailPanelProps) {
aria-label="Edit this agent"
style={{ display: 'inline-flex', alignItems: 'center', gap: 4 }}
>
- <Icon name="edit" /> edit
+ <Icon name="edit" />{!compactHeader && ' edit'}
</span>
</PixelButton>
{/* v0.3.4: the IDE lives at agent level (replaces the old files tab) —
@@ -143,7 +189,7 @@ export function AgentDetailPanel({ agent }: AgentDetailPanelProps) {
aria-label="Open the IDE"
style={{ display: 'inline-flex', alignItems: 'center', gap: 4 }}
>
- <Icon name="code" /> IDE
+ <Icon name="code" />{!compactHeader && ' IDE'}
</span>
</PixelButton>
<PixelButton variant="secondary" size="sm" onClick={openTerminal} disabled={openTerminalState === 'opening'}>
@@ -157,7 +203,13 @@ export function AgentDetailPanel({ agent }: AgentDetailPanelProps) {
style={{ display: 'inline-flex', alignItems: 'center', gap: 4 }}
>
<Icon name="terminal" />
- {openTerminalState === 'opening' ? '...' : openTerminalState === 'ok' ? 'ok' : openTerminalState === 'error' ? 'err' : 'terminal'}
+ {/* The transient states survive compact mode: they are feedback on
+ a click you just made, and they are two characters wide. Only
+ the resting word "terminal" is worth its space. */}
+ {openTerminalState === 'opening' ? '...'
+ : openTerminalState === 'ok' ? 'ok'
+ : openTerminalState === 'error' ? 'err'
+ : compactHeader ? '' : 'terminal'}
</span>
</PixelButton>
{isReal && (