summaryrefslogtreecommitdiff
path: root/apps/web/src/voiceover/voiceover-store.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/src/voiceover/voiceover-store.ts')
-rw-r--r--apps/web/src/voiceover/voiceover-store.ts41
1 files changed, 41 insertions, 0 deletions
diff --git a/apps/web/src/voiceover/voiceover-store.ts b/apps/web/src/voiceover/voiceover-store.ts
new file mode 100644
index 00000000..44ccae6c
--- /dev/null
+++ b/apps/web/src/voiceover/voiceover-store.ts
@@ -0,0 +1,41 @@
+/**
+ * Voice-over recording UI state.
+ * Transient by nature — a recording never survives a reload, so unlike most
+ * stores here this one is intentionally NOT persisted (same pattern as
+ * editor-store / properties-store).
+ */
+
+import { create } from "zustand";
+import type { MediaTime } from "@/wasm";
+
+export type VoiceOverStatus = "idle" | "recording";
+
+interface VoiceOverStore {
+ status: VoiceOverStatus;
+ startedAtMs: number | null;
+ playheadStartTime: MediaTime | null;
+ startRecording: ({ playheadTime }: { playheadTime: MediaTime }) => void;
+ stopRecording: () => void;
+}
+
+export const useVoiceOverStore = create<VoiceOverStore>()((set) => ({
+ status: "idle",
+ startedAtMs: null,
+ playheadStartTime: null,
+
+ startRecording: ({ playheadTime }) => {
+ set({
+ status: "recording",
+ startedAtMs: Date.now(),
+ playheadStartTime: playheadTime,
+ });
+ },
+
+ stopRecording: () => {
+ set({
+ status: "idle",
+ startedAtMs: null,
+ playheadStartTime: null,
+ });
+ },
+}));