diff --git a/apps/desktop/src/db/index.ts b/apps/desktop/src/db/index.ts index f821b11..ff66bbd 100644 --- a/apps/desktop/src/db/index.ts +++ b/apps/desktop/src/db/index.ts @@ -6,7 +6,7 @@ import * as fs from "fs"; import * as schema from "./schema"; // Get the user data directory for storing the database -const dbPath = app.isPackaged +export const dbPath = app.isPackaged ? path.join(app.getPath("userData"), "amical.db") : path.join(process.cwd(), "amical.db"); diff --git a/apps/desktop/src/renderer/main/pages/settings/advanced/index.tsx b/apps/desktop/src/renderer/main/pages/settings/advanced/index.tsx index 6642f2a..fc44077 100644 --- a/apps/desktop/src/renderer/main/pages/settings/advanced/index.tsx +++ b/apps/desktop/src/renderer/main/pages/settings/advanced/index.tsx @@ -6,17 +6,31 @@ import { CardDescription, CardContent, } from "@/components/ui/card"; -import { Button } from "@/components/ui/button"; import { Label } from "@/components/ui/label"; import { Switch } from "@/components/ui/switch"; +import { Input } from "@/components/ui/input"; +import { Button } from "@/components/ui/button"; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "@/components/ui/alert-dialog"; import { api } from "@/trpc/react"; import { toast } from "sonner"; export default function AdvancedSettingsPage() { const [preloadWhisperModel, setPreloadWhisperModel] = useState(true); + const [isResetting, setIsResetting] = useState(false); // tRPC queries and mutations const settingsQuery = api.settings.getSettings.useQuery(); + const dataPathQuery = api.settings.getDataPath.useQuery(); const utils = api.useUtils(); const updateTranscriptionSettingsMutation = @@ -31,6 +45,21 @@ export default function AdvancedSettingsPage() { }, }); + const resetAppMutation = api.settings.resetApp.useMutation({ + onMutate: () => { + setIsResetting(true); + toast.info("Resetting app..."); + }, + onSuccess: () => { + toast.success("App reset successfully. Restarting..."); + }, + onError: (error) => { + setIsResetting(false); + console.error("Failed to reset app:", error); + toast.error("Failed to reset app. Please try again."); + }, + }); + // Load settings when query data is available useEffect(() => { if (settingsQuery.data?.transcription) { @@ -97,15 +126,72 @@ export default function AdvancedSettingsPage() {
+ Delete all data and start fresh +
+