Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(voice): rebuild the Dictation tab as a home page with a photo hero, stats rail and day journal
rubenluetke10-beep0b4098ea2185
diff --git a/jarvis/ui/web/frontend/src/assets/voice/dictation-hero.webp b/jarvis/ui/web/frontend/src/assets/voice/dictation-hero.webpnew file mode 100644index 0000000000..5f112e06a0Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/voice/dictation-hero.webp differdiff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 163cf89159..3fc806cb64 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -470,12 +470,7 @@"state_active": "Nimmt auf","state_ready": "Bereit","state_unavailable": "Auf diesem Computer nicht verfügbar",- "shortcut_set": "Halte {0}, um zu diktieren.",- "shortcut_unset": "Noch keine Taste zugewiesen — Diktat geht auch über den Knopf unten.",- "engine_local": "Erkennt lokal auf diesem Rechner ({0}); Ausweichen: {1}.",- "engine_cloud": "Erkennt über {0}.","engine_local_off": "Lokal gerade nicht: {0}",- "assign_hint": "Weise unter Einstellungen → Sprach-Tastenkürzel eine Taste zu, um überall zu diktieren.","start": "Diktat starten","stop": "Stopp","saved": "Einstellung gespeichert",@@ -483,19 +478,45 @@"cannot_insert_generic": "Dein System blockiert, dass ein Programm in ein anderes tippt. Diktat funktioniert trotzdem — der Text landet in der Zwischenablage, du kannst ihn einfügen.","polish_first_run": "Neu: Ein schnelles Modell räumt jetzt deine Formulierung auf, bevor der Text ankommt — dein Rohtext bleibt in dieser Liste, und auf dem Tab „Sprache“ kannst du es abschalten.","history_title": "Letzte Diktate",- "history_empty": "Noch nichts diktiert.","clear_history": "Alle löschen","raw_prefix": "Gehört:","removed_words": "{0} Füllwort/-wörter entfernt","delete_entry": "Diesen Eintrag löschen","search_placeholder": "Diktate durchsuchen",+ "welcome": "Willkommen zurück{name_part}",+ "hero_hold": "Halte {0} gedrückt und diktiere",+ "hero_listening": "Ich höre zu — sprich jetzt",+ "hero_no_key": "Sprechen statt tippen",+ "hero_body": "Funktioniert in jeder App — E-Mail, Nachrichten, Dokumente oder überall sonst, wo du tippst.",+ "hero_body_active": "Sobald du stoppst, landen deine Worte in dem Feld, in dem du gerade getippt hast.",+ "hero_hands_free": "Oder drücke einmal {0}, um freihändig zu diktieren.",+ "hero_shortcuts": "Tastenkürzel ändern",+ "hero_assign": "Taste festlegen",+ "engine_title": "Erkennung",+ "engine_on_device": "Auf diesem Computer",+ "engine_cloud_short": "Cloud",+ "engine_fallback": "Ausweichlösung: {0}",+ "vocab_title": "Bring ihm deine Wörter bei",+ "vocab_body": "Füge Namen, Marken und Fachbegriffe hinzu, damit sie jedes Mal richtig geschrieben werden.",+ "vocab_cta": "Wörterbuch öffnen",+ "show_original": "Gehörtes anzeigen",+ "hide_original": "Gehörtes ausblenden",+ "empty_title": "Hier erscheinen deine Diktate",+ "empty_body": "Halte deine Taste in irgendeiner App, sprich und lass los. Jedes Diktat bleibt hier, damit du es erneut kopieren kannst.","stats": {"title": "Dein Diktat","words": "Wörter","wpm": "Wörter pro Minute","streak": "Tage in Folge","window_lifetime": "Gesamt",- "window_days": "Letzte {0} Tage"+ "window_days": "Letzte {0} Tage",+ "words_unit": "Wörter",+ "wpm_unit": "WpM",+ "streak_unit": "Tage in Folge",+ "today": "Heute: {0} Wörter",+ "best_streak": "Rekord: {0} Tage",+ "activity": "Letzte 14 Tage",+ "activity_day": "{0}: {1} Wörter"},"group": {"today": "Heute",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 1b0a2017c4..dcfc614a93 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -470,12 +470,7 @@"state_active": "Recording","state_ready": "Ready","state_unavailable": "Not available on this computer",- "shortcut_set": "Hold {0} to dictate.",- "shortcut_unset": "No key assigned yet — dictation still works from the button below.",- "engine_local": "Recognizes locally on this machine ({0}); fallback: {1}.",- "engine_cloud": "Recognizes via {0}.","engine_local_off": "Local engine not in front right now: {0}",- "assign_hint": "Assign a key in Settings → Voice Keybinds to dictate from anywhere.","start": "Start dictating","stop": "Stop","saved": "Setting saved",@@ -483,19 +478,45 @@"cannot_insert_generic": "Your system is blocking one program from typing into another. Dictation still works — the text is placed on your clipboard so you can paste it.","polish_first_run": "New: a fast model now tidies up your wording before the text lands — your raw words stay in this list, and you can switch it off on the Language tab.","history_title": "Recent dictations",- "history_empty": "Nothing dictated yet.","clear_history": "Delete all","raw_prefix": "Heard:","removed_words": "{0} filler word(s) removed","delete_entry": "Delete this entry","search_placeholder": "Search your dictations",+ "welcome": "Welcome back{name_part}",+ "hero_hold": "Hold {0} to dictate",+ "hero_listening": "Listening — speak now",+ "hero_no_key": "Speak instead of typing",+ "hero_body": "Works in every app — email, messages, docs, or anywhere else you type.",+ "hero_body_active": "When you stop, your words land in the field you were typing in.",+ "hero_hands_free": "Or press {0} once to dictate hands-free.",+ "hero_shortcuts": "Change shortcut",+ "hero_assign": "Assign a key",+ "engine_title": "Recognition",+ "engine_on_device": "On this computer",+ "engine_cloud_short": "Cloud",+ "engine_fallback": "Fallback: {0}",+ "vocab_title": "Teach it your words",+ "vocab_body": "Add names, brands and terms so they are spelled right every time.",+ "vocab_cta": "Open dictionary",+ "show_original": "Show what was heard",+ "hide_original": "Hide what was heard",+ "empty_title": "Your dictations will show up here",+ "empty_body": "Hold your key in any app, speak, and let go. Every dictation is kept here so you can copy it again.","stats": {"title": "Your dictation","words": "Words","wpm": "Words per minute","streak": "Day streak","window_lifetime": "All time",- "window_days": "Last {0} days"+ "window_days": "Last {0} days",+ "words_unit": "words",+ "wpm_unit": "wpm",+ "streak_unit": "day streak",+ "today": "Today: {0} words",+ "best_streak": "Best streak: {0} days",+ "activity": "Last 14 days",+ "activity_day": "{0}: {1} words"},"group": {"today": "Today",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex b79adac233..1840c11a3f 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -470,12 +470,7 @@"state_active": "Grabando","state_ready": "Listo","state_unavailable": "No disponible en este ordenador",- "shortcut_set": "Mantén {0} para dictar.",- "shortcut_unset": "Aún no hay tecla asignada — el dictado también funciona con el botón de abajo.",- "engine_local": "Reconoce localmente en este equipo ({0}); alternativa: {1}.",- "engine_cloud": "Reconoce mediante {0}.","engine_local_off": "Motor local ahora no disponible: {0}",- "assign_hint": "Asigna una tecla en Ajustes → Atajos de voz para dictar desde cualquier sitio.","start": "Empezar a dictar","stop": "Detener","saved": "Ajuste guardado",@@ -483,19 +478,45 @@"cannot_insert_generic": "Tu sistema impide que un programa escriba en otro. El dictado sigue funcionando — el texto queda en el portapapeles para que lo pegues.","polish_first_run": "Novedad: un modelo rápido pule ahora tu redacción antes de que el texto llegue; tu texto original permanece en esta lista y puedes desactivarlo en la pestaña «Idioma».","history_title": "Dictados recientes",- "history_empty": "Todavía no has dictado nada.","clear_history": "Borrar todo","raw_prefix": "Se oyó:","removed_words": "{0} muletilla(s) eliminada(s)","delete_entry": "Eliminar esta entrada","search_placeholder": "Buscar en tus dictados",+ "welcome": "Bienvenido de nuevo{name_part}",+ "hero_hold": "Mantén {0} para dictar",+ "hero_listening": "Escuchando — habla ahora",+ "hero_no_key": "Habla en lugar de escribir",+ "hero_body": "Funciona en todas tus apps: correo, mensajes, documentos o cualquier otro sitio donde escribas.",+ "hero_body_active": "Cuando te detengas, tus palabras aparecerán en el campo donde estabas escribiendo.",+ "hero_hands_free": "O pulsa {0} una vez para dictar sin manos.",+ "hero_shortcuts": "Cambiar atajo",+ "hero_assign": "Asignar una tecla",+ "engine_title": "Reconocimiento",+ "engine_on_device": "En este ordenador",+ "engine_cloud_short": "Nube",+ "engine_fallback": "Alternativa: {0}",+ "vocab_title": "Enséñale tus palabras",+ "vocab_body": "Añade nombres, marcas y términos para que se escriban bien siempre.",+ "vocab_cta": "Abrir diccionario",+ "show_original": "Ver lo que se oyó",+ "hide_original": "Ocultar lo que se oyó",+ "empty_title": "Tus dictados aparecerán aquí",+ "empty_body": "Mantén tu tecla en cualquier app, habla y suelta. Cada dictado se guarda aquí para que puedas copiarlo de nuevo.","stats": {"title": "Tu dictado","words": "Palabras","wpm": "Palabras por minuto","streak": "Días seguidos","window_lifetime": "Desde siempre",- "window_days": "Últimos {0} días"+ "window_days": "Últimos {0} días",+ "words_unit": "palabras",+ "wpm_unit": "ppm",+ "streak_unit": "días seguidos",+ "today": "Hoy: {0} palabras",+ "best_streak": "Mejor racha: {0} días",+ "activity": "Últimos 14 días",+ "activity_day": "{0}: {1} palabras"},"group": {"today": "Hoy",diff --git a/jarvis/ui/web/frontend/src/views/DictationView.test.tsx b/jarvis/ui/web/frontend/src/views/DictationView.test.tsxindex f0d8bc8c91..5fd3d4685a 100644--- a/jarvis/ui/web/frontend/src/views/DictationView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/DictationView.test.tsx@@ -13,7 +13,9 @@* in this repo — assertions use toBeTruthy()/toBeNull().*/import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { cleanup, fireEvent, render as rtlRender, screen, waitFor } from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import type { ReactElement } from "react";// ViewHeader lives in ChatsView, which drags in the whole chat surface; the// view only needs its shape.@@ -27,6 +29,12 @@ vi.mock("@/lib/clipboard", () => ({ robustCopy: copyMock }));import { DictationView } from "@/views/DictationView";import { setUiLanguage } from "@/i18n";+/** The greeting reads the profile name through react-query. */+function render(ui: ReactElement) {+ const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });+ return rtlRender(<QueryClientProvider client={client}>{ui}</QueryClientProvider>);+}+interface RouteResult {status?: number;body: unknown;@@ -195,6 +203,7 @@ function defaultRoutes("GET /api/dictation/history": () => ({ body: { entries, count: entries.length } }),"GET /api/dictation/stats": () => ({ body: STATS }),"PUT /api/settings/ui-language": () => ({ body: { ok: true } }),+ "GET /api/profile": () => ({ body: { user: { name: "Ada" } } }),...extra,};}@@ -459,3 +468,53 @@ describe("DictationView header", () => {expect(container.querySelector("header")).toBeNull();});});++describe("DictationView home layout", () => {+ it("greets the person by their profile name", async () => {+ installFetchMock(defaultRoutes());+ render(<DictationView />);++ await waitFor(() =>+ expect(screen.getByTestId("dictation-welcome").textContent).toBe("Welcome back, Ada"),+ );+ });++ it("puts the dictation key in the hero title, pretty-printed", async () => {+ installFetchMock(defaultRoutes());+ render(<DictationView />);++ await waitFor(() => expect(screen.queryByTestId("dictation-history")).toBeTruthy());+ const hero = screen.getByTestId("dictation-hero");+ expect(hero.querySelector("h2")?.textContent).toContain("to dictate");+ expect(hero.querySelector("h2")?.textContent).not.toContain("ctrl+right_alt+j");+ expect(screen.getByTestId("dictation-state").textContent).toBe("Ready");+ });++ it("draws fourteen days of activity", async () => {+ installFetchMock(defaultRoutes());+ render(<DictationView />);++ await waitFor(() => expect(screen.queryByTestId("dictation-activity")).toBeTruthy());+ expect(screen.getByTestId("dictation-activity").children).toHaveLength(14);+ });++ it("keeps what was heard one click away instead of under every row", async () => {+ installFetchMock(defaultRoutes([TODAY_ENTRY]));+ render(<DictationView />);++ await waitFor(() => expect(screen.queryByTestId("dictation-history")).toBeTruthy());+ expect(screen.queryByTestId("dictation-raw-text")).toBeNull();+ fireEvent.click(screen.getByTestId("dictation-toggle-raw"));+ expect(screen.getByTestId("dictation-raw-text").textContent).toContain(+ "so uh send the report",+ );+ });++ it("shows a designed empty surface when nothing was dictated yet", async () => {+ installFetchMock(defaultRoutes([]));+ render(<DictationView />);++ await waitFor(() => expect(screen.queryByTestId("dictation-empty")).toBeTruthy());+ expect(screen.queryByTestId("dictation-history")).toBeNull();+ });+});diff --git a/jarvis/ui/web/frontend/src/views/DictationView.tsx b/jarvis/ui/web/frontend/src/views/DictationView.tsxindex fab536627d..10f83d76d8 100644--- a/jarvis/ui/web/frontend/src/views/DictationView.tsx+++ b/jarvis/ui/web/frontend/src/views/DictationView.tsx@@ -1,58 +1,58 @@import { useMemo, useState } from "react";-import {- AlertTriangle,- Keyboard,- Loader2,- Mic,- Search,- Square,- Trash2,-} from "lucide-react";+import { AlertTriangle, Mic, Search, Trash2 } from "lucide-react";import { ViewHeader } from "@/views/ChatsView";import { Button } from "@/components/ui/button";-import { Card } from "@/components/ui/card";-import { EmptyState } from "@/components/layout/EmptyState";-import { PanelSkeleton, SkeletonBar } from "@/components/layout/PanelSkeleton";+import { SkeletonBar } from "@/components/layout/PanelSkeleton";import { useDictation, type DictationEntry } from "@/hooks/useDictation";-import { DictationStatsBar } from "@/views/voice/DictationStatsBar";+import { useUserName } from "@/hooks/useUserName";+import { DictationHero } from "@/views/voice/DictationHero";+import { DictationStatsCard } from "@/views/voice/DictationStatsCard";+import {+ DictationEngineCard,+ DictationVocabularyCard,+} from "@/views/voice/DictationSideCards";import { DictationHistoryGroup } from "@/views/voice/DictationHistoryGroup";import { useEventStore } from "@/store/events";-import { useT } from "@/i18n";+import { fill, useT } from "@/i18n";/**- * "Dictation" section — hold a key, speak, and the text lands in whatever text- * field currently has focus.+ * "Dictation" — the first tab of the voice section: hold a key, speak, and the+ * text lands in whatever field has focus, in any app.+ *+ * The screen is built like a home page for the feature rather than a settings+ * panel:+ *+ * Welcome back, Ruben+ * ┌───────────────────────────── hero ─┐ ┌ stats ──────┐+ * │ Hold [Ctrl + Alt] to dictate 📷 │ │ 241.2K words│+ * │ [Start dictating] [Change shortcut]│ │ 149 wpm │+ * └────────────────────────────────────┘ │ ▁▃▅▂▇ 14 d │+ * TODAY [🔍 ] │ ├─────────────┤+ * ┌ 4:12 PM transcript … ⧉ ↺ 🗑 ──┐ │ Recognition │+ * └────────────────────────────────────┘ │ Dictionary →│+ *+ * The one instruction a newcomer needs is the largest thing on the screen,+ * the numbers sit beside it instead of above the history, and the history is+ * a journal of days with a time column — something you read back, not a log.+ * Below `xl` the side column folds in between the hero and the history.*- * Four things this view deliberately makes visible rather than hiding:+ * Four things this view deliberately keeps visible:** 1. **Whether insertion can work at all.** On Wayland, on a headless host, or* while an elevated window is in front, the OS blocks one program from- * typing into another — and does so silently. The notice says it up front so- * "nothing happened" is never a mystery.- * 2. **What the filler cleanup changed.** Every entry keeps the raw transcript- * next to the inserted one, so a wrong rule is findable instead of merely- * suspected.- * 3. **What actually became of each dictation.** The outcome badge is- * translated from a fixed vocabulary — "Could not insert" is a different- * story from "Nothing heard", and the row says which one happened.+ * typing into another — silently. The notice says so up front.+ * 2. **What the cleanup changed.** Every row keeps the raw transcript one click+ * away, so a wrong rule is findable instead of merely suspected.+ * 3. **What became of each dictation.** The outcome is translated from a fixed+ * vocabulary; only faults and partial deliveries get a coloured badge.* 4. **That deleting is recoverable.** The trash icon discards; the entry stays- * listed, restorable, until the second, explicit "Delete permanently" step.+ * listed, restorable, until the explicit "Delete permanently" step.*- * What is deliberately NOT here any more: the "How dictation behaves" settings- * block — the paste shortcut, the delivery method, the insertion target and the- * three cleanup/history switches. Every one of them shipped a sensible default,- * and a wall of six controls in front of the feature made a thing that "just- * works" look like something to be configured first. The `[dictation]` config- * keys and their REST route (`PUT /api/dictation/settings`, hence- * `jarvis api dictation ...`) are untouched, so an install that genuinely needs- * a different paste shortcut can still set one — it is simply no longer the- * first thing this screen shows. The "Key behaviour (hold/toggle)" dropdown- * left earlier for the same reason: the two dictation shortcuts in the voice- * section's Shortcuts tab are the source of truth for hold-vs-hands-free.- *- * The screen is three groups — state, numbers, history — separated by 32px and- * bounded at the reading measure, because everything on it is either a card or- * a transcript and neither earns the full width of a desktop window.+ * Deliberately NOT here: the "How dictation behaves" settings block. Every one+ * of its controls shipped a sensible default, and a wall of switches in front+ * of the feature made a thing that "just works" look like something to+ * configure first. The `[dictation]` config keys and `PUT+ * /api/dictation/settings` (hence `jarvis api dictation ...`) are untouched.** Backed by /api/dictation (status/start/stop/history/stats) via useDictation.*/@@ -69,6 +69,7 @@ export interface DictationViewProps {export function DictationView({ hideHeader = false }: DictationViewProps = {}) {const t = useT();+ const userName = useUserName();const {status,entries,@@ -84,6 +85,7 @@ export function DictationView({ hideHeader = false }: DictationViewProps = {}) {clearHistory,} = useDictation();const pushToast = useEventStore((s) => s.pushToast);+ const setActiveSection = useEventStore((s) => s.setActiveSection);const [busy, setBusy] = useState(false);const [query, setQuery] = useState("");const [busyIds, setBusyIds] = useState<ReadonlySet<string>>(new Set());@@ -155,22 +157,15 @@ export function DictationView({ hideHeader = false }: DictationViewProps = {}) {const q = query.trim().toLowerCase();if (!q) return entries;return entries.filter(- (e) =>- e.text.toLowerCase().includes(q) || e.raw_text.toLowerCase().includes(q),+ (e) => e.text.toLowerCase().includes(q) || e.raw_text.toLowerCase().includes(q),);}, [entries, query]);const groups = useMemo(() => groupByDay(filtered), [filtered]);- // Life / neutral / fault, and nothing in between. A recording session is the- // one thing on this screen that is actually running, so it is the one thing- // wearing --success; "ready" is a neutral idle, and a machine that cannot- // dictate at all is a fault rather than a dimmer shade of ready.- const dotFill = status?.active- ? "bg-success motion-safe:animate-pulse"- : status?.available- ? "bg-muted-foreground"- : "bg-destructive";+ const greeting = fill(t("dictation.welcome"), {+ name_part: userName ? `, ${userName}` : "",+ });return (<div className="flex h-full flex-col">@@ -181,233 +176,180 @@ export function DictationView({ hideHeader = false }: DictationViewProps = {}) {subtitle={t("dictation.description")}/>)}- <div className="flex-1 overflow-y-auto scrollbar-jarvis p-6">- <div className="mx-auto flex max-w-reading flex-col gap-group">- {error && <p className="text-meta text-destructive">{error}</p>}+ <div className="flex-1 overflow-y-auto scrollbar-jarvis">+ <div className="mx-auto w-full max-w-[1120px] px-6 pb-12 pt-8">+ <h1+ className="text-xl font-semibold text-foreground-strong"+ data-testid="dictation-welcome"+ >+ {greeting}+ </h1>- {/* --- Insertion notice: the silent-failure paths, made loud. ---- Degraded, not broken — the words still reach the clipboard — so- it is a --warning glyph on an ordinary card, never a washed- panel that claims the whole screen has failed. */}- {blocked && (- <Card- className="flex items-start gap-3 p-5"- data-testid="dictation-insert-warning"- >- <AlertTriangle- aria-hidden="true"- className="mt-0.5 h-4 w-4 shrink-0 text-warning"- />- <div className="min-w-0">- <h4 className="text-title font-semibold text-foreground-strong">- {t("dictation.cannot_insert_title")}- </h4>- <p className="mt-1 text-meta text-muted-foreground">- {status?.insertion.detail || t("dictation.cannot_insert_generic")}- </p>- </div>- </Card>- )}+ <div className="mt-5 grid grid-cols-1 gap-6 [grid-template-areas:'hero'_'side'_'list'] xl:grid-cols-[minmax(0,1fr)_300px] xl:grid-rows-[auto_1fr] xl:[grid-template-areas:'hero_side'_'list_side']">+ <div className="flex min-w-0 flex-col gap-4 [grid-area:hero]">+ {error && <p className="text-meta text-destructive">{error}</p>}- {/* --- State, and the one primary action on the screen. --- */}- <Card className="p-5">- {loading ? (- // The real card at its real height with bars where the state- // line and the button will be — never a centred grey word, which- // is indistinguishable from a section that failed.- <div- role="status"- aria-busy="true"- aria-label={t("dictation.loading")}- className="flex items-center justify-between gap-4"- >- <div className="flex min-w-0 flex-1 flex-col gap-2">- <SkeletonBar className="h-4 w-32" />- <SkeletonBar className="h-3 w-3/5" />- </div>- <SkeletonBar className="h-9 w-32 shrink-0" />- </div>- ) : (- <div className="flex flex-wrap items-center justify-between gap-4">- <div className="min-w-0">- <div className="flex items-center gap-2">- <span- className={`h-2 w-2 shrink-0 rounded-full ${dotFill}`}- />- <span className="text-title font-semibold text-foreground-strong">- {status?.active- ? t("dictation.state_active")- : status?.available- ? t("dictation.state_ready")- : t("dictation.state_unavailable")}- </span>- </div>- <p className="mt-1 text-meta text-muted-foreground">- {status?.available- ? status.hotkey- ? t("dictation.shortcut_set").replace("{0}", status.hotkey)- : t("dictation.shortcut_unset")- : status?.reason || t("dictation.state_unavailable")}- </p>- {/* Which recognizer really answers the next press (P-41):- the settings name one, the lane may hold another. */}- {status?.available && status.engine?.provider && (+ {/* The silent-failure paths, made loud. Degraded, not broken —+ the words still reach the clipboard — so a --warning glyph+ on an ordinary card, never a washed panel. */}+ {blocked && (+ <div+ className="flex items-start gap-3 rounded-xl border border-border bg-card p-5 shadow-rim"+ data-testid="dictation-insert-warning"+ >+ <AlertTriangle+ aria-hidden="true"+ className="mt-0.5 h-4 w-4 shrink-0 text-warning"+ />+ <div className="min-w-0">+ <h4 className="text-title font-semibold text-foreground-strong">+ {t("dictation.cannot_insert_title")}+ </h4><p className="mt-1 text-meta text-muted-foreground">- {status.engine.local- ? t("dictation.engine_local")- .replace("{0}", status.engine.model || status.engine.provider)- .replace("{1}", status.engine.fallback || "—")- : t("dictation.engine_cloud").replace("{0}", status.engine.provider)}- {!status.engine.local && status.engine.detail- ? ` ${t("dictation.engine_local_off").replace("{0}", status.engine.detail)}`- : ""}+ {status?.insertion.detail || t("dictation.cannot_insert_generic")}</p>- )}+ </div></div>- <Button- className="gap-2"- disabled={busy || !status?.available}- data-testid="dictation-toggle"- onClick={() => void onToggle()}- >- {busy ? (- <Loader2- aria-hidden="true"- className="h-4 w-4 animate-spin motion-reduce:animate-none"- />- ) : status?.active ? (- <Square aria-hidden="true" className="h-4 w-4" />- ) : (- <Mic aria-hidden="true" className="h-4 w-4" />- )}- {status?.active ? t("dictation.stop") : t("dictation.start")}- </Button>- </div>- )}- {!status?.hotkey && status?.available && (- <p className="mt-block flex items-center gap-2 text-meta text-muted-foreground">- <Keyboard aria-hidden="true" className="h-3.5 w-3.5 shrink-0" />- {t("dictation.assign_hint")}- </p>- )}- </Card>-- {/* --- How much you dictate, honestly windowed. ---- While the request is in flight the three tiles stand at their- real size as empty bars. Rendering the card with zeros in it- would not read as loading; it would read as a person who has- never dictated anything. */}- {loading ? (- <Card className="p-5">- <SkeletonBar className="h-3 w-24" />- <div className="mt-stack grid gap-stack sm:grid-cols-3">- <SkeletonBar className="h-[84px]" />- <SkeletonBar className="h-[84px]" />- <SkeletonBar className="h-[84px]" />- </div>- </Card>- ) : (- stats && <DictationStatsBar stats={stats} />- )}+ )}- {/* --- History. ---- With nothing in it there is no list to frame, so the card, its- title, its hint and its search field all go and the designed- empty surface stands alone. */}- {loading ? (- <Card className="p-5">- <SkeletonBar className="h-4 w-40" />- <SkeletonBar className="mt-block h-9 w-full" />- <PanelSkeleton- className="mt-block"- rows={4}- rowHeight={56}- label={t("dictation.loading")}+ <DictationHero+ status={status}+ loading={loading}+ busy={busy}+ onToggle={() => void onToggle()}+ onOpenShortcuts={() => setActiveSection("voice-shortcuts")}/>- </Card>- ) : entries.length === 0 ? (- <EmptyState icon={<Mic />} body={t("dictation.history_empty")} />- ) : (- <Card className="p-5">- <div className="flex items-center justify-between gap-3">- <h4 className="text-title font-semibold text-foreground-strong">- {t("dictation.history_title")}- </h4>- <Button- size="sm"- variant="ghost"- className="gap-2 text-muted-foreground"- data-testid="dictation-clear-history"- onClick={() => {- void clearHistory().catch((e) =>- pushToast("error", (e as Error).message),- );- }}- >- <Trash2 aria-hidden="true" className="h-3.5 w-3.5" />- {t("dictation.clear_history")}- </Button>- </div>- <p className="mt-1 text-meta text-muted-foreground">- {t("dictation.clear_history_hint")}- </p>- {/* A field is a lift surface, not a hairline outline: it now- answers with a fill the way every other input in the app- does, and the focus ring is a rim rather than a third fill. */}- <div className="relative mt-block">- <Search- aria-hidden="true"- className="pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"- />- <input- value={query}- onChange={(e) => setQuery(e.target.value)}- placeholder={t("dictation.search_placeholder")}- aria-label={t("dictation.search_placeholder")}- data-testid="dictation-search"- className="h-9 w-full rounded-md bg-input pl-9 pr-3 text-body text-foreground placeholder:text-faint-foreground focus:outline-none focus:ring-2 focus:ring-border-strong"- />- </div>- {filtered.length === 0 ? (- /* Shared "nothing matched your search" string — the Dictionary- tab owns it and it is already localized everywhere. A lift- panel at the height the list would have had, so clearing the- query does not make the card jump. */- <div- className="mt-block rounded-md bg-secondary px-block py-10 text-center text-body text-muted-foreground"- data-testid="dictation-no-matches"- >- {t("dictionary.no_matches")}+ </div>++ {/* The side column. While loading it stands at its real size as+ empty bars — a card with zeros in it would read as a person+ who has never dictated anything. */}+ <aside className="flex min-w-0 flex-col gap-4 [grid-area:side] xl:sticky xl:top-0 xl:self-start">+ {loading ? (+ <div className="rounded-xl border border-border bg-card p-5 shadow-rim">+ <SkeletonBar className="h-3 w-20" />+ <div className="mt-4 flex flex-col gap-3">+ <SkeletonBar className="h-8 w-40" />+ <SkeletonBar className="h-8 w-32" />+ <SkeletonBar className="h-8 w-36" />+ </div>+ <SkeletonBar className="mt-5 h-14 w-full" /></div>) : (- <div className="mt-block" data-testid="dictation-history">- {groups.map((group) => (- <DictationHistoryGroup- key={group.key}- label={dayLabel(t, group.key)}- entries={group.entries}- busyIds={busyIds}- copiedId={copiedId}- onCopy={(entry) => void onCopy(entry)}- onRestore={(entry) => void onRestore(entry)}- onDiscard={(entry) => {- void withRowBusy(entry.id, () => discardEntry(entry.id));- }}- onDelete={(entry) => {- void withRowBusy(entry.id, () => deleteEntry(entry.id));- }}- />- ))}+ stats && <DictationStatsCard stats={stats} />+ )}+ {!loading && status?.available && status.engine?.provider && (+ <DictationEngineCard engine={status.engine} />+ )}+ <DictationVocabularyCard onOpen={() => setActiveSection("dictionary")} />+ </aside>++ <div className="min-w-0 [grid-area:list]">+ {loading ? (+ <div className="flex flex-col gap-2" aria-busy="true">+ <SkeletonBar className="h-3 w-24" />+ <SkeletonBar className="h-[220px] w-full rounded-xl" /></div>+ ) : entries.length === 0 ? (+ <EmptyHistory />+ ) : (+ <>+ <div className="flex flex-wrap items-center justify-between gap-3">+ <h2 className="text-base font-semibold text-foreground-strong">+ {t("dictation.history_title")}+ </h2>+ <div className="flex items-center gap-1">+ <div className="relative">+ <Search+ aria-hidden="true"+ className="pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"+ />+ <input+ value={query}+ onChange={(e) => setQuery(e.target.value)}+ placeholder={t("dictation.search_placeholder")}+ aria-label={t("dictation.search_placeholder")}+ data-testid="dictation-search"+ className="h-8 w-56 rounded-md bg-input pl-8 pr-3 text-sm text-foreground placeholder:text-faint-foreground focus:outline-none focus:ring-2 focus:ring-border-strong"+ />+ </div>+ <Button+ size="sm"+ variant="ghost"+ className="gap-2 text-muted-foreground"+ title={t("dictation.clear_history_hint")}+ data-testid="dictation-clear-history"+ onClick={() => {+ void clearHistory().catch((e) =>+ pushToast("error", (e as Error).message),+ );+ }}+ >+ <Trash2 aria-hidden="true" className="h-3.5 w-3.5" />+ {t("dictation.clear_history")}+ </Button>+ </div>+ </div>++ {filtered.length === 0 ? (+ /* Shared "nothing matched your search" string — the+ Dictionary tab owns it and it is localized everywhere. */+ <div+ className="mt-4 rounded-xl border border-dashed border-border px-block py-12 text-center text-body text-muted-foreground"+ data-testid="dictation-no-matches"+ >+ {t("dictionary.no_matches")}+ </div>+ ) : (+ <div className="mt-4 flex flex-col gap-6" data-testid="dictation-history">+ {groups.map((group) => (+ <DictationHistoryGroup+ key={group.key}+ label={dayLabel(t, group.key)}+ entries={group.entries}+ busyIds={busyIds}+ copiedId={copiedId}+ onCopy={(entry) => void onCopy(entry)}+ onRestore={(entry) => void onRestore(entry)}+ onDiscard={(entry) => {+ void withRowBusy(entry.id, () => discardEntry(entry.id));+ }}+ onDelete={(entry) => {+ void withRowBusy(entry.id, () => deleteEntry(entry.id));+ }}+ />+ ))}+ </div>+ )}+ </>)}- </Card>- )}+ </div>+ </div></div></div></div>);}+/** The designed first-run surface: what will appear here, and how. */+function EmptyHistory() {+ const t = useT();+ return (+ <div+ className="flex flex-col items-center rounded-xl border border-dashed border-border px-6 py-12 text-center"+ data-testid="dictation-empty"+ >+ <span className="flex h-10 w-10 items-center justify-center rounded-full bg-secondary text-foreground">+ <Mic aria-hidden="true" className="h-4 w-4" />+ </span>+ <h3 className="mt-3 text-base font-semibold text-foreground-strong">+ {t("dictation.empty_title")}+ </h3>+ <p className="mt-1 max-w-sm text-sm text-muted-foreground">{t("dictation.empty_body")}</p>+ </div>+ );+}+interface DayGroup {/** Local calendar date, ISO `YYYY-MM-DD`. */key: string;@@ -450,7 +392,7 @@ function localDateKey(iso: string): string {return Number.isNaN(date.getTime()) ? iso : dateKey(date);}-/** "Today" / "Yesterday" / a locale-formatted date for everything older. */+/** "Today" / "Yesterday" / a long locale date ("August 23, 2026") otherwise. */function dayLabel(t: (key: string) => string, key: string): string {const now = new Date();if (key === dateKey(now)) return t("dictation.group.today");@@ -458,5 +400,7 @@ function dayLabel(t: (key: string) => string, key: string): string {yesterday.setDate(yesterday.getDate() - 1);if (key === dateKey(yesterday)) return t("dictation.group.yesterday");const parsed = new Date(`${key}T00:00:00`);- return Number.isNaN(parsed.getTime()) ? key : parsed.toLocaleDateString();+ return Number.isNaN(parsed.getTime())+ ? key+ : parsed.toLocaleDateString(undefined, { year: "numeric", month: "long", day: "numeric" });}diff --git a/jarvis/ui/web/frontend/src/views/voice/DictationHero.tsx b/jarvis/ui/web/frontend/src/views/voice/DictationHero.tsxnew file mode 100644index 0000000000..ea8bf7ec02--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/voice/DictationHero.tsx@@ -0,0 +1,173 @@+import { Keyboard, Loader2, Mic, Square } from "lucide-react";++import type { DictationStatus } from "@/hooks/useDictation";+import { useT } from "@/i18n";+import { cn } from "@/lib/utils";+import { formatCombo } from "@/views/settings/KeybindRow";+import heroImage from "@/assets/voice/dictation-hero.webp";++/**+ * The opening banner of the Dictation tab — the one thing a person needs to+ * know ("hold this key and speak") set large enough to be read from across the+ * desk, with the one action on the screen beside it.+ *+ * The banner is a photographic plate, and a photograph does not change with+ * the theme: it is the same dark scene in light and in dark mode. That is why+ * this component — and only this one — writes its inks as fixed white-on-dark+ * literals instead of theme tokens. A token-driven title would turn dark on a+ * light theme and vanish into the photo. The plate's own edge is a+ * `--border` ring, so on a dark page it still separates from the ground.+ *+ * The left of the plate is a solid fall-off into near-black (the image itself+ * is composed that way, and a gradient guarantees it on any aspect ratio), so+ * the text always sits on a calm surface rather than on the picture.+ */+export interface DictationHeroProps {+ status: DictationStatus | null;+ loading: boolean;+ busy: boolean;+ onToggle: () => void;+ onOpenShortcuts: () => void;+}++/** The plate's ground; also the gradient's start so the seam is invisible. */+const PLATE = "#050507";++export function DictationHero({+ status,+ loading,+ busy,+ onToggle,+ onOpenShortcuts,+}: DictationHeroProps) {+ const t = useT();+ const active = Boolean(status?.active);+ const available = Boolean(status?.available);+ const hotkey = status?.hotkey ?? "";+ const handsFree = status?.hotkey_toggle ?? "";++ // Life / neutral / fault — the same three states the status dot has always+ // had, now as a small pill on the plate instead of a separate card.+ const stateLabel = active+ ? t("dictation.state_active")+ : available+ ? t("dictation.state_ready")+ : t("dictation.state_unavailable");+ const dotFill = active+ ? "bg-success motion-safe:animate-pulse"+ : available+ ? "bg-white/70"+ : "bg-destructive";++ return (+ <section+ className="relative isolate overflow-hidden rounded-2xl ring-1 ring-border"+ style={{ backgroundColor: PLATE }}+ data-testid="dictation-hero"+ >+ <img+ src={heroImage}+ alt=""+ aria-hidden="true"+ draggable={false}+ className="pointer-events-none absolute inset-y-0 right-0 h-full w-full select-none object-cover object-right sm:w-[78%]"+ />+ <div+ aria-hidden="true"+ className="pointer-events-none absolute inset-0"+ style={{+ background: `linear-gradient(90deg, ${PLATE} 0%, ${PLATE} 30%, rgb(5 5 7 / 0.82) 48%, rgb(5 5 7 / 0.25) 72%, rgb(5 5 7 / 0) 100%)`,+ }}+ />++ <div className="relative flex min-h-[232px] flex-col justify-center gap-5 px-6 py-7 sm:px-9">+ <span+ className="inline-flex w-fit items-center gap-2 rounded-full bg-white/10 px-2.5 py-1 text-xs font-medium text-white/85 ring-1 ring-white/10 backdrop-blur-sm"+ data-testid="dictation-state"+ >+ <span className={cn("h-1.5 w-1.5 shrink-0 rounded-full", dotFill)} />+ {loading ? t("dictation.loading") : stateLabel}+ </span>++ <div className="max-w-[520px]">+ <h2 className="text-[30px] font-semibold leading-[36px] tracking-[-0.02em] text-white [text-wrap:balance]">+ {loading ? (+ <span className="inline-block h-8 w-72 max-w-full animate-pulse rounded-md bg-white/10" />+ ) : active ? (+ t("dictation.hero_listening")+ ) : available && hotkey ? (+ <HoldTitle template={t("dictation.hero_hold")} combo={hotkey} />+ ) : (+ t("dictation.hero_no_key")+ )}+ </h2>+ <p className="mt-2 text-base text-white/70">+ {!loading && !available+ ? status?.reason || t("dictation.state_unavailable")+ : active+ ? t("dictation.hero_body_active")+ : t("dictation.hero_body")}+ </p>+ {available && !active && handsFree && (+ <p className="mt-1 text-sm text-white/50">+ {t("dictation.hero_hands_free").replace("{0}", formatCombo(handsFree))}+ </p>+ )}+ </div>++ <div className="flex flex-wrap items-center gap-2">+ <button+ type="button"+ disabled={loading || busy || !available}+ data-testid="dictation-toggle"+ onClick={onToggle}+ className="inline-flex h-9 items-center gap-2 rounded-md bg-white px-4 text-base font-medium text-neutral-900 transition-colors hover:bg-white/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60 disabled:cursor-not-allowed disabled:opacity-50"+ >+ {busy ? (+ <Loader2+ aria-hidden="true"+ className="h-4 w-4 animate-spin motion-reduce:animate-none"+ />+ ) : active ? (+ <Square aria-hidden="true" className="h-4 w-4" />+ ) : (+ <Mic aria-hidden="true" className="h-4 w-4" />+ )}+ {active ? t("dictation.stop") : t("dictation.start")}+ </button>+ {!loading && available && (+ <button+ type="button"+ onClick={onOpenShortcuts}+ data-testid="dictation-open-shortcuts"+ className="inline-flex h-9 items-center gap-2 rounded-md px-3 text-base font-medium text-white/80 transition-colors hover:bg-white/10 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60"+ >+ <Keyboard aria-hidden="true" className="h-4 w-4" />+ {hotkey ? t("dictation.hero_shortcuts") : t("dictation.hero_assign")}+ </button>+ )}+ </div>+ </div>+ </section>+ );+}++/**+ * "Hold [Ctrl + Alt] to dictate" with the key set apart from the sentence.+ *+ * The locale owns the word order (some languages put the key in the middle+ * of the sentence, others at its end), so the template is split at its placeholder instead of+ * being glued together from fragments here.+ */+function HoldTitle({ template, combo }: { template: string; combo: string }) {+ const [before, after = ""] = template.split("{0}");+ return (+ <>+ {before}+ <span className="whitespace-nowrap rounded-lg bg-white/10 px-2 py-0.5 font-semibold text-white ring-1 ring-white/15">+ {formatCombo(combo)}+ </span>+ {after}+ </>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/voice/DictationHistoryGroup.tsx b/jarvis/ui/web/frontend/src/views/voice/DictationHistoryGroup.tsxindex 99ad61ce51..c7b5410d6c 100644--- a/jarvis/ui/web/frontend/src/views/voice/DictationHistoryGroup.tsx+++ b/jarvis/ui/web/frontend/src/views/voice/DictationHistoryGroup.tsx@@ -1,5 +1,5 @@import { useState, type ReactNode } from "react";-import { Check, Copy, RotateCcw, Trash2, Volume2 } from "lucide-react";+import { Check, ChevronDown, Copy, RotateCcw, Trash2, Volume2 } from "lucide-react";import { Badge } from "@/components/ui/badge";import {@@ -10,13 +10,16 @@ import {type DictationEntry,} from "@/hooks/useDictation";import { useT } from "@/i18n";+import { cn } from "@/lib/utils";/**- * One day's worth of dictations — a date header plus its rows.+ * One day's worth of dictations — a small date label and one framed list.** Grouping by day is what turns a flat list into something you can actually* read back: "what did I dictate this morning" is a question about a day, not- * about entry number 34.+ * about entry number 34. Each day is one bordered surface with hairlines+ * between its rows, so a day reads as a single page of a journal rather than+ * as a pile of separate cards.*/export interface DictationHistoryGroupProps {/** Already-localized day label — "Today", "Yesterday", or a formatted date. */@@ -43,21 +46,14 @@ export function DictationHistoryGroup({copiedId,}: DictationHistoryGroupProps) {return (- <section className="mt-group first:mt-0" data-testid="dictation-history-group">- {/* A quiet date divider, not a heading. It used to be an 11px uppercase- label with letter-spacing — the one construction that makes a screen- read as an admin panel, and it competed with the card title two lines- above it for no reason. */}+ <section data-testid="dictation-history-group"><h5- className="text-meta text-muted-foreground"+ className="px-1 text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground"data-testid="dictation-history-group-label">{label}</h5>- {/* No dividers. Separation between rows is the hover fill and the- padding, the way both reference apps do it; a rule under every row- drew a table over what is meant to read as a transcript. */}- <ul className="mt-1">+ <ul className="mt-2 divide-y divide-border overflow-hidden rounded-xl border border-border bg-card shadow-rim">{entries.map((entry) => (<HistoryRowkey={entry.id}@@ -85,12 +81,12 @@ export function DictationHistoryGroup({* to go. "Cancelled" in particular stays quiet: a bright chip on the one* outcome the user caused themselves inverts the whole ramp.*/-function outcomeVariant(outcome: string): "fault" | "degraded" | "secondary" {+function outcomeVariant(outcome: string): "fault" | "degraded" | null {if (outcome === "failed") return "fault";if (outcome === "unavailable" || outcome === "partial" || outcome === "empty") {return "degraded";}- return "secondary";+ return null;}function HistoryRow({@@ -115,24 +111,30 @@ function HistoryRow({// discards, and this flag is what turns the discarded row's follow-up button// into the one that really removes the entry and its audio.const [confirmDelete, setConfirmDelete] = useState(false);+ // What the recognizer actually heard stays one click away instead of being+ // printed under every row — it is there to check a cleanup, not to be read+ // twice.+ const [showRaw, setShowRaw] = useState(false);const cleaned = Boolean(entry.raw_text) && entry.text !== entry.raw_text;- // Both badges are computed here rather than inline so the render stays a- // list of chips. A row from before either field existed carries neither.+ // A row from before either field existed carries neither badge. "off" is the+ // one polish value worth hiding — the feature being switched off is not an+ // event; everything else is either "a model rewrote this" or "it did not,+ // and here is why", and the person who spoke deserves to see both.const polishBadge =- entry.polish_status && entry.polish_status !== "off"- ? entry.polish_status- : "";+ entry.polish_status && entry.polish_status !== "off" ? entry.polish_status : "";const polishTitle = [entry.polish_provider || "",entry.polish_latency_ms ? `${Math.round(entry.polish_latency_ms)} ms` : "",].filter(Boolean).join(" · ");+ // The filler cleanup's own verdict: outside its rule languages the cleanup+ // is a silent no-op, so a user dictating in Japanese or Polish saw the switch+ // sitting ON while nothing happened. "disabled" is skipped — that one the+ // user did themselves.const cleanupBadge =- entry.cleanup_reason && entry.cleanup_reason !== "disabled"- ? entry.cleanup_reason- : "";+ entry.cleanup_reason && entry.cleanup_reason !== "disabled" ? entry.cleanup_reason : "";// Restore is offered whenever there is something to win back: a soft-deleted// entry, a transcription that failed or only partly arrived, or kept audio// that can be run again. The two outcomes are named as well as the audio@@ -143,93 +145,97 @@ function HistoryRow({entry.audio_available ||entry.outcome === "failed" ||entry.outcome === "partial";+ const variant = entry.outcome ? outcomeVariant(entry.outcome) : null;return (<li- // The hover fill is drawn on the WHOLE row, inset from the card's own- // padding rather than on any one control inside it.- className="group -mx-2 flex items-start gap-2 rounded-md px-3 py-3 transition-colors hover:bg-secondary"+ className="group grid grid-cols-[64px_minmax(0,1fr)_auto] gap-x-4 px-5 py-4 transition-colors hover:bg-secondary/60 focus-within:bg-secondary/60 sm:grid-cols-[84px_minmax(0,1fr)_auto]"data-testid="dictation-history-row"data-entry-id={entry.id}>- <div className="min-w-0 flex-1">+ <time+ dateTime={entry.created_at}+ className="pt-0.5 text-sm tabular-nums text-muted-foreground"+ >+ {formatTime(entry.created_at)}+ </time>++ <div className="min-w-0">{/* The transcript is the reason this screen exists, so it is set as- prose — 15/1.6 in body ink — instead of as another 14px interface- label. Its measure is bounded by the column, not by the window. */}+ prose in body ink; everything else on the row is smaller and+ quieter than it. */}<p- className={`break-words text-reading ${- entry.discarded- ? "text-muted-foreground line-through"- : "text-foreground"- }`}+ className={cn(+ "whitespace-pre-wrap break-words text-base leading-6",+ entry.discarded ? "text-muted-foreground line-through" : "text-foreground",+ )}>{entry.text || entry.raw_text}</p>- {cleaned && (- <p className="mt-1 break-words text-meta text-muted-foreground">- {t("dictation.raw_prefix")} {entry.raw_text}- </p>- )}{entry.error && (<p- className="mt-1 break-words text-meta text-destructive"+ className="mt-1 break-words text-sm text-destructive"data-testid="dictation-failure-reason">{failureLabel(t, entry.error)}</p>)}- <div className="mt-2 flex flex-wrap items-center gap-2 text-meta text-muted-foreground">- <span>{new Date(entry.created_at).toLocaleTimeString()}</span>- {entry.outcome && (- <Badge- variant={outcomeVariant(entry.outcome)}- data-testid="dictation-outcome-badge"- >- {outcomeLabel(t, entry.outcome)}- </Badge>- )}+ {cleaned && showRaw && (+ <p+ className="mt-2 break-words border-l-2 border-border-strong pl-3 text-sm text-muted-foreground"+ data-testid="dictation-raw-text"+ >+ {t("dictation.raw_prefix")} {entry.raw_text}+ </p>+ )}++ <div className="mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground">+ {entry.outcome &&+ (variant ? (+ <Badge variant={variant} data-testid="dictation-outcome-badge">+ {outcomeLabel(t, entry.outcome)}+ </Badge>+ ) : (+ <span data-testid="dictation-outcome-badge">{outcomeLabel(t, entry.outcome)}</span>+ ))}{entry.discarded && (<Badge variant="secondary" data-testid="dictation-discarded-badge">{t("dictation.discarded_badge")}</Badge>)}- {entry.audio_available && (- <Badge variant="secondary" className="gap-1">- <Volume2 aria-hidden="true" className="h-3 w-3" />- {t("dictation.audio_kept")}- </Badge>- )}- {/* What the wording pass did to this row. "off" is the one value- worth hiding — the feature being switched off is not an event,- and a badge on every single row would be noise. Everything else- is either "a model rewrote this" or "it did not, and here is- why", and both are things the person who spoke deserves to see- next to their own words. */}{polishBadge && (- <Badge- variant="secondary"- data-testid="dictation-polish-badge"- title={polishTitle || undefined}- >+ <MetaItem testId="dictation-polish-badge" title={polishTitle || undefined}>{polishStatusLabel(t, polishBadge)}- </Badge>+ </MetaItem>)}- {/* The filler cleanup's own verdict, and the reason this badge- exists at all: outside its three rule languages the cleanup is a- silent no-op, so a user dictating in Japanese or Polish saw the- switch sitting ON while nothing ever happened. "disabled" is- skipped — that one the user did themselves. */}{cleanupBadge && (- <Badge- variant="secondary"- data-testid="dictation-cleanup-reason-badge"- >+ <MetaItem testId="dictation-cleanup-reason-badge">{cleanupReasonLabel(t, cleanupBadge)}- </Badge>+ </MetaItem>)}- </div>- {entry.discarded && (- <div className="mt-2">+ {entry.audio_available && (+ <MetaItem>+ <Volume2 aria-hidden="true" className="h-3 w-3" />+ {t("dictation.audio_kept")}+ </MetaItem>+ )}+ {cleaned && (+ <button+ type="button"+ onClick={() => setShowRaw((v) => !v)}+ aria-expanded={showRaw}+ data-testid="dictation-toggle-raw"+ className="inline-flex items-center gap-0.5 rounded-sm text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-strong"+ >+ <Dot />+ {showRaw ? t("dictation.hide_original") : t("dictation.show_original")}+ <ChevronDown+ aria-hidden="true"+ className={cn("h-3 w-3 transition-transform", showRaw && "rotate-180")}+ />+ </button>+ )}+ {entry.discarded && (<buttontype="button"disabled={busy}@@ -241,28 +247,32 @@ function HistoryRow({onDelete();}}data-testid="dictation-delete-permanently"- className="rounded-md text-meta text-muted-foreground transition-colors hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:opacity-50"+ className={cn(+ "rounded-sm text-xs transition-colors hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:opacity-50",+ confirmDelete ? "font-medium text-destructive" : "text-muted-foreground",+ )}>{confirmDelete? `${t("dictation.delete_permanently")} ?`: t("dictation.delete_permanently")}</button>- </div>- )}+ )}+ </div></div>- {/* Row actions appear when the row does. They are still in the document- and still reachable by keyboard — focus inside the row reveals them- the same way the pointer does. */}- <div className="flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100">++ {/* Row actions appear with the row's hover. They stay in the document+ and reachable by keyboard — focus inside the row reveals them the+ same way the pointer does. */}+ <div className="-my-1 flex shrink-0 items-start gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100"><RowActiononClick={onCopy}label={copied ? t("dictation.copied") : t("dictation.copy")}testId="dictation-copy-entry">{copied ? (- <Check aria-hidden="true" className="h-3.5 w-3.5" />+ <Check aria-hidden="true" className="h-4 w-4" />) : (- <Copy aria-hidden="true" className="h-3.5 w-3.5" />+ <Copy aria-hidden="true" className="h-4 w-4" />)}</RowAction>{canRestore && (@@ -273,7 +283,7 @@ function HistoryRow({title={t("dictation.restore_hint")}testId="dictation-restore-entry">- <RotateCcw aria-hidden="true" className="h-3.5 w-3.5" />+ <RotateCcw aria-hidden="true" className="h-4 w-4" /></RowAction>)}{!entry.discarded && (@@ -284,7 +294,7 @@ function HistoryRow({testId="dictation-discard-entry"destructive>- <Trash2 aria-hidden="true" className="h-3.5 w-3.5" />+ <Trash2 aria-hidden="true" className="h-4 w-4" /></RowAction>)}</div>@@ -292,13 +302,38 @@ function HistoryRow({);}+/** A quiet "· label" in the row's meta line. */+function MetaItem({+ children,+ testId,+ title,+}: {+ children: ReactNode;+ testId?: string;+ title?: string;+}) {+ return (+ <span className="inline-flex items-center">+ <Dot />+ <span className="inline-flex items-center gap-1" data-testid={testId} title={title}>+ {children}+ </span>+ </span>+ );+}++function Dot() {+ return (+ <span aria-hidden="true" className="mr-1 text-faint-foreground">+ ·+ </span>+ );+}+/**- * One icon button in a row's action strip.- *- * The three used to hover to three different inks — foreground, --primary and- * --destructive — which made the same gesture mean three things. Now they all- * answer the pointer the way every other control in the app does: one step up- * the surface ladder. Only discarding, which changes something, keeps a hue.+ * One icon button in a row's action strip. All three answer the pointer the+ * same way — one step up the surface ladder; only discarding, which changes+ * something, keeps a hue.*/function RowAction({children,@@ -325,15 +360,23 @@ function RowAction({aria-label={label}title={title ?? label}data-testid={testId}- className={`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-popover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:opacity-50 ${- destructive ? "hover:text-destructive" : "hover:text-foreground"- }`}+ className={cn(+ "rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-surface-raised focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:opacity-50",+ destructive ? "hover:text-destructive" : "hover:text-foreground",+ )}>{children}</button>);}+/** "4:12 PM" / "16:12" — the viewer's own clock format, no seconds. */+function formatTime(iso: string): string {+ const date = new Date(iso);+ if (Number.isNaN(date.getTime())) return "";+ return date.toLocaleTimeString(undefined, { hour: "numeric", minute: "2-digit" });+}+const KNOWN_OUTCOMES: ReadonlySet<string> = new Set(DICTATION_OUTCOMES);const KNOWN_FAILURES: ReadonlySet<string> = new Set(STT_FAILURE_REASONS);@@ -353,10 +396,9 @@ function outcomeLabel(t: (key: string) => string, outcome: string): string {* Unlike `outcomeLabel`, an unknown value does NOT fall through to the raw* string. This line exists to tell a person why their words did not arrive, and* the raw value here is either a stack-trace fragment stored by an older- * version — the exact thing this replaced — or a reason code from a newer- * backend, which is an identifier and explains nothing either. Both are better- * served by the honest generic sentence; the technical detail is in the log,- * where whoever needs it is already looking.+ * version or a reason code from a newer backend — an identifier that explains+ * nothing. Both are better served by the honest generic sentence; the+ * technical detail is in the log.*/function failureLabel(t: (key: string) => string, reason: string): string {return KNOWN_FAILURES.has(reason)diff --git a/jarvis/ui/web/frontend/src/views/voice/DictationSideCards.tsx b/jarvis/ui/web/frontend/src/views/voice/DictationSideCards.tsxnew file mode 100644index 0000000000..43b947dbac--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/voice/DictationSideCards.tsx@@ -0,0 +1,87 @@+import { ArrowRight, BookOpen, Cloud, Cpu } from "lucide-react";++import type { DictationStatus } from "@/hooks/useDictation";+import { useT } from "@/i18n";++/**+ * Which recognizer answers the next press (P-41) — the settings name one, the+ * lane may hold another, and this card says which. It used to be a second grey+ * sentence under the "Ready" line; as its own small card it can carry a plain+ * "On this computer" / "Cloud" headline, with the exact model and fallback+ * under it for whoever wants them.+ */+export function DictationEngineCard({+ engine,+}: {+ engine: NonNullable<DictationStatus["engine"]>;+}) {+ const t = useT();+ const Icon = engine.local ? Cpu : Cloud;+ // The headline already names the model, so the line under it only adds+ // what is not on screen yet: the fallback behind a local engine, or why+ // the local engine is not the one in front.+ const detail = engine.local+ ? engine.fallback+ ? t("dictation.engine_fallback").replace("{0}", engine.fallback)+ : ""+ : engine.detail+ ? t("dictation.engine_local_off").replace("{0}", engine.detail)+ : "";++ return (+ <section+ className="rounded-xl border border-border bg-card p-5 shadow-rim"+ data-testid="dictation-engine"+ >+ <p className="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">+ {t("dictation.engine_title")}+ </p>+ <div className="mt-3 flex items-center gap-3">+ <span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-secondary text-foreground">+ <Icon aria-hidden="true" className="h-4 w-4" />+ </span>+ <div className="min-w-0">+ <p className="text-base font-medium text-foreground-strong">+ {engine.local ? t("dictation.engine_on_device") : t("dictation.engine_cloud_short")}+ </p>+ <p className="truncate text-sm text-muted-foreground" title={engine.model || engine.provider}>+ {engine.model || engine.provider}+ </p>+ </div>+ </div>+ {detail && <p className="mt-3 text-sm text-muted-foreground">{detail}</p>}+ </section>+ );+}++/**+ * The one invitation on the screen: the dictionary is what makes names and+ * jargon come out right, and it lives one tab over, so the card is a door to+ * it rather than a copy of it.+ */+export function DictationVocabularyCard({ onOpen }: { onOpen: () => void }) {+ const t = useT();+ return (+ <section+ className="rounded-xl border border-border bg-card p-5 shadow-rim"+ data-testid="dictation-vocabulary"+ >+ <span className="flex h-9 w-9 items-center justify-center rounded-lg bg-secondary text-foreground">+ <BookOpen aria-hidden="true" className="h-4 w-4" />+ </span>+ <h3 className="mt-3 text-base font-semibold text-foreground-strong">+ {t("dictation.vocab_title")}+ </h3>+ <p className="mt-1 text-sm text-muted-foreground">{t("dictation.vocab_body")}</p>+ <button+ type="button"+ onClick={onOpen}+ data-testid="dictation-open-dictionary"+ className="mt-4 inline-flex h-9 w-full items-center justify-center gap-2 rounded-md bg-primary px-4 text-base font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ >+ {t("dictation.vocab_cta")}+ <ArrowRight aria-hidden="true" className="h-4 w-4" />+ </button>+ </section>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/voice/DictationStatsBar.tsx b/jarvis/ui/web/frontend/src/views/voice/DictationStatsBar.tsxdeleted file mode 100644index 9d3a3d5fff..0000000000--- a/jarvis/ui/web/frontend/src/views/voice/DictationStatsBar.tsx+++ /dev/null@@ -1,105 +0,0 @@-import { Card } from "@/components/ui/card";-import type { DictationStats } from "@/hooks/useDictation";-import { useT } from "@/i18n";--/**- * The three numbers worth knowing about your own dictation: how many words you- * have spoken, how fast you speak them, and how many days in a row you have- * used it.- *- * The honesty rule this component exists to enforce: the totals are only- * all-time when the never-pruned stats sidecar answered. When the backend fell- * back to deriving them from the rolling history window, the strip says "Last- * N days" instead — a 30-day slice labelled "All time" would quietly understate- * every long-time user's numbers.- *- * That window line now stands where the card's own title used to. Three- * numbers labelled "Words", "Words per minute" and "Day streak" do not need a- * heading saying "Your dictation" above them — it repeated what the tiles- * already said — while the window they cover is the one fact nothing else on- * the screen carries. The three decorative icons went for the same reason: at- * --primary they rendered brighter than the numbers they decorated.- *- * Informational only. No goal, no nag, no popup.- */-export function DictationStatsBar({ stats }: { stats: DictationStats }) {- const t = useT();-- const windowLabel =- stats.source === "lifetime"- ? t("dictation.stats.window_lifetime")- : t("dictation.stats.window_days").replace(- "{0}",- String(stats.window.days),- );-- return (- <Card className="p-5" data-testid="dictation-stats">- <p- className="text-meta text-muted-foreground"- data-testid="dictation-stats-window"- >- {windowLabel}- </p>- <div className="mt-stack grid gap-stack sm:grid-cols-3">- <StatTile- label={t("dictation.stats.words")}- value={formatCount(stats.totals.words)}- testId="dictation-stat-words"- />- <StatTile- label={t("dictation.stats.wpm")}- value={formatWpm(stats.totals.wpm)}- testId="dictation-stat-wpm"- />- <StatTile- label={t("dictation.stats.streak")}- value={formatCount(stats.streak.current_days)}- testId="dictation-stat-streak"- />- </div>- </Card>- );-}--/**- * One tile: the number first, its name under it.- *- * --secondary, one step ABOVE the card it sits in. It used to be- * `bg-background/40` inside `bg-card/60`, which rendered the three headline- * numbers darker than their own container — a child below its parent, and on- * exactly the elements someone opens this screen to read.- */-function StatTile({- label,- value,- testId,-}: {- label: string;- value: string;- testId: string;-}) {- return (- <div className="rounded-md bg-secondary p-4">- <p- className="text-display tabular-nums text-foreground-strong"- data-testid={testId}- >- {value}- </p>- <p className="mt-1 text-meta text-muted-foreground">{label}</p>- </div>- );-}--/** Locale-grouped integer; a non-finite server value degrades to a dash. */-function formatCount(value: number): string {- if (!Number.isFinite(value)) return "—";- return Math.round(value).toLocaleString();-}--/** Words per minute, one decimal only while it is still small. */-function formatWpm(value: number): string {- if (!Number.isFinite(value) || value <= 0) return "—";- return value >= 10 ? String(Math.round(value)) : value.toFixed(1);-}diff --git a/jarvis/ui/web/frontend/src/views/voice/DictationStatsCard.tsx b/jarvis/ui/web/frontend/src/views/voice/DictationStatsCard.tsxnew file mode 100644index 0000000000..b862726514--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/voice/DictationStatsCard.tsx@@ -0,0 +1,211 @@+import { useMemo } from "react";++import type { DictationStats } from "@/hooks/useDictation";+import { useT } from "@/i18n";+import { cn } from "@/lib/utils";++/**+ * The side card with the three numbers worth knowing about your own+ * dictation — how much, how fast, how steadily — and the last two weeks drawn+ * as a row of bars underneath.+ *+ * Each number is set large with its unit beside it ("241.2K words") so the+ * card reads as three short sentences instead of a grid of labelled tiles.+ * The exact count lives in the title attribute: the compact form is for+ * glancing, the full number is one hover away.+ *+ * The honesty rule from before still holds: the totals are only "All time"+ * when the never-pruned stats sidecar answered. When the backend fell back to+ * the rolling history window, the card says "Last N days" — a 30-day slice+ * labelled "All time" would quietly understate every long-time user.+ *+ * Informational only. No goal, no nag, no popup.+ */+export function DictationStatsCard({ stats }: { stats: DictationStats }) {+ const t = useT();++ const windowLabel =+ stats.source === "lifetime"+ ? t("dictation.stats.window_lifetime")+ : t("dictation.stats.window_days").replace("{0}", String(stats.window.days));++ const days = useMemo(() => lastDays(stats.by_day, 14), [stats.by_day]);+ const peak = Math.max(1, ...days.map((d) => d.words));++ return (+ <section+ className="rounded-xl border border-border bg-card p-5 shadow-rim"+ data-testid="dictation-stats"+ >+ <p+ className="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground"+ data-testid="dictation-stats-window"+ >+ {windowLabel}+ </p>++ <dl className="mt-4 flex flex-col gap-3">+ <Stat+ value={formatCompact(stats.totals.words)}+ exact={formatCount(stats.totals.words)}+ unit={t("dictation.stats.words_unit")}+ label={t("dictation.stats.words")}+ testId="dictation-stat-words"+ />+ <Stat+ value={formatWpm(stats.totals.wpm)}+ unit={t("dictation.stats.wpm_unit")}+ label={t("dictation.stats.wpm")}+ testId="dictation-stat-wpm"+ />+ <Stat+ value={formatCount(stats.streak.current_days)}+ unit={t("dictation.stats.streak_unit")}+ label={t("dictation.stats.streak")}+ testId="dictation-stat-streak"+ />+ </dl>++ <div className="mt-5 border-t border-border pt-4">+ <div className="flex items-baseline justify-between gap-3 text-xs text-muted-foreground">+ <span>{t("dictation.stats.activity")}</span>+ {stats.streak.longest_days > 0 && (+ <span data-testid="dictation-stat-best">+ {t("dictation.stats.best_streak").replace(+ "{0}",+ formatCount(stats.streak.longest_days),+ )}+ </span>+ )}+ </div>+ {/* Two weeks as bars, today on the right. Height is relative to the+ busiest day in view; a day with nothing keeps a 2px stub so the+ row still reads as fourteen days rather than as gaps. */}+ <div+ className="mt-3 flex h-14 items-end gap-[3px]"+ role="img"+ aria-label={t("dictation.stats.activity")}+ data-testid="dictation-activity"+ >+ {days.map((day, i) => {+ const today = i === days.length - 1;+ const pct = day.words > 0 ? Math.max(8, (day.words / peak) * 100) : 0;+ return (+ <div+ key={day.date}+ title={t("dictation.stats.activity_day")+ .replace("{0}", day.label)+ .replace("{1}", formatCount(day.words))}+ className={cn(+ "min-h-[2px] flex-1 rounded-[3px] transition-colors",+ day.words === 0+ ? "bg-secondary"+ : today+ ? "bg-foreground-strong"+ : "bg-muted-foreground/45 hover:bg-muted-foreground/70",+ )}+ style={{ height: day.words > 0 ? `${pct}%` : undefined }}+ />+ );+ })}+ </div>+ <p className="mt-3 text-sm text-foreground-secondary">+ {t("dictation.stats.today").replace("{0}", formatCount(stats.today.words))}+ </p>+ </div>+ </section>+ );+}++/** One "241.2K words" line; the long label is kept for screen readers. */+function Stat({+ value,+ exact,+ unit,+ label,+ testId,+}: {+ value: string;+ exact?: string;+ unit: string;+ label: string;+ testId: string;+}) {+ return (+ <div className="flex items-baseline gap-2">+ <dt className="sr-only">{label}</dt>+ <dd className="flex items-baseline gap-2">+ <span+ className="text-[28px] font-semibold leading-[32px] tracking-[-0.02em] tabular-nums text-foreground-strong"+ title={exact && exact !== value ? exact : undefined}+ data-testid={testId}+ >+ {value}+ </span>+ <span className="text-base text-muted-foreground">{unit}</span>+ </dd>+ </div>+ );+}++interface DayBar {+ /** Local `YYYY-MM-DD`. */+ date: string;+ /** Locale-formatted short date for the tooltip. */+ label: string;+ words: number;+}++/**+ * The last `count` local calendar days, oldest first, each with its word count+ * from `by_day` (a day the backend did not list is a zero day).+ */+function lastDays(byDay: DictationStats["by_day"], count: number): DayBar[] {+ const words = new Map<string, number>();+ for (const day of byDay ?? []) words.set(day.date, day.words);+ const out: DayBar[] = [];+ const cursor = new Date();+ cursor.setHours(12, 0, 0, 0);+ cursor.setDate(cursor.getDate() - (count - 1));+ for (let i = 0; i < count; i += 1) {+ const key = localKey(cursor);+ out.push({+ date: key,+ label: cursor.toLocaleDateString(undefined, { month: "short", day: "numeric" }),+ words: words.get(key) ?? 0,+ });+ cursor.setDate(cursor.getDate() + 1);+ }+ return out;+}++function localKey(date: Date): string {+ const month = String(date.getMonth() + 1).padStart(2, "0");+ const day = String(date.getDate()).padStart(2, "0");+ return `${date.getFullYear()}-${month}-${day}`;+}++/** Locale-grouped integer; a non-finite server value degrades to a dash. */+function formatCount(value: number): string {+ if (!Number.isFinite(value)) return "—";+ return Math.round(value).toLocaleString();+}++/**+ * Short form for the headline number — "241.2K" — once it no longer fits at a+ * glance. Below ten thousand the exact count is short enough to show as is.+ */+function formatCompact(value: number): string {+ if (!Number.isFinite(value)) return "—";+ if (Math.abs(value) < 10_000) return formatCount(value);+ return new Intl.NumberFormat(undefined, {+ notation: "compact",+ maximumFractionDigits: 1,+ }).format(value);+}++/** Words per minute, one decimal only while it is still small. */+function formatWpm(value: number): string {+ if (!Number.isFinite(value) || value <= 0) return "—";+ return value >= 10 ? String(Math.round(value)) : value.toFixed(1);+}