import { useEffect } from 'react'; import { NavLink } from 'react-router'; import { LayoutDashboard, Users, Building2, Activity, Megaphone, MessageSquare, Settings, X, } from './Icons'; import { BrandMark } from './BrandMark'; // Consolidated navigation. Per-player moderation (bans, grants, gifts, // password resets) lives in the player detail modal; the old Bans / // Reports / Audit / Player-logs / Community / Loading-tips / Gift / // Passwords / Signup-codes pages are now tabs under Players, Activity, // Content, and Settings. Import room is a header action on the Rooms // page. Old routes still resolve via redirects in App.tsx. const groups: Array<{ title: string; items: Array<{ to: string; label: string; icon: React.ReactNode; new?: boolean }>}> = [ { title: 'Overview', items: [ { to: '/', label: 'Dashboard', icon: }, ], }, { title: 'Moderation', items: [ { to: '/players', label: 'Players', icon: }, { to: '/activity', label: 'Activity', icon: }, ], }, { title: 'Content', items: [ { to: '/rooms', label: 'Rooms', icon: }, { to: '/content', label: 'Content', icon: }, ], }, { title: 'Operations', items: [ { to: '/broadcast', label: 'Broadcast', icon: }, { to: '/settings', label: 'Settings', icon: }, ], }, ]; // Two-mode rendering: // * Desktop (md+): always-visible static rail to the left of
. // * Mobile: hidden by default; opens as a slide-in drawer with a // backdrop scrim, controlled by `open` from . Tapping any // nav link calls `onNavigate()` so the drawer closes automatically // after the user picks a destination. Escape also closes. export function Sidebar({ open, onClose, onNavigate }: { open: boolean; onClose: () => void; onNavigate: () => void }) { // Lock body scroll while the mobile drawer is up so the page behind // doesn't scroll through the backdrop. Skip on desktop where `open` // is irrelevant (the sidebar is always there). useEffect(() => { if (!open) return; const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); }; document.addEventListener('keydown', onKey); const prev = document.body.style.overflow; document.body.style.overflow = 'hidden'; return () => { document.removeEventListener('keydown', onKey); document.body.style.overflow = prev; }; }, [open, onClose]); const inner = ( <>
DorkNet
admin
); return ( <> {/* Mobile drawer + backdrop */}
{/* Desktop static rail */} ); }