diff --git a/src/lib/pages/DictationPage.svelte b/src/lib/pages/DictationPage.svelte index f189157..eef97a9 100644 --- a/src/lib/pages/DictationPage.svelte +++ b/src/lib/pages/DictationPage.svelte @@ -9,6 +9,11 @@ import { extractTasks } from "$lib/utils/taskExtractor.js"; import { pad } from "$lib/utils/time.js"; import { MAX_PCM_SAMPLES, MIN_CHUNK_SAMPLES, CHUNK_INTERVAL_MS, FEEDBACK_TIMEOUT_MS } from "$lib/utils/constants.js"; + import { Mic, Loader2, SquareCheck, AlertTriangle } from 'lucide-svelte'; + import EmptyState from '$lib/components/EmptyState.svelte'; + import { getPreferences } from '$lib/stores/preferences.svelte.js'; + import { bionicReading } from '$lib/actions/bionicReading.js'; + const prefs = getPreferences(); let transcript = $state(""); let segments = $state([]); @@ -196,6 +201,7 @@ async function startRecording() { error = ""; saved = false; + transcriptionFailed = false; if (!modelReady) { if (needsDownload) return; await loadModel(); @@ -339,6 +345,7 @@ } catch (err) { console.error("transcribe_pcm failed:", err); error = typeof err === "string" ? err : err.message || "Transcription failed"; + transcriptionFailed = true; if (!page.recording) { page.status = "Error"; page.statusColor = "#e87171"; @@ -496,6 +503,15 @@ const trimmed = transcript.trim(); return trimmed ? trimmed.split(/\s+/).length : 0; }); + + let reduceMotion = $derived( + prefs.accessibility.reduceMotion === 'on' + || (prefs.accessibility.reduceMotion === 'system' + && typeof window !== 'undefined' + && window.matchMedia('(prefers-reduced-motion: reduce)').matches) + ); + + let transcriptionFailed = $state(false);
@@ -510,7 +526,7 @@ + + {page.recording ? 'Stop' : modelLoading ? 'Loading' : 'Record'} +
{#if page.recording} {#each [0.4, 0.8, 0.5, 1, 0.6, 0.9, 0.4, 0.7, 0.5, 0.8, 0.3, 0.6] as h, i} - + {#if reduceMotion} + + {:else} + + {/if} {/each} {:else} @@ -586,9 +611,10 @@ onclick={() => page.taskSidebarOpen = !page.taskSidebarOpen} aria-label="Toggle task sidebar" > - - - + + {#if taskCount > 0} {taskCount} @@ -679,19 +705,40 @@ {/if} -
+
- + {#if transcriptionFailed && !transcript.trim() && !page.recording} +
+ +
+ {:else if !transcript.trim() && !page.recording && !transcribing} +
+ +
+ + {:else} + + {/if}