'use client' // apps/web/src/components/layout/sidebar.tsx // 대시보드 좌측 사이드바 import { usePathname, useRouter } from 'next/navigation' import { Box, FormControl, InputLabel, List, ListItem, ListItemButton, ListItemIcon, ListItemText, MenuItem, Select, type SelectChangeEvent } from '@mui/material' import DashboardIcon from '@mui/icons-material/Dashboard' import MeetingRoomIcon from '@mui/icons-material/MeetingRoom' import MicIcon from '@mui/icons-material/Mic' import ChatIcon from '@mui/icons-material/Chat' import LibraryBooksIcon from '@mui/icons-material/LibraryBooks' import AutoAwesomeIcon from '@mui/icons-material/AutoAwesome' import GroupsIcon from '@mui/icons-material/Groups' import PaymentIcon from '@mui/icons-material/Payment' import AdminPanelSettingsIcon from '@mui/icons-material/AdminPanelSettings' import LogoutIcon from '@mui/icons-material/Logout' import PaletteIcon from '@mui/icons-material/Palette' import type { ThemeMode } from '@d3ro/core/types' import { PhosphorText } from '@d3ro/ui/components/ds' import { d3roPalette } from '@d3ro/ui/theme' import { useI18n } from '@d3ro/i18n' import { getSupabaseBrowserClient } from '@/lib/supabase-browser' import { AVAILABLE_MODES, useThemeMode } from '@/components/providers/theme-mode-context' interface NavItem { key: string path: string label: string icon: React.ReactElement } export function Sidebar(): React.ReactElement { const router = useRouter() const pathname = usePathname() const { t } = useI18n() const { mode, setMode } = useThemeMode() const handleThemeChange = (event: SelectChangeEvent): void => { setMode(event.target.value as ThemeMode) } const items: NavItem[] = [ { key: 'dashboard', path: '/dashboard', label: t('nav.dashboard') ?? 'Dashboard', icon: }, { key: 'meetings', path: '/meetings', label: t('nav.meetings') ?? 'Meetings', icon: }, { key: 'record', path: '/record', label: t('nav.record') ?? 'Record', icon: }, { key: 'chat', path: '/chat', label: t('nav.chat') ?? 'Chat', icon: }, { key: 'knowledge', path: '/knowledge', label: t('nav.knowledge') ?? 'Knowledge', icon: }, { key: 'actions', path: '/actions', label: t('nav.actions') ?? 'Actions', icon: }, { key: 'teams', path: '/teams', label: t('nav.teams') ?? 'Teams', icon: }, { key: 'billing', path: '/billing', label: t('nav.billing') ?? 'Billing', icon: }, { key: 'admin', path: '/admin', label: 'Admin', icon: } ] async function handleLogout(): Promise { const supabase = getSupabaseBrowserClient() await supabase.auth.signOut() router.replace('/login') } return ( D3RO VOICE {items.map((item) => { const active = pathname === item.path || pathname.startsWith(`${item.path}/`) return ( router.push(item.path)} sx={{ '&.Mui-selected': { bgcolor: d3roPalette.bg.inset, borderLeft: `3px solid ${d3roPalette.accent.amber}` } }} > {item.icon} ) })} {t('theme.label') ?? 'Theme'} labelId="theme-mode-label" id="theme-mode-select" value={mode} onChange={handleThemeChange} label={t('theme.label') ?? 'Theme'} > {AVAILABLE_MODES.map((m) => ( {t(`theme.${m}`) ?? m} ))} void handleLogout()}> ) }