From 61a0bff4a30314c25ac809e3a25dde71cd867bac Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Sun, 22 Mar 2026 03:19:36 +0100 Subject: [PATCH] feat: refactor InstancePanel from tabs to sectioned single page --- .../modals/settingsPanels/InstancePanel.tsx | 71 ++++++++++--------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/packages/web/src/components/modals/settingsPanels/InstancePanel.tsx b/packages/web/src/components/modals/settingsPanels/InstancePanel.tsx index 071efc30..bdf88301 100644 --- a/packages/web/src/components/modals/settingsPanels/InstancePanel.tsx +++ b/packages/web/src/components/modals/settingsPanels/InstancePanel.tsx @@ -1,54 +1,59 @@ -import { useState, useEffect } from 'react'; +import { useEffect } from 'react'; import { useSettingsStore } from '../../../stores/settingsStore'; +import { useSettingsSections } from '../../../hooks/useSettingsSections'; import { GeneralPanel } from '../instanceSettingsPanels/GeneralPanel'; import { StreamingPanel } from '../instanceSettingsPanels/StreamingPanel'; import { StoragePanel } from '../instanceSettingsPanels/StoragePanel'; import { UsersPanel } from '../instanceSettingsPanels/UsersPanel'; -type SubTab = 'general' | 'streaming' | 'storage' | 'users'; +const SECTIONS = [ + { id: 'general', label: 'General' }, + { id: 'streaming', label: 'Streaming' }, + { id: 'storage', label: 'Storage' }, + { id: 'users', label: 'Users' }, +] as const; export function InstancePanel() { const fetchInstanceSettings = useSettingsStore((s) => s.fetchInstanceSettings); const fetchStreamingLimits = useSettingsStore((s) => s.fetchStreamingLimits); - - const [subTab, setSubTab] = useState('general'); + const { sectionRef } = useSettingsSections([...SECTIONS]); useEffect(() => { fetchInstanceSettings(); fetchStreamingLimits(); }, [fetchInstanceSettings, fetchStreamingLimits]); - const pillClass = (t: SubTab) => - `px-3 py-1 text-sm rounded-full transition-colors ${ - subTab === t - ? 'bg-interactive-selected text-txt-primary' - : 'text-txt-tertiary hover:text-txt-secondary hover:bg-interactive-hover' - }`; - return ( -
-

Instance

- {/* Sub-tab switcher */} -
- - - - -
+
+ {/* General */} +

+ General +

+ - {/* Content */} - {subTab === 'general' && } - {subTab === 'streaming' && } - {subTab === 'storage' && } - {subTab === 'users' && } +
+ + {/* Streaming */} +

+ Streaming +

+ + +
+ + {/* Storage */} +

+ Storage +

+ + +
+ + {/* Users */} +

+ Users +

+
); }