diff --git a/artifacts/toolrate/src/components/layout.tsx b/artifacts/toolrate/src/components/layout.tsx index e19c553..0f856c1 100644 --- a/artifacts/toolrate/src/components/layout.tsx +++ b/artifacts/toolrate/src/components/layout.tsx @@ -47,8 +47,17 @@ export function Layout({ children }: { children: React.ReactNode }) { { href: "/trash", label: t("nav.trash"), icon: Trash2 }, ]; + const navLinks = [...mainLinks, ...adminLinks]; + function isActive(href: string) { - return location === href || (href !== "/" && location.startsWith(href)); + if (href === "/") return location === "/"; + if (!location.startsWith(href)) return false; + // Only the most specific active nav link should be highlighted, so a + // nested link (e.g. /admin/redundancy) wins over its parent (/admin). + const nestedActive = navLinks.some( + (l) => l.href !== href && l.href.startsWith(href) && location.startsWith(l.href), + ); + return !nestedActive; } return ( diff --git a/artifacts/toolrate/src/pages/redundancy.tsx b/artifacts/toolrate/src/pages/redundancy.tsx index 14b067a..3b38619 100644 --- a/artifacts/toolrate/src/pages/redundancy.tsx +++ b/artifacts/toolrate/src/pages/redundancy.tsx @@ -37,8 +37,16 @@ export default function RedundancyPage() { } } - function certaintyColor(c: string) { - return c === "high" ? "bg-green-100 text-green-800 border-green-300" : c === "medium" ? "bg-amber-100 text-amber-800 border-amber-300" : "bg-gray-100 text-gray-600 border-gray-300"; + function certaintyBadge(c: string) { + if (c === "high") return "default"; + if (c === "medium") return "secondary"; + return "outline"; + } + + function certaintyClass(c: string) { + if (c === "high") return "text-primary"; + if (c === "medium") return "text-primary/70"; + return "text-muted-foreground"; } return ( @@ -118,12 +126,12 @@ export default function RedundancyPage() {

{t("redundancy.comparisonsTitle")}

{group.pairs.map((pair: any, i: number) => ( - +
- + {pair.a.name} @@ -139,7 +147,7 @@ export default function RedundancyPage() {
- + {pair.b.name} @@ -151,7 +159,7 @@ export default function RedundancyPage() {
{pair.recommendation.reason && ( - + {pair.recommendation.betterName}