Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
style: cleanup onboarding part 1
Gabriel Stein5cc3510e34f8
diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsxindex eb5ae299d..b7c7a5c25 100644--- a/src/components/OnboardingFlow.tsx+++ b/src/components/OnboardingFlow.tsx@@ -31,6 +31,7 @@ declare global {electronAPI: {pasteText: (text: string) => Promise<void>;hideWindow: () => Promise<void>;+ showDictationPanel?: () => Promise<void>;onToggleDictation: (callback: () => void) => void;saveTranscription: (text: string) => Promise<{ id: number; success: boolean }>;getTranscriptions: (limit?: number) => Promise<any[]>;@@ -104,7 +105,11 @@ interface OnboardingFlowProps {}export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {- const [currentStep, setCurrentStep] = useState(0);+ const [currentStep, setCurrentStep] = useState(() => {+ // Load the current step from localStorage on component mount+ const savedStep = localStorage.getItem('onboardingCurrentStep');+ return savedStep ? parseInt(savedStep, 10) : 0;+ });const [useLocalWhisper, setUseLocalWhisper] = useState(false);const [apiKey, setApiKey] = useState("");const [whisperModel, setWhisperModel] = useState("base");@@ -159,6 +164,36 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {}}, [useLocalWhisper]);+ // Add hotkey listener for practice step and manage dictation panel visibility+ useEffect(() => {+ if (currentStep === 5) { // Practice step+ // Show dictation panel when reaching test step+ const showDictationPanel = () => {+ // Create a new window for dictation panel or bring it to front+ // This depends on your electron setup - you might need to add this to electronAPI+ if (window.electronAPI?.showDictationPanel) {+ window.electronAPI.showDictationPanel();+ }+ };++ showDictationPanel();++ const handleKeyDown = (event: KeyboardEvent) => {+ if (event.key === hotkey && !event.repeat) {+ event.preventDefault();+ if (isRecording) {+ stopPracticeRecording();+ } else if (!isProcessing) {+ startPracticeRecording();+ }+ }+ };++ window.addEventListener('keydown', handleKeyDown);+ return () => window.removeEventListener('keydown', handleKeyDown);+ }+ }, [currentStep, hotkey, isRecording, isProcessing]);+const loadModelList = async () => {try {const result = await window.electronAPI.listWhisperModels();@@ -319,6 +354,8 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {localStorage.setItem("useLocalWhisper", useLocalWhisper.toString());localStorage.setItem("whisperModel", whisperModel);localStorage.setItem("dictationKey", hotkey);+ localStorage.setItem("micPermissionGranted", micPermissionGranted.toString());+ localStorage.setItem("accessibilityPermissionGranted", accessibilityPermissionGranted.toString());localStorage.setItem("onboardingCompleted", "true");if (!useLocalWhisper && apiKey) {@@ -329,18 +366,24 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {const nextStep = () => {if (currentStep < steps.length - 1) {- setCurrentStep(currentStep + 1);+ const newStep = currentStep + 1;+ setCurrentStep(newStep);+ localStorage.setItem('onboardingCurrentStep', newStep.toString());}};const prevStep = () => {if (currentStep > 0) {- setCurrentStep(currentStep - 1);+ const newStep = currentStep - 1;+ setCurrentStep(newStep);+ localStorage.setItem('onboardingCurrentStep', newStep.toString());}};const finishOnboarding = async () => {await saveSettings();+ // Clear the onboarding step since we're done+ localStorage.removeItem('onboardingCurrentStep');onComplete();};@@ -348,18 +391,18 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {switch (currentStep) {case 0: // Welcomereturn (- <div className="text-center space-y-6">- <div className="w-16 h-16 mx-auto bg-indigo-100 rounded-full flex items-center justify-center">- <Sparkles className="w-8 h-8 text-indigo-600" />+ <div className="text-center space-y-6" style={{ fontFamily: 'Noto Sans, sans-serif' }}>+ <div className="w-16 h-16 mx-auto bg-blue-100 rounded-full flex items-center justify-center">+ <Sparkles className="w-8 h-8 text-blue-600" /></div><div>- <h2 className="text-2xl font-bold text-gray-900 mb-2">Welcome to OpenWispr</h2>- <p className="text-gray-600">+ <h2 className="text-2xl font-bold text-stone-900 mb-2" style={{ fontFamily: 'Noto Sans, sans-serif' }}>Welcome to OpenWispr</h2>+ <p className="text-stone-600" style={{ fontFamily: 'Noto Sans, sans-serif' }}>Let's set up your voice dictation in just a few simple steps.</p></div>- <div className="bg-blue-50 p-4 rounded-lg">- <p className="text-sm text-blue-800">+ <div className="bg-blue-50/50 p-4 rounded-lg border border-blue-200/60">+ <p className="text-sm text-blue-800" style={{ fontFamily: 'Noto Sans, sans-serif' }}>π€ Turn your voice into text instantly<br />β‘ Works anywhere on your computer<br />π Your privacy is protected@@ -370,10 +413,10 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {case 1: // Choose Modereturn (- <div className="space-y-6">+ <div className="space-y-6" style={{ fontFamily: 'Noto Sans, sans-serif' }}><div className="text-center">- <h2 className="text-2xl font-bold text-gray-900 mb-2">Choose Your Processing Mode</h2>- <p className="text-gray-600">+ <h2 className="text-2xl font-bold text-stone-900 mb-2" style={{ fontFamily: 'Noto Sans, sans-serif' }}>Choose Your Processing Mode</h2>+ <p className="text-stone-600" style={{ fontFamily: 'Noto Sans, sans-serif' }}>How would you like to convert your speech to text?</p></div>@@ -381,25 +424,26 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {<div className="grid grid-cols-1 md:grid-cols-2 gap-4"><buttononClick={() => setUseLocalWhisper(false)}- className={`p-6 border-2 rounded-xl text-left transition-all ${+ className={`p-6 border-2 rounded-xl text-left transition-all cursor-pointer ${!useLocalWhisper- ? "border-indigo-500 bg-indigo-50 shadow-md"- : "border-gray-200 bg-white hover:border-gray-300"+ ? "border-blue-500 bg-blue-50/50 shadow-md"+ : "border-stone-200 bg-white hover:border-stone-300 hover:shadow-sm"}`}+ style={{ fontFamily: 'Noto Sans, sans-serif' }}><div className="flex items-center justify-between mb-3"><div className="flex items-center gap-3">- <Cloud className="w-6 h-6 text-indigo-600" />- <h3 className="font-semibold text-gray-900">Cloud Processing</h3>+ <Cloud className="w-6 h-6 text-blue-600" />+ <h3 className="font-semibold text-stone-900">Cloud Processing</h3></div><span className="text-xs text-green-600 bg-green-100 px-2 py-1 rounded-full">Fastest</span></div>- <p className="text-sm text-gray-600 mb-3">+ <p className="text-sm text-stone-600 mb-3">Uses OpenAI's servers for lightning-fast transcription</p>- <div className="text-xs text-gray-500">+ <div className="text-xs text-stone-500">β Fastest processing<br />β Best accuracy<br />β’ Requires internet<br />@@ -409,25 +453,26 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {<buttononClick={() => setUseLocalWhisper(true)}- className={`p-6 border-2 rounded-xl text-left transition-all ${+ className={`p-6 border-2 rounded-xl text-left transition-all cursor-pointer ${useLocalWhisper- ? "border-indigo-500 bg-indigo-50 shadow-md"- : "border-gray-200 bg-white hover:border-gray-300"+ ? "border-blue-500 bg-blue-50/50 shadow-md"+ : "border-stone-200 bg-white hover:border-stone-300 hover:shadow-sm"}`}+ style={{ fontFamily: 'Noto Sans, sans-serif' }}><div className="flex items-center justify-between mb-3"><div className="flex items-center gap-3">- <Lock className="w-6 h-6 text-indigo-600" />- <h3 className="font-semibold text-gray-900">Local Processing</h3>+ <Lock className="w-6 h-6 text-blue-600" />+ <h3 className="font-semibold text-stone-900">Local Processing</h3></div><span className="text-xs text-blue-600 bg-blue-100 px-2 py-1 rounded-full">Private</span></div>- <p className="text-sm text-gray-600 mb-3">+ <p className="text-sm text-stone-600 mb-3">Processes everything on your device for complete privacy</p>- <div className="text-xs text-gray-500">+ <div className="text-xs text-stone-500">β Complete privacy<br />β Works offline<br />β No monthly costs<br />@@ -729,75 +774,64 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {case 5: // Test & Practicereturn (- <div className="space-y-6">+ <div className="space-y-6" style={{ fontFamily: 'Noto Sans, sans-serif' }}><div className="text-center">- <h2 className="text-2xl font-bold text-gray-900 mb-2">Test & Practice</h2>- <p className="text-gray-600">+ <h2 className="text-2xl font-bold text-stone-900 mb-2" style={{ fontFamily: 'Noto Sans, sans-serif' }}>Test & Practice</h2>+ <p className="text-stone-600" style={{ fontFamily: 'Noto Sans, sans-serif' }}>Let's test your setup and practice using OpenWispr</p></div><div className="space-y-6">- <div className="bg-blue-50 p-6 rounded-lg">- <h3 className="font-semibold text-blue-900 mb-3">Practice Recording</h3>- <p className="text-sm text-blue-800 mb-4">- Click the button below, then speak something. We'll transcribe it and paste it into the text area.+ <div className="bg-blue-50/50 p-6 rounded-lg border border-blue-200/60">+ <h3 className="font-semibold text-blue-900 mb-3" style={{ fontFamily: 'Noto Sans, sans-serif' }}>Practice with Your Hotkey</h3>+ <p className="text-sm text-blue-800 mb-4" style={{ fontFamily: 'Noto Sans, sans-serif' }}>+ Press <kbd className="bg-white px-2 py-1 rounded text-xs font-mono border border-blue-200">{hotkey}</kbd> to start recording, then speak something. Press <kbd className="bg-white px-2 py-1 rounded text-xs font-mono border border-blue-200">{hotkey}</kbd> again to stop and paste the text below.</p><div className="space-y-4">- <div className="flex justify-center">- <Button- onClick={isRecording ? stopPracticeRecording : startPracticeRecording}- className={`w-32 h-12 ${- isRecording- ? 'bg-red-500 hover:bg-red-600'- : isProcessing- ? 'bg-purple-500 hover:bg-purple-600'- : 'bg-indigo-500 hover:bg-indigo-600'- }`}- disabled={isProcessing}- >- {isProcessing ? (- <>- <div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>- Processing...- </>- ) : isRecording ? (- <>- <div className="animate-pulse w-2 h-2 bg-white rounded-full mr-2"></div>- Stop Recording- </>- ) : (- <>- <Mic className="w-4 h-4 mr-2" />- Start Recording- </>- )}- </Button>+ <div className="text-center">+ {isRecording ? (+ <div className="flex items-center justify-center gap-2 text-red-600">+ <div className="animate-pulse w-3 h-3 bg-red-500 rounded-full"></div>+ <span className="font-medium" style={{ fontFamily: 'Noto Sans, sans-serif' }}>Recording... Press <kbd className="bg-white px-1 py-0.5 rounded text-xs font-mono border">{hotkey}</kbd> to stop</span>+ </div>+ ) : isProcessing ? (+ <div className="flex items-center justify-center gap-2 text-purple-600">+ <div className="animate-spin rounded-full h-4 w-4 border-b-2 border-purple-600"></div>+ <span className="font-medium" style={{ fontFamily: 'Noto Sans, sans-serif' }}>Processing transcription...</span>+ </div>+ ) : (+ <div className="flex items-center justify-center gap-2 text-stone-600">+ <Mic className="w-4 h-4" />+ <span style={{ fontFamily: 'Noto Sans, sans-serif' }}>Press <kbd className="bg-white px-1 py-0.5 rounded text-xs font-mono border">{hotkey}</kbd> to start recording</span>+ </div>+ )}</div><div>- <label className="block text-sm font-medium text-gray-700 mb-2">- Transcribed Text (will be pasted automatically):+ <label className="block text-sm font-medium text-stone-700 mb-2" style={{ fontFamily: 'Noto Sans, sans-serif' }}>+ Transcribed Text:</label><textareavalue={practiceText}onChange={(e) => setPracticeText(e.target.value)}- className="w-full p-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500"+ className="w-full p-3 border border-stone-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white"+ style={{ fontFamily: 'Noto Sans, sans-serif' }}rows={4}- placeholder="Your transcribed text will appear here..."+ placeholder="Your transcribed text will appear here after recording..."/></div></div></div>- <div className="bg-green-50 p-4 rounded-lg">- <h4 className="font-medium text-green-900 mb-2">π‘ How to use OpenWispr:</h4>- <ol className="text-sm text-green-800 space-y-1">+ <div className="bg-green-50/50 p-4 rounded-lg border border-green-200/60">+ <h4 className="font-medium text-green-900 mb-2" style={{ fontFamily: 'Noto Sans, sans-serif' }}>π‘ How to use OpenWispr:</h4>+ <ol className="text-sm text-green-800 space-y-1" style={{ fontFamily: 'Noto Sans, sans-serif' }}><li>1. Click in any text field (email, document, etc.)</li>- <li>2. Press <kbd className="bg-white px-2 py-1 rounded text-xs font-mono">{hotkey}</kbd> to start recording</li>+ <li>2. Press <kbd className="bg-white px-2 py-1 rounded text-xs font-mono border border-green-200">{hotkey}</kbd> to start recording</li><li>3. Speak your text clearly</li>- <li>4. Press <kbd className="bg-white px-2 py-1 rounded text-xs font-mono">{hotkey}</kbd> again to stop</li>+ <li>4. Press <kbd className="bg-white px-2 py-1 rounded text-xs font-mono border border-green-200">{hotkey}</kbd> again to stop</li><li>5. Your text will automatically appear where you were typing!</li></ol></div>@@ -857,9 +891,9 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {switch (currentStep) {case 0: return true;case 1: return true; // Mode selection- case 2:+case 2:if (useLocalWhisper) {- return whisperInstalled && modelList.some(m => m.downloaded);+ return whisperInstalled;} else {return apiKey.trim() !== '';}@@ -871,25 +905,50 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {}};+ // Load Google Font only in the browser+ React.useEffect(() => {+ const link = document.createElement('link');+ link.href = 'https://fonts.googleapis.com/css2?family=Noto+Sans:wght@300;400;500;600;700&display=swap';+ link.rel = 'stylesheet';+ document.head.appendChild(link);+ return () => {+ document.head.removeChild(link);+ };+ }, []);+return (- <div className="min-h-screen bg-gradient-to-br from-indigo-50 via-white to-purple-50">+ <div+ className="h-screen flex flex-col bg-gradient-to-br from-stone-50 via-white to-blue-50/30"+ style={{+ backgroundImage: `repeating-linear-gradient(+ transparent,+ transparent 24px,+ #e7e5e4 24px,+ #e7e5e4 25px+ )`,+ fontFamily: 'Noto Sans, sans-serif',+ }}+ >+ {/* Left margin line for entire page */}+ <div className="fixed left-6 md:left-12 top-0 bottom-0 w-px bg-red-300/40 z-0"></div>+{/* Header */}- <div className="bg-white border-b border-gray-200 px-6 py-4">+ <div className="bg-white backdrop-blur-xl border-b border-stone-200/60 px-6 md:pl-16 md:pr-6 py-4 relative z-10 flex-shrink-0"><div className="flex items-center justify-between"><div className="flex items-center gap-3">- <div className="w-8 h-8 bg-indigo-600 rounded-lg flex items-center justify-center">- <span className="text-white font-bold text-sm">OW</span>- </div>- <h1 className="text-lg font-semibold text-gray-900">OpenWispr Setup</h1>+ {/* <div className="w-8 h-8 bg-gradient-to-br from-blue-500 to-blue-600 rounded-lg flex items-center justify-center">+ <span className="text-white font-bold text-sm" style={{ fontFamily: 'Noto Sans, sans-serif' }}>OW</span>+ </div> */}+ <h1 className="text-sm font-semibold text-stone-900" style={{ fontFamily: 'Noto Sans, sans-serif' }}>OpenWispr Setup</h1></div>- <div className="text-sm text-gray-500">+ <div className="text-sm text-stone-500" style={{ fontFamily: 'Noto Sans, sans-serif' }}>Step {currentStep + 1} of {steps.length}</div></div></div>{/* Progress Bar */}- <div className="bg-white border-b border-gray-200 px-6 py-2">+ <div className="bg-white backdrop-blur-xl border-b border-stone-200/60 px-6 md:pl-16 md:pr-6 py-2 relative z-10 flex-shrink-0"><div className="flex items-center justify-between mb-2">{steps.map((step, index) => {const Icon = step.icon;@@ -899,14 +958,14 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {return (<div key={index} className="flex items-center"><div className={`flex items-center gap-2 ${- isActive ? 'text-indigo-600' : isCompleted ? 'text-green-600' : 'text-gray-400'- }`}>+ isActive ? 'text-blue-600' : isCompleted ? 'text-green-600' : 'text-stone-400'+ }`} style={{ fontFamily: 'Noto Sans, sans-serif' }}><div className={`w-8 h-8 rounded-full flex items-center justify-center border-2 ${isActive- ? 'border-indigo-600 bg-indigo-50'+ ? 'border-blue-600 bg-blue-50': isCompleted? 'border-green-600 bg-green-50'- : 'border-gray-300 bg-white'+ : 'border-stone-300 bg-white'}`}>{isCompleted ? (<Check className="w-4 h-4" />@@ -918,7 +977,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {</div>{index < steps.length - 1 && (<div className={`w-8 h-0.5 mx-2 ${- isCompleted ? 'bg-green-600' : 'bg-gray-300'+ isCompleted ? 'bg-green-600' : 'bg-stone-300'}`} />)}</div>@@ -927,24 +986,25 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {</div></div>- {/* Content */}- <div className="flex-1 px-6 py-8">- <div className="max-w-2xl mx-auto">- <Card className="bg-white shadow-lg">- <CardContent className="p-8">+ {/* Content - This will grow to fill available space */}+ <div className="flex-1 px-6 md:pl-16 md:pr-6 py-8 relative z-10 overflow-y-auto">+ <div className="max-w-4xl mx-auto">+ <Card className="bg-white backdrop-blur-xl border border-stone-200/60 shadow-sm rounded-2xl overflow-hidden">+ <CardContent className="p-8" style={{ fontFamily: 'Noto Sans, sans-serif' }}>{renderStep()}</CardContent></Card></div></div>- {/* Footer */}- <div className="bg-white border-t border-gray-200 px-6 py-4">- <div className="max-w-2xl mx-auto flex items-center justify-between">+ {/* Footer - This will stick to the bottom */}+ <div className="bg-white backdrop-blur-xl border-t border-stone-200/60 px-6 md:pl-16 md:pr-6 py-4 relative z-10 flex-shrink-0">+ <div className="max-w-4xl mx-auto flex items-center justify-between"><ButtononClick={prevStep}variant="outline"disabled={currentStep === 0}+ style={{ fontFamily: 'Noto Sans, sans-serif' }}><ChevronLeft className="w-4 h-4 mr-2" />Previous@@ -952,7 +1012,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {<div className="flex items-center gap-2">{currentStep === steps.length - 1 ? (- <Button onClick={finishOnboarding} className="bg-green-600 hover:bg-green-700">+ <Button onClick={finishOnboarding} className="bg-green-600 hover:bg-green-700" style={{ fontFamily: 'Noto Sans, sans-serif' }}><Check className="w-4 h-4 mr-2" />Finish Setup</Button>@@ -960,6 +1020,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {<ButtononClick={nextStep}disabled={!canProceed()}+ style={{ fontFamily: 'Noto Sans, sans-serif' }}>Next<ChevronRight className="w-4 h-4 ml-2" />diff --git a/src/main.jsx b/src/main.jsxindex 6b07d93ff..07ce2ebe0 100644--- a/src/main.jsx+++ b/src/main.jsx@@ -18,15 +18,21 @@ function AppRouter() {useEffect(() => {// Check if onboarding has been completed- const onboardingCompleted = localStorage.getItem('onboardingCompleted');+ const onboardingCompleted = localStorage.getItem('onboardingCompleted') === 'true';+ const currentStep = parseInt(localStorage.getItem('onboardingCurrentStep') || '0');if (isControlPanel && !onboardingCompleted) {// Show onboarding for control panel if not completedsetShowOnboarding(true);}+ // Hide dictation panel window unless onboarding is complete or we're on the test step (step 5)+ if (isDictationPanel && !onboardingCompleted && currentStep !== 5) {+ window.electronAPI?.hideWindow?.();+ }+setIsLoading(false);- }, [isControlPanel]);+ }, [isControlPanel, isDictationPanel]);const handleOnboardingComplete = () => {setShowOnboarding(false);@@ -44,27 +50,6 @@ function AppRouter() {);}- // Hide dictation panel during onboarding- if (isDictationPanel && localStorage.getItem('onboardingCompleted') !== 'true') {- return (- <div className="min-h-screen bg-gray-900 flex items-center justify-center">- <div className="text-center text-white">- <div className="w-16 h-16 mx-auto bg-indigo-600 rounded-full flex items-center justify-center mb-4">- <span className="text-white font-bold text-lg">OW</span>- </div>- <h2 className="text-xl font-semibold mb-2">Setup in Progress</h2>- <p className="text-gray-300 mb-4">Please complete setup in the Control Panel first.</p>- <button- onClick={() => window.electronAPI?.hideWindow?.()}- className="text-sm text-indigo-400 hover:text-indigo-300"- >- Hide Window- </button>- </div>- </div>- );- }-if (isControlPanel && showOnboarding) {return <OnboardingFlow onComplete={handleOnboardingComplete} />;}