Production tooltips: styled tooltips everywhere, shortcuts surfaced, dev-speak culled
Owner-approved full pass (tooltip wave, 2026-09-25). Mechanism: icon/pill controls ride the styled Radix tooltip via a new Hint composition (components/ui/hint.tsx) — the shared primitive adopted as-is, no restyling; the shortcut appends as an em-dash suffix off the LIVE registry (a rebind in Settings → Keyboard changes the suffix): "Dictate — ⌘D". Surface-owned keys (Esc closes, Enter submits) ride a raw binding prop. Native title= stays only for truncation-reveals (dock spans, the rename field) and menu-interior abbreviations (MenuShell untouched). One em-dash pattern; per-state truth on the send square (busy = "Stop the reply — Esc", idle = "Send — ↵"), Enter on the plan verdict's accept, "Stop dictation (Esc)" kept verbatim per the owner's flag. Copy: the dev-speak cull — no pipeline/prober/tier/wave vocabulary anywhere a user reads. New pins in tests/tooltip-mechanism.test.tsx (hintText composition, asChild no-wrapper-DOM, the auto-update hint constant); dock truncation titles pinned native; graph-chrome + settings pins updated to the new copy. Live-verified on :3001 — 12.6ms hover appearance (no native 1s lag); glyphs render on every suffixed surface (⌘D, ⌘K, ⌘⇧F, ⌘,, ⌘B, F2, ↵, Esc); per-page probes confirm Settings entry, Home logo, session search, Start session, Close sidebar, model + thinking pills, stats summary, rename title, plan chip, coverage ring, send square, cost button, node search (⌘F), graph gear, settings close (Close — Esc), keyboard section "Fixed — part of this screen", auto-update hint, light-mode "Coming soon", the three slot rosters, graph-tools hint. Esc still closes the settings dialog.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip"
|
||||
import { bindingForAction, formatBinding, type KeyAction } from "@/src/core"
|
||||
|
||||
/**
|
||||
* The tooltip composition for icon and pill controls (tooltip wave, owner
|
||||
* 2026-09-25). The styled Radix tooltip (ui/tooltip.tsx, adopted as-is —
|
||||
* no restyling) carries the label, with the control's shortcut appended as
|
||||
* an em-dash suffix when it has one ("Dictate — ⌘D").
|
||||
*
|
||||
* The binding is override-aware: pass `action` for registry shortcuts (a
|
||||
* user rebind in Settings → Keyboard changes the suffix live), or
|
||||
* `binding` for surface-owned keys with no registry entry ("escape" for a
|
||||
* dialog close, "enter" for a form submit).
|
||||
*
|
||||
* children must be a single element able to take a ref (TooltipTrigger
|
||||
* asChild merges onto it — no wrapper DOM, no layout shift).
|
||||
*/
|
||||
|
||||
interface HintProps {
|
||||
label: string
|
||||
/** Registry action whose LIVE binding is shown (override-aware). */
|
||||
action?: KeyAction
|
||||
/** Surface-owned binding ("escape", "enter") — keys the registry
|
||||
* deliberately doesn't dispatch (Esc closes the dialog itself; Enter
|
||||
* submits the form the button belongs to). */
|
||||
binding?: string
|
||||
side?: "top" | "bottom" | "left" | "right"
|
||||
children: React.ReactElement
|
||||
}
|
||||
|
||||
/** The composition itself, pure — "Dictate" + ⌘D → "Dictate — ⌘D". Exported
|
||||
* for the mechanism pins (tests/tooltip-mechanism.test.tsx). */
|
||||
export function hintText(label: string, action?: KeyAction, binding?: string): string {
|
||||
const live = action
|
||||
? formatBinding(bindingForAction(action))
|
||||
: binding
|
||||
? formatBinding(binding)
|
||||
: ""
|
||||
return live ? `${label} — ${live}` : label
|
||||
}
|
||||
|
||||
export function Hint({ label, action, binding, side = "top", children }: HintProps) {
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>{children}</TooltipTrigger>
|
||||
<TooltipContent side={side}>{hintText(label, action, binding)}</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user