import { useEffect, useState } from "react"; import { useLocation } from "react-router-dom"; import * as ScrollArea from "@radix-ui/react-scroll-area"; import { cn } from "@/lib/cn"; import { MainRightSide } from "@/layouts/MainRightSide.tsx"; import { VerticalTabs } from "@/components/VerticalTabs.tsx"; import { SettingsNavigationTriggers } from "@/modules/settings/SettingsNavigationTriggers.tsx"; import { SettingsProvider } from "@/modules/settings/SettingsContext.tsx"; import { SettingsGeneral } from "@/modules/settings/SettingsGeneral.tsx"; import { SettingsNetwork } from "@/modules/settings/SettingsNetwork.tsx"; import { SettingsSecurity } from "@/modules/settings/SettingsSecurity.tsx"; import { SettingsSSH } from "@/modules/settings/SettingsSSH.tsx"; import { SettingsAdvanced } from "@/modules/settings/SettingsAdvanced.tsx"; import { SettingsTroubleshooting } from "@/modules/settings/SettingsTroubleshooting.tsx"; import { SettingsAbout } from "@/modules/settings/SettingsAbout.tsx"; // The settings window always opens at General. The only way to land on a // different tab is via navigation state (e.g. the update-available header // trigger jumps to About). No persistence across opens — a user who wants // to revisit a deep tab gets there in two clicks. export const Settings = () => { const location = useLocation(); const navState = location.state as { tab?: string } | null; const [active, setActive] = useState(() => navState?.tab ?? "general"); useEffect(() => { if (navState?.tab) setActive(navState.tab); }, [navState?.tab, location.key]); return (
); };