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 (

Settings

Telemetry

This records anonymous usage data to improve the product.
Telemetry ID: {settings ? settings.telemetryUserId : "n/a"}
{/* Integrations Section */}

Integrations

{/* Tools (MCP) */}

Tools (MCP)

{/* Experiments Section */}

Experiments

{ updateSettings({ enableNativeGit: checked, }); }} />
{/* Danger Zone */}

Danger Zone

Reset Everything

This will delete all your apps, chats, and settings. This action cannot be undone.

setIsResetDialogOpen(false)} />
); } export function GeneralSettings({ appVersion }: { appVersion: string | null }) { const { theme, setTheme } = useTheme(); return (

General Settings

{(["system", "light", "dark"] as const).map((option) => ( ))}
This will automatically update the app when new versions are available.
App Version: {appVersion ? appVersion : "-"}
); } export function WorkflowSettings() { return (

Workflow Settings

This will automatically approve code changes and run them.
This will automatically fix TypeScript errors.
); } export function AISettings() { return (

AI Settings

); }