From 0e888d62af1434fef231e11a5c307a5b48a8deb1 Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Sat, 07 Mar 2026 10:49:07 +0100
Subject: [PATCH] feat: singleton audio, transcript reflection, voice persistence

---
 components/chat/VoiceButton.tsx |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/components/chat/VoiceButton.tsx b/components/chat/VoiceButton.tsx
index 93b357a..9a8a2b8 100644
--- a/components/chat/VoiceButton.tsx
+++ b/components/chat/VoiceButton.tsx
@@ -10,7 +10,7 @@
 import { stopPlayback } from "../../services/audio";
 
 interface VoiceButtonProps {
-  onVoiceRecorded: (uri: string) => void;
+  onVoiceRecorded: (uri: string, durationMs?: number) => void;
 }
 
 const VOICE_BUTTON_SIZE = 72;
@@ -98,7 +98,11 @@
       });
       const uri = recorder.uri;
       if (uri) {
-        onVoiceRecorded(uri);
+        // currentTime is in seconds after stop
+        const durationMs = recorder.currentTime > 0
+          ? Math.round(recorder.currentTime * 1000)
+          : undefined;
+        onVoiceRecorded(uri, durationMs);
       }
     } catch (err) {
       console.error("Failed to stop recording:", err);

--
Gitblit v1.3.1