import { useState } from 'react'; import { useAppContext } from '../context/AppContext'; import { SettingsTab } from '../tabs/SettingsTab'; import { AdminTab } from '../tabs/AdminTab'; import { ConfigTab } from '../tabs/ConfigTab'; import { PageHeader } from '../components/ui/page-header'; type SettingsSection = 'Account' | 'Bot Config' | 'Admin Panel'; export function SettingsView() { const { botState, isAdmin, socket } = useAppContext(); const sections: SettingsSection[] = [ 'Account', ...(isAdmin ? ['Bot Config' as SettingsSection] : []), ...(isAdmin ? ['Admin Panel' as SettingsSection] : []), ]; const [section, setSection] = useState('Account'); return (
{sections.map(s => ( ))}
{section === 'Account' && } {section === 'Bot Config' && isAdmin && } {section === 'Admin Panel' && isAdmin && }
); }