hermes-agent/apps/desktop/src/components/chat/activity-timer-text.tsx
ethernet 470c7e2a60
fix(desktop): prevent timers from shifting as they count (#68131)
LiveDuration returned a bare string with proportional digits, so the
statusbar reflowed every second as the timer ticked. Extract a shared
StableText component that renders each character in its own 1ch-wide
cell, preventing any digit from shifting the layout — works with the
proportional sans font, no need for font-mono.

Both LiveDuration (statusbar session/running timers) and
ActivityTimerText (tool activity timers) now use StableText, dropping
the font-mono + tabular-nums workaround from the latter.

Also renames statusbar.ts → statusbar.tsx since LiveDuration now
returns JSX.
2026-07-20 16:39:20 +00:00

25 lines
735 B
TypeScript

import { cn } from '@/lib/utils'
import { formatElapsed } from './activity-timer'
import { StableText } from './stable-text'
interface ActivityTimerTextProps {
seconds: number
className?: string
}
export function ActivityTimerText({ seconds, className }: ActivityTimerTextProps) {
return (
<StableText
className={cn(
// Tinted with --dt-midground (very low alpha) so the timer reads
// as part of the same "live signal" cluster as the dither block /
// arc-border / working-session dot, instead of being neutral chrome.
'shrink-0 text-[0.56rem] leading-none tracking-[0.02em] text-midground/55',
className
)}
>
{formatElapsed(seconds)}
</StableText>
)
}