peppa/apps/web/components/Nav.tsx
Асель 412f5f05ce PEP-61: top menu — Home instead of Inbox, Runners and Projects pages
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:02:37 +05:00

34 lines
1.1 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
const ITEMS = [
{ href: "/", label: "Главная", match: (p: string) => p === "/" },
{ href: "/projects", label: "Проекты", match: (p: string) => p.startsWith("/projects") || p.startsWith("/p/") || p.startsWith("/t/") },
{ href: "/runners", label: "Раннеры", match: (p: string) => p.startsWith("/runners") },
{ href: "/help", label: "Помощь", match: (p: string) => p.startsWith("/help") },
];
export function Nav() {
const path = usePathname();
return (
<nav>
{ITEMS.map((i) => (
<Link key={i.href} href={i.href} className={i.match(path) ? "active" : undefined} aria-current={i.match(path) ? "page" : undefined}>
{i.label}
</Link>
))}
</nav>
);
}
export function SettingsLink() {
const active = usePathname().startsWith("/settings");
return (
<Link href="/settings" className={active ? "active" : undefined} aria-current={active ? "page" : undefined}>
Настройки
</Link>
);
}