Files
mcma-webui/src/components/common/SubNav.tsx
T
Senko-san aed0572071 Scaffold global navigation aligned to routes plan
Build out the full web route map from music-selfhost-routes.md as
scaffolding (no functionality on new screens):

- Full route tree: /login, /albums/:id, /artists/:id, /playlists(+detail),
  /discover, /upload, metadata editor (single + batch), /storage/maintenance,
  /queue, nested /settings and /admin, and a 404.
- Sidebar rebuilt to the A1 spec with permission-gated Discover/Upload.
- ProtectedRoute gains requirePermission; Permission exported.
- AppShell wraps Outlet in a Suspense boundary for lazy routes.
- Reusable Placeholder + SubNav; Settings/Admin become nested layouts.
- Settings/Profile: wired language + theme selectors.
- Remove orphaned Home feature (web has no Home; / -> /library) and the
  now-unused house icon + nav.home keys.
- i18n keys (en + ru) and CSS for page-title/sub-nav.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-07 17:05:21 +03:00

30 lines
701 B
TypeScript

import { NavLink } from 'react-router';
export interface SubNavItem {
to: string;
label: string;
/** Match the path exactly (used for index/redirect targets). */
end?: boolean;
}
interface Props {
items: SubNavItem[];
}
function subNavClass({ isActive }: { isActive: boolean }) {
return isActive ? 'sub-nav-item active' : 'sub-nav-item';
}
/** Horizontal secondary navigation for screens with sub-sections (Settings, Admin). */
export function SubNav({ items }: Props) {
return (
<nav className="sub-nav">
{items.map((it) => (
<NavLink key={it.to} to={it.to} end={it.end} className={subNavClass}>
{it.label}
</NavLink>
))}
</nav>
);
}