Files
Logan CusanoandClaude Opus 5.5 bf206334e3 fix(frontend): finish the token migration — raw grey classes -> theme tokens
UI_REDESIGN chunk 4 was never finished: 39 app/component files still used
raw Tailwind greys, kept readable in light mode only by the !important
override sheet. In dark mode text-gray-600 is ~2.3:1 on surface, and the
light override maps it to #94a3b8 (~2.6:1 on white) — unreadable in both.

Mechanical mapping (886 classes): gray-100/200 -> ink, 300/400 -> ink-2,
500/600/700 -> ink-muted, bg 950/900/800 -> page/surface/raised,
border 800 -> line, 700/600 -> line-strong, plus hover/divide/placeholder.
Alpha suffixes kept (tokens are color-mix, so /60 works). bg-gray-700,
text-white and marketing pages left alone. text-[9px] -> text-[10px].

Frontend unverified: no Node on the authoring box (#207).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 21:29:13 -04:00

66 lines
2.4 KiB
TypeScript

"use client";
import { useEffect } from "react";
import Link from "next/link";
import { usePathname, useRouter } from "next/navigation";
import { useAuth } from "@/components/AuthProvider";
import { PageHeader } from "@/components/ui/PageHeader";
const TABS = [
{ href: "/settings/organization", label: "Organization" },
{ href: "/settings/members", label: "Members" },
{ href: "/settings/nodes", label: "Node Ownership" },
{ href: "/settings/api-keys", label: "API Keys" },
{ href: "/settings/billing", label: "Billing" },
];
// Platform-admin-only tabs: every route behind them is require_admin_token,
// so an org owner would only see 403s (server-26#213 item 2).
const ADMIN_TABS = [{ href: "/settings/discord", label: "Discord" }];
export default function SettingsLayout({ children }: { children: React.ReactNode }) {
// SAAS_PLAN.md B7: this used to gate on isAdmin (platform admin) alone,
// which meant a paying customer who is their own org's owner couldn't
// reach their own billing/members/node-ownership settings — "admin" here
// conflated "platform operator" with "org owner". isAdmin still passes
// (support/debugging access to any org's settings), but org_role ===
// "owner" is now sufficient on its own.
const { isAdmin, isOrgOwner, loading } = useAuth();
const canAccess = isAdmin || isOrgOwner;
const pathname = usePathname();
const router = useRouter();
useEffect(() => {
if (!loading && !canAccess) router.replace("/");
}, [loading, canAccess, router]);
if (loading || !canAccess) return null;
return (
<div className="space-y-6">
<PageHeader
title="Settings"
description="Organization profile, team access, node ownership, API keys, and billing."
/>
<div className="flex flex-wrap gap-1 bg-surface border border-line rounded-lg p-1 w-fit max-w-full overflow-x-auto">
{[...TABS, ...(isAdmin ? ADMIN_TABS : [])].map((t) => (
<Link
key={t.href}
href={t.href}
className={`text-sm font-mono px-4 py-1.5 rounded-md transition-colors whitespace-nowrap ${
pathname === t.href || pathname.startsWith(t.href + "/")
? "bg-raised text-white"
: "text-ink-muted hover:text-ink"
}`}
>
{t.label}
</Link>
))}
</div>
{children}
</div>
);
}