Files
popiart-server/web/components/main-nav.tsx
T
wtgoku baba209519 Expose gateway billing flows from the synced server baseline
The preserved local work adds PopiNewAPI billing checkout, gateway account binding, and matching web console/pricing surfaces on top of the current test-server baseline. During the merge, the start-end video helpers from the deployed baseline were kept alongside the actionGenerate prompt handling from the WIP.

Constraint: Current usable baseline is 7054436, already deployed on the test server.

Rejected: Commit the WIP before syncing the baseline | would have hidden conflicts with the deployed start-end-frame changes.

Confidence: medium

Scope-risk: broad

Directive: Do not deploy this commit to the test server without rechecking gateway credentials and billing checkout behavior in that environment.

Tested: go test ./...

Tested: make build

Tested: cd web && npm run build
2026-05-21 16:53:07 +08:00

62 lines
1.5 KiB
TypeScript

"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import type { Locale } from "@/lib/site-content";
function localize(locale: Locale, path: string) {
if (!path || path === "/") {
return `/${locale}`;
}
return `/${locale}${path}`;
}
function isActive(pathname: string, href: string) {
if (href === "/") {
return pathname === href;
}
return pathname === href || pathname.startsWith(`${href}/`);
}
export function MainNav({
locale,
labels,
}: {
locale: Locale;
labels: {
home: string;
docs: string;
skills: string;
console: string;
pricing: string;
billing?: string;
};
}) {
const pathname = usePathname();
const items = [
{ href: localize(locale, "/"), label: labels.home },
{ href: localize(locale, "/docs"), label: labels.docs },
{ href: localize(locale, "/skills"), label: labels.skills },
{ href: localize(locale, "/console"), label: labels.console },
{ href: localize(locale, "/pricing"), label: labels.pricing },
];
if (labels.billing) {
items.push({ href: localize(locale, "/billing"), label: labels.billing });
}
return (
<nav className="main-nav" aria-label="Primary">
{items.map((item) => (
<Link
aria-current={isActive(pathname, item.href) ? "page" : undefined}
className={`nav-link ${isActive(pathname, item.href) ? "nav-link-active" : ""}`}
href={item.href}
key={item.href}
>
{item.label}
</Link>
))}
</nav>
);
}