Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

merge: integrate origin/main into feat/system-audio-windows-linux

Gabriel Stein4c3a24a6c419
diff --cc src/AppRouter.jsx
index e505694f8,000000000..4089c84f8
mode 100644,000000..100644
--- a/src/AppRouter.jsx
+++ b/src/AppRouter.jsx
@@@ -1,190 -1,0 +1,195 @@@
+import React, { Suspense, useEffect, useState } from "react";
+import { useTranslation } from "react-i18next";
+import App from "./App.jsx";
+import AuthenticationStep from "./components/AuthenticationStep.tsx";
+import MeetingNotificationOverlay from "./components/MeetingNotificationOverlay.tsx";
++import TranscriptionPreviewOverlay from "./components/TranscriptionPreviewOverlay.tsx";
+import UpdateNotificationOverlay from "./components/UpdateNotificationOverlay.tsx";
+import WindowControls from "./components/WindowControls.tsx";
+import { Card, CardContent } from "./components/ui/card.tsx";
+import { useAuth } from "./hooks/useAuth";
+import { useTheme } from "./hooks/useTheme";
+
+const ControlPanel = React.lazy(() => import("./components/ControlPanel.tsx"));
+const OnboardingFlow = React.lazy(() => import("./components/OnboardingFlow.tsx"));
+const AgentOverlay = React.lazy(() => import("./components/AgentOverlay.tsx"));
+
+export default function AppRouter() {
+ useTheme();
+ const params = window.location.search;
+
+ if (params.includes("meeting-notification=true")) {
+ return <MeetingNotificationOverlay />;
+ }
+
+ if (params.includes("update-notification=true")) {
+ return <UpdateNotificationOverlay />;
+ }
+
++ if (params.includes("transcription-preview=true")) {
++ return <TranscriptionPreviewOverlay />;
++ }
++
+ return <MainApp />;
+}
+
+function MainApp() {
+ const { isSignedIn, isGracePeriodOnly, isLoaded: authLoaded } = useAuth();
+
+ const [showOnboarding, setShowOnboarding] = useState(false);
+ const [needsReauth, setNeedsReauth] = useState(false);
+ const [isLoading, setIsLoading] = useState(true);
+
+ const isAgentPanel = window.location.search.includes("agent=true");
+ const isControlPanel =
+ !isAgentPanel &&
+ (window.location.pathname.includes("control") || window.location.search.includes("panel=true"));
+ const isDictationPanel = !isControlPanel && !isAgentPanel;
+
+ useEffect(() => {
+ if (isAgentPanel) {
+ import("./components/AgentOverlay.tsx").catch(() => {});
+ } else if (isControlPanel) {
+ import("./components/ControlPanel.tsx").catch(() => {});
+
+ if (!localStorage.getItem("onboardingCompleted")) {
+ import("./components/OnboardingFlow.tsx").catch(() => {});
+ }
+ }
+ }, [isAgentPanel, isControlPanel]);
+
+ useEffect(() => {
+ if (!authLoaded) return;
+
+ const onboardingCompleted = localStorage.getItem("onboardingCompleted") === "true";
+ const authSkipped =
+ localStorage.getItem("authenticationSkipped") === "true" ||
+ localStorage.getItem("skipAuth") === "true";
+ const onboardingInProgress = localStorage.getItem("onboardingCurrentStep") !== null;
+ const isReturningUser =
+ !onboardingCompleted && isSignedIn && !isGracePeriodOnly && !onboardingInProgress;
+
+ if (isReturningUser) {
+ localStorage.setItem("onboardingCompleted", "true");
+ }
+
+ const resolved = localStorage.getItem("onboardingCompleted") === "true";
+
+ if (isControlPanel) {
+ if (!resolved) {
+ setShowOnboarding(true);
+ } else if (!isSignedIn && !authSkipped) {
+ setNeedsReauth(true);
+ }
+ }
+
+ if (isDictationPanel && !resolved) {
+ const rawStep = parseInt(localStorage.getItem("onboardingCurrentStep") || "0");
+ const currentStep = Math.max(0, Math.min(rawStep, 5));
+ if (currentStep < 4) {
+ window.electronAPI?.hideWindow?.();
+ }
+ }
+
+ setIsLoading(false);
+ }, [authLoaded, isControlPanel, isDictationPanel, isGracePeriodOnly, isSignedIn]);
+
+ const handleOnboardingComplete = () => {
+ setShowOnboarding(false);
+ localStorage.setItem("onboardingCompleted", "true");
+ };
+
+ if (isAgentPanel) {
+ return (
+ <Suspense fallback={<LoadingFallback />}>
+ <AgentOverlay />
+ </Suspense>
+ );
+ }
+
+ if (isLoading) {
+ return <LoadingFallback />;
+ }
+
+ if (isControlPanel && showOnboarding) {
+ return (
+ <Suspense fallback={<LoadingFallback />}>
+ <OnboardingFlow onComplete={handleOnboardingComplete} />
+ </Suspense>
+ );
+ }
+
+ if (isControlPanel && needsReauth) {
+ return (
+ <div
+ className="h-screen flex flex-col bg-background"
+ style={{ paddingTop: "env(safe-area-inset-top, 0px)" }}
+ >
+ <div
+ className="flex items-center justify-end w-full h-10 shrink-0"
+ style={{ WebkitAppRegion: "drag" }}
+ >
+ {window.electronAPI?.getPlatform?.() !== "darwin" && (
+ <div className="pr-1" style={{ WebkitAppRegion: "no-drag" }}>
+ <WindowControls />
+ </div>
+ )}
+ </div>
+ <div className="flex-1 px-6 overflow-y-auto flex items-center">
+ <div className="w-full max-w-sm mx-auto">
+ <Card className="bg-card/90 backdrop-blur-2xl border border-border/50 dark:border-white/5 shadow-lg rounded-xl overflow-hidden">
+ <CardContent className="p-6">
+ <AuthenticationStep
+ onContinueWithoutAccount={() => {
+ localStorage.setItem("authenticationSkipped", "true");
+ localStorage.setItem("skipAuth", "true");
+ setNeedsReauth(false);
+ }}
+ onAuthComplete={() => setNeedsReauth(false)}
+ onNeedsVerification={() => {}}
+ />
+ </CardContent>
+ </Card>
+ </div>
+ </div>
+ </div>
+ );
+ }
+
+ return isControlPanel ? (
+ <Suspense fallback={<LoadingFallback />}>
+ <ControlPanel />
+ </Suspense>
+ ) : (
+ <App />
+ );
+}
+
+function LoadingFallback({ message }) {
+ const { t } = useTranslation();
+ const fallbackMessage = message || t("common.loading");
+
+ return (
+ <div className="min-h-screen bg-background flex items-center justify-center">
+ <div className="flex flex-col items-center gap-4 animate-[scale-in_300ms_ease-out]">
+ <svg
+ viewBox="0 0 1024 1024"
+ className="w-12 h-12 drop-shadow-[0_2px_8px_rgba(37,99,235,0.18)] dark:drop-shadow-[0_2px_12px_rgba(100,149,237,0.25)]"
+ aria-label="OpenWhispr"
+ >
+ <rect width="1024" height="1024" rx="241" fill="#2056DF" />
+ <circle cx="512" cy="512" r="314" fill="#2056DF" stroke="white" strokeWidth="74" />
+ <path d="M512 383V641" stroke="white" strokeWidth="74" strokeLinecap="round" />
+ <path d="M627 457V568" stroke="white" strokeWidth="74" strokeLinecap="round" />
+ <path d="M397 457V568" stroke="white" strokeWidth="74" strokeLinecap="round" />
+ </svg>
+ <div className="w-7 h-7 rounded-full border-[2.5px] border-transparent border-t-primary animate-[spinner-rotate_0.8s_cubic-bezier(0.4,0,0.2,1)_infinite] motion-reduce:animate-none motion-reduce:border-t-muted-foreground motion-reduce:opacity-50" />
+ {fallbackMessage && (
+ <p className="text-[13px] font-medium text-muted-foreground dark:text-foreground/60 tracking-[-0.01em]">
+ {fallbackMessage}
+ </p>
+ )}
+ </div>
+ </div>
+ );
+}