From 209efd1a74c735061258c2a3b08e12bfda37612c Mon Sep 17 00:00:00 2001 From: anti Date: Sat, 9 May 2026 05:19:50 -0400 Subject: [PATCH] refactor(decnet_web/Config): extract types Foundation for the Config split. UserEntry / ConfigData move out of the page so the upcoming hook + tab extractions can import without reaching back through Config.tsx. New ConfigTab union and FormMsg type for the inline success/error chip pattern that repeats across every admin form on the page. - New Config/types.ts (UserEntry, ConfigData, ConfigTab, FormMsg) - Config.tsx loses the inline interfaces and the `as any` cast on setActiveTab in the tab-switcher. --- decnet_web/src/components/Config.tsx | 19 +++------------- decnet_web/src/components/Config/types.ts | 27 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 decnet_web/src/components/Config/types.ts diff --git a/decnet_web/src/components/Config.tsx b/decnet_web/src/components/Config.tsx index f9a7df46..04166505 100644 --- a/decnet_web/src/components/Config.tsx +++ b/decnet_web/src/components/Config.tsx @@ -6,25 +6,12 @@ import RuleStateControls from './RuleStateControls'; import './Dashboard.css'; import './Config.css'; -interface UserEntry { - uuid: string; - username: string; - role: string; - must_change_password: boolean; -} - -interface ConfigData { - role: string; - deployment_limit: number; - global_mutation_interval: string; - users?: UserEntry[]; - developer_mode?: boolean; -} +import type { ConfigData, ConfigTab } from './Config/types'; const Config: React.FC = () => { const [config, setConfig] = useState(null); const [loading, setLoading] = useState(true); - const [activeTab, setActiveTab] = useState<'limits' | 'users' | 'globals' | 'appearance' | 'workers' | 'ttp'>('limits'); + const [activeTab, setActiveTab] = useState('limits'); const [accent, setAccent] = useState<'matrix' | 'violet'>(() => { try { const raw = localStorage.getItem('decnet_tweaks'); @@ -256,7 +243,7 @@ const Config: React.FC = () => {