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
fix(voice): size the visualizer so the waveform reads as a waveform
Ruben Lütkede4ca7952b41
diff --git a/jarvis/ui/web/frontend/src/components/overlay/OverlayStylePreviews.tsx b/jarvis/ui/web/frontend/src/components/overlay/OverlayStylePreviews.tsxindex faadb86e6b..5120bdbbce 100644--- a/jarvis/ui/web/frontend/src/components/overlay/OverlayStylePreviews.tsx+++ b/jarvis/ui/web/frontend/src/components/overlay/OverlayStylePreviews.tsx@@ -1,7 +1,7 @@import { MascotGigi } from "@/components/MascotGigi";import type { OverlayStyle } from "@/hooks/useOverlayStyle";import {- BAR_SPAN,+ PREVIEW_BAR_SPAN,PILL_CY,PILL_H,PILL_R,@@ -48,7 +48,7 @@ export function StylePreview({ style }: { style: OverlayStyle }) {}export function BarPreview() {- const w = barWidth(PREVIEW_BAR_HEIGHTS.length);+ const w = barWidth(PREVIEW_BAR_HEIGHTS.length, PREVIEW_BAR_SPAN);return (<svg viewBox={`0 0 ${VIEW_W} ${VIEW_H}`} className="w-20" aria-hidden="true"><rect@@ -61,7 +61,7 @@ export function BarPreview() {stroke={PREVIEW_RIM}strokeWidth="1.6"/>- {evenlySpaced(VIEW_W / 2, BAR_SPAN, PREVIEW_BAR_HEIGHTS.length).map((x, i) => {+ {evenlySpaced(VIEW_W / 2, PREVIEW_BAR_SPAN, PREVIEW_BAR_HEIGHTS.length).map((x, i) => {const h = PREVIEW_BAR_HEIGHTS[i];return (<rectdiff --git a/jarvis/ui/web/frontend/src/components/overlay/VoiceWaveform.tsx b/jarvis/ui/web/frontend/src/components/overlay/VoiceWaveform.tsxindex b0b9081a65..e18cb3746d 100644--- a/jarvis/ui/web/frontend/src/components/overlay/VoiceWaveform.tsx+++ b/jarvis/ui/web/frontend/src/components/overlay/VoiceWaveform.tsx@@ -3,7 +3,7 @@ import { memo, useEffect, useRef, useState, type MutableRefObject } from "react"import { cn } from "@/lib/utils";import {BAR_MIN_H,- BAR_SPAN,+ LIVE_BAR_SPAN,COLUMN_MS,LIVE_BAR_COUNT,PILL_CY,@@ -232,12 +232,12 @@ function VoiceWaveformImpl({}, [count, levelRef, phase, reduced]);const tone = PHASE_TONE[phase];- const w = barWidth(count);+ const w = barWidth(count, LIVE_BAR_SPAN);return (<svgviewBox={`0 0 ${VIEW_W} ${VIEW_H}`}- className={cn("h-11 w-full", className)}+ className={cn("h-14 w-full", className)}data-testid="voice-waveform"data-phase={phase}aria-hidden="true"@@ -263,7 +263,7 @@ function VoiceWaveformImpl({transition: "opacity 300ms ease, fill 300ms ease",}}>- {evenlySpaced(VIEW_W / 2, BAR_SPAN, count).map((x) => (+ {evenlySpaced(VIEW_W / 2, LIVE_BAR_SPAN, count).map((x) => (<rectkey={x}x={x - w / 2}diff --git a/jarvis/ui/web/frontend/src/components/overlay/voiceBars.test.ts b/jarvis/ui/web/frontend/src/components/overlay/voiceBars.test.tsindex 9f57ec686e..22a798c6d5 100644--- a/jarvis/ui/web/frontend/src/components/overlay/voiceBars.test.ts+++ b/jarvis/ui/web/frontend/src/components/overlay/voiceBars.test.ts@@ -3,8 +3,12 @@ import { describe, expect, it } from "vitest";import {BAR_MAX_H,BAR_MIN_H,+ LIVE_BAR_COUNT,+ LIVE_BAR_SPAN,PILL_W,PILL_X,+ PREVIEW_BAR_HEIGHTS,+ PREVIEW_BAR_SPAN,VIEW_W,barHeight,barWidth,@@ -17,21 +21,33 @@ import {describe("evenlySpaced", () => {it("centres the row on the pill instead of drifting off to one side", () => {- const xs = evenlySpaced(VIEW_W / 2, 62, 7);+ const xs = evenlySpaced(VIEW_W / 2, PREVIEW_BAR_SPAN, PREVIEW_BAR_HEIGHTS.length);expect((xs[0] + xs[xs.length - 1]) / 2).toBeCloseTo(VIEW_W / 2, 6);});- it("keeps every stroke inside the pill", () => {- const count = 18;- const half = barWidth(count) / 2;- for (const x of evenlySpaced(VIEW_W / 2, 62, count)) {- expect(x - half).toBeGreaterThan(PILL_X);- expect(x + half).toBeLessThan(PILL_X + PILL_W);+ it("keeps every stroke of BOTH rows inside the pill", () => {+ for (const [count, span] of [+ [LIVE_BAR_COUNT, LIVE_BAR_SPAN],+ [PREVIEW_BAR_HEIGHTS.length, PREVIEW_BAR_SPAN],+ ] as const) {+ const half = barWidth(count, span) / 2;+ for (const x of evenlySpaced(VIEW_W / 2, span, count)) {+ expect(x - half).toBeGreaterThan(PILL_X);+ expect(x + half).toBeLessThan(PILL_X + PILL_W);+ }}});+ it("leaves a gap at least as wide as the strokes themselves", () => {+ // Bars touching each other would read as one solid block, not a waveform.+ const xs = evenlySpaced(VIEW_W / 2, LIVE_BAR_SPAN, LIVE_BAR_COUNT);+ expect(xs[1] - xs[0]).toBeGreaterThanOrEqual(+ barWidth(LIVE_BAR_COUNT, LIVE_BAR_SPAN) * 2,+ );+ });+it("puts a single item exactly on the centre", () => {- expect(evenlySpaced(50, 62, 1)).toEqual([50]);+ expect(evenlySpaced(50, LIVE_BAR_SPAN, 1)).toEqual([50]);});});diff --git a/jarvis/ui/web/frontend/src/components/overlay/voiceBars.ts b/jarvis/ui/web/frontend/src/components/overlay/voiceBars.tsindex 41338224d5..a58816d2ca 100644--- a/jarvis/ui/web/frontend/src/components/overlay/voiceBars.ts+++ b/jarvis/ui/web/frontend/src/components/overlay/voiceBars.ts@@ -21,13 +21,13 @@ export const PILL_H = 18;export const PILL_R = PILL_H / 2;export const PILL_CY = PILL_Y + PILL_H / 2;-/** Bar row: centred in the pill, inset so no stroke ever touches the rim.- *- * 62 of the pill's 88 units — a touch wider than the desktop renderer's 0.62- * fraction, because the desktop keeps that extra margin free for the hover- * controls (close-X, mic toggle) it flanks the row with. The web pill carries- * no controls, so the row may use the space. */-export const BAR_SPAN = 62;+/** Bar row width. The two surfaces share the pill and the maths but not this+ * number, because seven chunky strokes and eighteen slim ones do not want the+ * same room: the thumbnail keeps the tight middle cluster it always had (it+ * portrays the RESTING desktop bar), while the live row spreads out to give a+ * scrolling waveform something to scroll across. */+export const PREVIEW_BAR_SPAN = 48;+export const LIVE_BAR_SPAN = 62;export const BAR_MIN_H = 2.4;export const BAR_MAX_H = 15;@@ -48,10 +48,10 @@ export const PREVIEW_BAR_HEIGHTS = [6, 11, 15, 8, 14, 9, 7];export const COLUMN_MS = 33;/** Bar stroke width for a given count, sized so the gaps stay even. */-export function barWidth(count: number): number {+export function barWidth(count: number, span: number = LIVE_BAR_SPAN): number {if (count <= 1) return 3;// Half the pitch, capped so a short row does not turn into fat blocks.- return Math.min(3, (BAR_SPAN / (count - 1)) * 0.5);+ return Math.min(3, (span / (count - 1)) * 0.5);}/** X-positions of ``n`` items centred on ``cx`` across ``span``.