import { useState, type ReactNode } from 'react'; import { appStore, changeLanguage, connectWithToken, getStoredToken, logout, requestToken, showView, type ViewName, } from '../lib/app'; import { useStore } from '../lib/store'; import { promptDialog } from '../lib/dialog'; import { Avatar } from './Avatar'; import { CodeIcon, GearIcon, HeartIcon, PlayIcon, QueueIcon, SearchIcon, StatsIcon, UpdateIcon, WatchIcon, } from './icons'; import { t, useLanguage } from '../i18n'; const NAV: Array<{ view: ViewName; icon: ReactNode; label: string }> = [ { view: 'dashboard', icon: , label: 'Dashboard' }, { view: 'queue', icon: , label: 'Queue' }, { view: 'search', icon: , label: 'Search' }, { view: 'library', icon: , label: 'Library' }, { view: 'stats', icon: , label: 'History & Stats' }, { view: 'server', icon: , label: 'Server & Admin' }, { view: 'updates', icon: , label: 'Updates' }, { view: 'rpc', icon: , label: 'RPC / API' }, ]; export function Sidebar() { const s = useStore(appStore); const language = useLanguage(); const [token, setToken] = useState(getStoredToken() || ''); const isAdmin = !!(s.identity && s.identity.isAdmin); const playing = !!( s.status && s.status.isPlaying && !s.status.isPaused ); const name = s.identity ? s.identity.nickname || s.identity.uid || t('user') : ''; return ( ); }