import { useEffect, useState } from "react"; import { useTheme } from "../contexts/ThemeContext"; import { ProviderSettingsGrid } from "@/components/ProviderSettings"; import ConfirmationDialog from "@/components/ConfirmationDialog"; import { IpcClient } from "@/ipc/ipc_client"; import { showSuccess, showError } from "@/lib/toast"; import { AutoApproveSwitch } from "@/components/AutoApproveSwitch"; import { TelemetrySwitch } from "@/components/TelemetrySwitch"; import { MaxChatTurnsSelector } from "@/components/MaxChatTurnsSelector"; import { ThinkingBudgetSelector } from "@/components/ThinkingBudgetSelector"; import { useSettings } from "@/hooks/useSettings"; import { useAppVersion } from "@/hooks/useAppVersion"; import { Button } from "@/components/ui/button"; import { ArrowLeft } from "lucide-react"; import { useRouter } from "@tanstack/react-router"; import { GitHubIntegration } from "@/components/GitHubIntegration"; import { VercelIntegration } from "@/components/VercelIntegration"; import { SupabaseIntegration } from "@/components/SupabaseIntegration"; import { Switch } from "@/components/ui/switch"; import { Label } from "@/components/ui/label"; import { AutoFixProblemsSwitch } from "@/components/AutoFixProblemsSwitch"; import { AutoUpdateSwitch } from "@/components/AutoUpdateSwitch"; import { ReleaseChannelSelector } from "@/components/ReleaseChannelSelector"; import { NeonIntegration } from "@/components/NeonIntegration"; import { RuntimeModeSelector } from "@/components/RuntimeModeSelector"; import { NodePathSelector } from "@/components/NodePathSelector"; import { ToolsMcpSettings } from "@/components/settings/ToolsMcpSettings"; import { ZoomSelector } from "@/components/ZoomSelector"; import { useSetAtom } from "jotai"; import { activeSettingsSectionAtom } from "@/atoms/viewAtoms"; export default function SettingsPage() { const [isResetDialogOpen, setIsResetDialogOpen] = useState(false); const [isResetting, setIsResetting] = useState(false); const appVersion = useAppVersion(); const { settings, updateSettings } = useSettings(); const router = useRouter(); const setActiveSettingsSection = useSetAtom(activeSettingsSectionAtom); useEffect(() => { setActiveSettingsSection("general-settings"); }, [setActiveSettingsSection]); const handleResetEverything = async () => { setIsResetting(true); try { const ipcClient = IpcClient.getInstance(); await ipcClient.resetAll(); showSuccess("Successfully reset everything. Restart the application."); } catch (error) { console.error("Error resetting:", error); showError( error instanceof Error ? error.message : "An unknown error occurred", ); } finally { setIsResetting(false); setIsResetDialogOpen(false); } }; return (
This will delete all your apps, chats, and settings. This action cannot be undone.