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
Revert "Referral program (#251)" (#265)
Gabriel Stein10339ae5eaa5
diff --git a/main.js b/main.jsindex 31c93b8ad..b76f8fa1d 100644--- a/main.js+++ b/main.js@@ -320,7 +320,6 @@ function navigateControlPanelWithVerifier(verifier) {windowManager.controlPanelWindow.focus();}-function handleOAuthDeepLink(deepLinkUrl) {try {const parsed = new URL(deepLinkUrl);diff --git a/package-lock.json b/package-lock.jsonindex fe0db023c..dd6fa8a10 100644--- a/package-lock.json+++ b/package-lock.json@@ -10,7 +10,6 @@"hasInstallScript": true,"license": "MIT","dependencies": {- "@neondatabase/auth": "^0.1.0-beta.21","@neondatabase/neon-js": "^0.1.0-beta.22","@radix-ui/react-accordion": "^1.1.2","@radix-ui/react-dialog": "^1.1.14",diff --git a/package.json b/package.jsonindex 6173c903a..daf26b5f9 100644--- a/package.json+++ b/package.json@@ -83,7 +83,6 @@"vite": "^6.3.5"},"dependencies": {- "@neondatabase/auth": "^0.1.0-beta.21","@neondatabase/neon-js": "^0.1.0-beta.22","@radix-ui/react-accordion": "^1.1.2","@radix-ui/react-dialog": "^1.1.14",diff --git a/preload.js b/preload.jsindex 44da05cdb..87f557917 100644--- a/preload.js+++ b/preload.js@@ -1,4 +1,4 @@-const { contextBridge, ipcRenderer, webUtils } = require("electron");+const { contextBridge, ipcRenderer } = require("electron");/*** Helper to register an IPC listener and return a cleanup function.@@ -51,37 +51,6 @@ contextBridge.exposeInMainWorld("electronAPI", {getDictionary: () => ipcRenderer.invoke("db-get-dictionary"),setDictionary: (words) => ipcRenderer.invoke("db-set-dictionary", words),- // Note functions- saveNote: (title, content, noteType, sourceFile, audioDuration) =>- ipcRenderer.invoke("db-save-note", title, content, noteType, sourceFile, audioDuration),- getNote: (id) => ipcRenderer.invoke("db-get-note", id),- getNotes: (noteType, limit) => ipcRenderer.invoke("db-get-notes", noteType, limit),- updateNote: (id, updates) => ipcRenderer.invoke("db-update-note", id, updates),- deleteNote: (id) => ipcRenderer.invoke("db-delete-note", id),- exportNote: (noteId, format) => ipcRenderer.invoke("export-note", noteId, format),-- // Audio file operations- selectAudioFile: () => ipcRenderer.invoke("select-audio-file"),- transcribeAudioFile: (filePath, options) =>- ipcRenderer.invoke("transcribe-audio-file", filePath, options),- getPathForFile: (file) => webUtils.getPathForFile(file),-- onNoteAdded: (callback) => {- const listener = (_event, note) => callback?.(note);- ipcRenderer.on("note-added", listener);- return () => ipcRenderer.removeListener("note-added", listener);- },- onNoteUpdated: (callback) => {- const listener = (_event, note) => callback?.(note);- ipcRenderer.on("note-updated", listener);- return () => ipcRenderer.removeListener("note-updated", listener);- },- onNoteDeleted: (callback) => {- const listener = (_event, data) => callback?.(data);- ipcRenderer.on("note-deleted", listener);- return () => ipcRenderer.removeListener("note-deleted", listener);- },-onTranscriptionAdded: (callback) => {const listener = (_event, transcription) => callback?.(transcription);ipcRenderer.on("transcription-added", listener);@@ -287,11 +256,6 @@ contextBridge.exposeInMainWorld("electronAPI", {cloudCheckout: () => ipcRenderer.invoke("cloud-checkout"),cloudBillingPortal: () => ipcRenderer.invoke("cloud-billing-portal"),- // Referral stats- getReferralStats: () => ipcRenderer.invoke("get-referral-stats"),- sendReferralInvite: (email) => ipcRenderer.invoke("send-referral-invite", email),- getReferralInvites: () => ipcRenderer.invoke("get-referral-invites"),-// Assembly AI StreamingassemblyAiStreamingWarmup: (options) => ipcRenderer.invoke("assemblyai-streaming-warmup", options),assemblyAiStreamingStart: (options) => ipcRenderer.invoke("assemblyai-streaming-start", options),diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsxindex 6faabf001..b4c5cfa44 100644--- a/src/components/ControlPanel.tsx+++ b/src/components/ControlPanel.tsx@@ -1,7 +1,22 @@import React, { Suspense, useState, useEffect, useRef, useCallback } from "react";import { Button } from "./ui/button";-import { Download, RefreshCw, Loader2, AlertTriangle } from "lucide-react";+import {+ Trash2,+ Settings,+ FileText,+ Mic,+ Download,+ RefreshCw,+ Loader2,+ Sparkles,+ Cloud,+ X,+ AlertTriangle,+} from "lucide-react";import type { SettingsSectionType } from "./SettingsModal";+import TitleBar from "./TitleBar";+import SupportDropdown from "./ui/SupportDropdown";+import TranscriptionItem from "./ui/TranscriptionItem";import UpgradePrompt from "./UpgradePrompt";import { ConfirmDialog, AlertDialog } from "./ui/dialog";import { useDialogs } from "../hooks/useDialogs";@@ -17,14 +32,9 @@ import {removeTranscription as removeFromStore,clearTranscriptions as clearStoreTranscriptions,} from "../stores/transcriptionStore";-import ControlPanelSidebar, { type ControlPanelView } from "./ControlPanelSidebar";-import HistoryView from "./HistoryView";+import { formatHotkeyLabel } from "../utils/hotkeys";const SettingsModal = React.lazy(() => import("./SettingsModal"));-const ReferralModal = React.lazy(() => import("./ReferralModal"));-const PersonalNotesView = React.lazy(() => import("./notes/PersonalNotesView"));-const DictionaryView = React.lazy(() => import("./DictionaryView"));-const UploadAudioView = React.lazy(() => import("./notes/UploadAudioView"));export default function ControlPanel() {const history = useTranscriptions();@@ -37,14 +47,12 @@ export default function ControlPanel() {const [aiCTADismissed, setAiCTADismissed] = useState(() => localStorage.getItem("aiCTADismissed") === "true");- const [showReferrals, setShowReferrals] = useState(false);const [showCloudMigrationBanner, setShowCloudMigrationBanner] = useState(false);- const [activeView, setActiveView] = useState<ControlPanelView>("home");const cloudMigrationProcessed = useRef(false);const { hotkey } = useHotkey();const { toast } = useToast();const { useReasoningModel, setUseLocalWhisper, setCloudTranscriptionMode } = useSettings();- const { isSignedIn, isLoaded: authLoaded, user } = useAuth();+ const { isSignedIn, isLoaded: authLoaded } = useAuth();const usage = useUsage();const {@@ -298,7 +306,7 @@ export default function ControlPanel() {};return (- <div className="min-h-screen bg-background flex flex-col">+ <div className="min-h-screen bg-background"><ConfirmDialogopen={confirmDialog.open}onOpenChange={hideConfirmDialog}@@ -323,6 +331,40 @@ export default function ControlPanel() {limit={limitData?.limit}/>+ <TitleBar+ actions={+ <>+ {!updateStatus.isDevelopment &&+ (updateStatus.updateAvailable ||+ updateStatus.updateDownloaded ||+ isDownloading ||+ isInstalling) && (+ <Button+ variant={updateStatus.updateDownloaded ? "default" : "outline"}+ size="sm"+ onClick={handleUpdateClick}+ disabled={isInstalling || isDownloading}+ className="gap-1.5 text-xs"+ >+ {getUpdateButtonContent()}+ </Button>+ )}+ <SupportDropdown />+ <Button+ variant="ghost"+ size="icon"+ onClick={() => {+ setSettingsSection(undefined);+ setShowSettings(true);+ }}+ className="text-foreground/70 hover:text-foreground hover:bg-foreground/10"+ >+ <Settings size={16} />+ </Button>+ </>+ }+ />+{showSettings && (<Suspense fallback={null}><SettingsModal@@ -336,114 +378,177 @@ export default function ControlPanel() {</Suspense>)}- {showReferrals && (- <Suspense fallback={null}>- <ReferralModal open={showReferrals} onOpenChange={setShowReferrals} />- </Suspense>- )}+ <div className="p-4">+ <div className="max-w-3xl mx-auto">+ {usage?.isPastDue && (+ <div className="mb-3 rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/50 p-3">+ <div className="flex items-start gap-3">+ <div className="shrink-0 w-8 h-8 rounded-md bg-amber-100 dark:bg-amber-900/50 flex items-center justify-center">+ <AlertTriangle size={16} className="text-amber-600 dark:text-amber-400" />+ </div>+ <div className="flex-1 min-w-0">+ <p className="text-[13px] font-medium text-amber-900 dark:text-amber-200 mb-0.5">+ We couldn't process your payment+ </p>+ <p className="text-[12px] text-amber-700 dark:text-amber-300/80 mb-2">+ You're on the free plan for now — you still get {usage.limit.toLocaleString()}{" "}+ words per week. Update your payment to get back to Pro.+ </p>+ <Button+ variant="default"+ size="sm"+ className="h-7 text-[11px]"+ onClick={() => {+ setSettingsSection("account");+ setShowSettings(true);+ }}+ >+ Update Payment+ </Button>+ </div>+ </div>+ </div>+ )}- <div className="flex flex-1 overflow-hidden">- <ControlPanelSidebar- activeView={activeView}- onViewChange={setActiveView}- onOpenSettings={() => {- setSettingsSection(undefined);- setShowSettings(true);- }}- onOpenReferrals={() => setShowReferrals(true)}- userName={user?.name}- userEmail={user?.email}- userImage={user?.image}- isSignedIn={isSignedIn}- updateAction={- !updateStatus.isDevelopment &&- (updateStatus.updateAvailable ||- updateStatus.updateDownloaded ||- isDownloading ||- isInstalling) ? (+ <div className="flex items-center justify-between mb-3 px-1">+ <div className="flex items-center gap-2">+ <FileText size={14} className="text-primary" />+ <h2 className="text-sm font-semibold text-foreground">Transcriptions</h2>+ {history.length > 0 && (+ <span className="text-[11px] text-muted-foreground tabular-nums">+ ({history.length})+ </span>+ )}+ </div>+ {history.length > 0 && (<Button- variant={updateStatus.updateDownloaded ? "default" : "outline"}+ onClick={clearHistory}+ variant="ghost"size="sm"- onClick={handleUpdateClick}- disabled={isInstalling || isDownloading}- className="gap-1.5 text-[11px] w-full h-7"+ className="h-7 px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10">- {getUpdateButtonContent()}+ <Trash2 size={12} className="mr-1" />+ Clear</Button>- ) : undefined- }- />- <main className="flex-1 flex flex-col overflow-hidden">- <div- className="w-full h-10 shrink-0"- style={{ WebkitAppRegion: "drag" } as React.CSSProperties}- />- <div className="flex-1 overflow-y-auto pt-1">- {usage?.isPastDue && (- <div className="mx-4 mb-3 rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/50 p-3">- <div className="flex items-start gap-3">- <div className="shrink-0 w-8 h-8 rounded-md bg-amber-100 dark:bg-amber-900/50 flex items-center justify-center">- <AlertTriangle size={16} className="text-amber-600 dark:text-amber-400" />- </div>- <div className="flex-1 min-w-0">- <p className="text-[13px] font-medium text-amber-900 dark:text-amber-200 mb-0.5">- We couldn't process your payment- </p>- <p className="text-[12px] text-amber-700 dark:text-amber-300/80 mb-2">- You're on the free plan for now — you still get {usage.limit.toLocaleString()}{" "}- words per week. Update your payment to get back to Pro.- </p>- <Button- variant="default"- size="sm"- className="h-7 text-[11px]"- onClick={() => {- setSettingsSection("account");- setShowSettings(true);- }}- >- Update Payment- </Button>- </div>+ )}+ </div>++ {showCloudMigrationBanner && (+ <div className="mb-3 relative rounded-lg border border-primary/20 bg-primary/5 dark:bg-primary/10 p-3">+ <button+ onClick={() => {+ setShowCloudMigrationBanner(false);+ localStorage.setItem("cloudMigrationShown", "true");+ }}+ className="absolute top-2 right-2 p-1 rounded-sm text-muted-foreground hover:text-foreground hover:bg-black/5 dark:hover:bg-white/5 transition-colors"+ >+ <X size={14} />+ </button>+ <div className="flex items-start gap-3 pr-6">+ <div className="shrink-0 w-8 h-8 rounded-md bg-primary/10 dark:bg-primary/20 flex items-center justify-center">+ <Cloud size={16} className="text-primary" />+ </div>+ <div className="flex-1 min-w-0">+ <p className="text-[13px] font-medium text-foreground mb-0.5">+ Welcome to OpenWhispr Pro+ </p>+ <p className="text-[12px] text-muted-foreground mb-2">+ Your 7-day free trial is active! We've switched your transcription to OpenWhispr+ Cloud for faster, more accurate results. Your previous settings are saved —+ switch back anytime in Settings.+ </p>+ <Button+ variant="default"+ size="sm"+ className="h-7 text-[11px]"+ onClick={() => {+ setShowCloudMigrationBanner(false);+ localStorage.setItem("cloudMigrationShown", "true");+ setSettingsSection("transcription");+ setShowSettings(true);+ }}+ >+ View Settings+ </Button></div></div>- )}- {activeView === "home" && (- <HistoryView- history={history}- isLoading={isLoading}- hotkey={hotkey}- showCloudMigrationBanner={showCloudMigrationBanner}- setShowCloudMigrationBanner={setShowCloudMigrationBanner}- aiCTADismissed={aiCTADismissed}- setAiCTADismissed={setAiCTADismissed}- useReasoningModel={useReasoningModel}- clearHistory={clearHistory}- copyToClipboard={copyToClipboard}- deleteTranscription={deleteTranscription}- onOpenSettings={(section) => {- setSettingsSection(section as SettingsSectionType);- setShowSettings(true);+ </div>+ )}++ {!useReasoningModel && !aiCTADismissed && (+ <div className="mb-3 relative rounded-lg border border-primary/20 bg-primary/5 dark:bg-primary/10 p-3">+ <button+ onClick={() => {+ localStorage.setItem("aiCTADismissed", "true");+ setAiCTADismissed(true);}}- />- )}- {activeView === "personal-notes" && (- <Suspense fallback={null}>- <PersonalNotesView />- </Suspense>- )}- {activeView === "dictionary" && (- <Suspense fallback={null}>- <DictionaryView />- </Suspense>- )}- {activeView === "upload" && (- <Suspense fallback={null}>- <UploadAudioView onNoteCreated={() => setActiveView("personal-notes")} />- </Suspense>+ className="absolute top-2 right-2 p-1 rounded-sm text-muted-foreground hover:text-foreground hover:bg-black/5 dark:hover:bg-white/5 transition-colors"+ >+ <X size={14} />+ </button>+ <div className="flex items-start gap-3 pr-6">+ <div className="shrink-0 w-8 h-8 rounded-md bg-primary/10 dark:bg-primary/20 flex items-center justify-center">+ <Sparkles size={16} className="text-primary" />+ </div>+ <div className="flex-1 min-w-0">+ <p className="text-[13px] font-medium text-foreground mb-0.5">+ Enhance your transcriptions with AI+ </p>+ <p className="text-[12px] text-muted-foreground mb-2">+ Automatically fix grammar, punctuation, and formatting as you speak.+ </p>+ <Button+ variant="default"+ size="sm"+ className="h-7 text-[11px]"+ onClick={() => {+ setSettingsSection("aiModels");+ setShowSettings(true);+ }}+ >+ Enable AI Enhancement+ </Button>+ </div>+ </div>+ </div>+ )}++ <div className="rounded-lg border border-border bg-card/50 dark:bg-card/30 backdrop-blur-sm">+ {isLoading ? (+ <div className="flex items-center justify-center gap-2 py-8">+ <Loader2 size={14} className="animate-spin text-primary" />+ <span className="text-sm text-muted-foreground">Loading…</span>+ </div>+ ) : history.length === 0 ? (+ <div className="flex flex-col items-center justify-center py-12 px-4">+ <div className="w-10 h-10 rounded-md bg-muted/50 dark:bg-white/4 flex items-center justify-center mb-3">+ <Mic size={18} className="text-muted-foreground" />+ </div>+ <p className="text-sm text-muted-foreground mb-3">No transcriptions yet</p>+ <div className="flex items-center gap-2 text-[12px] text-muted-foreground">+ <span>Press</span>+ <kbd className="inline-flex items-center h-5 px-1.5 rounded-sm bg-surface-1 dark:bg-white/6 border border-border text-[11px] font-mono font-medium">+ {formatHotkeyLabel(hotkey)}+ </kbd>+ <span>to start</span>+ </div>+ </div>+ ) : (+ <div className="divide-y divide-border/50 max-h-[calc(100vh-180px)] overflow-y-auto">+ {history.map((item, index) => (+ <TranscriptionItem+ key={item.id}+ item={item}+ index={index}+ total={history.length}+ onCopy={copyToClipboard}+ onDelete={deleteTranscription}+ />+ ))}+ </div>)}</div>- </main>+ </div></div></div>);diff --git a/src/components/ControlPanelSidebar.tsx b/src/components/ControlPanelSidebar.tsxdeleted file mode 100644index b12749fbe..000000000--- a/src/components/ControlPanelSidebar.tsx+++ /dev/null@@ -1,230 +0,0 @@-import React, { useState } from "react";-import {- Home,- NotebookPen,- BookOpen,- Upload,- Settings,- HelpCircle,- UserCircle,- Power,- Gift,-} from "lucide-react";-import { cn } from "./lib/utils";-import SupportDropdown from "./ui/SupportDropdown";-import WindowControls from "./WindowControls";-import { ConfirmDialog } from "./ui/dialog";--export type ControlPanelView = "home" | "personal-notes" | "dictionary" | "upload";--interface ControlPanelSidebarProps {- activeView: ControlPanelView;- onViewChange: (view: ControlPanelView) => void;- onOpenSettings: () => void;- onOpenReferrals?: () => void;- userName?: string | null;- userEmail?: string | null;- userImage?: string | null;- isSignedIn?: boolean;- updateAction?: React.ReactNode;-}--const platform =- typeof window !== "undefined" && window.electronAPI?.getPlatform- ? window.electronAPI.getPlatform()- : "darwin";--const navItems: {- id: ControlPanelView;- label: string;- icon: React.ComponentType<{ size?: number; className?: string }>;-}[] = [- { id: "home", label: "Home", icon: Home },- { id: "personal-notes", label: "Notes", icon: NotebookPen },- { id: "upload", label: "Upload", icon: Upload },- { id: "dictionary", label: "Dictionary", icon: BookOpen },-];--export default function ControlPanelSidebar({- activeView,- onViewChange,- onOpenSettings,- onOpenReferrals,- userName,- userEmail,- userImage,- isSignedIn,- updateAction,-}: ControlPanelSidebarProps) {- const [showQuitConfirm, setShowQuitConfirm] = useState(false);-- const handleQuit = async () => {- try {- await window.electronAPI?.appQuit?.();- } catch {- // noop- }- };-- return (- <div className="w-48 shrink-0 border-r border-border/15 dark:border-white/5 flex flex-col bg-surface-1/60 dark:bg-surface-0/40">- <ConfirmDialog- open={showQuitConfirm}- onOpenChange={setShowQuitConfirm}- title="Quit OpenWhispr?"- description="This will close OpenWhispr and stop background processes."- confirmText="Quit"- cancelText="Cancel"- onConfirm={handleQuit}- variant="destructive"- />-- {platform === "darwin" ? (- <div- className="w-full h-10 shrink-0"- style={{ WebkitAppRegion: "drag" } as React.CSSProperties}- />- ) : (- <div- className="flex items-center justify-between px-2 h-10 shrink-0"- style={{ WebkitAppRegion: "drag" } as React.CSSProperties}- >- <div style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}>- <WindowControls />- </div>- </div>- )}-- <nav className="flex flex-col gap-0.5 px-2 pt-4 pb-2">- {navItems.map((item) => {- const Icon = item.icon;- const isActive = activeView === item.id;-- return (- <button- key={item.id}- onClick={() => onViewChange(item.id)}- className={cn(- "group relative flex items-center gap-2.5 w-full h-8 px-2.5 rounded-md outline-none transition-all duration-150 text-left",- isActive- ? "bg-primary/8 dark:bg-primary/10"- : "hover:bg-foreground/4 dark:hover:bg-white/4 active:bg-foreground/6"- )}- >- {isActive && (- <div className="absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-3.5 rounded-r-full bg-primary" />- )}- <Icon- size={15}- className={cn(- "shrink-0 transition-colors duration-150",- isActive ? "text-primary" : "text-foreground/25 group-hover:text-foreground/40"- )}- />- <span- className={cn(- "text-[12px] transition-colors duration-150",- isActive- ? "text-foreground font-medium"- : "text-foreground/50 group-hover:text-foreground/70"- )}- >- {item.label}- </span>- </button>- );- })}- </nav>-- <div className="flex-1" />-- <div className="px-2 pb-2 space-y-0.5">- {updateAction && (- <div className="px-1 pb-1" style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}>- {updateAction}- </div>- )}-- {isSignedIn && onOpenReferrals && (- <button- onClick={onOpenReferrals}- className="group flex items-center gap-2.5 w-full px-2.5 py-2 rounded-lg text-left transition-all duration-200 bg-success/[0.04] dark:bg-success/[0.06] border border-success/[0.08] dark:border-success/[0.10] hover:bg-success/[0.07] dark:hover:bg-success/[0.10] hover:border-success/[0.14] dark:hover:border-success/[0.16]"- >- <div className="flex items-center justify-center h-5 w-5 rounded bg-success/10 dark:bg-success/15 shrink-0">- <Gift size={11} className="text-success" />- </div>- <span className="text-[11px] text-success/70 dark:text-success/60 group-hover:text-success/90 dark:group-hover:text-success/80 font-medium transition-colors duration-150">- Get 1 month free- </span>- </button>- )}-- <button- onClick={onOpenSettings}- className="group flex items-center gap-2.5 w-full h-8 px-2.5 rounded-md text-left hover:bg-foreground/4 dark:hover:bg-white/4 transition-all duration-150"- >- <Settings- size={15}- className="shrink-0 text-foreground/20 group-hover:text-foreground/40 transition-colors duration-150"- />- <span className="text-[12px] text-foreground/40 group-hover:text-foreground/60 transition-colors duration-150">- Settings- </span>- </button>-- <SupportDropdown- trigger={- <button className="group flex items-center gap-2.5 w-full h-8 px-2.5 rounded-md text-left hover:bg-foreground/4 dark:hover:bg-white/4 transition-all duration-150">- <HelpCircle- size={15}- className="shrink-0 text-foreground/20 group-hover:text-foreground/40 transition-colors duration-150"- />- <span className="text-[12px] text-foreground/40 group-hover:text-foreground/60 transition-colors duration-150">- Support- </span>- </button>- }- />-- <button- onClick={() => setShowQuitConfirm(true)}- className="group flex items-center gap-2.5 w-full h-8 px-2.5 rounded-md text-left hover:bg-destructive/5 dark:hover:bg-destructive/8 transition-all duration-150"- >- <Power- size={15}- className="shrink-0 text-foreground/20 group-hover:text-destructive/60 transition-colors duration-150"- />- <span className="text-[12px] text-foreground/40 group-hover:text-destructive/60 transition-colors duration-150">- Quit- </span>- </button>-- <div className="mx-1 h-px bg-border/10 dark:bg-white/4 my-1.5!" />-- <div className="flex items-center gap-2.5 px-2.5 py-1.5 rounded-md">- {userImage ? (- <img src={userImage} alt="" className="w-6 h-6 rounded-full shrink-0 object-cover" />- ) : (- <UserCircle size={18} className="shrink-0 text-foreground/15" />- )}- <div className="flex-1 min-w-0">- {isSignedIn && (userName || userEmail) ? (- <>- <p className="text-[11px] text-foreground/60 truncate leading-tight">- {userName || "User"}- </p>- {userEmail && (- <p className="text-[9px] text-foreground/25 truncate leading-tight">- {userEmail}- </p>- )}- </>- ) : (- <p className="text-[11px] text-foreground/30">Not signed in</p>- )}- </div>- </div>- </div>- </div>- );-}diff --git a/src/components/DictionaryView.tsx b/src/components/DictionaryView.tsxdeleted file mode 100644index 3156fd2e3..000000000--- a/src/components/DictionaryView.tsx+++ /dev/null@@ -1,202 +0,0 @@-import { useState, useCallback } from "react";-import { BookOpen, X, CornerDownLeft, Info } from "lucide-react";-import { Input } from "./ui/input";-import { ConfirmDialog } from "./ui/dialog";-import { useSettings } from "../hooks/useSettings";--export default function DictionaryView() {- const { customDictionary, setCustomDictionary } = useSettings();- const [newWord, setNewWord] = useState("");- const [confirmClear, setConfirmClear] = useState(false);- const [showInfo, setShowInfo] = useState(false);-- const isEmpty = customDictionary.length === 0;-- const handleAdd = useCallback(() => {- const words = newWord- .split(",")- .map((w) => w.trim())- .filter((w) => w && !customDictionary.includes(w));- if (words.length > 0) {- setCustomDictionary([...customDictionary, ...words]);- setNewWord("");- }- }, [newWord, customDictionary, setCustomDictionary]);-- const handleRemove = useCallback(- (word: string) => {- setCustomDictionary(customDictionary.filter((w) => w !== word));- },- [customDictionary, setCustomDictionary]- );-- return (- <div className="flex flex-col h-full">- <ConfirmDialog- open={confirmClear}- onOpenChange={setConfirmClear}- title="Clear dictionary?"- description="This will remove all words from your custom dictionary. This action cannot be undone."- onConfirm={() => setCustomDictionary([])}- variant="destructive"- />-- {isEmpty ? (- /* ─── Empty state ─── */- <div className="flex-1 flex flex-col items-center justify-center px-8 -mt-4">- <div className="w-10 h-10 rounded-[10px] bg-gradient-to-b from-primary/8 to-primary/4 dark:from-primary/12 dark:to-primary/6 border border-primary/10 dark:border-primary/15 flex items-center justify-center mb-4">- <BookOpen- size={17}- strokeWidth={1.5}- className="text-primary/50 dark:text-primary/60"- />- </div>-- <h2 className="text-[13px] font-semibold text-foreground mb-1">Custom Dictionary</h2>- <p className="text-[11px] text-foreground/30 text-center leading-relaxed max-w-[240px] mb-6">- Teach the AI your vocabulary — names, jargon, and terms it might otherwise miss- </p>-- <div className="w-full max-w-[260px] relative">- <Input- placeholder="Add a word or phrase..."- value={newWord}- onChange={(e) => setNewWord(e.target.value)}- onKeyDown={(e) => {- if (e.key === "Enter") handleAdd();- }}- className="w-full h-8 text-[11px] pr-8 placeholder:text-foreground/20"- />- {newWord.trim() ? (- <button- onClick={handleAdd}- className="absolute right-2 top-1/2 -translate-y-1/2 text-primary/50 hover:text-primary transition-colors"- >- <CornerDownLeft size={11} />- </button>- ) : (- <kbd className="absolute right-2.5 top-1/2 -translate-y-1/2 text-[9px] text-foreground/12 font-mono select-none pointer-events-none">- ⏎- </kbd>- )}- </div>-- <div className="flex items-center gap-1.5 mt-3">- {["OpenWhispr", "Dr. Smith", "gRPC"].map((ex) => (- <span- key={ex}- className="text-[9px] text-foreground/12 px-1.5 py-0.5 rounded-[4px] border border-dashed border-foreground/6 dark:border-white/5"- >- {ex}- </span>- ))}- </div>-- <div className="mt-8 w-full max-w-[260px]">- <button- onClick={() => setShowInfo(!showInfo)}- className="flex items-center gap-1 text-[9px] text-foreground/15 hover:text-foreground/30 transition-colors mx-auto"- >- <Info size={9} />- How it works- </button>- {showInfo && (- <div className="mt-2.5 rounded-md bg-foreground/[0.02] dark:bg-white/[0.02] border border-foreground/5 dark:border-white/4 px-3 py-2.5">- <p className="text-[9px] text-foreground/25 leading-[1.6]">- Words are fed as context hints to the speech model, helping it recognize uncommon- terms. For difficult words, try adding context like{" "}- <span className="text-foreground/35">"The word is Synty"</span> alongside the word- itself.- </p>- </div>- )}- </div>- </div>- ) : (- /* ─── Populated state ─── */- <>- <div className="px-5 pt-4 pb-2.5 flex items-baseline justify-between">- <div className="flex items-baseline gap-2">- <h2 className="text-[13px] font-semibold text-foreground">Dictionary</h2>- <span className="text-[10px] text-foreground/15 font-mono tabular-nums">- {customDictionary.length}- </span>- </div>- <button- onClick={() => setConfirmClear(true)}- className="text-[9px] text-foreground/15 hover:text-destructive/70 transition-colors"- >- Clear all- </button>- </div>-- <div className="px-5 pb-3">- <div className="relative">- <Input- placeholder="Add word or phrase..."- value={newWord}- onChange={(e) => setNewWord(e.target.value)}- onKeyDown={(e) => {- if (e.key === "Enter") handleAdd();- }}- className="w-full h-7 text-[11px] pr-8 placeholder:text-foreground/20"- />- {newWord.trim() ? (- <button- onClick={handleAdd}- className="absolute right-2 top-1/2 -translate-y-1/2 text-primary/50 hover:text-primary transition-colors"- >- <CornerDownLeft size={10} />- </button>- ) : (- <kbd className="absolute right-2.5 top-1/2 -translate-y-1/2 text-[9px] text-foreground/12 font-mono select-none pointer-events-none">- ⏎- </kbd>- )}- </div>- </div>-- <div className="mx-5 h-px bg-border/8 dark:bg-white/3" />-- <div className="flex-1 overflow-y-auto px-5 py-3">- <div className="flex flex-wrap gap-1.5">- {customDictionary.map((word) => (- <span- key={word}- className="group inline-flex items-center gap-1 pl-2.5 pr-1 py-[3px]- bg-foreground/[0.02] dark:bg-white/[0.03]- text-foreground/60 dark:text-foreground/50- rounded-[5px] text-[11px]- border border-foreground/8 dark:border-white/6- transition-all duration-150- hover:border-foreground/15 dark:hover:border-white/12- hover:bg-foreground/[0.04] dark:hover:bg-white/[0.06]- hover:text-foreground/80 dark:hover:text-foreground/70"- >- {word}- <button- onClick={() => handleRemove(word)}- className="p-0.5 rounded-sm- opacity-0 group-hover:opacity-100- text-foreground/25 hover:!text-destructive/70- transition-all duration-150"- >- <X size={10} strokeWidth={2} />- </button>- </span>- ))}- </div>- </div>-- <div className="px-5 pb-3 flex items-start gap-1.5">- <Info size={9} className="text-foreground/10 mt-px shrink-0" />- <p className="text-[9px] text-foreground/12 leading-relaxed">- Separate multiple words with commas. Add context phrases like "The word is Synty" for- better recognition.- </p>- </div>- </>- )}- </div>- );-}diff --git a/src/components/HistoryView.tsx b/src/components/HistoryView.tsxdeleted file mode 100644index 1b859e16e..000000000--- a/src/components/HistoryView.tsx+++ /dev/null@@ -1,176 +0,0 @@-import { Button } from "./ui/button";-import { Trash2, FileText, Mic, Loader2, Sparkles, Cloud, X } from "lucide-react";-import TranscriptionItem from "./ui/TranscriptionItem";-import type { TranscriptionItem as TranscriptionItemType } from "../types/electron";-import { formatHotkeyLabel } from "../utils/hotkeys";--interface HistoryViewProps {- history: TranscriptionItemType[];- isLoading: boolean;- hotkey: string;- showCloudMigrationBanner: boolean;- setShowCloudMigrationBanner: (show: boolean) => void;- aiCTADismissed: boolean;- setAiCTADismissed: (dismissed: boolean) => void;- useReasoningModel: boolean;- clearHistory: () => void;- copyToClipboard: (text: string) => void;- deleteTranscription: (id: number) => void;- onOpenSettings: (section?: string) => void;-}--export default function HistoryView({- history,- isLoading,- hotkey,- showCloudMigrationBanner,- setShowCloudMigrationBanner,- aiCTADismissed,- setAiCTADismissed,- useReasoningModel,- clearHistory,- copyToClipboard,- deleteTranscription,- onOpenSettings,-}: HistoryViewProps) {- return (- <div className="p-4">- <div className="max-w-3xl mx-auto">- <div className="flex items-center justify-between mb-3 px-1">- <div className="flex items-center gap-2">- <FileText size={14} className="text-primary" />- <h2 className="text-sm font-semibold text-foreground">Transcriptions</h2>- {history.length > 0 && (- <span className="text-[11px] text-muted-foreground tabular-nums">- ({history.length})- </span>- )}- </div>- {history.length > 0 && (- <Button- onClick={clearHistory}- variant="ghost"- size="sm"- className="h-7 px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10"- >- <Trash2 size={12} className="mr-1" />- Clear- </Button>- )}- </div>-- {showCloudMigrationBanner && (- <div className="mb-3 relative rounded-lg border border-primary/20 bg-primary/5 dark:bg-primary/10 p-3">- <button- onClick={() => {- setShowCloudMigrationBanner(false);- localStorage.setItem("cloudMigrationShown", "true");- }}- className="absolute top-2 right-2 p-1 rounded-sm text-muted-foreground hover:text-foreground hover:bg-black/5 dark:hover:bg-white/5 transition-colors"- >- <X size={14} />- </button>- <div className="flex items-start gap-3 pr-6">- <div className="shrink-0 w-8 h-8 rounded-md bg-primary/10 dark:bg-primary/20 flex items-center justify-center">- <Cloud size={16} className="text-primary" />- </div>- <div className="flex-1 min-w-0">- <p className="text-[13px] font-medium text-foreground mb-0.5">- Welcome to OpenWhispr Pro- </p>- <p className="text-[12px] text-muted-foreground mb-2">- Your 7-day free trial is active! We've switched your transcription to OpenWhispr- Cloud for faster, more accurate results. Your previous settings are saved — switch- back anytime in Settings.- </p>- <Button- variant="default"- size="sm"- className="h-7 text-[11px]"- onClick={() => {- setShowCloudMigrationBanner(false);- localStorage.setItem("cloudMigrationShown", "true");- onOpenSettings("transcription");- }}- >- View Settings- </Button>- </div>- </div>- </div>- )}-- {!useReasoningModel && !aiCTADismissed && (- <div className="mb-3 relative rounded-lg border border-primary/20 bg-primary/5 dark:bg-primary/10 p-3">- <button- onClick={() => {- localStorage.setItem("aiCTADismissed", "true");- setAiCTADismissed(true);- }}- className="absolute top-2 right-2 p-1 rounded-sm text-muted-foreground hover:text-foreground hover:bg-black/5 dark:hover:bg-white/5 transition-colors"- >- <X size={14} />- </button>- <div className="flex items-start gap-3 pr-6">- <div className="shrink-0 w-8 h-8 rounded-md bg-primary/10 dark:bg-primary/20 flex items-center justify-center">- <Sparkles size={16} className="text-primary" />- </div>- <div className="flex-1 min-w-0">- <p className="text-[13px] font-medium text-foreground mb-0.5">- Enhance your transcriptions with AI- </p>- <p className="text-[12px] text-muted-foreground mb-2">- Automatically fix grammar, punctuation, and formatting as you speak.- </p>- <Button- variant="default"- size="sm"- className="h-7 text-[11px]"- onClick={() => onOpenSettings("aiModels")}- >- Enable AI Enhancement- </Button>- </div>- </div>- </div>- )}-- <div className="rounded-lg border border-border bg-card/50 dark:bg-card/30 backdrop-blur-sm">- {isLoading ? (- <div className="flex items-center justify-center gap-2 py-8">- <Loader2 size={14} className="animate-spin text-primary" />- <span className="text-sm text-muted-foreground">Loading…</span>- </div>- ) : history.length === 0 ? (- <div className="flex flex-col items-center justify-center py-12 px-4">- <div className="w-10 h-10 rounded-md bg-muted/50 dark:bg-white/4 flex items-center justify-center mb-3">- <Mic size={18} className="text-muted-foreground" />- </div>- <p className="text-sm text-muted-foreground mb-3">No transcriptions yet</p>- <div className="flex items-center gap-2 text-[12px] text-muted-foreground">- <span>Press</span>- <kbd className="inline-flex items-center h-5 px-1.5 rounded-sm bg-surface-1 dark:bg-white/6 border border-border text-[11px] font-mono font-medium">- {formatHotkeyLabel(hotkey)}- </kbd>- <span>to start</span>- </div>- </div>- ) : (- <div className="divide-y divide-border/50 max-h-[calc(100vh-180px)] overflow-y-auto">- {history.map((item, index) => (- <TranscriptionItem- key={item.id}- item={item}- index={index}- total={history.length}- onCopy={copyToClipboard}- onDelete={deleteTranscription}- />- ))}- </div>- )}- </div>- </div>- </div>- );-}diff --git a/src/components/ReferralDashboard.tsx b/src/components/ReferralDashboard.tsxdeleted file mode 100644index 3b2316f2b..000000000--- a/src/components/ReferralDashboard.tsx+++ /dev/null@@ -1,440 +0,0 @@-import React, { useEffect, useState, useCallback, useRef } from "react";-import { Send, Mail, ChevronRight } from "lucide-react";-import { Badge } from "./ui/badge";-import { useToast } from "./ui/Toast";-import { cn } from "./lib/utils";-import { SpectrogramCard } from "./referral-cards/SpectrogramCard";--interface ReferralStats {- referralCode: string;- referralLink: string;- totalReferrals: number;- completedReferrals: number;- totalMonthsEarned: number;-}--interface ReferralInvite {- id: string;- recipientEmail: string;- status: "sent" | "opened" | "converted" | "failed";- sentAt: string;- openedAt?: string;- convertedAt?: string;-}--const statusConfig: Record<- ReferralInvite["status"],- { label: string; variant: "success" | "info" | "destructive" | "outline" }-> = {- converted: { label: "Converted", variant: "success" },- opened: { label: "Opened", variant: "info" },- failed: { label: "Failed", variant: "destructive" },- sent: { label: "Sent", variant: "outline" },-};--function formatDate(dateStr: string) {- const date = new Date(dateStr);- return date.toLocaleDateString(undefined, {- month: "short",- day: "numeric",- ...(date.getFullYear() !== new Date().getFullYear() && { year: "numeric" }),- });-}--function AnimatedCounter({ value, delay = 0 }: { value: number; delay?: number }) {- const [display, setDisplay] = useState(0);- const rafRef = useRef<number>(0);-- useEffect(() => {- if (value === 0) {- setDisplay(0);- return;- }-- const prefersReduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;- if (prefersReduced) {- setDisplay(value);- return;- }-- const duration = 800;- let start: number | null = null;-- const timeout = setTimeout(() => {- const animate = (timestamp: number) => {- if (!start) start = timestamp;- const progress = Math.min((timestamp - start) / duration, 1);- const eased = 1 - Math.pow(1 - progress, 3);- setDisplay(Math.round(eased * value));- if (progress < 1) rafRef.current = requestAnimationFrame(animate);- };- rafRef.current = requestAnimationFrame(animate);- }, delay);-- return () => {- clearTimeout(timeout);- cancelAnimationFrame(rafRef.current);- };- }, [value, delay]);-- return <span className="tabular-nums">{display}</span>;-}--function TiltCard({ children, className }: { children: React.ReactNode; className?: string }) {- const cardRef = useRef<HTMLDivElement>(null);- const rafRef = useRef<number>(0);-- const handleMouseMove = useCallback((e: React.MouseEvent<HTMLDivElement>) => {- const card = cardRef.current;- if (!card) return;- if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;-- cancelAnimationFrame(rafRef.current);- rafRef.current = requestAnimationFrame(() => {- const rect = card.getBoundingClientRect();- const centerX = rect.left + rect.width / 2;- const centerY = rect.top + rect.height / 2;- const nx = (e.clientX - centerX) / (rect.width / 2);- const ny = (e.clientY - centerY) / (rect.height / 2);- const tiltX = -ny * 4;- const tiltY = nx * 4;- const hx = ((e.clientX - rect.left) / rect.width) * 100;- const hy = ((e.clientY - rect.top) / rect.height) * 100;-- card.style.setProperty("--tilt-x", `${tiltX}deg`);- card.style.setProperty("--tilt-y", `${tiltY}deg`);- card.style.setProperty("--highlight-x", `${hx}%`);- card.style.setProperty("--highlight-y", `${hy}%`);- card.style.setProperty("--highlight-opacity", "1");- });- }, []);-- const handleMouseLeave = useCallback(() => {- const card = cardRef.current;- if (!card) return;- card.style.setProperty("--tilt-x", "0deg");- card.style.setProperty("--tilt-y", "0deg");- card.style.setProperty("--highlight-opacity", "0");- }, []);-- return (- <div- ref={cardRef}- onMouseMove={handleMouseMove}- onMouseLeave={handleMouseLeave}- className={cn("tilt-card", className)}- >- {children}- </div>- );-}--function StatGauge({- value,- label,- delay = 0,- highlight = false,-}: {- value: number;- label: string;- delay?: number;- highlight?: boolean;-}) {- const [mounted, setMounted] = useState(false);-- useEffect(() => {- const timer = setTimeout(() => setMounted(true), delay + 400);- return () => clearTimeout(timer);- }, [delay]);-- return (- <div- className={cn(- "stat-gauge rounded-md px-3 py-2.5",- "bg-foreground/3 border border-foreground/6",- "backdrop-blur-sm"- )}- data-active={mounted && value > 0 ? "true" : "false"}- >- <div- className={cn(- "text-[18px] font-bold tabular-nums leading-none",- highlight ? "text-success" : "text-foreground"- )}- >- <AnimatedCounter value={value} delay={delay} />- </div>- <div className="text-[10px] text-foreground/30 mt-1 leading-tight">{label}</div>- </div>- );-}--export function ReferralDashboard() {- const [stats, setStats] = useState<ReferralStats | null>(null);- const [invites, setInvites] = useState<ReferralInvite[]>([]);- const [copied, setCopied] = useState(false);- const [loading, setLoading] = useState(true);- const [error, setError] = useState<string | null>(null);- const [emailInput, setEmailInput] = useState("");- const [sendingInvite, setSendingInvite] = useState(false);- const [showInvites, setShowInvites] = useState(false);- const { toast } = useToast();-- const fetchStats = useCallback(async () => {- try {- setLoading(true);- setError(null);- const data = await window.electronAPI?.getReferralStats?.();- setStats(data ?? null);- } catch (err) {- console.error("Failed to fetch referral stats:", err);- setError("Unable to load referral stats. Please try again later.");- } finally {- setLoading(false);- }- }, []);-- const fetchInvites = useCallback(async () => {- try {- const result = await window.electronAPI?.getReferralInvites?.();- setInvites(result?.invites ?? []);- } catch (err) {- console.error("Failed to fetch referral invites:", err);- }- }, []);-- useEffect(() => {- fetchStats();- fetchInvites();- }, [fetchStats, fetchInvites]);-- const copyLink = async () => {- if (!stats) return;- try {- await navigator.clipboard.writeText(stats.referralLink);- setCopied(true);- toast({- title: "Copied!",- description: "Referral link copied to clipboard",- variant: "success",- duration: 2000,- });- setTimeout(() => setCopied(false), 2000);- } catch (err) {- console.error("Failed to copy link:", err);- toast({- title: "Copy Failed",- description: "Failed to copy link to clipboard",- variant: "destructive",- });- }- };-- const sendInvite = async () => {- if (!emailInput.trim()) return;-- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;- if (!emailRegex.test(emailInput.trim())) {- toast({- title: "Invalid Email",- description: "Please enter a valid email address",- variant: "destructive",- });- return;- }-- try {- setSendingInvite(true);- const result = await window.electronAPI?.sendReferralInvite?.(emailInput.trim());-- if (result?.success) {- toast({- title: "Invite Sent!",- description: `Invitation sent to ${emailInput}`,- variant: "success",- });- setEmailInput("");- fetchInvites();- } else {- throw new Error("Failed to send invite");- }- } catch (err) {- console.error("Failed to send invite:", err);- toast({- title: "Send Failed",- description: "Failed to send invitation. Please try again.",- variant: "destructive",- });- } finally {- setSendingInvite(false);- }- };-- const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {- if (e.key === "Enter" && !sendingInvite) {- sendInvite();- }- };-- if (loading) {- return (- <div className="bg-card px-7 pt-9 pb-6">- <div className="h-5 w-36 rounded bg-foreground/4 animate-pulse" />- <div className="h-3 w-44 rounded bg-foreground/3 animate-pulse mt-2" />- <div className="h-16 rounded-lg bg-foreground/3 animate-pulse mt-5" />- <div className="grid grid-cols-3 gap-2.5 mt-5">- <div className="h-14 rounded-md bg-foreground/3 animate-pulse" />- <div className="h-14 rounded-md bg-foreground/3 animate-pulse" />- <div className="h-14 rounded-md bg-foreground/3 animate-pulse" />- </div>- <div className="h-px bg-foreground/4 mt-5" />- <div className="h-3 w-20 rounded bg-foreground/3 animate-pulse mt-5" />- <div className="h-8 rounded-md bg-foreground/3 animate-pulse mt-2" />- </div>- );- }-- if (error || !stats) {- return (- <div className="flex flex-col items-center justify-center h-85 bg-card text-center px-6">- <p className="text-[13px] text-foreground/40 mb-3">- {error || "Unable to load referral data"}- </p>- <button- onClick={fetchStats}- className="px-3.5 py-1.5 rounded-md text-[12px] font-medium bg-foreground/7 text-foreground/55 border border-foreground/5 hover:bg-foreground/12 hover:text-foreground/90 transition-all duration-200"- >- Try Again- </button>- </div>- );- }-- return (- <div className="relative bg-card">- {/* Animated mesh gradient background */}- <div className="referral-mesh-bg">- <div- className="absolute w-50 h-50 rounded-full blur-[80px] opacity-3"- style={{- background: "oklch(0.55 0.2 320)",- top: "40%",- left: "15%",- animation: "mesh-drift 25s ease-in-out infinite alternate",- animationDelay: "-8s",- }}- />- </div>-- <div className="relative z-10 px-7 pt-9 pb-6">- <h2 className="text-[20px] font-bold tracking-tight leading-tight text-foreground">- Share OpenWhispr- </h2>- <p className="text-[12px] text-foreground/30 mt-1">Give a month. Get a month.</p>-- {/* Share card */}- <div className="mt-5">- <TiltCard>- <SpectrogramCard referralCode={stats.referralCode} copied={copied} onCopy={copyLink} />- </TiltCard>- </div>-- {/* Stat Gauges */}- <div className="mt-5 grid grid-cols-3 gap-2.5">- <StatGauge value={stats.totalReferrals} label="Referred" delay={0} />- <StatGauge value={stats.completedReferrals} label="Converted" delay={150} />- <StatGauge- value={stats.totalMonthsEarned}- label="Months earned"- delay={300}- highlight={stats.totalMonthsEarned > 0}- />- </div>-- <div className="mt-5 h-px bg-linear-to-r from-transparent via-foreground/6 to-transparent" />-- {/* Email Invite */}- <div className="mt-5 space-y-2">- <h4 className="text-[10px] font-medium text-foreground/25 uppercase tracking-wider">- Invite by email- </h4>- <div className="flex items-center gap-2">- <input- type="email"- placeholder="[email protected]"- value={emailInput}- onChange={(e) => setEmailInput(e.target.value)}- onKeyDown={handleKeyDown}- disabled={sendingInvite}- className="flex-1 h-8 px-3 text-[12px] rounded-md bg-foreground/4 border border-foreground/7 text-foreground/70 placeholder:text-foreground/20 focus:outline-none focus:border-foreground/15 focus:ring-1 focus:ring-foreground/10 disabled:opacity-50"- />- <button- onClick={sendInvite}- disabled={sendingInvite || !emailInput.trim()}- className="shrink-0 h-8 px-3.5 rounded-md text-[11px] font-medium flex items-center gap-1.5 transition-all duration-200 bg-foreground/7 text-foreground/55 border border-foreground/5 hover:bg-foreground/12 hover:text-foreground/90 active:scale-[0.97] disabled:opacity-40 disabled:pointer-events-none"- >- {sendingInvite ? (- <div className="w-3 h-3 border-1.5 border-current border-r-transparent rounded-full animate-spin" />- ) : (- <Send className="w-3 h-3" />- )}- {sendingInvite ? "Sending" : "Send"}- </button>- </div>- </div>-- {/* Past invites */}- {invites.length > 0 && (- <div className="mt-4">- <button- onClick={() => setShowInvites(!showInvites)}- className="flex items-center gap-1.5 py-1 text-[11px] text-foreground/25 hover:text-foreground/50 transition-colors"- >- <ChevronRight- className={cn(- "w-3 h-3 transition-transform duration-200",- showInvites && "rotate-90"- )}- />- <span>Past invites</span>- <span className="text-foreground/15" aria-hidden>- ·- </span>- <span className="text-foreground/15">{invites.length}</span>- </button>- <div className="invites-expand" data-open={showInvites}>- <div>- <div className="space-y-1 pt-1.5">- {invites.map((invite) => {- const { label, variant } = statusConfig[invite.status] ?? statusConfig.sent;- return (- <div- key={invite.id}- className="flex items-center justify-between py-1.5 px-2.5 rounded-md bg-foreground/3 border border-foreground/5 hover:border-foreground/8 transition-colors"- >- <div className="flex items-center gap-2 min-w-0 flex-1">- <Mail className="w-3 h-3 text-foreground/20 shrink-0" />- <span className="text-[11px] text-foreground/60 truncate">- {invite.recipientEmail}- </span>- <span className="text-[10px] text-foreground/15 shrink-0">- {formatDate(invite.sentAt)}- </span>- </div>- <Badge variant={variant} className="ml-2 text-[9px] shrink-0">- {label}- </Badge>- </div>- );- })}- </div>- </div>- </div>- </div>- )}-- <p className="text-[9px] text-foreground/12 text-center mt-5">No cap on referrals</p>- </div>- </div>- );-}diff --git a/src/components/ReferralModal.tsx b/src/components/ReferralModal.tsxdeleted file mode 100644index 16ee87fd7..000000000--- a/src/components/ReferralModal.tsx+++ /dev/null@@ -1,49 +0,0 @@-import React from "react";-import * as DialogPrimitive from "@radix-ui/react-dialog";-import { X } from "lucide-react";-import { cn } from "./lib/utils";-import { ReferralDashboard } from "./ReferralDashboard";--interface ReferralModalProps {- open: boolean;- onOpenChange: (open: boolean) => void;-}--export default function ReferralModal({ open, onOpenChange }: ReferralModalProps) {- return (- <DialogPrimitive.Root open={open} onOpenChange={onOpenChange}>- <DialogPrimitive.Portal>- <DialogPrimitive.Overlay- className={cn(- "fixed inset-0 z-50 bg-black/60 backdrop-blur-lg",- "data-[state=open]:animate-in data-[state=closed]:animate-out",- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"- )}- />- <DialogPrimitive.Content- className={cn(- "fixed left-[50%] top-[50%] z-50 w-full max-w-[500px]",- "translate-x-[-50%] translate-y-[-50%]",- "rounded-xl border overflow-hidden shadow-2xl duration-200",- "bg-card border-border",- "shadow-[0_24px_48px_-12px_oklch(0_0_0/0.12)] dark:shadow-[0_24px_48px_-12px_oklch(0_0_0/0.5)]",- "data-[state=open]:animate-in data-[state=closed]:animate-out",- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",- "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",- "data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]",- "data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]"- )}- >- <DialogPrimitive.Title className="sr-only">Refer and earn rewards</DialogPrimitive.Title>-- <DialogPrimitive.Close className="absolute right-3 top-3 z-20 rounded-full p-1.5 opacity-40 transition-all hover:opacity-80 hover:bg-foreground/10 focus:outline-none focus:ring-2 focus:ring-foreground/20 focus:ring-offset-0">- <X className="h-4 w-4 text-foreground" />- <span className="sr-only">Close</span>- </DialogPrimitive.Close>-- <ReferralDashboard />- </DialogPrimitive.Content>- </DialogPrimitive.Portal>- </DialogPrimitive.Root>- );-}diff --git a/src/components/SettingsModal.tsx b/src/components/SettingsModal.tsxindex 042a3d267..147a31a91 100644--- a/src/components/SettingsModal.tsx+++ b/src/components/SettingsModal.tsx@@ -7,6 +7,7 @@ import {Sparkles,UserCircle,Wrench,+ BookOpen,ShieldCheck,Lock,} from "lucide-react";@@ -44,6 +45,13 @@ export default function SettingsModal({ open, onOpenChange, initialSection }: Sedescription: "Speech-to-text engine",group: "Speech",},+ {+ id: "dictionary",+ label: "Dictionary",+ icon: BookOpen,+ description: "Custom words & phrases",+ group: "Speech",+ },{id: "aiModels",label: "AI Models",diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex 2630f3fdf..cee526b40 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -16,7 +16,6 @@ import {Monitor,Cloud,Key,- ChevronDown,Sparkles,AlertTriangle,Loader2,@@ -41,6 +40,7 @@ import { useUpdater } from "../hooks/useUpdater";import PromptStudio from "./ui/PromptStudio";import ReasoningModelSelector from "./ReasoningModelSelector";+import { HotkeyInput } from "./ui/HotkeyInput";import HotkeyGuidanceAccordion from "./ui/HotkeyGuidanceAccordion";import { useHotkeyRegistration } from "../hooks/useHotkeyRegistration";@@ -64,6 +64,7 @@ export type SettingsSectionType =| "account"| "general"| "transcription"+ | "dictionary"| "aiModels"| "agentConfig"| "prompts"@@ -599,6 +600,7 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPagecloudTranscriptionModel,cloudTranscriptionBaseUrl,cloudReasoningBaseUrl,+ customDictionary,useReasoningModel,reasoningModel,reasoningProvider,@@ -622,6 +624,7 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPagesetCloudTranscriptionModel,setCloudTranscriptionBaseUrl,setCloudReasoningBaseUrl,+ setCustomDictionary,setUseReasoningModel,setReasoningModel,setReasoningProvider,@@ -721,6 +724,24 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPagereturn "linux";}, []);+ const [newDictionaryWord, setNewDictionaryWord] = useState("");++ const handleAddDictionaryWord = useCallback(() => {+ const word = newDictionaryWord.trim();+ if (word && !customDictionary.includes(word)) {+ setCustomDictionary([...customDictionary, word]);+ setNewDictionaryWord("");+ }+ }, [newDictionaryWord, customDictionary, setCustomDictionary]);++ const handleRemoveDictionaryWord = useCallback(+ (wordToRemove: string) => {+ if (wordToRemove === agentName) return;+ setCustomDictionary(customDictionary.filter((word) => word !== wordToRemove));+ },+ [customDictionary, setCustomDictionary, agentName]+ );+const [autoStartEnabled, setAutoStartEnabled] = useState(false);const [autoStartLoading, setAutoStartLoading] = useState(true);@@ -1567,6 +1588,152 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage/>);+ case "dictionary":+ return (+ <div className="space-y-5">+ <SectionHeader+ title="Custom Dictionary"+ description="Add words, names, or technical terms to improve transcription accuracy"+ />++ {/* Add Words */}+ <SettingsPanel>+ <SettingsPanelRow>+ <div className="space-y-2">+ <p className="text-[12px] font-medium text-foreground">Add a word or phrase</p>+ <div className="flex gap-2">+ <Input+ placeholder="e.g. OpenWhispr, Kubernetes, Dr. Martinez..."+ value={newDictionaryWord}+ onChange={(e) => setNewDictionaryWord(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === "Enter") {+ handleAddDictionaryWord();+ }+ }}+ className="flex-1 h-8 text-[12px]"+ />+ <Button+ onClick={handleAddDictionaryWord}+ disabled={!newDictionaryWord.trim()}+ size="sm"+ className="h-8"+ >+ Add+ </Button>+ </div>+ <p className="text-[10px] text-muted-foreground/50">Press Enter to add</p>+ </div>+ </SettingsPanelRow>+ </SettingsPanel>++ {/* Word List */}+ <div>+ <div className="flex items-center justify-between mb-2">+ <p className="text-[12px] font-medium text-foreground">+ Your words+ {customDictionary.length > 0 && (+ <span className="ml-1.5 text-muted-foreground/50 font-normal text-[11px]">+ {customDictionary.length}+ </span>+ )}+ </p>+ {customDictionary.length > 0 && (+ <button+ onClick={() => {+ showConfirmDialog({+ title: "Clear dictionary?",+ description:+ "This will remove all words from your custom dictionary. This action cannot be undone.",+ confirmText: "Clear All",+ variant: "destructive",+ onConfirm: () =>+ setCustomDictionary(customDictionary.filter((w) => w === agentName)),+ });+ }}+ className="text-[10px] text-muted-foreground/40 hover:text-destructive transition-colors"+ >+ Clear all+ </button>+ )}+ </div>++ {customDictionary.length > 0 ? (+ <SettingsPanel>+ <SettingsPanelRow>+ <div className="flex flex-wrap gap-1">+ {customDictionary.map((word) => {+ const isAgentName = word === agentName;+ return (+ <span+ key={word}+ className={`group inline-flex items-center gap-0.5 py-0.5 rounded-[5px] text-[11px] border transition-all ${+ isAgentName+ ? "pl-2 pr-2 bg-primary/10 dark:bg-primary/15 text-primary border-primary/20 dark:border-primary/30"+ : "pl-2 pr-1 bg-primary/5 dark:bg-primary/10 text-foreground border-border/30 dark:border-border-subtle hover:border-destructive/40 hover:bg-destructive/5"+ }`}+ title={isAgentName ? "Agent name (auto-managed)" : undefined}+ >+ {word}+ {!isAgentName && (+ <button+ onClick={() => handleRemoveDictionaryWord(word)}+ className="ml-0.5 p-0.5 rounded-sm text-muted-foreground/40 hover:text-destructive transition-colors"+ title="Remove word"+ >+ <svg+ width="9"+ height="9"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth="2.5"+ strokeLinecap="round"+ >+ <path d="M18 6L6 18M6 6l12 12" />+ </svg>+ </button>+ )}+ </span>+ );+ })}+ </div>+ </SettingsPanelRow>+ </SettingsPanel>+ ) : (+ <div className="rounded-lg border border-dashed border-border/40 dark:border-border-subtle py-6 flex flex-col items-center justify-center text-center">+ <p className="text-[11px] text-muted-foreground/50">No words added yet</p>+ <p className="text-[10px] text-muted-foreground/40 mt-0.5">+ Words you add will appear here+ </p>+ </div>+ )}+ </div>++ {/* How it works */}+ <div>+ <SectionHeader title="How it works" />+ <SettingsPanel>+ <SettingsPanelRow>+ <p className="text-[12px] text-muted-foreground leading-relaxed">+ Words in your dictionary are provided as context hints to the speech recognition+ model. This helps it correctly identify uncommon names, technical jargon, brand+ names, or anything that's frequently misrecognized.+ </p>+ </SettingsPanelRow>+ <SettingsPanelRow>+ <p className="text-[12px] text-muted-foreground leading-relaxed">+ <span className="font-medium text-foreground">Tip</span> — For difficult words,+ add context phrases like "The word is Synty" alongside the word itself. Adding+ related terms (e.g. "Synty" and "SyntyStudios") also helps the model understand+ the intended spelling.+ </p>+ </SettingsPanelRow>+ </SettingsPanel>+ </div>+ </div>+ );+case "aiModels":return (<AiModelsSection@@ -1829,9 +1996,6 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage</div>);- // ───────────────────────────────────────────────────- // DEVELOPER (+ data management moved here)- // ───────────────────────────────────────────────────case "developer":return (<div className="space-y-6">diff --git a/src/components/UsageDisplay.tsx b/src/components/UsageDisplay.tsxdeleted file mode 100644index a79a13186..000000000--- a/src/components/UsageDisplay.tsx+++ /dev/null@@ -1,137 +0,0 @@-import { useEffect, useRef } from "react";-import { useUsage } from "../hooks/useUsage";-import { useToast } from "./ui/Toast";-import { Badge } from "./ui/badge";-import { Progress } from "./ui/progress";-import { Button } from "./ui/button";--export default function UsageDisplay() {- const usage = useUsage();- const { toast } = useToast();- const hasShownApproachingToast = useRef(false);-- // One-time toast when approaching limit (>80%)- useEffect(() => {- if (usage?.isApproachingLimit && !hasShownApproachingToast.current) {- hasShownApproachingToast.current = true;- toast({- title: "Approaching Weekly Limit",- description: `You've used ${usage.wordsUsed.toLocaleString()} of ${usage.limit.toLocaleString()} free words this week.`,- duration: 6000,- });- }- }, [usage?.isApproachingLimit, usage?.wordsUsed, usage?.limit, toast]);-- if (!usage) return null;-- // Pro plan or trial — minimal display- if (usage.isSubscribed) {- return (- <div className="bg-white border border-neutral-200 rounded-xl p-4 space-y-3">- <div className="flex items-center justify-between">- <span className="text-sm font-medium text-neutral-700">Your Plan</span>- {usage.isTrial ? (- <Badge variant="outline" className="text-indigo-600 border-indigo-300">- Trial ({usage.trialDaysLeft} {usage.trialDaysLeft === 1 ? "day" : "days"} left)- </Badge>- ) : (- <Badge variant="success">Pro</Badge>- )}- </div>- <p className="text-sm text-neutral-600">- {usage.isTrial- ? "Unlimited transcriptions during your trial"- : "Unlimited transcriptions"}- </p>- {!usage.isTrial && (- <Button variant="outline" size="sm" onClick={() => usage.openBillingPortal()}>- Manage Subscription- </Button>- )}- </div>- );- }-- // Free plan- const percentage = usage.limit > 0 ? Math.min(100, (usage.wordsUsed / usage.limit) * 100) : 0;- const progressColor =- percentage >= 100- ? "[&>div]:bg-red-500"- : percentage >= 80- ? "[&>div]:bg-amber-500"- : "[&>div]:bg-indigo-600";-- return (- <div className="bg-white border border-neutral-200 rounded-xl p-4 space-y-3">- <div className="flex items-center justify-between">- <span className="text-sm font-medium text-neutral-700">Weekly Usage</span>- {usage.isOverLimit ? (- <Badge variant="warning">Limit reached</Badge>- ) : (- <Badge variant="outline">Free</Badge>- )}- </div>-- <div className="space-y-1.5">- <Progress- value={percentage}- className={`h-2 transition-colors duration-500 ${progressColor}`}- />- <div className="flex items-center justify-between">- <span className="text-sm tabular-nums text-neutral-600">- {usage.wordsUsed.toLocaleString()} / {usage.limit.toLocaleString()}- </span>- {usage.isApproachingLimit && (- <span className="text-xs text-amber-600">- {usage.wordsRemaining.toLocaleString()} words remaining- </span>- )}- {!usage.isApproachingLimit && !usage.isOverLimit && (- <span className="text-xs text-neutral-400">Rolling weekly limit</span>- )}- </div>- </div>-- {usage.isOverLimit ? (- <div className="flex gap-2">- <Button- size="sm"- className="bg-indigo-600 hover:bg-indigo-700"- onClick={() => usage.openCheckout()}- >- Upgrade to Pro- </Button>- <Button- variant="outline"- size="sm"- onClick={() => {- localStorage.setItem("cloudTranscriptionMode", "byok");- window.location.reload();- }}- >- Use Your Own Key- </Button>- </div>- ) : usage.isApproachingLimit ? (- <Button- size="sm"- className="bg-indigo-600 hover:bg-indigo-700"- onClick={() => usage.openCheckout()}- >- Upgrade to Pro- </Button>- ) : (- <a- href="#"- className="text-indigo-600 hover:text-indigo-700 text-sm inline-block"- onClick={(e) => {- e.preventDefault();- usage.openCheckout();- }}- >- Upgrade to Pro — unlimited transcriptions- </a>- )}- </div>- );-}diff --git a/src/components/notes/MeetingNotesPlaceholder.tsx b/src/components/notes/MeetingNotesPlaceholder.tsxdeleted file mode 100644index 1547a39ff..000000000--- a/src/components/notes/MeetingNotesPlaceholder.tsx+++ /dev/null@@ -1,16 +0,0 @@-import { Users } from "lucide-react";--export default function MeetingNotesPlaceholder() {- return (- <div className="flex flex-col items-center justify-center h-full">- <Users size={18} className="text-foreground/8 mb-2.5" />- <p className="text-[11px] text-foreground/25 mb-1">Meeting Notes</p>- <p className="text-[9px] text-foreground/12 text-center max-w-48">- Speaker identification & structured summaries- </p>- <span className="mt-2.5 text-[8px] font-medium uppercase tracking-wider text-foreground/15 bg-foreground/3 px-2 py-0.5 rounded-sm">- Coming Soon- </span>- </div>- );-}diff --git a/src/components/notes/NoteEditor.tsx b/src/components/notes/NoteEditor.tsxdeleted file mode 100644index 93b304a69..000000000--- a/src/components/notes/NoteEditor.tsx+++ /dev/null@@ -1,345 +0,0 @@-import { useState, useRef, useEffect, useMemo, useCallback } from "react";-import { Mic, Eye, Pencil, Loader2, Sparkles, Download, FileText } from "lucide-react";-import { MarkdownRenderer } from "../ui/MarkdownRenderer";-import {- DropdownMenu,- DropdownMenuTrigger,- DropdownMenuContent,- DropdownMenuItem,-} from "../ui/dropdown-menu";-import { cn } from "../lib/utils";-import type { NoteItem } from "../../types/electron";--interface NoteEditorProps {- note: NoteItem;- onTitleChange: (title: string) => void;- onContentChange: (content: string) => void;- isSaving: boolean;- isRecording: boolean;- partialTranscript: string;- finalTranscript: string | null;- onFinalTranscriptConsumed: () => void;- onStartRecording: () => void;- onStopRecording: () => void;- onOpenEnhance?: () => void;- onExportNote?: (format: "md" | "txt") => void;- hasEnhancedContent?: boolean;- enhancedContent?: string | null;- isEnhancementStale?: boolean;-}--export default function NoteEditor({- note,- onTitleChange,- onContentChange,- isSaving,- isRecording,- partialTranscript,- finalTranscript,- onFinalTranscriptConsumed,- onStartRecording,- onStopRecording,- onOpenEnhance,- onExportNote,- hasEnhancedContent,- enhancedContent,- isEnhancementStale,-}: NoteEditorProps) {- const [isPreview, setIsPreview] = useState(false);- const [viewMode, setViewMode] = useState<"raw" | "enhanced">("raw");- const textareaRef = useRef<HTMLTextAreaElement>(null);- const titleRef = useRef<HTMLDivElement>(null);- const prevNoteIdRef = useRef<number>(note.id);-- const cursorPosRef = useRef(0);- const dictationRef = useRef<{ start: number; end: number } | null>(null);- const isDictationUpdateRef = useRef(false);- const prevRecordingRef = useRef(false);-- useEffect(() => {- if (note.id !== prevNoteIdRef.current) {- prevNoteIdRef.current = note.id;- setIsPreview(false);- setViewMode("raw");- if (titleRef.current && titleRef.current.textContent !== note.title) {- titleRef.current.textContent = note.title || "";- }- textareaRef.current?.focus();- }- }, [note.id]);-- useEffect(() => {- if (titleRef.current && titleRef.current.textContent !== note.title) {- titleRef.current.textContent = note.title || "";- }- }, [note.title]);-- const handleTitleInput = useCallback(() => {- if (titleRef.current) {- const text = titleRef.current.textContent || "";- onTitleChange(text);- }- }, [onTitleChange]);-- const handleTitleKeyDown = useCallback((e: React.KeyboardEvent) => {- if (e.key === "Enter") {- e.preventDefault();- textareaRef.current?.focus();- }- }, []);-- const handleTitlePaste = useCallback((e: React.ClipboardEvent) => {- e.preventDefault();- const text = e.clipboardData.getData("text/plain").replace(/\n/g, " ");- document.execCommand("insertText", false, text);- }, []);-- useEffect(() => {- if (isRecording && !prevRecordingRef.current) {- dictationRef.current = { start: cursorPosRef.current, end: cursorPosRef.current };- if (viewMode === "enhanced") setViewMode("raw");- }- if (!isRecording && prevRecordingRef.current) {- dictationRef.current = null;- }- prevRecordingRef.current = isRecording;- }, [isRecording]);-- useEffect(() => {- if (!partialTranscript || !dictationRef.current) return;-- const { start, end } = dictationRef.current;- const before = note.content.slice(0, start);- const after = note.content.slice(end);- const newContent = before + partialTranscript + after;-- dictationRef.current = { start, end: start + partialTranscript.length };- isDictationUpdateRef.current = true;- onContentChange(newContent);-- requestAnimationFrame(() => {- if (textareaRef.current) {- const pos = start + partialTranscript.length;- textareaRef.current.setSelectionRange(pos, pos);- cursorPosRef.current = pos;- }- });- }, [partialTranscript]); // note.content intentionally excluded-- useEffect(() => {- if (finalTranscript == null) return;-- const range = dictationRef.current;- if (!range) {- const pos = cursorPosRef.current;- const before = note.content.slice(0, pos);- const after = note.content.slice(pos);- const separator = before && !before.endsWith("\n") ? "\n" : "";- const newContent = before + separator + finalTranscript + after;- isDictationUpdateRef.current = true;- onContentChange(newContent);- onFinalTranscriptConsumed();- return;- }-- const { start, end } = range;- const before = note.content.slice(0, start);- const after = note.content.slice(end);- const newContent = before + finalTranscript + after;-- const newEnd = start + finalTranscript.length;- dictationRef.current = { start: newEnd, end: newEnd };-- isDictationUpdateRef.current = true;- onContentChange(newContent);- onFinalTranscriptConsumed();-- requestAnimationFrame(() => {- if (textareaRef.current) {- textareaRef.current.setSelectionRange(newEnd, newEnd);- cursorPosRef.current = newEnd;- }- });- }, [finalTranscript]); // note.content intentionally excluded-- const handleSelect = () => {- if (textareaRef.current) {- cursorPosRef.current = textareaRef.current.selectionStart;- }- };-- const handleContentChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {- const newValue = e.target.value;-- if (isDictationUpdateRef.current) {- isDictationUpdateRef.current = false;- return;- }-- if (dictationRef.current) {- const delta = newValue.length - note.content.length;- const editPos = e.target.selectionStart - delta;- if (editPos <= dictationRef.current.start) {- dictationRef.current.start += delta;- dictationRef.current.end += delta;- }- }-- onContentChange(newValue);- cursorPosRef.current = e.target.selectionStart;- };-- const wordCount = useMemo(() => {- const trimmed = note.content.trim();- return trimmed ? trimmed.split(/\s+/).length : 0;- }, [note.content]);-- return (- <div className="flex flex-col h-full">- <div className="px-5 pt-4 pb-0">- <div- ref={titleRef}- contentEditable- suppressContentEditableWarning- onInput={handleTitleInput}- onKeyDown={handleTitleKeyDown}- onPaste={handleTitlePaste}- data-placeholder="Untitled"- className="w-full text-base font-semibold text-foreground bg-transparent outline-none tracking-[-0.01em] empty:before:content-[attr(data-placeholder)] empty:before:text-foreground/15 empty:before:pointer-events-none"- role="textbox"- aria-label="Note title"- />- </div>-- <div className="flex items-center gap-px px-5 py-1.5">- <button- onClick={isRecording ? onStopRecording : onStartRecording}- className={cn(- "flex items-center gap-1.5 h-6 px-2 rounded-md text-[10px] font-medium transition-all duration-200",- isRecording- ? "bg-destructive/10 text-destructive hover:bg-destructive/15"- : "text-muted-foreground/40 hover:text-foreground/60 hover:bg-foreground/4"- )}- >- {isRecording ? (- <>- <span className="relative flex h-2 w-2">- <span className="absolute inline-flex h-full w-full rounded-full bg-destructive/60 animate-ping" />- <span className="relative inline-flex h-2 w-2 rounded-full bg-destructive" />- </span>- Stop- </>- ) : (- <>- <Mic size={11} />- Dictate- </>- )}- </button>-- {viewMode !== "enhanced" && (- <button- onClick={() => setIsPreview(!isPreview)}- className={cn(- "flex items-center gap-1.5 h-6 px-2 rounded-md text-[10px] font-medium transition-all duration-200",- isPreview- ? "bg-foreground/6 text-foreground/60"- : "text-muted-foreground/40 hover:text-foreground/60 hover:bg-foreground/4"- )}- >- {isPreview ? <Pencil size={10} /> : <Eye size={10} />}- {isPreview ? "Edit" : "Preview"}- </button>- )}-- {onOpenEnhance && (- <button- onClick={onOpenEnhance}- className="flex items-center gap-1.5 h-6 px-2 rounded-md text-[10px] font-medium text-muted-foreground/40 hover:text-foreground/60 hover:bg-foreground/4 transition-all duration-150"- >- <Sparkles size={10} />- {isEnhancementStale ? "Re-enhance" : "Enhance"}- </button>- )}-- {onExportNote && (- <DropdownMenu>- <DropdownMenuTrigger asChild>- <button className="flex items-center gap-1.5 h-6 px-2 rounded-md text-[10px] font-medium text-muted-foreground/40 hover:text-foreground/60 hover:bg-foreground/4 transition-all duration-150">- <Download size={10} />- Export- </button>- </DropdownMenuTrigger>- <DropdownMenuContent align="start" sideOffset={4}>- <DropdownMenuItem onClick={() => onExportNote("md")} className="text-[12px] gap-2">- <FileText size={13} className="text-foreground/40" />- As Markdown- </DropdownMenuItem>- <DropdownMenuItem onClick={() => onExportNote("txt")} className="text-[12px] gap-2">- <FileText size={13} className="text-foreground/40" />- As Plain Text- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- )}-- {hasEnhancedContent && (- <div className="flex items-center rounded-md bg-foreground/3 dark:bg-white/3 p-0.5 ml-1">- <button- onClick={() => setViewMode("raw")}- className={cn(- "px-2 h-5 rounded text-[9px] font-medium transition-all duration-150",- viewMode === "raw"- ? "bg-background dark:bg-surface-2 text-foreground/60 shadow-sm"- : "text-foreground/25 hover:text-foreground/40"- )}- >- Raw- </button>- <button- onClick={() => setViewMode("enhanced")}- className={cn(- "px-2 h-5 rounded text-[9px] font-medium transition-all duration-150 flex items-center gap-1",- viewMode === "enhanced"- ? "bg-background dark:bg-surface-2 text-foreground/60 shadow-sm"- : "text-foreground/25 hover:text-foreground/40"- )}- >- Enhanced- {isEnhancementStale && <span className="w-1 h-1 rounded-full bg-amber-400/60" />}- </button>- </div>- )}-- <div className="flex-1" />-- <span className="text-[9px] text-foreground/20 tabular-nums flex items-center gap-1.5">- {isSaving && <Loader2 size={8} className="animate-spin" />}- {isSaving ? "Saving" : wordCount > 0 ? `${wordCount} words` : ""}- </span>- </div>-- <div className="flex-1 overflow-y-auto">- {viewMode === "enhanced" && enhancedContent ? (- <div className="px-5 py-3 text-[13px] text-foreground leading-relaxed">- <MarkdownRenderer content={enhancedContent} />- </div>- ) : isPreview ? (- <div className="px-5 py-3 text-[13px] text-foreground leading-relaxed">- <MarkdownRenderer content={note.content} />- </div>- ) : (- <textarea- ref={textareaRef}- value={note.content}- onChange={handleContentChange}- onSelect={handleSelect}- placeholder="Start writing..."- className="w-full h-full px-5 py-3 text-[13px] text-foreground/90 bg-transparent! border-none! outline-none resize-none rounded-none leading-[1.7] placeholder:text-foreground/15"- style={{ boxShadow: "none" }}- />- )}- </div>- </div>- );-}diff --git a/src/components/notes/NoteEnhanceModal.tsx b/src/components/notes/NoteEnhanceModal.tsxdeleted file mode 100644index a30ff9b47..000000000--- a/src/components/notes/NoteEnhanceModal.tsx+++ /dev/null@@ -1,194 +0,0 @@-import { useState, useEffect } from "react";-import { Sparkles, Loader2, ChevronDown } from "lucide-react";-import { Button } from "../ui/button";-import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/dialog";-import { MarkdownRenderer } from "../ui/MarkdownRenderer";-import reasoningService from "../../services/ReasoningService";-import { getAllReasoningModels } from "../../models/ModelRegistry";-import { cn } from "../lib/utils";--interface NoteEnhanceModalProps {- open: boolean;- onOpenChange: (open: boolean) => void;- noteContent: string;- onApply: (enhancedContent: string, prompt: string) => void;-}--type ModalState = "idle" | "enhancing" | "preview" | "error";--const DEFAULT_PROMPT =- "Clean up grammar, improve structure, and format these notes for readability while preserving all original meaning.";--const BASE_SYSTEM_PROMPT =- "You are a note enhancement assistant. The user will provide raw notes — possibly voice-transcribed, rough, or unstructured. Your job is to clean them up according to the instructions below while preserving all original meaning and information. Output clean markdown.\n\nInstructions: ";--export default function NoteEnhanceModal({- open,- onOpenChange,- noteContent,- onApply,-}: NoteEnhanceModalProps) {- const [state, setState] = useState<ModalState>("idle");- const [prompt, setPrompt] = useState(DEFAULT_PROMPT);- const [result, setResult] = useState("");- const [error, setError] = useState("");- const [selectedModel, setSelectedModel] = useState("");-- const models = getAllReasoningModels();-- useEffect(() => {- if (open && !selectedModel) {- const stored = localStorage.getItem("reasoningModel") || "";- if (stored && models.some((m) => m.value === stored)) {- setSelectedModel(stored);- } else if (models.length > 0) {- setSelectedModel(models[0].value);- }- }- }, [open, selectedModel, models]);-- useEffect(() => {- if (open) {- setState("idle");- setResult("");- setError("");- }- }, [open]);-- const handleEnhance = async () => {- if (!selectedModel || !noteContent.trim()) return;-- setState("enhancing");- setError("");-- try {- const systemPrompt = BASE_SYSTEM_PROMPT + prompt;- const enhanced = await reasoningService.processText(noteContent, selectedModel, null, {- systemPrompt,- temperature: 0.3,- });-- setResult(enhanced);- setState("preview");- } catch (err) {- setError(err instanceof Error ? err.message : "Enhancement failed");- setState("error");- }- };-- const handleApply = () => {- onApply(result, prompt);- onOpenChange(false);- };-- return (- <Dialog open={open} onOpenChange={onOpenChange}>- <DialogContent className="sm:max-w-md gap-2.5">- <DialogHeader>- <DialogTitle className="flex items-center gap-2 text-[14px]">- <Sparkles size={13} className="text-primary" />- Enhance with AI- </DialogTitle>- </DialogHeader>-- <div className="relative">- <select- value={selectedModel}- onChange={(e) => setSelectedModel(e.target.value)}- disabled={state === "enhancing"}- className={cn(- "w-full h-8 px-3 pr-8 rounded-md text-[12px] appearance-none",- "bg-foreground/3 dark:bg-white/4 border border-border/30 dark:border-white/6",- "text-foreground/80 outline-none",- "focus:border-primary/30 transition-colors duration-150",- "disabled:opacity-40"- )}- >- {models.map((m) => (- <option key={m.value} value={m.value}>- {m.fullLabel}- </option>- ))}- </select>- <ChevronDown- size={12}- className="absolute right-2.5 top-1/2 -translate-y-1/2 text-foreground/30 pointer-events-none"- />- </div>-- <textarea- value={prompt}- onChange={(e) => setPrompt(e.target.value)}- disabled={state === "enhancing"}- placeholder="What should the AI do with your notes?"- rows={3}- className={cn(- "w-full px-3 py-2 rounded-md text-[12px] leading-relaxed resize-none",- "bg-foreground/3 dark:bg-white/4 border border-border/30 dark:border-white/6",- "text-foreground/80 placeholder:text-foreground/20 outline-none",- "focus:border-primary/30 transition-colors duration-150",- "disabled:opacity-40"- )}- />-- {state === "preview" && result && (- <div className="max-h-48 overflow-y-auto rounded-md border border-border/20 dark:border-white/4 bg-foreground/2 dark:bg-white/2 px-3 py-2">- <div className="text-[12px] leading-relaxed">- <MarkdownRenderer content={result} />- </div>- </div>- )}-- {state === "error" && error && (- <p className="text-[11px] text-destructive/80 px-1">{error}</p>- )}-- <div className="flex items-center justify-end gap-2 pt-1">- {state === "preview" ? (- <>- <Button- variant="ghost"- size="sm"- onClick={() => setState("idle")}- className="h-7 text-[11px]"- >- Try Again- </Button>- <Button variant="default" size="sm" onClick={handleApply} className="h-7 text-[11px]">- Apply- </Button>- </>- ) : (- <>- <Button- variant="ghost"- size="sm"- onClick={() => onOpenChange(false)}- disabled={state === "enhancing"}- className="h-7 text-[11px]"- >- Cancel- </Button>- <Button- variant="default"- size="sm"- onClick={handleEnhance}- disabled={state === "enhancing" || !selectedModel || !noteContent.trim()}- className="h-7 text-[11px]"- >- {state === "enhancing" ? (- <>- <Loader2 size={12} className="animate-spin mr-1.5" />- Enhancing...- </>- ) : (- "Enhance"- )}- </Button>- </>- )}- </div>- </DialogContent>- </Dialog>- );-}diff --git a/src/components/notes/NoteListItem.tsx b/src/components/notes/NoteListItem.tsxdeleted file mode 100644index 7e0fc8abf..000000000--- a/src/components/notes/NoteListItem.tsx+++ /dev/null@@ -1,93 +0,0 @@-import { Trash2 } from "lucide-react";-import { Button } from "../ui/button";-import { cn } from "../lib/utils";-import type { NoteItem } from "../../types/electron";--interface NoteListItemProps {- note: NoteItem;- isActive: boolean;- onClick: () => void;- onDelete: (id: number) => void;-}--function stripMarkdown(text: string): string {- return text- .replace(/#{1,6}\s+/g, "")- .replace(/[*_~`]+/g, "")- .replace(/\[([^\]]+)\]\([^)]+\)/g, "$1")- .replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1")- .replace(/>\s+/g, "")- .replace(/\n+/g, " ")- .trim();-}--function relativeTime(dateStr: string): string {- const source = dateStr.endsWith("Z") ? dateStr : `${dateStr}Z`;- const date = new Date(source);- if (Number.isNaN(date.getTime())) return dateStr;-- const diff = Date.now() - date.getTime();- const minutes = Math.floor(diff / 60000);- const hours = Math.floor(diff / 3600000);- const days = Math.floor(diff / 86400000);-- if (minutes < 1) return "now";- if (minutes < 60) return `${minutes}m`;- if (hours < 24) return `${hours}h`;- if (days < 7) return `${days}d`;- return date.toLocaleDateString("en-US", { month: "short", day: "numeric" });-}--export default function NoteListItem({ note, isActive, onClick, onDelete }: NoteListItemProps) {- const preview = stripMarkdown(note.content);-- return (- <div- role="button"- tabIndex={0}- onClick={onClick}- onKeyDown={(e) => {- if (e.key === "Enter" || e.key === " ") onClick();- }}- className={cn(- "group relative px-3 py-2 cursor-pointer transition-all duration-150",- isActive ? "bg-primary/6 dark:bg-primary/8" : "hover:bg-foreground/3 dark:hover:bg-white/3"- )}- >- {isActive && (- <div className="absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-4 rounded-r-full bg-primary" />- )}- <div className="flex-1 min-w-0">- <div className="flex items-center justify-between gap-2">- <p- className={cn(- "text-[12px] truncate transition-colors duration-150",- isActive ? "text-foreground font-medium" : "text-foreground/80"- )}- >- {note.title || "Untitled"}- </p>- <div className="flex items-center gap-0.5 shrink-0">- <span className="text-[9px] text-muted-foreground/30 tabular-nums group-hover:opacity-0 transition-opacity">- {relativeTime(note.updated_at)}- </span>- <Button- size="icon"- variant="ghost"- onClick={(e) => {- e.stopPropagation();- onDelete(note.id);- }}- className="h-5 w-5 rounded-sm opacity-0 group-hover:opacity-100 transition-opacity absolute right-2 text-muted-foreground/40 hover:text-destructive hover:bg-destructive/10"- >- <Trash2 size={10} />- </Button>- </div>- </div>- {preview && (- <p className="text-[10px] text-muted-foreground/40 line-clamp-1 mt-0.5">{preview}</p>- )}- </div>- </div>- );-}diff --git a/src/components/notes/PersonalNotesView.tsx b/src/components/notes/PersonalNotesView.tsxdeleted file mode 100644index 794014326..000000000--- a/src/components/notes/PersonalNotesView.tsx+++ /dev/null@@ -1,248 +0,0 @@-import { useState, useEffect, useRef, useCallback, useMemo } from "react";-import { Plus, NotebookPen, Loader2 } from "lucide-react";-import { Button } from "../ui/button";-import { useToast } from "../ui/Toast";-import NoteListItem from "./NoteListItem";-import NoteEditor from "./NoteEditor";-import NoteEnhanceModal from "./NoteEnhanceModal";-import { useNoteRecording } from "../../hooks/useNoteRecording";-import {- useNotes,- useActiveNoteId,- initializeNotes,- setActiveNoteId,-} from "../../stores/noteStore";--export default function PersonalNotesView() {- const notes = useNotes();- const activeNoteId = useActiveNoteId();- const [isLoading, setIsLoading] = useState(true);- const [isSaving, setIsSaving] = useState(false);- const [localTitle, setLocalTitle] = useState("");- const [localContent, setLocalContent] = useState("");- const [finalTranscript, setFinalTranscript] = useState<string | null>(null);- const [showEnhanceModal, setShowEnhanceModal] = useState(false);- const saveTimeoutRef = useRef<NodeJS.Timeout | null>(null);- const activeNoteRef = useRef<number | null>(null);- const localContentRef = useRef(localContent);- localContentRef.current = localContent;- const localTitleRef = useRef(localTitle);- localTitleRef.current = localTitle;- const { toast } = useToast();-- const activeNote = notes.find((n) => n.id === activeNoteId) ?? null;-- const { isRecording, partialTranscript, startRecording, stopRecording } = useNoteRecording({- onTranscriptionComplete: useCallback((text: string) => {- setFinalTranscript(text);- }, []),- onPartialTranscript: useCallback(() => {}, []),- onError: useCallback(- (error: { title: string; description: string }) => {- toast({ title: error.title, description: error.description, variant: "destructive" });- },- [toast]- ),- });-- useEffect(() => {- const load = async () => {- try {- setIsLoading(true);- await initializeNotes(null);- } finally {- setIsLoading(false);- }- };- load();- }, []);-- useEffect(() => {- if (activeNote && activeNote.id !== activeNoteRef.current) {- activeNoteRef.current = activeNote.id;- setLocalTitle(activeNote.title);- setLocalContent(activeNote.content);- }- if (!activeNote) {- activeNoteRef.current = null;- }- }, [activeNote]);-- const debouncedSave = useCallback((noteId: number, title: string, content: string) => {- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- saveTimeoutRef.current = setTimeout(async () => {- setIsSaving(true);- try {- await window.electronAPI.updateNote(noteId, { title, content });- } finally {- setIsSaving(false);- }- }, 1000);- }, []);-- useEffect(() => {- return () => {- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- };- }, []);-- const handleTitleChange = useCallback(- (title: string) => {- setLocalTitle(title);- if (activeNoteId) debouncedSave(activeNoteId, title, localContent);- },- [activeNoteId, localContent, debouncedSave]- );-- const handleContentChange = useCallback(- (content: string) => {- setLocalContent(content);- if (activeNoteId) debouncedSave(activeNoteId, localTitle, content);- },- [activeNoteId, localTitle, debouncedSave]- );-- const handleNewNote = useCallback(async () => {- const result = await window.electronAPI.saveNote("Untitled Note", "", "personal");- if (result.success && result.note) {- setActiveNoteId(result.note.id);- }- }, []);-- const handleDelete = useCallback(- async (id: number) => {- await window.electronAPI.deleteNote(id);- if (activeNoteId === id) {- const remaining = notes.filter((n) => n.id !== id);- setActiveNoteId(remaining.length > 0 ? remaining[0].id : null);- }- },- [activeNoteId, notes]- );-- const handleApplyEnhancement = useCallback(- async (enhancedContent: string, prompt: string) => {- if (!activeNoteId) return;- const hash =- String(localContentRef.current.length) + "-" + localContentRef.current.slice(0, 50);- setIsSaving(true);- try {- await window.electronAPI.updateNote(activeNoteId, {- enhanced_content: enhancedContent,- enhancement_prompt: prompt,- enhanced_at_content_hash: hash,- });- } finally {- setIsSaving(false);- }- setShowEnhanceModal(false);- },- [activeNoteId]- );-- const isEnhancementStale = useMemo(() => {- if (!activeNote?.enhanced_content || !activeNote?.enhanced_at_content_hash) return false;- const currentHash = String(localContent.length) + "-" + localContent.slice(0, 50);- return currentHash !== activeNote.enhanced_at_content_hash;- }, [activeNote?.enhanced_content, activeNote?.enhanced_at_content_hash, localContent]);-- const handleExportNote = useCallback(- async (format: "md" | "txt") => {- if (!activeNoteId) return;- await window.electronAPI.exportNote(activeNoteId, format);- },- [activeNoteId]- );-- const editorNote = activeNote- ? { ...activeNote, title: localTitle, content: localContent }- : null;-- return (- <div className="flex h-full">- <div className="w-52 shrink-0 border-r border-border/15 dark:border-white/4 flex flex-col">- <div className="flex items-center justify-between px-3 py-2">- <span className="text-[10px] font-medium uppercase tracking-wider text-foreground/25">- Notes- </span>- <Button- variant="ghost"- size="icon"- onClick={handleNewNote}- className="h-5 w-5 rounded-md text-muted-foreground/30 hover:text-foreground/60 hover:bg-foreground/5"- >- <Plus size={13} />- </Button>- </div>-- <div className="flex-1 overflow-y-auto">- {isLoading ? (- <div className="flex items-center justify-center py-8">- <Loader2 size={12} className="animate-spin text-foreground/15" />- </div>- ) : notes.length === 0 ? (- <button- onClick={handleNewNote}- className="group flex flex-col items-center justify-center py-10 px-4 w-full hover:bg-foreground/2 transition-colors"- >- <Plus- size={14}- className="text-foreground/10 mb-1.5 group-hover:text-foreground/20 transition-colors"- />- <p className="text-[10px] text-foreground/20 group-hover:text-foreground/30 transition-colors">- New note- </p>- </button>- ) : (- notes.map((note) => (- <NoteListItem- key={note.id}- note={note}- isActive={note.id === activeNoteId}- onClick={() => setActiveNoteId(note.id)}- onDelete={handleDelete}- />- ))- )}- </div>- </div>-- <div className="flex-1 flex flex-col min-w-0">- {editorNote ? (- <>- <NoteEditor- note={editorNote}- onTitleChange={handleTitleChange}- onContentChange={handleContentChange}- isSaving={isSaving}- isRecording={isRecording}- partialTranscript={partialTranscript}- finalTranscript={finalTranscript}- onFinalTranscriptConsumed={() => setFinalTranscript(null)}- onStartRecording={startRecording}- onStopRecording={stopRecording}- onOpenEnhance={() => setShowEnhanceModal(true)}- onExportNote={handleExportNote}- hasEnhancedContent={!!activeNote?.enhanced_content}- enhancedContent={activeNote?.enhanced_content ?? null}- isEnhancementStale={isEnhancementStale}- />- <NoteEnhanceModal- open={showEnhanceModal}- onOpenChange={setShowEnhanceModal}- noteContent={localContent}- onApply={handleApplyEnhancement}- />- </>- ) : (- <div className="flex-1 flex flex-col items-center justify-center">- <NotebookPen size={16} className="text-foreground/6 mb-2" />- <p className="text-[10px] text-foreground/12">- {notes.length === 0 ? "Create a note to get started" : "Select a note"}- </p>- </div>- )}- </div>- </div>- );-}diff --git a/src/components/notes/UploadAudioView.tsx b/src/components/notes/UploadAudioView.tsxdeleted file mode 100644index c6053091d..000000000--- a/src/components/notes/UploadAudioView.tsx+++ /dev/null@@ -1,256 +0,0 @@-import { useState } from "react";-import { Upload, FileAudio, Loader2, CheckCircle, X } from "lucide-react";-import { Button } from "../ui/button";-import { cn } from "../lib/utils";--type UploadState = "idle" | "selected" | "transcribing" | "complete" | "error";--const SUPPORTED_EXTENSIONS = ["mp3", "wav", "m4a", "webm", "ogg", "flac", "aac"];--function formatFileSize(bytes: number): string {- if (bytes < 1024) return `${bytes} B`;- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;-}--interface UploadAudioViewProps {- onNoteCreated?: (noteId: number) => void;-}--export default function UploadAudioView({ onNoteCreated }: UploadAudioViewProps) {- const [state, setState] = useState<UploadState>("idle");- const [file, setFile] = useState<{ name: string; path: string; size: string } | null>(null);- const [result, setResult] = useState<string | null>(null);- const [noteId, setNoteId] = useState<number | null>(null);- const [error, setError] = useState<string | null>(null);- const [isDragOver, setIsDragOver] = useState(false);-- const handleBrowse = async () => {- const res = await window.electronAPI.selectAudioFile();- if (!res.canceled && res.filePath) {- const name = res.filePath.split(/[/\\]/).pop() || "audio";- setFile({ name, path: res.filePath, size: "" });- setState("selected");- setError(null);- }- };-- const handleTranscribe = async () => {- if (!file) return;- setState("transcribing");- setError(null);- try {- const res = await window.electronAPI.transcribeAudioFile(file.path);- if (res.success && res.text) {- setResult(res.text);- const title = file.name.replace(/\.[^.]+$/, "");- const noteRes = await window.electronAPI.saveNote(- title,- res.text,- "upload",- file.name,- null- );- if (noteRes.success && noteRes.note) setNoteId(noteRes.note.id);- setState("complete");- } else {- setError(res.error || "Transcription failed");- setState("error");- }- } catch (err) {- setError(err instanceof Error ? err.message : "An error occurred");- setState("error");- }- };-- const handleDrop = (e: React.DragEvent) => {- e.preventDefault();- setIsDragOver(false);- const f = e.dataTransfer.files[0];- if (!f) return;- const ext = f.name.split(".").pop()?.toLowerCase() || "";- if (SUPPORTED_EXTENSIONS.includes(ext)) {- const filePath = window.electronAPI.getPathForFile(f);- if (!filePath) return;- setFile({ name: f.name, path: filePath, size: formatFileSize(f.size) });- setState("selected");- setError(null);- }- };-- const reset = () => {- setState("idle");- setFile(null);- setResult(null);- setNoteId(null);- setError(null);- };-- return (- <div className="flex flex-col items-center justify-center h-full px-8 -mt-4">- <div className="w-full max-w-[300px]">- {state === "idle" && (- <div className="flex flex-col items-center mb-5">- <div className="w-10 h-10 rounded-[10px] bg-gradient-to-b from-foreground/5 to-foreground/[0.02] dark:from-white/8 dark:to-white/3 border border-foreground/8 dark:border-white/8 flex items-center justify-center mb-4">- <Upload- size={17}- strokeWidth={1.5}- className="text-foreground/25 dark:text-foreground/35"- />- </div>- <h2 className="text-[13px] font-semibold text-foreground mb-1">Upload Audio</h2>- <p className="text-[11px] text-foreground/30 text-center leading-relaxed">- Transcribe an audio file and save it as a note- </p>- </div>- )}-- <div- onDrop={handleDrop}- onDragOver={(e) => {- e.preventDefault();- setIsDragOver(true);- }}- onDragLeave={(e) => {- e.preventDefault();- setIsDragOver(false);- }}- onClick={state === "idle" ? handleBrowse : undefined}- className={cn(- "relative rounded-lg border p-6 text-center transition-all duration-200",- state === "idle" && "cursor-pointer",- isDragOver- ? "border-primary/30 bg-primary/3 dark:bg-primary/5 scale-[1.005]"- : state === "idle"- ? "border-dashed border-foreground/8 dark:border-white/6 hover:border-foreground/15 dark:hover:border-white/10 hover:bg-foreground/[0.01] dark:hover:bg-white/[0.02]"- : "border-foreground/8 dark:border-white/6"- )}- >- {state === "idle" && !isDragOver && (- <div className="flex flex-col items-center gap-1.5">- <p className="text-[11px] text-foreground/35">Drop audio file or click to browse</p>- <p className="text-[9px] text-foreground/15 tracking-wide">- MP3, WAV, M4A, WebM, OGG, FLAC, AAC- </p>- </div>- )}-- {state === "idle" && isDragOver && (- <div className="flex flex-col items-center gap-1.5">- <Upload size={16} className="text-primary/60" />- <p className="text-[11px] text-primary/60 font-medium">Drop to upload</p>- </div>- )}-- {state === "selected" && file && (- <div className="flex flex-col items-center gap-3">- <div className="flex items-center gap-2.5 max-w-full">- <FileAudio size={14} className="text-foreground/25 shrink-0" />- <div className="text-left min-w-0">- <p className="text-[11px] text-foreground/70 truncate">{file.name}</p>- {file.size && <p className="text-[9px] text-foreground/25">{file.size}</p>}- </div>- </div>- <div className="flex items-center gap-2">- <Button- variant="default"- size="sm"- onClick={handleTranscribe}- className="h-7 text-[11px]"- >- Transcribe- </Button>- <Button- variant="ghost"- size="sm"- onClick={reset}- className="h-7 text-[11px] text-foreground/35"- >- Cancel- </Button>- </div>- </div>- )}-- {state === "transcribing" && (- <div className="flex flex-col items-center gap-2.5">- <Loader2 size={16} className="animate-spin text-primary/50" />- <div className="text-center">- <p className="text-[11px] text-foreground/50">Transcribing...</p>- {file && (- <p className="text-[9px] text-foreground/20 mt-0.5 truncate max-w-[200px] mx-auto">- {file.name}- </p>- )}- </div>- </div>- )}-- {state === "complete" && result && (- <div className="flex flex-col items-center gap-3">- <CheckCircle size={16} className="text-success/60" />- <div className="text-center">- <p className="text-[11px] text-foreground/60">Transcription complete</p>- <p className="text-[9px] text-foreground/25 mt-1 max-w-[240px] mx-auto line-clamp-2">- {result.slice(0, 150)}- </p>- </div>- <div className="flex items-center gap-2">- {noteId != null && onNoteCreated && (- <Button- variant="default"- size="sm"- onClick={() => onNoteCreated(noteId)}- className="h-7 text-[11px]"- >- Open Note- </Button>- )}- <Button- variant="ghost"- size="sm"- onClick={reset}- className="h-7 text-[11px] text-foreground/35"- >- Upload Another- </Button>- </div>- </div>- )}-- {state === "error" && error && (- <div className="flex flex-col items-center gap-2.5">- <div className="flex items-start gap-2 max-w-full">- <p className="flex-1 text-[10px] text-destructive/70 text-left">{error}</p>- <button- onClick={reset}- className="text-foreground/15 hover:text-foreground/30 transition-colors shrink-0"- >- <X size={11} />- </button>- </div>- <div className="flex items-center gap-2">- <Button- variant="ghost"- size="sm"- onClick={handleTranscribe}- className="h-6 text-[10px] text-foreground/40"- >- Retry- </Button>- <Button- variant="ghost"- size="sm"- onClick={reset}- className="h-6 text-[10px] text-foreground/25"- >- Start Over- </Button>- </div>- </div>- )}- </div>- </div>- </div>- );-}diff --git a/src/components/referral-cards/SpectrogramCard.tsx b/src/components/referral-cards/SpectrogramCard.tsxdeleted file mode 100644index 2aba33f00..000000000--- a/src/components/referral-cards/SpectrogramCard.tsx+++ /dev/null@@ -1,251 +0,0 @@-import { useState, useMemo, useRef, useEffect, useCallback } from "react";-import { Copy, Check } from "lucide-react";-import { cn } from "../lib/utils";-import { generateSpectrogramData } from "./generateWaveform";--interface SpectrogramCardProps {- referralCode: string;- copied?: boolean;- onCopy?: () => void;-}--const COLS = 48;-const ROWS = 14;-const STEP = 9;-const CELL = 6;-const CELL_RADIUS = 1.2;-const SVG_W = COLS * STEP;-const SVG_H = ROWS * STEP;-const OFFSET = (STEP - CELL) / 2;-const DURATION = 2.5;--const NOISE_BG = `url("data:image/svg+xml,${encodeURIComponent(- '<svg viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(#n)" opacity="1"/></svg>'-)}")`;--const FREQ_MIN = 150;-const FREQ_MAX = 4000;-const FREQUENCIES = Array.from({ length: ROWS }, (_, i) => {- const t = i / (ROWS - 1);- return FREQ_MIN * Math.pow(FREQ_MAX / FREQ_MIN, t);-});--function spectrogramColor(value: number): string {- if (value < 0.05) return "transparent";- const a = (0.1 + value * 0.8).toFixed(3);- return `rgba(70, 120, 220, ${a})`;-}--function createAudio(data: number[][]): { stop: () => void } {- const ctx = new AudioContext();- const master = ctx.createGain();- const lpf = ctx.createBiquadFilter();-- lpf.type = "lowpass";- lpf.frequency.value = 3500;- lpf.Q.value = 0.7;- lpf.connect(master);- master.connect(ctx.destination);-- master.gain.setValueAtTime(0, ctx.currentTime);- master.gain.linearRampToValueAtTime(0.15, ctx.currentTime + 0.08);- master.gain.setValueAtTime(0.15, ctx.currentTime + DURATION - 0.15);- master.gain.linearRampToValueAtTime(0, ctx.currentTime + DURATION);-- const oscillators: OscillatorNode[] = [];-- for (let band = 0; band < ROWS; band++) {- const osc = ctx.createOscillator();- const bandGain = ctx.createGain();-- osc.type = "sine";- osc.frequency.value = FREQUENCIES[band];- osc.detune.value = (Math.random() - 0.5) * 4;-- const row = data[band];- bandGain.gain.setValueAtTime(0, ctx.currentTime);- for (let col = 0; col < COLS; col++) {- const t = ctx.currentTime + (col / (COLS - 1)) * DURATION;- bandGain.gain.linearRampToValueAtTime(row[col] * 0.08, t);- }- bandGain.gain.linearRampToValueAtTime(0, ctx.currentTime + DURATION);-- osc.connect(bandGain);- bandGain.connect(lpf);- osc.start(ctx.currentTime);- osc.stop(ctx.currentTime + DURATION);- oscillators.push(osc);- }-- return {- stop() {- oscillators.forEach((o) => {- try {- o.stop();- } catch {- /* already stopped */- }- });- ctx.close().catch(() => {});- },- };-}--export function SpectrogramCard({ referralCode, copied = false, onCopy }: SpectrogramCardProps) {- const data = useMemo(() => generateSpectrogramData(referralCode, COLS, ROWS), [referralCode]);- const [playing, setPlaying] = useState(false);- const [playKey, setPlayKey] = useState(0);- const audioRef = useRef<{ stop: () => void } | null>(null);- const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);- const hasAutoPlayed = useRef(false);-- const resetPlayback = useCallback(() => {- if (timerRef.current) clearTimeout(timerRef.current);- timerRef.current = null;- audioRef.current?.stop();- audioRef.current = null;- setPlaying(false);- }, []);-- const play = useCallback(() => {- audioRef.current?.stop();- if (timerRef.current) clearTimeout(timerRef.current);-- setPlaying(true);- setPlayKey((k) => k + 1);- audioRef.current = createAudio(data);-- // Safety net — animationend on scan line is the primary reset- timerRef.current = setTimeout(resetPlayback, DURATION * 1000 + 500);- }, [data, resetPlayback]);-- useEffect(() => {- return () => {- if (timerRef.current) clearTimeout(timerRef.current);- audioRef.current?.stop();- };- }, []);-- useEffect(() => {- if (hasAutoPlayed.current) return;- hasAutoPlayed.current = true;- const delay = setTimeout(() => play(), 200);- return () => clearTimeout(delay);- }, [play]);-- return (- <div className="relative w-full h-55 rounded-lg border border-foreground/6 overflow-hidden bg-card dark:bg-[oklch(0.07_0.01_270)]">- {/* Noise texture */}- <div- className="absolute inset-0 rounded-lg opacity-[0.03] pointer-events-none mix-blend-overlay"- style={{ backgroundImage: NOISE_BG, backgroundSize: "128px 128px" }}- />-- {/* Brand + Signal ID */}- <div className="absolute top-0 inset-x-0 px-5 pt-3.5 flex items-center justify-between z-10">- <span className="text-[9px] font-medium uppercase tracking-[0.2em] text-foreground/20 select-none">- OpenWhispr- </span>- <div className="flex flex-col items-end">- <span className="text-[10px] font-mono text-foreground/30 tracking-wider select-all">- {referralCode}- </span>- <span className="text-[7px] uppercase tracking-[0.15em] text-foreground/12 select-none">- Signal ID- </span>- </div>- </div>-- {/* Spectrogram visualization */}- <div className="absolute inset-x-5 top-11 bottom-17">- <svg- viewBox={`0 0 ${SVG_W} ${SVG_H}`}- className="w-full h-full"- preserveAspectRatio="none"- aria-hidden- >- {data.map((row, y) =>- row.map((value, x) =>- value >= 0.05 ? (- <rect- key={`${x}-${y}`}- x={x * STEP + OFFSET}- y={y * STEP + OFFSET}- width={CELL}- height={CELL}- rx={CELL_RADIUS}- fill={spectrogramColor(value)}- />- ) : null- )- )}- </svg>-- {/* Playback scan line — onAnimationEnd resets play state */}- {playing && (- <div- key={playKey}- className="spectrogram-play absolute top-0 bottom-0 w-px pointer-events-none z-10"- onAnimationEnd={resetPlayback}- style={{- background: "oklch(0.72 0.22 260)",- boxShadow:- "0 0 10px 3px oklch(0.72 0.22 260 / 0.5), 0 0 24px 6px oklch(0.72 0.22 260 / 0.2)",- animationDuration: `${DURATION}s`,- }}- />- )}- </div>-- {/* Bottom content */}- <div className="absolute bottom-0 inset-x-0 px-5 pb-4 z-10">- <div className="h-px bg-linear-to-r from-transparent via-foreground/6 to-transparent mb-3" />- <div className="flex items-end justify-between">- <div className="flex items-center gap-3">- <button- onClick={playing ? resetPlayback : play}- className={cn(- "w-8 h-8 rounded-full flex items-center justify-center transition-all duration-200",- "border border-foreground/10 active:scale-[0.93]",- playing- ? "bg-foreground/12 text-foreground/80"- : "bg-foreground/6 text-foreground/40 hover:bg-foreground/10 hover:text-foreground/70"- )}- aria-label={playing ? "Stop" : "Play signal"}- >- {playing ? (- <svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor">- <rect x="1" y="1" width="8" height="8" rx="1" />- </svg>- ) : (- <svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor">- <polygon points="2,0.5 9.5,5 2,9.5" />- </svg>- )}- </button>- <div>- <span className="text-[17px] font-semibold text-foreground leading-tight block">- 1 Month Free- </span>- <span className="text-[10px] text-foreground/20 mt-0.5 block select-none">- Your unique audio signature- </span>- </div>- </div>- <button- onClick={onCopy}- className={cn(- "flex items-center gap-1.5 px-3 py-1.5 rounded-md text-[11px] font-medium transition-all duration-200",- copied- ? "bg-emerald-500/15 text-emerald-400/80"- : "bg-foreground/7 text-foreground/50 hover:bg-foreground/12 hover:text-foreground/80 active:scale-[0.97]"- )}- >- {copied ? <Check className="w-3 h-3" /> : <Copy className="w-3 h-3" />}- {copied ? "Copied" : "Copy"}- </button>- </div>- </div>- </div>- );-}diff --git a/src/components/referral-cards/generateWaveform.ts b/src/components/referral-cards/generateWaveform.tsdeleted file mode 100644index 8176c0f6d..000000000--- a/src/components/referral-cards/generateWaveform.ts+++ /dev/null@@ -1,74 +0,0 @@-/**- * Generates a 2D spectrogram-like heatmap from a referral code.- * Rows = frequency bands (low->high), Cols = time steps.- * Each cell is a 0-1 intensity value.- */-export function generateSpectrogramData(code: string, cols: number, rows: number): number[][] {- let hash = 0;- for (let i = 0; i < code.length; i++) {- hash = ((hash << 5) - hash + code.charCodeAt(i)) | 0;- }-- const seed = (offset: number) => {- const h = ((hash + offset * 2654435761) | 0) >>> 0;- return (h % 10000) / 10000;- };-- // Formant peaks — horizontal bands of energy like speech- const numFormants = 3 + Math.floor(seed(0) * 3);- const formants = Array.from({ length: numFormants }, (_, f) => ({- center: 1 + seed(f * 10 + 1) * (rows - 2),- width: 0.8 + seed(f * 10 + 2) * 2,- intensity: 0.3 + seed(f * 10 + 3) * 0.7,- timeFreq: 0.5 + seed(f * 10 + 4) * 3,- timePhase: seed(f * 10 + 5) * Math.PI * 2,- }));-- // Time bursts — energy clusters like syllables- const numBursts = 3 + Math.floor(seed(100) * 3);- const bursts = Array.from({ length: numBursts }, (_, b) => ({- center: 0.1 + seed(b * 5 + 101) * 0.8,- width: 0.05 + seed(b * 5 + 102) * 0.15,- intensity: 0.5 + seed(b * 5 + 103) * 0.5,- }));-- const data: number[][] = [];- for (let row = 0; row < rows; row++) {- const rowData: number[] = [];- for (let col = 0; col < cols; col++) {- let value = 0;- const t = col / (cols - 1);-- // Noise floor- value += seed(row * cols + col + 500) * 0.08;-- // Burst envelope- let burstEnv = 0.15;- for (const burst of bursts) {- const dist = Math.abs(t - burst.center);- burstEnv += burst.intensity * Math.exp(-(dist * dist) / (2 * burst.width * burst.width));- }- burstEnv = Math.min(1, burstEnv);-- // Formant contributions- for (const f of formants) {- const freqDist = Math.abs(row - f.center);- const gaussian = Math.exp(-(freqDist * freqDist) / (2 * f.width * f.width));- const timeMod = 0.4 + 0.6 * Math.sin(t * Math.PI * f.timeFreq * 2 + f.timePhase);- value += gaussian * f.intensity * timeMod * burstEnv;- }-- // High frequency rolloff- const freqRolloff = 1 - (row / rows) * 0.5;-- // Edge fade- const edgeFade = Math.min(t * 8, (1 - t) * 8, 1);-- const raw = Math.min(1, value * freqRolloff * edgeFade);- rowData.push(Math.pow(raw, 0.75)); // contrast boost — brightens midtones- }- data.push(rowData);- }-- return data;-}diff --git a/src/components/ui/SupportDropdown.tsx b/src/components/ui/SupportDropdown.tsxindex 74a179f4a..b1d3c8d59 100644--- a/src/components/ui/SupportDropdown.tsx+++ b/src/components/ui/SupportDropdown.tsx@@ -19,7 +19,6 @@ function DiscordIcon({ className }: { className?: string }) {interface SupportDropdownProps {className?: string;- trigger?: React.ReactNode;}const openExternal = async (url: string) => {@@ -33,22 +32,20 @@ const openExternal = async (url: string) => {}};-export default function SupportDropdown({ className, trigger }: SupportDropdownProps) {+export default function SupportDropdown({ className }: SupportDropdownProps) {return (<DropdownMenu><DropdownMenuTrigger asChild>- {trigger || (- <Button- variant="ghost"- size="icon"- className={cn(- "text-foreground/70 hover:text-foreground hover:bg-foreground/10",- className- )}- >- <HelpCircle size={16} />- </Button>- )}+ <Button+ variant="ghost"+ size="icon"+ className={cn(+ "text-foreground/70 hover:text-foreground hover:bg-foreground/10",+ className+ )}+ >+ <HelpCircle size={16} />+ </Button></DropdownMenuTrigger><DropdownMenuContent align="end"><DropdownMenuItem onClick={() => openExternal("https://discord.gg/yZWC9WTtX7")}>diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.jsindex 10650822a..35c41655b 100644--- a/src/helpers/audioManager.js+++ b/src/helpers/audioManager.js@@ -2077,7 +2077,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);}const tAudioCleanup = performance.now();- // 3. Wait for flushed buffer to travel: port -> main thread -> IPC -> WebSocket -> server.+ // 3. Wait for flushed buffer to travel: port → main thread → IPC → WebSocket → server.// Then mark streaming done so no further audio is forwarded.await new Promise((resolve) => setTimeout(resolve, 120));this.isStreaming = false;diff --git a/src/helpers/database.js b/src/helpers/database.jsindex 466525de7..9d9e8e6dc 100644--- a/src/helpers/database.js+++ b/src/helpers/database.js@@ -36,29 +36,6 @@ class DatabaseManager {)`);- this.db.exec(`- CREATE TABLE IF NOT EXISTS notes (- id INTEGER PRIMARY KEY AUTOINCREMENT,- title TEXT NOT NULL DEFAULT 'Untitled Note',- content TEXT NOT NULL DEFAULT '',- note_type TEXT NOT NULL DEFAULT 'personal',- source_file TEXT,- audio_duration_seconds REAL,- created_at DATETIME DEFAULT CURRENT_TIMESTAMP,- updated_at DATETIME DEFAULT CURRENT_TIMESTAMP- )- `);-- try {- this.db.exec("ALTER TABLE notes ADD COLUMN enhanced_content TEXT");- } catch {}- try {- this.db.exec("ALTER TABLE notes ADD COLUMN enhancement_prompt TEXT");- } catch {}- try {- this.db.exec("ALTER TABLE notes ADD COLUMN enhanced_at_content_hash TEXT");- } catch {}-return true;} catch (error) {console.error("Database initialization failed:", error.message);@@ -164,104 +141,6 @@ class DatabaseManager {}}- saveNote(title, content, noteType = "personal", sourceFile = null, audioDuration = null) {- try {- if (!this.db) {- throw new Error("Database not initialized");- }- const stmt = this.db.prepare(- "INSERT INTO notes (title, content, note_type, source_file, audio_duration_seconds) VALUES (?, ?, ?, ?, ?)"- );- const result = stmt.run(title, content, noteType, sourceFile, audioDuration);-- const fetchStmt = this.db.prepare("SELECT * FROM notes WHERE id = ?");- const note = fetchStmt.get(result.lastInsertRowid);-- return { success: true, note };- } catch (error) {- console.error("Error saving note:", error.message);- throw error;- }- }-- getNote(id) {- try {- if (!this.db) {- throw new Error("Database not initialized");- }- const stmt = this.db.prepare("SELECT * FROM notes WHERE id = ?");- return stmt.get(id) || null;- } catch (error) {- console.error("Error getting note:", error.message);- throw error;- }- }-- getNotes(noteType = null, limit = 100) {- try {- if (!this.db) {- throw new Error("Database not initialized");- }- if (noteType) {- const stmt = this.db.prepare(- "SELECT * FROM notes WHERE note_type = ? ORDER BY updated_at DESC LIMIT ?"- );- return stmt.all(noteType, limit);- }- const stmt = this.db.prepare("SELECT * FROM notes ORDER BY updated_at DESC LIMIT ?");- return stmt.all(limit);- } catch (error) {- console.error("Error getting notes:", error.message);- throw error;- }- }-- updateNote(id, updates) {- try {- if (!this.db) throw new Error("Database not initialized");- const allowedFields = [- "title",- "content",- "enhanced_content",- "enhancement_prompt",- "enhanced_at_content_hash",- ];- const fields = [];- const values = [];- for (const [key, value] of Object.entries(updates)) {- if (allowedFields.includes(key) && value !== undefined) {- fields.push(`${key} = ?`);- values.push(value);- }- }- if (fields.length === 0) return { success: false };- fields.push("updated_at = CURRENT_TIMESTAMP");- values.push(id);- const stmt = this.db.prepare(`UPDATE notes SET ${fields.join(", ")} WHERE id = ?`);- stmt.run(...values);- const fetchStmt = this.db.prepare("SELECT * FROM notes WHERE id = ?");- const note = fetchStmt.get(id);- return { success: true, note };- } catch (error) {- console.error("Error updating note:", error.message);- throw error;- }- }-- deleteNote(id) {- try {- if (!this.db) {- throw new Error("Database not initialized");- }- const stmt = this.db.prepare("DELETE FROM notes WHERE id = ?");- const result = stmt.run(id);- return { success: result.changes > 0, id };- } catch (error) {- console.error("Error deleting note:", error.message);- throw error;- }- }-cleanup() {console.log("Starting database cleanup...");try {diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex e85d3c7d6..18ad6f2b2 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -175,108 +175,6 @@ class IPCHandlers {return this.databaseManager.setDictionary(words);});- // Note handlers- ipcMain.handle(- "db-save-note",- async (event, title, content, noteType, sourceFile, audioDuration) => {- const result = this.databaseManager.saveNote(- title,- content,- noteType,- sourceFile,- audioDuration- );- if (result?.success && result?.note) {- setImmediate(() => {- this.broadcastToWindows("note-added", result.note);- });- }- return result;- }- );-- ipcMain.handle("db-get-note", async (event, id) => {- return this.databaseManager.getNote(id);- });-- ipcMain.handle("db-get-notes", async (event, noteType, limit) => {- return this.databaseManager.getNotes(noteType, limit);- });-- ipcMain.handle("db-update-note", async (event, id, updates) => {- const result = this.databaseManager.updateNote(id, updates);- if (result?.success && result?.note) {- setImmediate(() => {- this.broadcastToWindows("note-updated", result.note);- });- }- return result;- });-- ipcMain.handle("db-delete-note", async (event, id) => {- const result = this.databaseManager.deleteNote(id);- if (result?.success) {- setImmediate(() => {- this.broadcastToWindows("note-deleted", { id });- });- }- return result;- });-- ipcMain.handle("export-note", async (event, noteId, format) => {- try {- const note = this.databaseManager.getNote(noteId);- if (!note) return { success: false, error: "Note not found" };-- const { dialog } = require("electron");- const fs = require("fs");- const ext = format === "txt" ? "txt" : "md";- const safeName = (note.title || "Untitled").replace(/[/\\?%*:|"<>]/g, "-");-- const result = await dialog.showSaveDialog({- defaultPath: `${safeName}.${ext}`,- filters: [- { name: "Markdown", extensions: ["md"] },- { name: "Text", extensions: ["txt"] },- ],- });-- if (result.canceled || !result.filePath) return { success: false };-- fs.writeFileSync(result.filePath, note.content, "utf-8");- return { success: true };- } catch (error) {- console.error("Error exporting note:", error.message);- return { success: false, error: error.message };- }- });-- ipcMain.handle("select-audio-file", async () => {- const { dialog } = require("electron");- const result = await dialog.showOpenDialog({- properties: ["openFile"],- filters: [- { name: "Audio Files", extensions: ["mp3", "wav", "m4a", "webm", "ogg", "flac", "aac"] },- ],- });- if (result.canceled || !result.filePaths.length) {- return { canceled: true };- }- return { canceled: false, filePath: result.filePaths[0] };- });-- ipcMain.handle("transcribe-audio-file", async (event, filePath, options = {}) => {- const fs = require("fs");- try {- const audioBuffer = fs.readFileSync(filePath);- const result = await this.whisperManager.transcribeLocalWhisper(audioBuffer, options);- return result;- } catch (error) {- debugLogger.error("Audio file transcription error", { error: error.message });- return { success: false, error: error.message };- }- });-// Clipboard handlersipcMain.handle("paste-text", async (event, text, options) => {// If the floating dictation panel currently has focus, blur it first so the@@ -1423,7 +1321,7 @@ class IPCHandlers {const apiUrl = getApiUrl();if (!apiUrl) throw new Error("OpenWhispr API URL not configured");- console.log("[cloud-reason] IPC called", {+ console.log("[cloud-reason] ⬇ IPC called", {apiUrl,model: opts.model || "(default)",agentName: opts.agentName || "(none)",@@ -1436,7 +1334,7 @@ class IPCHandlers {const cookieHeader = await getSessionCookies(event);if (!cookieHeader) throw new Error("No session cookies available");- console.log(`[cloud-reason] Fetching ${apiUrl}/api/reason ...`);+ console.log(`[cloud-reason] → Fetching ${apiUrl}/api/reason ...`);const fetchStart = Date.now();const response = await fetch(`${apiUrl}/api/reason`, {@@ -1459,7 +1357,7 @@ class IPCHandlers {});const fetchMs = Date.now() - fetchStart;- console.log("[cloud-reason] Response", {+ console.log("[cloud-reason] ← Response", {status: response.status,ok: response.ok,fetchMs,@@ -1467,16 +1365,16 @@ class IPCHandlers {if (!response.ok) {if (response.status === 401) {- console.log("[cloud-reason] 401 - session expired");+ console.log("[cloud-reason] ✗ 401 - session expired");return { success: false, error: "Session expired", code: "AUTH_EXPIRED" };}const errorData = await response.json().catch(() => ({}));- console.log("[cloud-reason] API error", { status: response.status, errorData });+ console.log("[cloud-reason] ✗ API error", { status: response.status, errorData });throw new Error(errorData.error || `API error: ${response.status}`);}const data = await response.json();- console.log("[cloud-reason] Success", {+ console.log("[cloud-reason] ✓ Success", {model: data.model,provider: data.provider,processingMs: data.processingMs,@@ -1485,7 +1383,7 @@ class IPCHandlers {});return { success: true, text: data.text, model: data.model, provider: data.provider };} catch (error) {- console.log("[cloud-reason] Error:", error.message);+ console.log("[cloud-reason] ✗ Error:", error.message);debugLogger.error("Cloud reasoning error:", error);return { success: false, error: error.message };}@@ -1555,109 +1453,6 @@ class IPCHandlers {fetchStripeUrl(event, "/api/stripe/portal", "Cloud billing portal error"));- // Referral stats handler- ipcMain.handle("get-referral-stats", async (event) => {- try {- const apiUrl = getApiUrl();- if (!apiUrl) {- throw new Error("OpenWhispr API URL not configured");- }-- const cookieHeader = await getSessionCookies(event);- if (!cookieHeader) {- throw new Error("No session cookies available");- }-- const response = await fetch(`${apiUrl}/api/referrals/stats`, {- headers: {- Cookie: cookieHeader,- "Content-Type": "application/json",- },- });-- if (!response.ok) {- if (response.status === 401) {- throw new Error("Unauthorized - please sign in");- }- throw new Error(`Failed to fetch referral stats: ${response.status}`);- }-- const data = await response.json();- return data;- } catch (error) {- debugLogger.error("Error fetching referral stats:", error);- throw error;- }- });-- ipcMain.handle("send-referral-invite", async (event, email) => {- try {- const apiUrl = getApiUrl();- if (!apiUrl) {- throw new Error("OpenWhispr API URL not configured");- }-- const cookieHeader = await getSessionCookies(event);- if (!cookieHeader) {- throw new Error("No session cookies available");- }-- const response = await fetch(`${apiUrl}/api/referrals/invite`, {- method: "POST",- headers: {- Cookie: cookieHeader,- "Content-Type": "application/json",- },- body: JSON.stringify({ email }),- });-- const data = await response.json();-- if (!response.ok) {- throw new Error(data.error || `Failed to send invite: ${response.status}`);- }-- return data;- } catch (error) {- debugLogger.error("Error sending referral invite:", error);- throw error;- }- });-- ipcMain.handle("get-referral-invites", async (event) => {- try {- const apiUrl = getApiUrl();- if (!apiUrl) {- throw new Error("OpenWhispr API URL not configured");- }-- const cookieHeader = await getSessionCookies(event);- if (!cookieHeader) {- throw new Error("No session cookies available");- }-- const response = await fetch(`${apiUrl}/api/referrals/invites`, {- headers: {- Cookie: cookieHeader,- "Content-Type": "application/json",- },- });-- if (!response.ok) {- if (response.status === 401) {- throw new Error("Unauthorized - please sign in");- }- throw new Error(`Failed to fetch referral invites: ${response.status}`);- }-- const data = await response.json();- return data;- } catch (error) {- debugLogger.error("Error fetching referral invites:", error);- throw error;- }- });-ipcMain.handle("open-whisper-models-folder", async () => {try {const modelsDir = this.whisperManager.getModelsDir();diff --git a/src/hooks/useNoteRecording.ts b/src/hooks/useNoteRecording.tsdeleted file mode 100644index 27a9cd5cb..000000000--- a/src/hooks/useNoteRecording.ts+++ /dev/null@@ -1,146 +0,0 @@-import { useState, useEffect, useRef, useCallback } from "react";-import AudioManager from "../helpers/audioManager";-import logger from "../utils/logger";--interface UseNoteRecordingOptions {- onTranscriptionComplete: (text: string) => void;- onPartialTranscript: (text: string) => void;- onError?: (error: { title: string; description: string }) => void;-}--interface UseNoteRecordingReturn {- isRecording: boolean;- isProcessing: boolean;- isStreaming: boolean;- partialTranscript: string;- startRecording: () => Promise<void>;- stopRecording: () => Promise<void>;- cancelRecording: () => void;-}--export function useNoteRecording({- onTranscriptionComplete,- onPartialTranscript,- onError,-}: UseNoteRecordingOptions): UseNoteRecordingReturn {- const [isRecording, setIsRecording] = useState(false);- const [isProcessing, setIsProcessing] = useState(false);- const [isStreaming, setIsStreaming] = useState(false);- const [partialTranscript, setPartialTranscript] = useState("");- const audioManagerRef = useRef<InstanceType<typeof AudioManager> | null>(null);-- const callbacksRef = useRef({ onTranscriptionComplete, onPartialTranscript, onError });- callbacksRef.current = { onTranscriptionComplete, onPartialTranscript, onError };-- useEffect(() => {- const manager = new AudioManager();- audioManagerRef.current = manager;-- manager.setCallbacks({- onStateChange: ({- isRecording,- isProcessing,- isStreaming,- }: {- isRecording: boolean;- isProcessing: boolean;- isStreaming?: boolean;- }) => {- setIsRecording(isRecording);- setIsProcessing(isProcessing);- setIsStreaming(isStreaming ?? false);- if (!isStreaming) {- setPartialTranscript("");- }- },- onError: (error: { title: string; description: string; code?: string }) => {- const title =- error.code === "AUTH_EXPIRED"- ? "Session Expired"- : error.code === "OFFLINE"- ? "You're Offline"- : error.code === "LIMIT_REACHED"- ? "Daily Limit Reached"- : error.title;-- callbacksRef.current.onError?.({ title, description: error.description });- },- onPartialTranscript: (text: string) => {- setPartialTranscript(text);- callbacksRef.current.onPartialTranscript(text);- },- onTranscriptionComplete: (result: {- success: boolean;- text: string;- source?: string;- limitReached?: boolean;- wordsUsed?: number;- wordsRemaining?: number;- }) => {- if (result.success) {- callbacksRef.current.onTranscriptionComplete(result.text);- manager.warmupStreamingConnection();- }- },- });-- manager.warmupStreamingConnection();-- return () => {- manager.cleanup();- audioManagerRef.current = null;- };- }, []);-- const startRecording = useCallback(async () => {- const manager = audioManagerRef.current;- if (!manager) return;-- const state = manager.getState();- if (state.isRecording || state.isProcessing) return;-- const didStart = manager.shouldUseStreaming()- ? await manager.startStreamingRecording()- : await manager.startRecording();-- if (!didStart) {- logger.debug("Note recording failed to start", {}, "notes");- }- }, []);-- const stopRecording = useCallback(async () => {- const manager = audioManagerRef.current;- if (!manager) return;-- const state = manager.getState();- if (!state.isRecording) return;-- if (state.isStreaming) {- await manager.stopStreamingRecording();- } else {- manager.stopRecording();- }- }, []);-- const cancelRecording = useCallback(() => {- const manager = audioManagerRef.current;- if (!manager) return;-- const state = manager.getState();- if (state.isStreaming) {- manager.stopStreamingRecording();- } else {- manager.cancelRecording();- }- }, []);-- return {- isRecording,- isProcessing,- isStreaming,- partialTranscript,- startRecording,- stopRecording,- cancelRecording,- };-}diff --git a/src/index.css b/src/index.cssindex 81dbc1811..dcf93c383 100644--- a/src/index.css+++ b/src/index.css@@ -421,203 +421,6 @@ a:hover {}}-/* ---- Referral Modal v2 ---- */--/* Animated mesh gradient — slow-drifting color blobs */-.referral-mesh-bg {- position: absolute;- inset: 0;- overflow: hidden;- z-index: 0;- pointer-events: none;-}--.referral-mesh-bg::before,-.referral-mesh-bg::after {- content: "";- position: absolute;- border-radius: 50%;- filter: blur(80px);- animation: mesh-drift 25s ease-in-out infinite alternate;-}--.referral-mesh-bg::before {- width: 300px;- height: 300px;- background: oklch(0.62 0.22 260);- opacity: 0.04;- top: -80px;- right: -60px;-}--.referral-mesh-bg::after {- width: 250px;- height: 250px;- background: oklch(0.6 0.18 180);- opacity: 0.04;- bottom: -60px;- left: -40px;- animation-delay: -12s;- animation-direction: alternate-reverse;-}--@keyframes mesh-drift {- 0% {- transform: translate(0, 0) scale(1);- }- 33% {- transform: translate(30px, -20px) scale(1.05);- }- 66% {- transform: translate(-20px, 15px) scale(0.95);- }- 100% {- transform: translate(10px, -10px) scale(1.02);- }-}--/* 3D perspective-tilt card */-.tilt-card {- --tilt-x: 0deg;- --tilt-y: 0deg;- --highlight-x: 50%;- --highlight-y: 50%;- --highlight-opacity: 0;- transform-style: preserve-3d;- transform: perspective(800px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));- transition: transform 0.6s cubic-bezier(0.03, 0.98, 0.52, 0.99);- position: relative;- isolation: isolate;- will-change: transform;-}--.tilt-card::before {- content: "";- position: absolute;- inset: 0;- border-radius: inherit;- background: radial-gradient(- circle at var(--highlight-x) var(--highlight-y),- oklch(1 0 0 / 0.07),- transparent 60%- );- opacity: var(--highlight-opacity);- transition: opacity 0.3s ease;- pointer-events: none;- z-index: 2;-}--.tilt-card::after {- content: "";- position: absolute;- inset: -1px;- border-radius: inherit;- background: conic-gradient(- from 180deg at 50% 50%,- oklch(0.62 0.22 260 / 0.2),- oklch(0.55 0.2 320 / 0.1),- oklch(0.6 0.18 180 / 0.15),- oklch(0.55 0.2 100 / 0.1),- oklch(0.62 0.22 260 / 0.2)- );- z-index: -1;- opacity: 0;- transition: opacity 0.4s ease;-}--.tilt-card:hover::after {- opacity: 1;-}--/* Stat gauge — accent bottom bar */-.stat-gauge {- position: relative;- overflow: hidden;-}--.stat-gauge::after {- content: "";- position: absolute;- bottom: 0;- left: 0;- right: 0;- height: 2px;- background: oklch(0.62 0.22 260 / 0.4);- transform: scaleX(0);- transform-origin: left;- transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.3s;-}--.stat-gauge[data-active="true"]::after {- transform: scaleX(1);-}--/* Spectrogram playback scan line — synced to audio */-@keyframes spectrogram-play {- 0% {- left: 0%;- opacity: 1;- }- 95% {- opacity: 1;- }- 100% {- left: 100%;- opacity: 0;- }-}--.spectrogram-play {- animation: spectrogram-play linear both;-}--/* Past invites slide-down */-.invites-expand {- display: grid;- grid-template-rows: 0fr;- transition: grid-template-rows 250ms ease-out;-}--.invites-expand[data-open="true"] {- grid-template-rows: 1fr;-}--.invites-expand > div {- overflow: hidden;-}--/* Reduced motion: disable all referral effects */-@media (prefers-reduced-motion: reduce) {- .referral-mesh-bg::before,- .referral-mesh-bg::after {- animation: none;- }-- .tilt-card {- transform: none !important;- transition: none;- }-- .tilt-card::before,- .tilt-card::after {- display: none;- }-- .stat-gauge::after {- transition: none;- transform: scaleX(1);- }-- .invites-expand {- transition: none;- }-- .spectrogram-play {- animation: none;- opacity: 0;- }-}-::-webkit-scrollbar {width: 6px;height: 6px;diff --git a/src/services/BaseReasoningService.ts b/src/services/BaseReasoningService.tsindex bb1c671d9..ddf993d86 100644--- a/src/services/BaseReasoningService.ts+++ b/src/services/BaseReasoningService.ts@@ -4,7 +4,6 @@ export interface ReasoningConfig {maxTokens?: number;temperature?: number;contextSize?: number;- systemPrompt?: string;}export abstract class BaseReasoningService {diff --git a/src/services/ReasoningService.ts b/src/services/ReasoningService.tsindex ef5e43e4b..6e214ffc8 100644--- a/src/services/ReasoningService.ts+++ b/src/services/ReasoningService.ts@@ -259,7 +259,7 @@ class ReasoningService extends BaseReasoningService {config: ReasoningConfig,providerName: string): Promise<string> {- const systemPrompt = config.systemPrompt || this.getSystemPrompt(agentName, text);+ const systemPrompt = this.getSystemPrompt(agentName, text);const userPrompt = text;const messages = [@@ -496,7 +496,7 @@ class ReasoningService extends BaseReasoningService {this.isProcessing = true;try {- const systemPrompt = config.systemPrompt || this.getSystemPrompt(agentName, text);+ const systemPrompt = this.getSystemPrompt(agentName, text);const userPrompt = text;const messages = [@@ -712,7 +712,7 @@ class ReasoningService extends BaseReasoningService {textLength: text.length,});- const systemPrompt = config.systemPrompt || this.getSystemPrompt(agentName, text);+ const systemPrompt = this.getSystemPrompt(agentName, text);const result = await window.electronAPI.processAnthropicReasoning(text, model, agentName, {...config,systemPrompt,@@ -763,7 +763,7 @@ class ReasoningService extends BaseReasoningService {textLength: text.length,});- const systemPrompt = config.systemPrompt || this.getSystemPrompt(agentName, text);+ const systemPrompt = this.getSystemPrompt(agentName, text);const result = await window.electronAPI.processLocalReasoning(text, model, agentName, {...config,systemPrompt,@@ -820,7 +820,7 @@ class ReasoningService extends BaseReasoningService {this.isProcessing = true;try {- const systemPrompt = config.systemPrompt || this.getSystemPrompt(agentName, text);+ const systemPrompt = this.getSystemPrompt(agentName, text);const userPrompt = text;const requestBody = {diff --git a/src/stores/noteStore.ts b/src/stores/noteStore.tsdeleted file mode 100644index 9b1932beb..000000000--- a/src/stores/noteStore.ts+++ /dev/null@@ -1,115 +0,0 @@-import { useSyncExternalStore } from "react";-import type { NoteItem } from "../types/electron";--type Listener = () => void;--const listeners = new Set<Listener>();-let notes: NoteItem[] = [];-let activeNoteId: number | null = null;-let hasBoundIpcListeners = false;-const DEFAULT_LIMIT = 50;-let currentLimit = DEFAULT_LIMIT;--const emit = () => {- listeners.forEach((listener) => listener());-};--const subscribe = (listener: Listener) => {- listeners.add(listener);- return () => listeners.delete(listener);-};--const getNotesSnapshot = () => notes;-const getActiveNoteIdSnapshot = () => activeNoteId;--function ensureIpcListeners() {- if (hasBoundIpcListeners || typeof window === "undefined") {- return;- }-- const disposers: Array<() => void> = [];-- if (window.electronAPI?.onNoteAdded) {- const dispose = window.electronAPI.onNoteAdded((note) => {- if (note) {- addNote(note);- }- });- if (typeof dispose === "function") {- disposers.push(dispose);- }- }-- if (window.electronAPI?.onNoteUpdated) {- const dispose = window.electronAPI.onNoteUpdated((note) => {- if (note) {- updateNoteInStore(note);- }- });- if (typeof dispose === "function") {- disposers.push(dispose);- }- }-- if (window.electronAPI?.onNoteDeleted) {- const dispose = window.electronAPI.onNoteDeleted(({ id }) => {- removeNote(id);- });- if (typeof dispose === "function") {- disposers.push(dispose);- }- }-- hasBoundIpcListeners = true;-- window.addEventListener("beforeunload", () => {- disposers.forEach((dispose) => dispose());- });-}--export async function initializeNotes(- noteType?: string | null,- limit = DEFAULT_LIMIT-): Promise<NoteItem[]> {- currentLimit = limit;- ensureIpcListeners();- const items = await window.electronAPI.getNotes(noteType, limit);- notes = items;- emit();- return items;-}--export function addNote(note: NoteItem): void {- if (!note) return;- const withoutDuplicate = notes.filter((existing) => existing.id !== note.id);- notes = [note, ...withoutDuplicate].slice(0, currentLimit);- emit();-}--export function updateNoteInStore(note: NoteItem): void {- if (!note) return;- notes = notes.map((existing) => (existing.id === note.id ? note : existing));- emit();-}--export function removeNote(id: number): void {- if (!id) return;- const next = notes.filter((item) => item.id !== id);- if (next.length === notes.length) return;- notes = next;- emit();-}--export function setActiveNoteId(id: number | null): void {- if (activeNoteId === id) return;- activeNoteId = id;- emit();-}--export function useNotes(): NoteItem[] {- return useSyncExternalStore(subscribe, getNotesSnapshot, getNotesSnapshot);-}--export function useActiveNoteId(): number | null {- return useSyncExternalStore(subscribe, getActiveNoteIdSnapshot, getActiveNoteIdSnapshot);-}diff --git a/src/types/electron.ts b/src/types/electron.tsindex 36cd29f13..2801bea44 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -7,20 +7,6 @@ export interface TranscriptionItem {created_at: string;}-export interface NoteItem {- id: number;- title: string;- content: string;- enhanced_content: string | null;- enhancement_prompt: string | null;- enhanced_at_content_hash: string | null;- note_type: "personal" | "meeting" | "upload";- source_file: string | null;- audio_duration_seconds: number | null;- created_at: string;- updated_at: string;-}-export interface WhisperCheckResult {installed: boolean;working: boolean;@@ -201,45 +187,6 @@ declare global {getDictionary: () => Promise<string[]>;setDictionary: (words: string[]) => Promise<{ success: boolean }>;- // Note operations- saveNote: (- title: string,- content: string,- noteType?: string,- sourceFile?: string | null,- audioDuration?: number | null- ) => Promise<{ success: boolean; note?: NoteItem }>;- getNote: (id: number) => Promise<NoteItem | null>;- getNotes: (noteType?: string | null, limit?: number) => Promise<NoteItem[]>;- updateNote: (- id: number,- updates: {- title?: string;- content?: string;- enhanced_content?: string | null;- enhancement_prompt?: string | null;- enhanced_at_content_hash?: string | null;- }- ) => Promise<{ success: boolean; note?: NoteItem }>;- deleteNote: (id: number) => Promise<{ success: boolean }>;- exportNote: (- noteId: number,- format: "txt" | "md"- ) => Promise<{ success: boolean; error?: string }>;-- // Audio file operations- selectAudioFile: () => Promise<{ canceled: boolean; filePath?: string }>;- transcribeAudioFile: (- filePath: string,- options?: Record<string, unknown>- ) => Promise<{ success: boolean; text?: string; error?: string }>;- getPathForFile: (file: File) => string;-- // Note event listeners- onNoteAdded?: (callback: (note: NoteItem) => void) => () => void;- onNoteUpdated?: (callback: (note: NoteItem) => void) => () => void;- onNoteDeleted?: (callback: (payload: { id: number }) => void) => () => void;-// Database event listenersonTranscriptionAdded?: (callback: (item: TranscriptionItem) => void) => () => void;onTranscriptionDeleted?: (callback: (payload: { id: number }) => void) => () => void;@@ -580,45 +527,6 @@ declare global {callback: (data: { audioDuration?: number; text?: string }) => void) => () => void;- // Referral stats- getReferralStats?: () => Promise<{- referralCode: string;- referralLink: string;- totalReferrals: number;- completedReferrals: number;- pendingReferrals: number;- totalMonthsEarned: number;- referrals: Array<{- id: string;- email: string;- name: string;- status: "pending" | "completed" | "rewarded";- created_at: string;- first_payment_at: string | null;- }>;- }>;-- sendReferralInvite?: (email: string) => Promise<{- success: boolean;- invite: {- id: string;- recipientEmail: string;- status: "sent" | "failed" | "opened" | "converted";- sentAt: string;- };- }>;-- getReferralInvites?: () => Promise<{- invites: Array<{- id: string;- recipientEmail: string;- status: "sent" | "failed" | "opened" | "converted";- sentAt: string;- openedAt?: string;- convertedAt?: string;- }>;- }>;-// Deepgram StreamingdeepgramStreamingWarmup?: (options?: { sampleRate?: number; language?: string }) => Promise<{success: boolean;diff --git a/src/vite.config.mjs b/src/vite.config.mjsindex d10d87a2b..a478f499d 100644--- a/src/vite.config.mjs+++ b/src/vite.config.mjs@@ -75,7 +75,9 @@ export default defineConfig(({ mode }) => {'zlib','tar','unzipper',- '@aws-sdk/client-s3'+ '@aws-sdk/client-s3',+ '@neondatabase/auth',+ '@neondatabase/auth/react'],output: {manualChunks: {