fix(dashboard): F4 sweep — leftovers, a11y and screen fixes deferred from the lotes (KEA-7886) (#17914)

fix(dashboard): F4 sweep — leftovers, a11y and screen fixes deferred from the lotes (KEA-7886)
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-10-22 03:50:24 -03:00
committed by GitHub
90 changed files with 2176 additions and 966 deletions

View File

@@ -653,11 +653,6 @@
"count": 2
}
},
"src/app/(dashboard)/dashboard/a2a/page.tsx": {
"@typescript-eslint/no-unused-vars": {
"count": 6
}
},
"src/app/(dashboard)/dashboard/analytics/CompressionAnalyticsTab.tsx": {
"@typescript-eslint/no-unused-vars": {
"count": 1
@@ -728,11 +723,6 @@
"count": 1
}
},
"src/app/(dashboard)/dashboard/mcp/page.tsx": {
"@typescript-eslint/no-unused-vars": {
"count": 2
}
},
"src/app/(dashboard)/dashboard/playground/components/tabs/CompareTab.tsx": {
"@typescript-eslint/no-unused-vars": {
"count": 1

View File

@@ -2,6 +2,8 @@
import { useState, useEffect, useCallback } from "react";
import { useTranslations } from "next-intl";
import { PageHeader } from "@omniroute/ui-kit/page-header";
import { interpolateNodes, nodeArgs } from "@/shared/utils/interpolateNodes";
import { Switch } from "@omniroute/ui-kit/switch";
import { Card } from "@/shared/components";
import Badge from "@/shared/components/Badge";
@@ -68,6 +70,7 @@ function DisabledPanel() {
export default function A2APage() {
const t = useTranslations("a2aDashboard");
const tSidebar = useTranslations("sidebar");
const [a2aStatus, setA2aStatus] = useState<ServiceStatus>({ online: false, loading: true });
const [a2aEnabled, setA2aEnabled] = useState(false);
const [a2aToggling, setA2aToggling] = useState(false);
@@ -129,27 +132,29 @@ export default function A2APage() {
return (
<div className="flex flex-col gap-6">
{/* Page title (lote 7 pendência 12): the shell title hides when a PageHeader is present. */}
<PageHeader compact title={tSidebar("a2a")} description={tSidebar("a2aSubtitle")} />
<Card>
<div className="flex items-start justify-between gap-4">
<div>
<p className="text-sm text-text-muted">{t("a2aIntro")}</p>
<ol className="mt-2 text-sm space-y-0.5 list-decimal list-inside text-text-muted">
<li>
{t.rich("a2aStep1", {
code: (chunks) => <code className="text-xs">{t("agentCardPath")}</code>,
{interpolateNodes(t("a2aStep1", nodeArgs(["code"])), {
code: <code className="text-xs">{t("agentCardPath")}</code>,
})}
</li>
<li>
{t.rich("a2aStep2", {
code1: (chunks) => <code className="text-xs">{t("rpcEndpoint")}</code>,
code2: (chunks) => <code className="text-xs">{t("rpcMethodSend")}</code>,
code3: (chunks) => <code className="text-xs">{t("rpcMethodStream")}</code>,
{interpolateNodes(t("a2aStep2", nodeArgs(["code1", "code2", "code3"])), {
code1: <code className="text-xs">{t("rpcEndpoint")}</code>,
code2: <code className="text-xs">{t("rpcMethodSend")}</code>,
code3: <code className="text-xs">{t("rpcMethodStream")}</code>,
})}
</li>
<li>
{t.rich("a2aStep3", {
code1: (chunks) => <code className="text-xs">{t("rpcMethodGet")}</code>,
code2: (chunks) => <code className="text-xs">{t("rpcMethodCancel")}</code>,
{interpolateNodes(t("a2aStep3", nodeArgs(["code1", "code2"])), {
code1: <code className="text-xs">{t("rpcMethodGet")}</code>,
code2: <code className="text-xs">{t("rpcMethodCancel")}</code>,
})}
</li>
</ol>

View File

@@ -239,7 +239,7 @@ export default function AgentsPage() {
<Icon name="fingerprint" size={14} className="text-text-muted" />
<p className="text-xs text-text-muted">
{t("fingerprintSettingsHint")}{" "}
<Link href="/dashboard/settings?tab=routing" className="text-primary hover:underline">
<Link href="/dashboard/settings?tab=routing" className="text-primary underline">
{t("settingsRoutingLink")}
</Link>
</p>

View File

@@ -2,6 +2,7 @@
import { useState, useEffect, useCallback, useMemo, useRef } from "react";
import { useTranslations } from "next-intl";
import { PageHeader } from "@omniroute/ui-kit/page-header";
import Icon from "@/shared/components/Icon";
import Button from "@/shared/components/Button";
import Card from "@/shared/components/Card";
@@ -56,6 +57,7 @@ function CoverageBarSkeleton(): JSX.Element {
export function AgentSkillsPageClient(): JSX.Element {
const t = useTranslations("agentSkills");
const tSidebar = useTranslations("sidebar");
// State
const [catalog, setCatalog] = useState<AgentSkill[]>([]);
@@ -208,6 +210,12 @@ export function AgentSkillsPageClient(): JSX.Element {
return (
<div className="flex flex-col gap-4">
{/* Page title (lote 7 pendência 12): the shell title hides when a PageHeader is present. */}
<PageHeader
compact
title={tSidebar("agentSkills")}
description={tSidebar("agentSkillsSubtitle")}
/>
{/* Concept card — full width */}
<SkillsConceptCard variant="agent" />

View File

@@ -163,7 +163,7 @@ export default function UploadFileModal({ onClose, onUploaded }: Props) {
/>
<span className="text-sm text-text-main text-center">{t("uploadModalDropOrPick")}</span>
<span className="text-xs text-text-muted text-center">{t("uploadModalSizeLimit")}</span>
{/* Native file picker, hidden behind the drop zone: the adapters have no file
{/* kit-exception: Native file picker, hidden behind the drop zone: the adapters have no file
input, and this one is driven by the zone's click/keyboard handlers. */}
<input
ref={inputRef}

View File

@@ -170,7 +170,7 @@ export default function InputStep({ input, onChange, destination }: InputStepPro
) : (
<span className="text-sm text-text-muted">{t("wizardDropOrPick")}</span>
)}
{/* Native file picker, hidden behind the drop zone (the adapters have no file input). */}
{/* kit-exception: Native file picker, hidden behind the drop zone (the adapters have no file input). */}
<input
ref={fileInputRef}
type="file"

View File

@@ -8,6 +8,7 @@ import EmptyState from "@/shared/components/EmptyState";
import Select from "@/shared/components/Select";
import Textarea from "@/shared/components/Textarea";
import { useLocale, useTranslations } from "next-intl";
import { PageHeader } from "@omniroute/ui-kit/page-header";
import { buttonVariants } from "@omniroute/ui-kit/button";
import { Field } from "@omniroute/ui-kit/field";
import { Switch } from "@omniroute/ui-kit/switch";
@@ -113,6 +114,7 @@ export default function CloudAgentsPage() {
const locale = useLocale();
const [activeTab, setActiveTab] = useState<TabId>("tasks");
const t = useTranslations("cloudAgents");
const tSidebar = useTranslations("sidebar");
const taskPromptId = useId();
// ── Tasks state ──────────────────────────────────────────────────────────
@@ -400,6 +402,12 @@ export default function CloudAgentsPage() {
return (
<div className="flex flex-col gap-6">
{/* Page title (lote 7 pendência 12): the shell title hides when a PageHeader is present. */}
<PageHeader
compact
title={tSidebar("cloudAgents")}
description={tSidebar("cloudAgentsSubtitle")}
/>
{/* Header */}
<Card className="border-primary/20 bg-primary/5">
<div className="flex items-start justify-between gap-4 flex-wrap">

View File

@@ -309,7 +309,7 @@ export default function AutoComboCatalog({
return (
<Card className="p-4">
{/* Raw <button> on purpose: a full-width disclosure header that carries the section
{/* kit-exception: Raw <button> on purpose: a full-width disclosure header that carries the section
heading — the kit Button is a fixed-height control, not a disclosure region. Focus
ring comes from the global :focus-visible rule (globals.css). */}
<button

View File

@@ -288,7 +288,12 @@ export default function CavemanContextPageClient() {
onChange={(event) => updateOutputMode({ autoClarity: event.target.checked })}
/>
</div>
<pre className="mt-3 overflow-auto rounded-lg border border-border bg-bg p-3 text-xs text-text-main">
<pre
// Scrollable region: keyboard users must be able to focus it (axe scrollable-region-focusable).
tabIndex={0}
aria-label={t("outputModeTitle")}
className="mt-3 overflow-auto rounded-lg border border-border bg-bg p-3 text-xs text-text-main"
>
{previewPrompt}
</pre>
<p className="mt-3 text-xs text-text-muted">

View File

@@ -72,7 +72,7 @@ function RtkTomlEditor({
<div className="mt-3 flex flex-col gap-3">
<label className="text-xs font-medium text-text-main">
{t("tomlChooseFile")}
{/* Native file picker: the kit has no file input; tokens style its button. */}
{/* kit-exception: Native file picker: the kit has no file input; tokens style its button. */}
<input
type="file"
accept=".toml,text/plain,application/toml"

View File

@@ -635,7 +635,9 @@ export default function CompressionPanel() {
/>
{/* Engine grid */}
<div className={`divide-y divide-border ${config.enabled ? "" : "opacity-60"}`}>
{/* No list-wide opacity while compression is off (it put the rows under AA, 19 axe nodes):
the selects and toggles carry their own disabled look (F4). */}
<div className="divide-y divide-border" data-disabled={config.enabled ? undefined : "true"}>
{ENGINE_IDS.map((id) => {
const meta = engineMeta(id);
const engine = config.engines[id] ?? { enabled: false };

View File

@@ -1415,17 +1415,25 @@ export default function APIPageClient({ machineId }: Readonly<APIPageClientProps
</span>
</div>
{/* Cloud OmniRoute */}
<div className="flex items-center gap-3 py-3">
{/* Cloud OmniRoute — wraps below sm: the text block keeps a minimum width so the
status pill and the action move to the next line instead of squeezing it; only
the URL may break anywhere ("Cloud sync d|estination" at 390 px, F4). */}
<div className="flex flex-wrap items-center gap-3 py-3">
<Icon name="cloud" size={18} className="text-info" />
<div className="flex-1 min-w-0">
<div className="flex-1 min-w-[12rem]">
<span className="text-sm font-medium">{t("cloudOmniroute")}</span>
<p className="text-xs text-text-muted break-all">
<p
className="text-xs text-text-muted break-words"
data-testid="cloud-sync-destination"
>
{translateOrFallback(
"cloudUploadDestination",
"Cloud sync destination (not local backups):"
)}{" "}
{cloudBaseUrl || tc("notConfigured")}
{/* break-all only for a URL: the "Not configured" fallback is words (review I-1). */}
<span className={cloudBaseUrl ? "break-all" : undefined}>
{cloudBaseUrl || tc("notConfigured")}
</span>
</p>
</div>
<span
@@ -2134,7 +2142,9 @@ export default function APIPageClient({ machineId }: Readonly<APIPageClientProps
</div>
<div className="rounded-lg border border-error/40 bg-error/10 p-4">
<p className="text-sm break-all">{cloudBaseUrl || tc("notConfigured")}</p>
<p className={cloudBaseUrl ? "text-sm break-all" : "text-sm"}>
{cloudBaseUrl || tc("notConfigured")}
</p>
<p className="text-sm mt-2">
{translateOrFallback(
"cloudUploadWarning",

View File

@@ -277,6 +277,60 @@ describe("EndpointPageClient", () => {
);
});
// F4 (wave-1 checkpoint): the whole destination line was break-all, so at 390 px the label
// split mid-word ("Cloud sync d|estination"). Only the URL may break anywhere now, and the
// row wraps instead of squeezing the text block.
it("breaks only the cloud destination URL, never the label words", async () => {
fetchMock.mockImplementation((input: RequestInfo | URL) => {
if (getRequestPath(input) === "/api/settings")
return Promise.resolve(
jsonResponse({
cloudEnabled: false,
cloudConfigured: true,
cloudUrl: "https://cloud.example",
hideEndpointCloudflaredTunnel: true,
hideEndpointTailscaleFunnel: true,
hideEndpointNgrokTunnel: true,
})
);
return Promise.resolve(jsonResponse({ data: [], providers: [], keys: [] }));
});
renderEndpointPage();
await waitForText("https://cloud.example");
const line = document.querySelector<HTMLElement>('[data-testid="cloud-sync-destination"]')!;
expect(line).not.toBeNull();
expect(line.className).not.toMatch(/\bbreak-all\b/);
expect(line.className).toMatch(/\bbreak-words\b/);
expect(line.querySelector("span.break-all")?.textContent).toContain("https://cloud.example");
expect(line.parentElement!.parentElement!.className).toMatch(/\bflex-wrap\b/);
});
it("does not break-all the 'not configured' fallback when no cloud URL is set", async () => {
fetchMock.mockImplementation((input: RequestInfo | URL) => {
if (getRequestPath(input) === "/api/settings")
return Promise.resolve(
jsonResponse({
cloudEnabled: false,
cloudConfigured: false,
hideEndpointCloudflaredTunnel: true,
hideEndpointTailscaleFunnel: true,
hideEndpointNgrokTunnel: true,
})
);
return Promise.resolve(jsonResponse({ data: [], providers: [], keys: [] }));
});
renderEndpointPage();
await waitForText("notConfigured");
const line = document.querySelector<HTMLElement>('[data-testid="cloud-sync-destination"]')!;
expect(line).not.toBeNull();
const fallback = [...line.querySelectorAll("span")].find(
(s) => s.textContent === "notConfigured"
);
expect(fallback).toBeDefined();
expect(fallback!.className).not.toMatch(/\bbreak-all\b/);
expect(line.querySelector(".break-all")).toBeNull();
});
it("renders the endpoint shell before models finish and skips hidden tunnel probes", async () => {
const modelsDeferred = createDeferred<Response>();

View File

@@ -2,6 +2,8 @@
import { useState, useEffect, useCallback } from "react";
import { useTranslations } from "next-intl";
import { PageHeader } from "@omniroute/ui-kit/page-header";
import { interpolateNodes, nodeArgs } from "@/shared/utils/interpolateNodes";
import { RadioGroup, RadioGroupItem } from "@omniroute/ui-kit/radio-group";
import { Switch } from "@omniroute/ui-kit/switch";
import { Card } from "@/shared/components";
@@ -148,6 +150,7 @@ function DisabledPanel() {
export default function McpPage() {
const t = useTranslations("mcpDashboard");
const tSidebar = useTranslations("sidebar");
const [mcpStatus, setMcpStatus] = useState<ServiceStatus>({ online: false, loading: true });
const [mcpEnabled, setMcpEnabled] = useState(false);
const [mcpToggling, setMcpToggling] = useState(false);
@@ -234,6 +237,8 @@ export default function McpPage() {
return (
<div className="flex flex-col gap-6">
{/* Page title (lote 7 pendência 12): the shell title hides when a PageHeader is present. */}
<PageHeader compact title={tSidebar("mcp")} description={tSidebar("mcpSubtitle")} />
<Card>
<div className="flex items-start justify-between gap-4">
<div>
@@ -242,15 +247,16 @@ export default function McpPage() {
</p>
<ol className="mt-2 text-sm space-y-0.5 list-decimal list-inside text-text-muted">
<li>
{t.rich("mcpStep1", {
code: (chunks) => <code className="text-xs">{chunks}</code>,
{interpolateNodes(t("mcpStep1", nodeArgs(["code"])), {
// `{code}` is an ICU argument, not a tag (see interpolateNodes).
code: <code className="text-xs">omniroute --mcp</code>,
})}
</li>
<li>{t("mcpStep2")}</li>
<li>
{t.rich("mcpStep3", {
code1: (chunks) => <code className="text-xs">omniroute_get_health</code>,
code2: (chunks) => <code className="text-xs">omniroute_list_combos</code>,
{interpolateNodes(t("mcpStep3", nodeArgs(["code1", "code2"])), {
code1: <code className="text-xs">omniroute_get_health</code>,
code2: <code className="text-xs">omniroute_list_combos</code>,
})}
</li>
</ol>

View File

@@ -179,7 +179,7 @@ export function SttExampleCard({ providerId }: Props) {
<span className="text-xs text-text-muted">{Math.round(file.size / 1024)}KB</span>
)}
</div>
{/* The native picker stays hidden behind the kit Button above (it opens it). */}
{/* kit-exception: The native picker stays hidden behind the kit Button above (it opens it). */}
<input
ref={inputRef}
id={fileInputId}

View File

@@ -341,7 +341,7 @@ export default function MemoriesTab() {
</Button>
</div>
<div className="flex gap-2 flex-wrap">
{/* Native file picker for Import (driven by the Import button; adapters have none). */}
{/* kit-exception: Native file picker for Import (driven by the Import button; adapters have none). */}
<input
type="file"
ref={fileInputRef}

View File

@@ -3,6 +3,7 @@
import { useSearchParams, useRouter } from "next/navigation";
import { Suspense } from "react";
import { useTranslations } from "next-intl";
import { PageHeader } from "@omniroute/ui-kit/page-header";
import { Switch } from "@omniroute/ui-kit/switch";
import { Tabs, TabsList, TabsTrigger } from "@omniroute/ui-kit/tabs";
import MemoryConceptCard from "./components/MemoryConceptCard";
@@ -17,6 +18,7 @@ const TABS: TabId[] = ["memories", "engine", "playground"];
function MemoryPageContent() {
const t = useTranslations("memory");
const tSidebar = useTranslations("sidebar");
const searchParams = useSearchParams();
const router = useRouter();
const { settings, save } = useMemorySettings();
@@ -33,6 +35,8 @@ function MemoryPageContent() {
return (
<div className="space-y-6">
{/* Page title (lote 7 pendência 12): the shell title hides when a PageHeader is present. */}
<PageHeader compact title={tSidebar("memory")} description={tSidebar("memorySubtitle")} />
{/* Concept card */}
<MemoryConceptCard />

View File

@@ -2,6 +2,7 @@
import { useState, useEffect, useRef } from "react";
import { useTranslations } from "next-intl";
import { PageHeader } from "@omniroute/ui-kit/page-header";
import { Tabs, TabsList, TabsTrigger } from "@omniroute/ui-kit/tabs";
import { Card } from "@/shared/components";
import { SkillsConceptCard } from "@/shared/components";
@@ -54,6 +55,7 @@ export function OmniSkillsPageClient(): JSX.Element {
const [skillsProvider, setSkillsProvider] = useState<SkillsProvider>("skillsmp");
const t = useTranslations("skills");
const tSidebar = useTranslations("sidebar");
// NOTE: commonT is intentionally unused here but retained for potential future use
useTranslations("common");
@@ -207,6 +209,12 @@ export function OmniSkillsPageClient(): JSX.Element {
return (
<div className="flex flex-col gap-6">
{/* Page title (lote 7 pendência 12): the shell title hides when a PageHeader is present. */}
<PageHeader
compact
title={tSidebar("omniSkills")}
description={tSidebar("omniSkillsSubtitle")}
/>
{/* Concept card */}
<SkillsConceptCard variant="omni" />
@@ -323,7 +331,7 @@ export function OmniSkillsPageClient(): JSX.Element {
className="h-48 resize-none font-mono text-sm"
/>
<div className="flex flex-wrap items-center gap-3 mt-3">
{/* Native file picker for the JSON upload (driven by the button; adapters have none). */}
{/* kit-exception: Native file picker for the JSON upload (driven by the button; adapters have none). */}
<input
ref={fileInputRef}
type="file"

View File

@@ -279,11 +279,15 @@ export default function OnboardingWizard() {
<div className="min-h-screen flex items-center justify-center p-4">
<div className="w-full max-w-lg">
{/* Progress Indicator */}
<ol aria-label={t("stepProgress")} className="flex items-center justify-center gap-2 mb-8">
{/* Narrow below sm: 6 dots + 5 connectors must fit 390 px (F4). */}
<ol
aria-label={t("stepProgress")}
className="flex items-center justify-center gap-1 sm:gap-2 mb-8"
>
{STEPS.map((s, i) => (
<li
key={s.id}
className="flex items-center gap-2"
className="flex items-center gap-1 sm:gap-2"
aria-current={i === step ? "step" : undefined}
>
<span
@@ -303,7 +307,7 @@ export default function OnboardingWizard() {
<span
aria-hidden="true"
className={cn(
"w-8 h-0.5 rounded-full transition-colors",
"w-3 sm:w-8 h-0.5 rounded-full transition-colors",
i < step ? "bg-success/40" : "bg-border"
)}
/>
@@ -324,7 +328,8 @@ export default function OnboardingWizard() {
currentStep.id === "done" ? "text-success" : "text-primary"
)}
/>
<h2 className="text-2xl font-bold text-text-main">{currentStep.title}</h2>
{/* The step title is the page heading (the wizard has no PageHeader). */}
<h1 className="text-2xl font-bold text-text-main">{currentStep.title}</h1>
{currentStep.id === "tiers" && (
<p className="mx-auto mt-2 max-w-md text-sm leading-relaxed text-text-muted text-balance">
{t("tier.subtitle")}

View File

@@ -324,7 +324,7 @@ function HistoryGridTable({
)}`;
const isSelected = compareMode && selectedIds.has(item.id);
return (
// 12px heatmap cell: far below the kit Button's minimum size, so it stays
// kit-exception: 12px heatmap cell: far below the kit Button's minimum size, so it stays
// a native <button> (named by aria-label, state in aria-pressed).
<button
key={item.id}

View File

@@ -116,7 +116,7 @@ export function OverviewTab({
<div className="flex flex-col gap-4 p-4 h-full overflow-auto">
<div className="grid grid-cols-3 md:grid-cols-6 gap-2">
{(Object.keys(counts) as OrchState[]).map((s) => (
// Two-line count tile that filters the board: stays a native <button> (the kit
// kit-exception: Two-line count tile that filters the board: stays a native <button> (the kit
// Button is a single-line pill), on kit tokens, with the filter state in aria-pressed.
<button
key={s}

View File

@@ -291,20 +291,30 @@ export default function ProfilePage() {
const rarityColor = RARITY_COLORS[badge.rarity] || RARITY_COLORS.common;
return (
// Multi-line badge tile (icon, name, description, date, progress): the kit Button
// kit-exception: Multi-line badge tile (icon, name, description, date, progress): the kit Button
// is a single-line pill, so the tile stays a native <button> on kit tokens.
<button
key={badge.id}
type="button"
onClick={() => !isHiddenAndLocked && setSelectedBadge(badge)}
disabled={isHiddenAndLocked}
className={`relative p-4 rounded-xl border transition-all text-left ${
// Locked: dashed border, muted surface, dimmed glyph and a lock mark. The text
// keeps full token ink — the old tile-wide opacity-50 + grayscale put names and
// descriptions under AA (36 axe color-contrast nodes, F4).
className={`relative p-4 rounded-xl border transition-all text-start ${
isEarned
? `${rarityColor} bg-surface hover:shadow-md`
: "border-border/50 bg-surface/50 opacity-50 grayscale enabled:hover:opacity-70 disabled:cursor-default"
: "border-dashed border-border bg-bg-subtle enabled:hover:border-text-muted disabled:cursor-default"
}`}
data-locked={isEarned ? undefined : "true"}
>
<div className="text-3xl mb-2">
{!isEarned && (
<span className="absolute top-2 end-2 text-text-muted">
<Icon name="lock" size={14} />
<span className="ci-sr-only">{tg("badgeLocked")}</span>
</span>
)}
<div className={`text-3xl mb-2 ${isEarned ? "" : "opacity-50 grayscale"}`}>
<BadgeIcon icon={isHiddenAndLocked ? null : badge.icon} earned={isEarned} />
</div>
<p className="font-semibold text-sm truncate">

View File

@@ -129,7 +129,7 @@ export default function HarImportButton({ provider, onImport }: HarImportButtonP
"Export from DevTools Network tab after sending at least one chat message."
)}
</span>
{/* Hidden native file input, opened by the Button above (no visible raw control). */}
{/* kit-exception: Hidden native file input, opened by the Button above (no visible raw control). */}
<input
ref={fileInputRef}
type="file"

View File

@@ -124,7 +124,7 @@ interface FilePickerRowProps {
function FilePickerRow({ fileInputRef, fileName, onFile, t }: FilePickerRowProps) {
return (
<div className="flex items-center gap-3">
{/* Hidden native file input, opened by the Button below (no visible raw control). */}
{/* kit-exception: Hidden native file input, opened by the Button below (no visible raw control). */}
<input
ref={fileInputRef}
type="file"

View File

@@ -100,7 +100,7 @@ export default function ProviderDisplayModeControl({
: "text-text-muted hover:bg-bg-primary/70 hover:text-text-main"
} ${option.disabled ? "cursor-not-allowed opacity-50" : ""}`}
>
{/* Visually hidden native radio: the label is the visible control and the radio
{/* kit-exception: Visually hidden native radio: the label is the visible control and the radio
carries the radiogroup semantics and keyboard model (kit-faithful exception). */}
<input
type="radio"

View File

@@ -266,9 +266,11 @@ export default function ProviderSummaryCard({
>
{cat.color && <CategoryDot color={cat.color} label={cat.label} />}
<span>{cat.label}</span>
{/* Full-opacity muted ink: the old opacity-70 "/total" fell to 3.28:1 on the kit
button (axe color-contrast, F4). */}
<span className="text-[11px] text-text-muted">
{cat.stat.configured}
<span className="opacity-70">/{cat.stat.total}</span>
<span>/{cat.stat.total}</span>
</span>
</Button>
);

View File

@@ -1043,7 +1043,7 @@ function KpiCard({
onClick: () => void;
active: boolean;
}) {
// Multi-line KPI tile that also filters the feed: the kit Button is a single-line pill, so
// kit-exception: Multi-line KPI tile that also filters the feed: the kit Button is a single-line pill, so
// this stays a native <button> on kit tokens (state exposed through aria-pressed).
return (
<button

View File

@@ -61,7 +61,7 @@ export default function SearchConceptCard({ defaultCollapsed = false }: SearchCo
data-testid="search-concept-card"
>
{/* Header */}
{/* Full-width disclosure header (label + chevron across the card): the kit Button is a
{/* kit-exception: Full-width disclosure header (label + chevron across the card): the kit Button is a
centred single-line pill, so the header stays a native <button> on kit tokens. */}
<button
type="button"

View File

@@ -216,7 +216,7 @@ export default function SearchForm({
{/* Filters (collapsible) */}
<div className="p-4 border-b border-border">
{/* Full-width disclosure header: stays a native <button> on kit tokens. */}
{/* kit-exception: Full-width disclosure header: stays a native <button> on kit tokens. */}
<button
type="button"
className="flex justify-between items-center w-full"

View File

@@ -50,7 +50,7 @@ export default function SearchHistory({ onReplay }: SearchHistoryProps) {
</span>
<div className="mt-2 space-y-1.5">
{entries.map((entry, i) => (
// Two-line history entry (query + provider/age): stays a native <button> on kit tokens
// kit-exception: Two-line history entry (query + provider/age): stays a native <button> on kit tokens
// (the kit Button is a single-line pill).
<button
key={`${entry.timestamp}:${entry.provider}:${entry.query}`}

View File

@@ -174,7 +174,7 @@ export default function SearchToolsConfigPane({
{/* History section (collapsible placeholder) */}
<div className="p-3 flex-1">
{/* Full-width disclosure header: stays a native <button> on kit tokens. */}
{/* kit-exception: Full-width disclosure header: stays a native <button> on kit tokens. */}
<button
type="button"
className="flex justify-between items-center w-full"

View File

@@ -2,6 +2,12 @@
import { useState, useEffect, useRef } from "react";
import { Card, Button } from "@/shared/components";
// Direct adapter imports (not the barrel): the tab's tests stub the barrel with Card/Button only.
import Icon from "@/shared/components/Icon";
import Input from "@/shared/components/Input";
import Select from "@/shared/components/Select";
import Textarea from "@/shared/components/Textarea";
import Toggle from "@/shared/components/Toggle";
import { useTranslations } from "next-intl";
import CompressionTokenSaverCard, {
type CompressionTokenSaverConfig,
@@ -361,7 +367,7 @@ export default function CompressionSettingsTab() {
return (
<Card className="p-6">
<div className="flex items-center justify-between gap-4">
<p role="alert" className="text-sm text-red-600 dark:text-red-400">
<p role="alert" className="text-sm text-error">
{t("compressionTitle")}: {tCommon("failedToLoad")}
</p>
<Button
@@ -382,23 +388,21 @@ export default function CompressionSettingsTab() {
return (
<Card className="p-6">
<div className="flex items-center gap-3 mb-5">
<div className="p-2 rounded-lg bg-blue-500/10 text-blue-500">
<span className="material-symbols-outlined text-[20px]" aria-hidden="true">
compress
</span>
<div className="p-2 rounded-lg bg-info/10 text-info">
<Icon name="compress" size={20} />
</div>
<div>
<h3 className="text-lg font-semibold">{t("compressionTitle")}</h3>
<p className="text-sm text-text-muted">{t("compressionDesc")}</p>
</div>
{status === "saved" && (
<span className="ml-auto text-xs font-medium text-emerald-500 flex items-center gap-1">
<span className="material-symbols-outlined text-[14px]">check_circle</span> {t("saved")}
<span className="ms-auto text-xs font-medium text-success flex items-center gap-1">
<Icon name="check_circle" size={14} /> {t("saved")}
</span>
)}
{status === "error" && (
<span className="ml-auto text-xs font-medium text-red-500 flex items-center gap-1">
<span className="material-symbols-outlined text-[14px]">error</span> {t("saveFailed")}
<span className="ms-auto text-xs font-medium text-error flex items-center gap-1">
<Icon name="error" size={14} /> {t("saveFailed")}
</span>
)}
</div>
@@ -410,36 +414,39 @@ export default function CompressionSettingsTab() {
<div className="space-y-3">
<h4 className="text-sm font-medium text-text-main">{t("compressionMode")}</h4>
<div className="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-7 gap-2">
{MODES.map((m) => (
<button
key={m.value}
onClick={() => save({ defaultMode: m.value })}
disabled={saving}
className={`flex items-start gap-3 p-3 rounded-lg border text-left transition-all ${
config.defaultMode === m.value
? "border-blue-500/50 bg-blue-500/5 ring-1 ring-blue-500/20"
: "border-border/50 hover:border-border hover:bg-surface/30"
}`}
>
<span
className={`material-symbols-outlined text-[20px] mt-0.5 ${
config.defaultMode === m.value ? "text-blue-500" : "text-text-muted"
{MODES.map((m) => {
const active = config.defaultMode === m.value;
return (
// kit-exception: a two-line mode tile (icon, title, description); the kit
// Button is a single-line pill. Kit tokens + the global :focus-visible ring.
<button
key={m.value}
type="button"
aria-pressed={active}
onClick={() => save({ defaultMode: m.value })}
disabled={saving}
className={`flex items-start gap-3 p-3 rounded-lg border text-start transition-all disabled:opacity-60 ${
active
? "border-info/50 bg-info/5 ring-1 ring-info/20"
: "border-border/50 hover:border-border hover:bg-surface/30"
}`}
>
{m.icon}
</span>
<div className="min-w-0">
<p
className={`text-sm font-medium ${
config.defaultMode === m.value ? "text-blue-400" : ""
}`}
>
{t(m.labelKey)}
</p>
<p className="text-xs text-text-muted mt-0.5 leading-relaxed">{t(m.descKey)}</p>
</div>
</button>
))}
<Icon
name={m.icon}
size={20}
className={`mt-0.5 ${active ? "text-info" : "text-text-muted"}`}
/>
<div className="min-w-0">
<p className={`text-sm font-medium ${active ? "text-info" : ""}`}>
{t(m.labelKey)}
</p>
<p className="text-xs text-text-muted mt-0.5 leading-relaxed">
{t(m.descKey)}
</p>
</div>
</button>
);
})}
</div>
</div>
)}
@@ -448,56 +455,38 @@ export default function CompressionSettingsTab() {
<div className="space-y-3 pt-4 border-t border-border/30">
<h4 className="text-sm font-medium text-text-main">{t("compressionGeneral")}</h4>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">{t("compressionAutoTrigger")}</span>
<div className="flex items-center gap-2">
<input
type="number"
min={0}
max={100000}
value={config.autoTriggerTokens}
onChange={(e) => save({ autoTriggerTokens: parseInt(e.target.value) || 0 })}
className="w-24 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"
/>
<span className="text-xs text-text-muted">{t("tokens")}</span>
</div>
</label>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">
{t("compressionSettingsAutoTriggerMode")}
</span>
<select
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<Input
label={t("compressionAutoTrigger")}
hint={t("tokens")}
type="number"
min={0}
max={100000}
value={config.autoTriggerTokens}
onChange={(e) => save({ autoTriggerTokens: parseInt(e.target.value) || 0 })}
/>
<Select
label={t("compressionSettingsAutoTriggerMode")}
value={config.autoTriggerMode ?? "lite"}
onChange={(e) => save({ autoTriggerMode: e.target.value as CompressionMode })}
className="w-36 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"
>
{MODES.filter((mode) => mode.value !== "off").map((mode) => (
<option key={mode.value} value={mode.value}>
{mode.value}
</option>
))}
</select>
</label>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">{t("compressionCacheTTL")}</span>
<div className="flex items-center gap-2">
<input
type="number"
min={1}
max={60}
value={config.cacheMinutes}
onChange={(e) => save({ cacheMinutes: parseInt(e.target.value) || 5 })}
className="w-24 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"
/>
<span className="text-xs text-text-muted">{t("minutes")}</span>
</div>
</label>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">{t("compressionPreserveSystem")}</span>
<select
</Select>
<Input
label={t("compressionCacheTTL")}
hint={t("minutes")}
type="number"
min={1}
max={60}
value={config.cacheMinutes}
onChange={(e) => save({ cacheMinutes: parseInt(e.target.value) || 5 })}
/>
<Select
label={t("compressionPreserveSystem")}
value={
config.preserveSystemPromptMode ??
(config.preserveSystemPrompt === false ? "whenNoCache" : "always")
@@ -507,37 +496,24 @@ export default function CompressionSettingsTab() {
preserveSystemPromptMode: e.target.value as "always" | "whenNoCache" | "never",
})
}
className="w-36 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"
data-testid="preserve-system-mode-select"
>
<option value="always">{t("compressionPreserveSystemAlways")}</option>
<option value="whenNoCache">{t("compressionPreserveSystemWhenNoCache")}</option>
<option value="never">{t("compressionPreserveSystemNever")}</option>
</select>
</label>
</Select>
</div>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">
{t("compressionSettingsMcpDescriptionCompression")}
</span>
<button
onClick={() =>
save({
mcpDescriptionCompressionEnabled:
config.mcpDescriptionCompressionEnabled === false,
})
}
className={`relative w-10 h-5 rounded-full transition-colors ${
config.mcpDescriptionCompressionEnabled !== false ? "bg-green-500" : "bg-border"
}`}
>
<span
className={`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${
config.mcpDescriptionCompressionEnabled !== false ? "left-5" : "left-0.5"
}`}
/>
</button>
</label>
<Toggle
label={t("compressionSettingsMcpDescriptionCompression")}
checked={config.mcpDescriptionCompressionEnabled !== false}
onChange={() =>
save({
mcpDescriptionCompressionEnabled:
config.mcpDescriptionCompressionEnabled === false,
})
}
/>
</div>
)}
@@ -563,39 +539,38 @@ export default function CompressionSettingsTab() {
<div className="space-y-2">
<p className="text-sm text-text-muted">{t("compressionRoles")}</p>
<div className="flex flex-wrap gap-2">
{ROLE_OPTIONS.map((opt) => (
<button
key={opt.value}
onClick={() => toggleCavemanRole(opt.value)}
className={`px-3 py-1.5 rounded-lg text-xs font-medium border transition-all ${
config.cavemanConfig!.compressRoles.includes(opt.value)
? "border-blue-500/50 bg-blue-500/10 text-blue-400"
: "border-border/50 text-text-muted hover:border-border"
}`}
>
{t(opt.labelKey)}
</button>
))}
{ROLE_OPTIONS.map((opt) => {
const on = config.cavemanConfig!.compressRoles.includes(opt.value);
return (
<Button
key={opt.value}
size="sm"
variant={on ? "secondary" : "ghost"}
aria-pressed={on}
onClick={() => toggleCavemanRole(opt.value)}
>
{t(opt.labelKey)}
</Button>
);
})}
</div>
</div>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">{t("compressionMinLength")}</span>
<input
type="number"
min={0}
max={100000}
value={config.cavemanConfig.minMessageLength}
onChange={(e) =>
save({
cavemanConfig: {
minMessageLength: parseInt(e.target.value) || 50,
},
})
}
className="w-24 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"
/>
</label>
<Input
label={t("compressionMinLength")}
type="number"
min={0}
max={100000}
value={config.cavemanConfig.minMessageLength}
onChange={(e) =>
save({
cavemanConfig: {
minMessageLength: parseInt(e.target.value) || 50,
},
})
}
className="sm:max-w-xs"
/>
{/* Caveman intensity (level) is set in the panel
(/dashboard/context/settings); kept out of this tab to avoid a
@@ -605,27 +580,30 @@ export default function CompressionSettingsTab() {
<p className="text-sm text-text-muted">{t("compressionSkipRules")}</p>
<p className="text-xs text-text-muted">{t("compressionSkipRulesDesc")}</p>
<div className="grid grid-cols-2 sm:grid-cols-3 gap-1.5">
{ruleMetadata.map((rule) => (
<button
key={rule.name}
onClick={() => toggleCavemanRule(rule.name)}
title={`${rule.category} · ${rule.context} · ${(rule.intensities ?? [rule.minIntensity]).join("/")}`}
className={`px-2 py-1 rounded text-xs border transition-all ${
config.cavemanConfig!.skipRules.includes(rule.name)
? "border-red-500/50 bg-red-500/10 text-red-400 line-through"
: "border-border/50 text-text-muted hover:border-border"
}`}
>
{rule.name.replace(/_/g, " ")}
</button>
))}
{ruleMetadata.map((rule) => {
const skipped = config.cavemanConfig!.skipRules.includes(rule.name);
return (
<Button
key={rule.name}
size="sm"
variant={skipped ? "outline" : "ghost"}
aria-pressed={skipped}
onClick={() => toggleCavemanRule(rule.name)}
title={`${rule.category} · ${rule.context} · ${(rule.intensities ?? [rule.minIntensity]).join("/")}`}
className={skipped ? "text-error line-through" : undefined}
>
{rule.name.replace(/_/g, " ")}
</Button>
);
})}
</div>
</div>
<div className="space-y-2">
<p className="text-sm text-text-muted">{t("compressionPreservePatterns")}</p>
<p className="text-xs text-text-muted">{t("compressionPreservePatternsDesc")}</p>
<textarea
<Textarea
aria-label={t("compressionPreservePatterns")}
value={(config.cavemanConfig.preservePatterns ?? []).join("\n")}
onChange={(e) => {
const patterns = e.target.value
@@ -639,7 +617,7 @@ export default function CompressionSettingsTab() {
});
}}
placeholder="https?://\S+\n```[\s\S]*?```"
className="w-full min-h-[80px] px-3 py-2 text-sm rounded-lg border border-border bg-surface text-text-main font-mono resize-y"
className="w-full min-h-[80px] font-mono resize-y"
/>
</div>
</>
@@ -648,81 +626,60 @@ export default function CompressionSettingsTab() {
{config.enabled && config.defaultMode === "aggressive" && config.aggressive && (
<div className="space-y-3 pt-4 border-t border-border/30">
<div className="flex items-center justify-between">
<div>
<h4 className="text-sm font-medium text-text-main">
{t("compressionAggressiveConfig")}
</h4>
<p className="text-xs text-text-muted mt-0.5">
{t("compressionAggressiveConfigDesc")}
</p>
</div>
<div>
<h4 className="text-sm font-medium text-text-main">
{t("compressionAggressiveConfig")}
</h4>
<p className="text-xs text-text-muted mt-0.5">
{t("compressionAggressiveConfigDesc")}
</p>
</div>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">{t("compressionSummarizerEnabled")}</span>
<button
onClick={() =>
<Toggle
label={t("compressionSummarizerEnabled")}
checked={config.aggressive.summarizerEnabled}
onChange={() =>
save({
aggressive: {
summarizerEnabled: !config.aggressive!.summarizerEnabled,
},
})
}
/>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<Input
label={t("compressionMaxTokensPerMessage")}
hint={t("tokens")}
type="number"
min={256}
max={32768}
value={config.aggressive.maxTokensPerMessage}
onChange={(e) =>
save({
aggressive: {
summarizerEnabled: !config.aggressive!.summarizerEnabled,
maxTokensPerMessage: parseInt(e.target.value) || 2048,
},
})
}
className={`relative w-10 h-5 rounded-full transition-colors ${
config.aggressive.summarizerEnabled ? "bg-green-500" : "bg-border"
}`}
>
<span
className={`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${
config.aggressive.summarizerEnabled ? "left-5" : "left-0.5"
}`}
/>
</button>
</label>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">{t("compressionMaxTokensPerMessage")}</span>
<div className="flex items-center gap-2">
<input
type="number"
min={256}
max={32768}
value={config.aggressive.maxTokensPerMessage}
onChange={(e) =>
save({
aggressive: {
maxTokensPerMessage: parseInt(e.target.value) || 2048,
},
})
}
className="w-24 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"
/>
<span className="text-xs text-text-muted">{t("tokens")}</span>
</div>
</label>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">{t("compressionMinSavings")}</span>
<div className="flex items-center gap-2">
<input
type="number"
min={0}
max={1}
step={0.01}
value={config.aggressive.minSavingsThreshold}
onChange={(e) =>
save({
aggressive: {
minSavingsThreshold: parseFloat(e.target.value) || 0.05,
},
})
}
className="w-24 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"
/>
<span className="text-xs text-text-muted">%</span>
</div>
</label>
/>
<Input
label={t("compressionMinSavings")}
hint="%"
type="number"
min={0}
max={1}
step={0.01}
value={config.aggressive.minSavingsThreshold}
onChange={(e) =>
save({
aggressive: {
minSavingsThreshold: parseFloat(e.target.value) || 0.05,
},
})
}
/>
</div>
<div className="space-y-2 pt-2">
<p className="text-sm font-medium text-text-main">
@@ -731,30 +688,24 @@ export default function CompressionSettingsTab() {
<p className="text-xs text-text-muted">{t("compressionAgingThresholdsDesc")}</p>
<div className="grid grid-cols-2 gap-2">
{(["fullSummary", "moderate", "light", "verbatim"] as const).map((tier) => (
<label
<Input
key={tier}
className="flex items-center justify-between p-2 rounded border border-border/50"
>
<span className="text-xs text-text-muted capitalize">
{tier.replace(/([A-Z])/g, " $1").trim()}
</span>
<input
type="number"
min={1}
max={100}
value={config.aggressive!.thresholds[tier]}
onChange={(e) =>
save({
aggressive: {
thresholds: {
[tier]: parseInt(e.target.value) || 2,
},
label={tier.replace(/([A-Z])/g, " $1").trim()}
type="number"
min={1}
max={100}
value={config.aggressive!.thresholds[tier]}
onChange={(e) =>
save({
aggressive: {
thresholds: {
[tier]: parseInt(e.target.value) || 2,
},
})
}
className="w-16 px-2 py-1 text-xs rounded border border-border bg-surface text-text-main"
/>
</label>
},
})
}
className="rounded border border-border/50 p-2 capitalize"
/>
))}
</div>
</div>
@@ -765,27 +716,28 @@ export default function CompressionSettingsTab() {
<div className="flex flex-wrap gap-2">
{(
["fileContent", "grepSearch", "shellOutput", "json", "errorMessage"] as const
).map((strategy) => (
<button
key={strategy}
onClick={() =>
save({
aggressive: {
toolStrategies: {
[strategy]: !config.aggressive!.toolStrategies[strategy],
).map((strategy) => {
const on = config.aggressive!.toolStrategies[strategy];
return (
<Button
key={strategy}
size="sm"
variant={on ? "secondary" : "ghost"}
aria-pressed={on}
onClick={() =>
save({
aggressive: {
toolStrategies: {
[strategy]: !config.aggressive!.toolStrategies[strategy],
},
},
},
})
}
className={`px-3 py-1.5 rounded-lg text-xs font-medium border transition-all ${
config.aggressive!.toolStrategies[strategy]
? "border-blue-500/50 bg-blue-500/10 text-blue-400"
: "border-border/50 text-text-muted hover:border-border"
}`}
>
{strategy.replace(/([A-Z])/g, " $1").trim()}
</button>
))}
})
}
>
{strategy.replace(/([A-Z])/g, " $1").trim()}
</Button>
);
})}
</div>
</div>
</div>
@@ -798,31 +750,21 @@ export default function CompressionSettingsTab() {
<p className="text-xs text-text-muted mt-0.5">{t("compressionUltraConfigDesc")}</p>
</div>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">{t("enabled")}</span>
<button
onClick={() =>
save({
ultra: {
enabled: !config.ultra!.enabled,
},
})
}
className={`relative w-10 h-5 rounded-full transition-colors ${
config.ultra.enabled ? "bg-green-500" : "bg-border"
}`}
>
<span
className={`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${
config.ultra.enabled ? "left-5" : "left-0.5"
}`}
/>
</button>
</label>
<Toggle
label={t("enabled")}
checked={config.ultra.enabled}
onChange={() =>
save({
ultra: {
enabled: !config.ultra!.enabled,
},
})
}
/>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">{t("compressionUltraRate")}</span>
<input
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<Input
label={t("compressionUltraRate")}
type="number"
min={0}
max={1}
@@ -835,13 +777,9 @@ export default function CompressionSettingsTab() {
},
})
}
className="w-24 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"
/>
</label>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">{t("compressionUltraMinScore")}</span>
<input
<Input
label={t("compressionUltraMinScore")}
type="number"
min={0}
max={1}
@@ -854,69 +792,50 @@ export default function CompressionSettingsTab() {
},
})
}
className="w-24 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"
/>
</label>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">{t("compressionMaxTokensPerMessage")}</span>
<div className="flex items-center gap-2">
<input
type="number"
min={0}
max={32768}
value={config.ultra.maxTokensPerMessage}
onChange={(e) =>
save({
ultra: {
maxTokensPerMessage: parseInt(e.target.value) || 0,
},
})
}
className="w-24 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"
/>
<span className="text-xs text-text-muted">{t("tokens")}</span>
</div>
</label>
<label className="flex items-center justify-between">
<span className="text-sm text-text-muted">{t("compressionUltraSlmFallback")}</span>
<button
onClick={() =>
save({
ultra: {
slmFallbackToAggressive: !config.ultra!.slmFallbackToAggressive,
},
})
}
className={`relative w-10 h-5 rounded-full transition-colors ${
config.ultra.slmFallbackToAggressive ? "bg-green-500" : "bg-border"
}`}
>
<span
className={`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${
config.ultra.slmFallbackToAggressive ? "left-5" : "left-0.5"
}`}
/>
</button>
</label>
<label className="block space-y-1">
<span className="text-sm text-text-muted">{t("compressionUltraModelPath")}</span>
<input
type="text"
value={config.ultra.modelPath ?? ""}
<Input
label={t("compressionMaxTokensPerMessage")}
hint={t("tokens")}
type="number"
min={0}
max={32768}
value={config.ultra.maxTokensPerMessage}
onChange={(e) =>
save({
ultra: {
modelPath: e.target.value.trim() || undefined,
maxTokensPerMessage: parseInt(e.target.value) || 0,
},
})
}
placeholder="/path/to/model.onnx"
className="w-full px-2 py-1 text-sm rounded border border-border bg-surface text-text-main font-mono"
/>
</label>
</div>
<Toggle
label={t("compressionUltraSlmFallback")}
checked={config.ultra.slmFallbackToAggressive}
onChange={() =>
save({
ultra: {
slmFallbackToAggressive: !config.ultra!.slmFallbackToAggressive,
},
})
}
/>
<Input
label={t("compressionUltraModelPath")}
type="text"
value={config.ultra.modelPath ?? ""}
onChange={(e) =>
save({
ultra: {
modelPath: e.target.value.trim() || undefined,
},
})
}
placeholder="/path/to/model.onnx"
inputClassName="font-mono"
/>
</div>
)}
</div>

View File

@@ -2,6 +2,8 @@
import Link from "next/link";
import { useTranslations } from "next-intl";
import Badge from "@/shared/components/Badge";
import Icon from "@/shared/components/Icon";
type CavemanIntensity = "lite" | "full" | "ultra";
type RtkIntensity = "minimal" | "standard" | "aggressive";
@@ -21,13 +23,9 @@ export type CompressionTokenSaverPatch = Partial<CompressionTokenSaverConfig>;
// is accepted for backward compatibility but intentionally unused).
function StatusPill({ on }: { on: boolean }) {
return (
<span
className={`rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider ${
on ? "bg-emerald-500/15 text-emerald-500" : "bg-border/50 text-text-muted"
}`}
>
<Badge variant={on ? "success" : "default"} size="sm" className="uppercase tracking-wider">
{on ? "on" : "off"}
</span>
</Badge>
);
}
@@ -88,7 +86,7 @@ export default function CompressionTokenSaverCard({
<div className="mb-1 flex items-start justify-between gap-4">
<div className="min-w-0 flex-1">
<h4 className="flex items-center gap-2 text-base font-semibold text-text-main">
<span className="material-symbols-outlined text-[21px] text-amber-500">bolt</span>
<Icon name="bolt" size={21} className="text-warning" />
{t("tokenSaverTitle")}
</h4>
<p className="mt-1 text-sm text-text-muted">{t("tokenSaverSubtitle")}</p>
@@ -121,7 +119,7 @@ export default function CompressionTokenSaverCard({
</div>
<div className="mt-4 flex items-start gap-2 border-t border-border pt-3 text-xs text-text-muted">
<span className="material-symbols-outlined mt-px text-[16px]">info</span>
<Icon name="info" size={16} className="mt-px" />
<p>
Turn these layers on/off and set their level in{" "}
<Link href="/dashboard/context/settings" className="text-primary hover:underline">

View File

@@ -2,7 +2,19 @@
import { useCallback, useEffect, useState } from "react";
import { useTranslations } from "next-intl";
import { Card } from "@/shared/components";
import { Alert } from "@omniroute/ui-kit/alert";
import { buttonVariants } from "@omniroute/ui-kit/button";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@omniroute/ui-kit/table";
import { Badge, Button, Card, Input } from "@/shared/components";
import Icon from "@/shared/components/Icon";
import { cn } from "@/shared/utils/cn";
const TRANSPARENT_MITM_PORT = 443;
@@ -78,6 +90,7 @@ async function fetchMitmStatusResult(): Promise<MitmStatusResult> {
export default function MitmProxyTab() {
const t = useTranslations("mitm");
const tCommon = useTranslations("common");
const [status, setStatus] = useState<MitmStatus>(emptyStatus);
const [loading, setLoading] = useState(true);
const [saving, setSaving] = useState(false);
@@ -192,49 +205,37 @@ export default function MitmProxyTab() {
}
};
const statusTone = status.running
? "border-emerald-500/30 bg-emerald-500/10 text-emerald-600"
: "border-border bg-sidebar text-text-muted";
return (
<Card className="p-6">
<div className="mb-6 flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between">
<div>
<h2 className="flex items-center gap-2 text-lg font-semibold text-text-main">
<span className="material-symbols-outlined text-[20px] text-primary">lan</span>
<Icon name="lan" size={20} className="text-text-muted" />
{t("title")}
</h2>
<p className="mt-1 text-sm text-text-muted">{t("description")}</p>
</div>
<div className="flex flex-wrap items-center gap-2">
<span
className={`inline-flex items-center gap-1 rounded-full border px-3 py-1 text-xs font-medium ${statusTone}`}
<Badge
variant={status.running ? "success" : "default"}
icon={status.running ? "play_circle" : "pause_circle"}
>
<span className="material-symbols-outlined text-[14px]">
{status.running ? "play_circle" : "pause_circle"}
</span>
{status.running ? t("running") : t("stopped")}
</span>
<button
onClick={() => void loadStatus()}
disabled={loading}
className="rounded-lg border border-border px-3 py-2 text-sm font-medium text-text-main transition-colors hover:bg-sidebar disabled:opacity-40"
>
</Badge>
<Button variant="outline" size="sm" onClick={() => void loadStatus()} disabled={loading}>
{t("refresh")}
</button>
</Button>
</div>
</div>
{feedback && (
<div
className={`mb-5 rounded-lg border px-4 py-3 text-sm ${
feedback.type === "success"
? "border-emerald-500/30 bg-emerald-500/10 text-emerald-600"
: "border-red-500/30 bg-red-500/10 text-red-600"
}`}
>
{feedback.message}
</div>
<Alert
className="mb-5"
variant={feedback.type === "success" ? "success" : "critical"}
description={feedback.message}
dismissLabel={tCommon("close")}
onDismiss={() => setFeedback(null)}
/>
)}
<div className="grid gap-4 lg:grid-cols-[1.1fr_0.9fr]">
@@ -245,66 +246,42 @@ export default function MitmProxyTab() {
<p className="text-sm font-semibold text-text-main">{t("enable")}</p>
<p className="text-xs text-text-muted">{t("enableDesc")}</p>
</div>
<button
<Button
variant={status.running ? "danger" : "primary"}
icon={status.running ? "stop_circle" : "play_circle"}
onClick={toggleMitm}
disabled={saving || loading}
className={`inline-flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-colors disabled:opacity-40 ${
status.running
? "bg-red-500 hover:bg-red-600 text-white"
: "bg-primary hover:bg-primary/90 text-accent-foreground"
}`}
>
<span className="material-symbols-outlined text-[18px]">
{status.running ? "stop_circle" : "play_circle"}
</span>
{status.running ? t("stop") : t("start")}
</button>
</Button>
</div>
<div className="grid gap-3 md:grid-cols-3">
<label className="space-y-1">
<span className="text-xs font-medium uppercase tracking-wider text-text-muted">
{t("port")}
</span>
<input
value={port}
readOnly
disabled={status.running}
className="w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/40 disabled:opacity-60"
/>
</label>
<label className="space-y-1">
<span className="text-xs font-medium uppercase tracking-wider text-text-muted">
{t("apiKey")}
</span>
<input
type="password"
value={apiKey}
onChange={(event) => setApiKey(event.target.value)}
placeholder={t("apiKeyPlaceholder")}
className="w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/40"
/>
</label>
<label className="space-y-1">
<span className="text-xs font-medium uppercase tracking-wider text-text-muted">
{t("sudoPassword")}
</span>
<input
type="password"
value={sudoPassword}
onChange={(event) => setSudoPassword(event.target.value)}
placeholder={status.hasCachedPassword ? t("cachedPassword") : t("sudoPassword")}
className="w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/40"
/>
</label>
<Input label={t("port")} value={port} readOnly disabled={status.running} />
<Input
label={t("apiKey")}
type="password"
value={apiKey}
onChange={(event) => setApiKey(event.target.value)}
placeholder={t("apiKeyPlaceholder")}
/>
<Input
label={t("sudoPassword")}
type="password"
value={sudoPassword}
onChange={(event) => setSudoPassword(event.target.value)}
placeholder={status.hasCachedPassword ? t("cachedPassword") : t("sudoPassword")}
/>
</div>
<button
<Button
variant="outline"
size="sm"
className="mt-3"
onClick={savePort}
disabled={saving || status.running}
className="mt-3 rounded-lg border border-border px-3 py-2 text-sm font-medium text-text-main transition-colors hover:bg-sidebar disabled:opacity-40"
>
{t("saveSettings")}
</button>
</Button>
</div>
<div className="rounded-xl border border-border bg-surface/50 p-4">
@@ -315,36 +292,31 @@ export default function MitmProxyTab() {
{status.certExists ? t("certificateReady") : t("certificateMissing")}
</p>
</div>
<span
className={`rounded-full border px-2 py-1 text-xs ${
status.certExists
? "border-emerald-500/30 bg-emerald-500/10 text-emerald-600"
: "border-amber-500/30 bg-amber-500/10 text-amber-600"
}`}
>
<Badge variant={status.certExists ? "success" : "warning"} size="sm">
{status.certExists ? t("available") : t("missing")}
</span>
</Badge>
</div>
<div className="flex flex-wrap gap-2">
<a
href="/api/settings/mitm?download=cert"
className={`inline-flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium transition-colors ${
status.certExists
? "text-text-main hover:bg-sidebar"
: "pointer-events-none text-text-muted opacity-50"
}`}
aria-disabled={!status.certExists || undefined}
className={cn(
buttonVariants({ variant: "outline", size: "sm" }),
!status.certExists && "pointer-events-none opacity-50"
)}
>
<span className="material-symbols-outlined text-[18px]">download</span>
<Icon name="download" size={18} />
{t("downloadCert")}
</a>
<button
<Button
variant="outline"
size="sm"
icon="autorenew"
onClick={regenerateCertificate}
disabled={saving || status.running}
className="inline-flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium text-text-main transition-colors hover:bg-sidebar disabled:opacity-40"
>
<span className="material-symbols-outlined text-[18px]">autorenew</span>
{t("regenerateCert")}
</button>
</Button>
</div>
</div>
</div>
@@ -380,8 +352,8 @@ export default function MitmProxyTab() {
</p>
<p className="mt-1 text-xl font-semibold text-text-main">{item.value}</p>
</div>
<span className="material-symbols-outlined rounded-lg bg-primary/10 p-2 text-[20px] text-primary">
{item.icon}
<span className="rounded-lg bg-bg-subtle p-2 text-text-muted">
<Icon name={item.icon} size={20} />
</span>
</div>
</div>
@@ -404,49 +376,42 @@ export default function MitmProxyTab() {
{status.targets.length === 0 ? (
<div className="p-6 text-center text-sm text-text-muted">{t("noTargets")}</div>
) : (
<div className="overflow-x-auto">
<table className="w-full min-w-[760px] text-left text-sm">
<thead className="text-xs uppercase tracking-wider text-text-muted">
<tr>
<th className="px-4 py-3 font-medium">{t("target")}</th>
<th className="px-4 py-3 font-medium">{t("host")}</th>
<th className="px-4 py-3 font-medium">{t("localPort")}</th>
<th className="px-4 py-3 font-medium">{t("endpoints")}</th>
<th className="px-4 py-3 font-medium">{t("status")}</th>
</tr>
</thead>
<tbody className="divide-y divide-border">
{status.targets.map((target) => (
<tr key={target.id}>
<td className="px-4 py-3 font-medium text-text-main">{target.name}</td>
<td className="px-4 py-3 font-mono text-xs text-text-muted">
{target.targetHost}:{target.targetPort}
</td>
<td className="px-4 py-3 font-mono text-xs text-text-muted">
{target.localPort}
</td>
<td className="px-4 py-3">
<div className="flex flex-wrap gap-1">
{target.endpoints.map((endpoint) => (
<span
key={endpoint}
className="rounded-full border border-border bg-surface px-2 py-0.5 text-xs text-text-muted"
>
{endpoint}
</span>
))}
</div>
</td>
<td className="px-4 py-3">
<span className="rounded-full border border-border bg-sidebar px-2 py-1 text-xs text-text-muted">
{target.enabled ? t("enabled") : t("configured")}
</span>
</td>
</tr>
))}
</tbody>
</table>
</div>
<Table className="min-w-[760px]">
<TableHeader>
<TableRow>
<TableHead>{t("target")}</TableHead>
<TableHead>{t("host")}</TableHead>
<TableHead>{t("localPort")}</TableHead>
<TableHead>{t("endpoints")}</TableHead>
<TableHead>{t("status")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{status.targets.map((target) => (
<TableRow key={target.id}>
<TableCell className="font-medium text-text-main">{target.name}</TableCell>
<TableCell className="font-mono text-xs text-text-muted">
{target.targetHost}:{target.targetPort}
</TableCell>
<TableCell className="font-mono text-xs text-text-muted">
{target.localPort}
</TableCell>
<TableCell>
<div className="flex flex-wrap gap-1">
{target.endpoints.map((endpoint) => (
<Badge key={endpoint} size="sm">
{endpoint}
</Badge>
))}
</div>
</TableCell>
<TableCell>
<Badge size="sm">{target.enabled ? t("enabled") : t("configured")}</Badge>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
)}
</div>
</Card>

View File

@@ -417,6 +417,7 @@ function FileChooser({
>
<Icon name="upload_file" size={16} />
{label}
{/* kit-exception: hidden native file input inside the chip label (no kit file picker) */}
<input type="file" accept=".json" className="sr-only" onChange={onChange} />
</label>
);

View File

@@ -308,7 +308,7 @@ export function AgentBridgeMaintenanceCard({
? t("importing") || "Importing…"
: t("importConfig") || "Import config"}
</Button>
{/* Hidden native file picker driven by the Import button above (no visible control). */}
{/* kit-exception: Hidden native file picker driven by the Import button above (no visible control). */}
<input
ref={fileInputRef}
type="file"

View File

@@ -22,7 +22,7 @@ function JsonNode({ data, depth = 0 }: { data: unknown; depth?: number }) {
if (data.length === 0) return <span className="text-text-muted">[]</span>;
return (
<span>
{/* Inline tree toggle inside a monospace line: a kit Button (fixed-height pill)
{/* kit-exception: Inline tree toggle inside a monospace line: a kit Button (fixed-height pill)
would break the line box, so this stays a native token-styled button. */}
<button
type="button"
@@ -52,7 +52,7 @@ function JsonNode({ data, depth = 0 }: { data: unknown; depth?: number }) {
if (entries.length === 0) return <span className="text-text-muted">{"{}"}</span>;
return (
<span>
{/* Inline tree toggle inside a monospace line: a kit Button (fixed-height pill)
{/* kit-exception: Inline tree toggle inside a monospace line: a kit Button (fixed-height pill)
would break the line box, so this stays a native token-styled button. */}
<button
type="button"

View File

@@ -1331,6 +1331,7 @@ export default function EvalsTab() {
>
<Icon name="upload_file" size={18} />
{t("importSuite")}
{/* kit-exception: Hidden native file picker inside the label (the adapters have no file input). */}
<input
type="file"
accept="application/json,.json"

View File

@@ -46,7 +46,7 @@ export function IntegrationCard({
disabled,
comingSoonLabel,
}: IntegrationCardProps) {
// A multi-line choice tile (icon, name, description, "coming soon" badge, check mark): the kit
// kit-exception: A multi-line choice tile (icon, name, description, "coming soon" badge, check mark): the kit
// Button is a single-line pill, so this stays a native <button> on kit tokens, with aria-pressed.
return (
<button

View File

@@ -958,6 +958,11 @@ html[dir="rtl"] :where(.material-symbols-outlined, .traffic-lights, .react-flow)
background: var(--ci-color-accent-surface-strong);
border-color: transparent;
}
/* Dark: the surface is a 14 % lime tint over the dark background, so the near-black accent
foreground vanished ("8 features" on the translator, F4); the lime itself is the ink. */
:root[data-theme="dark"] .ci-badge[data-tone="primary"] {
color: var(--ci-color-accent);
}
}
/* === OmniRoute kit extensions: trilha C === */

View File

@@ -1,5 +1,6 @@
"use client";
import { useTranslations } from "next-intl";
import Icon from "@/shared/components/Icon";
const FEATURES = [
{
@@ -120,9 +121,7 @@ export default function Features() {
<div
className={`w-10 h-10 rounded-lg ${feature.colors.iconBg} flex items-center justify-center mb-4 ${feature.colors.iconText} group-hover:scale-110 transition-transform duration-300`}
>
<span className="material-symbols-outlined" aria-hidden="true">
{feature.icon}
</span>
<Icon name={feature.icon} size={24} />
</div>
<h3
className={`text-lg font-bold mb-2 break-words ${feature.colors.titleHover} transition-colors`}

View File

@@ -3,6 +3,7 @@ import { useEffect, useState } from "react";
import { useTranslations } from "next-intl";
import ProviderIcon from "@/shared/components/ProviderIcon";
import Icon from "@/shared/components/Icon";
export default function FlowAnimation() {
const t = useTranslations("landing");
@@ -54,9 +55,7 @@ export default function FlowAnimation() {
<div className="relative h-[360px] hidden md:flex items-center justify-center animate-[float_6s_ease-in-out_infinite] overflow-hidden">
{/* OmniRoute Hub - Center */}
<div className="relative z-20 w-32 h-32 rounded-full bg-[#111520] border-2 border-[#E54D5E] shadow-[0_0_40px_rgba(229,77,94,0.3)] flex flex-col items-center justify-center gap-1 group cursor-pointer hover:scale-105 transition-transform duration-500">
<span className="material-symbols-outlined text-4xl text-[#E54D5E]" aria-hidden="true">
hub
</span>
<Icon name="hub" size={36} className="text-[#E54D5E]" />
<span className="text-xs font-bold text-white tracking-widest uppercase">
{t("brandName")}
</span>

View File

@@ -1,6 +1,7 @@
"use client";
import { useRouter } from "next/navigation";
import { useTranslations } from "next-intl";
import Icon from "@/shared/components/Icon";
export default function HeroSection() {
const t = useTranslations("landing");
@@ -35,9 +36,7 @@ export default function HeroSection() {
onClick={() => router.push("/dashboard")}
className="w-full sm:w-auto h-12 px-8 rounded-lg bg-[#E54D5E] hover:bg-[#C93D4E] text-white text-base font-bold transition-all shadow-[0_0_15px_rgba(229,77,94,0.4)] flex items-center justify-center gap-2"
>
<span className="material-symbols-outlined" aria-hidden="true">
rocket_launch
</span>
<Icon name="rocket_launch" size={20} />
{t("getStarted")}
</button>
<a
@@ -46,9 +45,7 @@ export default function HeroSection() {
rel="noopener noreferrer"
className="w-full sm:w-auto h-12 px-8 rounded-lg border border-[#2D333B] bg-[#111520] hover:bg-[#2D333B] text-white text-base font-bold transition-all flex items-center justify-center gap-2"
>
<span className="material-symbols-outlined" aria-hidden="true">
code
</span>
<Icon name="code" size={20} />
{t("viewOnGithub")}
</a>
</div>

View File

@@ -1,5 +1,6 @@
"use client";
import { useTranslations } from "next-intl";
import Icon from "@/shared/components/Icon";
export default function HowItWorks() {
const t = useTranslations("landing");
@@ -19,9 +20,7 @@ export default function HowItWorks() {
{/* Step 1: CLI & SDKs */}
<div className="flex flex-col gap-6 relative group">
<div className="w-24 h-24 rounded-2xl bg-[#0B0E14] border border-[#2D333B] flex items-center justify-center shadow-xl group-hover:border-gray-500 transition-colors z-10 mx-auto md:mx-0">
<span className="material-symbols-outlined text-4xl text-gray-300" aria-hidden="true">
terminal
</span>
<Icon name="terminal" size={36} className="text-gray-300" />
</div>
<div>
<h3 className="text-xl font-bold mb-2 break-words">{t("howItWorksStep1Title")}</h3>
@@ -32,12 +31,7 @@ export default function HowItWorks() {
{/* Step 2: OmniRoute Hub */}
<div className="flex flex-col gap-6 relative group md:items-center md:text-center">
<div className="w-24 h-24 rounded-2xl bg-[#0B0E14] border-2 border-[#E54D5E] flex items-center justify-center shadow-[0_0_30px_rgba(229,77,94,0.2)] z-10 mx-auto">
<span
className="material-symbols-outlined text-4xl text-[#E54D5E] animate-pulse"
aria-hidden="true"
>
hub
</span>
<Icon name="hub" size={36} className="text-[#E54D5E] animate-pulse" />
</div>
<div>
<h3 className="text-xl font-bold mb-2 text-[#E54D5E] break-words">

View File

@@ -1,7 +1,7 @@
import "./globals.css";
import { ThemeProvider } from "@/shared/components/ThemeProvider";
import { NextIntlClientProvider } from "next-intl";
import { getMessages, getLocale, getTranslations } from "next-intl/server";
import { getMessages, getLocale } from "next-intl/server";
import { RTL_LOCALES } from "@/i18n/config";
import { normalizeComplianceEventTypes } from "@/i18n/request";
import { pickMessages } from "@/i18n/pickMessages";
@@ -52,7 +52,6 @@ export async function generateMetadata() {
export default async function RootLayout({ children }) {
const locale = await getLocale();
const t = await getTranslations("sidebar");
// Serialize ONLY the public-surface namespaces into the flight payload.
// The full merged catalog is ~664 KB across 132 namespaces and used to be
// embedded in every rendered page (757-865 KB HTML even for /login and
@@ -142,13 +141,9 @@ export default async function RootLayout({ children }) {
}}
/>
</head>
{/* No skip link here: its #main-content target exists only in the dashboard shell, which
renders its own skip link as the first tab stop (F4). */}
<body className="font-sans antialiased" suppressHydrationWarning>
<a
href="#main-content"
className="sr-only focus:not-sr-only focus:absolute focus:top-2 focus:left-2 focus:z-50 focus:px-4 focus:py-2 focus:bg-accent focus:text-accent-foreground focus:rounded-lg focus:text-sm focus:font-semibold focus:shadow-lg"
>
{t("skipToContent")}
</a>
<NextIntlClientProvider locale={locale} messages={messages}>
<BasePathNetworkProvider>
<PwaRegister />

View File

@@ -13642,7 +13642,8 @@
}
},
"leaderboardTitle": "Leaderboard",
"leaderboardDescription": "Rankings and achievements across your API keys"
"leaderboardDescription": "Rankings and achievements across your API keys",
"badgeLocked": "Locked"
},
"featureFlags": {
"title": "Feature Flags",

View File

@@ -13642,7 +13642,8 @@
}
},
"leaderboardTitle": "Ranking",
"leaderboardDescription": "Classificação e conquistas entre as suas chaves de API"
"leaderboardDescription": "Classificação e conquistas entre as suas chaves de API",
"badgeLocked": "Bloqueado"
},
"featureFlags": {
"title": "Sinalizadores de recursos",

View File

@@ -13642,7 +13642,8 @@
}
},
"leaderboardTitle": "Bảng xếp hạng",
"leaderboardDescription": "Xếp hạng và thành tích giữa các khóa API của bạn"
"leaderboardDescription": "Xếp hạng và thành tích giữa các khóa API của bạn",
"badgeLocked": "Đã khóa"
},
"featureFlags": {
"title": "Cờ tính năng",

View File

@@ -13,7 +13,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -44,7 +43,6 @@
"kimiSponsorBanner",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"providers",
@@ -77,7 +75,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -108,7 +105,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -137,7 +133,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -165,7 +160,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -193,7 +187,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -223,7 +216,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -253,7 +245,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -284,7 +275,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -312,7 +302,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -340,7 +329,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -369,7 +357,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"media",
"noAuthProvider",
"oauthModal",
@@ -400,7 +387,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -429,7 +415,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -460,7 +445,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -491,7 +475,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -520,7 +503,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -551,7 +533,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -580,7 +561,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -610,7 +590,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -642,7 +621,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"omniglyph",
@@ -672,7 +650,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -700,7 +677,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"providers",
@@ -735,7 +711,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -765,7 +740,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"mcpDashboard",
"noAuthProvider",
"oauthModal",
@@ -795,7 +769,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -824,7 +797,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -852,7 +824,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -882,7 +853,6 @@
"health",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"providerHealthAutopilot",
@@ -915,7 +885,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -943,7 +912,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -971,7 +939,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -999,7 +966,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"loggers",
"logs",
"noAuthProvider",
@@ -1029,7 +995,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"mcpDashboard",
"noAuthProvider",
"oauthModal",
@@ -1058,7 +1023,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"media",
"miniPlayground",
"noAuthProvider",
@@ -1089,7 +1053,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"memory",
"noAuthProvider",
"oauthModal",
@@ -1118,7 +1081,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"modelCatalog",
"noAuthProvider",
"oauthModal",
@@ -1147,7 +1109,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -1176,7 +1137,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"onboarding",
@@ -1206,7 +1166,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"orchestration",
@@ -1235,7 +1194,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"playground",
@@ -1265,7 +1223,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"plugins",
@@ -1295,7 +1252,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -1323,7 +1279,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"providerStats",
@@ -1355,7 +1310,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"media",
"miniPlayground",
"noAuthProvider",
@@ -1389,7 +1343,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -1419,7 +1372,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -1452,7 +1404,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -1481,7 +1432,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -1511,7 +1461,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -1541,7 +1490,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"playground",
@@ -1575,7 +1523,6 @@
"health",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"mitm",
"noAuthProvider",
"oauthModal",
@@ -1611,7 +1558,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -1641,7 +1587,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -1671,7 +1616,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -1699,7 +1643,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -1731,7 +1674,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",
@@ -1761,7 +1703,6 @@
"header",
"kiroAuthModal",
"kiroSocialOAuthModal",
"landing",
"noAuthProvider",
"oauthModal",
"proxyConfigModal",

View File

@@ -13,17 +13,19 @@
import { useState, useEffect, useRef, useCallback } from "react";
import { useRouter } from "next/navigation";
import { useTranslations } from "next-intl";
import Button from "./Button";
import Icon from "./Icon";
// #6147 — user-facing labels renamed from "Cloud …" to "Remote Settings Sync"
// wording (this feature syncs the operator's own settings to their own remote
// store — it is not a cloud/telemetry service). Internal state keys, the
// `cloud_*` material icons and the cloudSync.* wiring are intentionally kept.
const STATUS_CONFIG = {
connected: { icon: "cloud_done", color: "text-green-500", labelKey: "synced" },
syncing: { icon: "cloud_sync", color: "text-blue-400 animate-pulse", labelKey: "syncing" },
disconnected: { icon: "cloud_off", color: "text-amber-500", labelKey: "off" },
error: { icon: "cloud_off", color: "text-red-400", labelKey: "error" },
disabled: { icon: "cloud_off", color: "text-text-muted/50", labelKey: "disabled" },
connected: { icon: "cloud_done", color: "text-success", labelKey: "synced" },
syncing: { icon: "cloud_sync", color: "text-info animate-pulse", labelKey: "syncing" },
disconnected: { icon: "cloud_off", color: "text-warning", labelKey: "off" },
error: { icon: "cloud_off", color: "text-error", labelKey: "error" },
disabled: { icon: "cloud_off", color: "text-text-muted", labelKey: "disabled" },
};
export default function CloudSyncStatus({ collapsed = false }) {
@@ -82,9 +84,12 @@ export default function CloudSyncStatus({ collapsed = false }) {
const label = t(config.labelKey);
return (
<button
<Button
variant="ghost"
size="sm"
fullWidth
onClick={() => router.push("/dashboard/endpoint")}
className="flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg hover:bg-white/5 transition-colors cursor-pointer w-full"
className="justify-start gap-2 px-3 text-xs"
title={
lastSync
? t("lastSync", {
@@ -95,16 +100,12 @@ export default function CloudSyncStatus({ collapsed = false }) {
}
aria-label={t("statusLabel", { status: label })}
>
<span className={`material-symbols-outlined text-[16px] ${config.color}`} aria-hidden="true">
{config.icon}
</span>
<Icon name={config.icon} size={16} className={config.color} />
{!collapsed && (
<span
className={`truncate ${status === "connected" ? "text-green-500" : "text-text-muted"}`}
>
<span className={`truncate ${status === "connected" ? "text-success" : "text-text-muted"}`}>
{label}
</span>
)}
</button>
</Button>
);
}

View File

@@ -71,6 +71,13 @@ function CommandPaletteDialog({ onClose }: { onClose: () => void }) {
const [hiddenItems, setHiddenItems] = useState<Set<string>>(new Set());
const [activePreset, setActivePreset] = useState<string | null>(null);
const [radarAdminUrl, setRadarAdminUrl] = useState<unknown>(null);
// The palette has no DialogTrigger (Radix's own focus return target) and mounts fresh on
// open, so the element focused before the first render is the one to return to on close.
const [opener] = useState<HTMLElement | null>(() => {
if (typeof document === "undefined") return null;
const active = document.activeElement;
return active instanceof HTMLElement && active !== document.body ? active : null;
});
useEffect(() => {
const ctrl = new AbortController();
@@ -265,6 +272,10 @@ function CommandPaletteDialog({ onClose }: { onClose: () => void }) {
<DialogContent
showCloseButton={false}
aria-describedby={undefined}
onCloseAutoFocus={(e) => {
e.preventDefault();
if (opener?.isConnected) opener.focus();
}}
className="top-[10vh] max-w-3xl overflow-hidden p-0 [animation-name:ci-fade-in] [transform:translateX(-50%)]"
>
<DialogTitle className="ci-sr-only">{t("commandPalette.title")}</DialogTitle>
@@ -340,6 +351,7 @@ function CommandPaletteDialog({ onClose }: { onClose: () => void }) {
aria-selected={selected}
data-flat-index={flatIndex}
>
{/* kit-exception: Native button styled as the kit menu row (.ci-menu__item). */}
<button
type="button"
className={cn(

View File

@@ -293,7 +293,7 @@ export default function ConsoleLogViewer() {
<div className="text-[#8b949e] text-center py-12">
<Icon name="terminal" size={40} className="block mb-2 opacity-30" />
<p>{t("noLogEntries")}</p>
<p className="text-[10px] mt-1 opacity-60">{tv("emptyFileLoggingHint")}</p>
<p className="text-[10px] mt-1">{tv("emptyFileLoggingHint")}</p>
</div>
) : (
filteredLogs.map((entry, idx) => {
@@ -312,7 +312,7 @@ export default function ConsoleLogViewer() {
}`}
>
{/* Timestamp */}
<span className="text-[#484f58] whitespace-nowrap shrink-0 select-none">
<span className="text-[#8b949e] whitespace-nowrap shrink-0 select-none">
{formatTime(entry.timestamp)}
</span>
@@ -331,7 +331,7 @@ export default function ConsoleLogViewer() {
{msg}
{/* Extra meta */}
{correlationId && (
<span className="text-[#484f58] ml-2">cid:{correlationId.slice(0, 8)}</span>
<span className="text-[#8b949e] ml-2">cid:{correlationId.slice(0, 8)}</span>
)}
</span>

View File

@@ -1,154 +0,0 @@
"use client";
import { useTranslations } from "next-intl";
import Link from "next/link";
import { Separator } from "@omniroute/ui-kit/separator";
import { APP_CONFIG } from "@/shared/constants/appConfig";
type FooterLink = { key: string; href: string; external?: boolean };
const footerLinks: Record<"product" | "resources" | "company", FooterLink[]> = {
product: [
{ key: "featuresLink", href: "#features" },
{ key: "pricing", href: "#pricing" },
{
key: "changelog",
href: "https://github.com/diegosouzapw/OmniRoute/releases",
external: true,
},
],
resources: [
{ key: "documentation", href: "/docs" },
{ key: "apiReference", href: "/docs#api-reference" },
{
key: "helpCenter",
href: "https://github.com/diegosouzapw/OmniRoute/discussions",
external: true,
},
],
company: [
{ key: "about", href: "https://github.com/diegosouzapw/OmniRoute", external: true },
{ key: "blog", href: "https://github.com/diegosouzapw/OmniRoute/releases", external: true },
{
key: "contact",
href: "https://github.com/diegosouzapw/OmniRoute/issues/new/choose",
external: true,
},
{ key: "terms", href: "/terms" },
{ key: "privacy", href: "/privacy" },
],
};
export default function Footer() {
const t = useTranslations("landing");
const linkClass = "transition-colors hover:text-heading";
const renderFooterLink = (link: FooterLink) => {
if (link.external) {
return (
<a href={link.href} target="_blank" rel="noopener noreferrer" className={linkClass}>
{t(link.key)}
</a>
);
}
return (
<Link href={link.href} className={linkClass}>
{t(link.key)}
</Link>
);
};
return (
<footer className="border-t border-border bg-bg pt-16 pb-12">
<div className="container mx-auto px-4 sm:px-6 lg:px-8">
<div className="mb-12 grid grid-cols-2 gap-10 md:grid-cols-4 lg:grid-cols-5">
{/* Brand */}
<div className="col-span-2 lg:col-span-2">
<div className="mb-6 flex items-center gap-2">
<div className="size-6 text-heading">
<svg
className="h-full w-full"
fill="currentColor"
viewBox="0 0 48 48"
aria-hidden="true"
>
<path
clipRule="evenodd"
d="M12.0799 24L4 19.2479L9.95537 8.75216L18.04 13.4961L18.0446 4H29.9554L29.96 13.4961L38.0446 8.75216L44 19.2479L35.92 24L44 28.7521L38.0446 39.2479L29.96 34.5039L29.9554 44H18.0446L18.04 34.5039L9.95537 39.2479L4 28.7521L12.0799 24Z"
fillRule="evenodd"
/>
</svg>
</div>
<span className="ci-heading text-xl">{APP_CONFIG.name}</span>
</div>
<p className="mb-6 max-w-sm text-text-muted">{t("footerDescription")}</p>
{/* Social links */}
<div className="flex gap-4">
<a
href="https://github.com/diegosouzapw/OmniRoute/discussions"
target="_blank"
rel="noopener noreferrer"
className="text-text-muted transition-colors hover:text-heading"
aria-label={t("communityDiscussions")}
>
<svg className="h-5 w-5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path d="M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z" />
</svg>
</a>
<a
href="https://github.com/diegosouzapw/OmniRoute"
target="_blank"
rel="noopener noreferrer"
className="text-text-muted transition-colors hover:text-heading"
aria-label="GitHub"
>
<svg className="h-5 w-5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z" />
</svg>
</a>
</div>
</div>
{(Object.keys(footerLinks) as (keyof typeof footerLinks)[]).map((group) => (
<div key={group}>
<h4 className="ci-eyebrow mb-4">{t(group)}</h4>
<ul className="flex flex-col gap-3 text-sm text-text-muted">
{footerLinks[group].map((link) => (
<li key={link.key}>{renderFooterLink(link)}</li>
))}
</ul>
</div>
))}
</div>
<Separator className="mb-8" />
{/* Bottom */}
<div className="flex flex-col items-center justify-between gap-4 md:flex-row">
<p className="text-sm text-text-muted">
{t("copyright", { year: new Date().getFullYear() })}
</p>
<div className="flex gap-6 text-sm text-text-muted">
<Link href="/docs" className={linkClass}>
{t("documentation")}
</Link>
<Link href="/terms" className={linkClass}>
{t("terms")}
</Link>
<Link href="/privacy" className={linkClass}>
{t("privacy")}
</Link>
<a
href="https://github.com/diegosouzapw/OmniRoute/blob/main/LICENSE"
target="_blank"
rel="noopener noreferrer"
className={linkClass}
>
{t("license")}
</a>
</div>
</div>
</div>
</footer>
);
}

View File

@@ -12,6 +12,33 @@ const getPlatformIsMac = () => {
return /Mac|iPhone|iPad|iPod/.test(platform);
};
const getPlatformIsMacServer = () => false;
// One title per page (F4): 67+ dashboard pages render a kit PageHeader (their own h1), and the
// shell title repeated it ("API Keys" × "API Key Management", two h1s). The shell title is
// dropped from the DOM while a PageHeader is mounted — removed, not CSS-hidden, so `h1` locators
// and the accessibility tree see exactly one page heading. SSR and hydration render the title
// (server snapshot false); client navigation re-checks through the observer. Scoped to the shell's
// content region (#main-content): a PageHeader inside a portalled dialog does not count, and the
// observer does not wake on unrelated body mutations (review M-1/N-6).
const PAGE_HEADER_SELECTOR = "#main-content .ci-page-header";
const contentRoot = () => document.getElementById("main-content") ?? document.body;
function subscribePageHeader(onChange: () => void) {
let frame = 0;
const observer = new MutationObserver(() => {
if (frame) return;
frame = requestAnimationFrame(() => {
frame = 0;
onChange();
});
});
observer.observe(contentRoot(), { childList: true, subtree: true });
return () => {
observer.disconnect();
if (frame) cancelAnimationFrame(frame);
};
}
const getPageHasHeader = () => document.querySelector(PAGE_HEADER_SELECTOR) !== null;
const getPageHasHeaderServer = () => false;
import ThemeToggle from "./ThemeToggle";
import TokenHealthBadge from "./TokenHealthBadge";
import DegradationBadge from "./DegradationBadge";
@@ -188,6 +215,11 @@ function usePageInfo(pathname: string | null): PageInfo {
*/
export default function Header({ onOpenCommandPalette }: HeaderProps) {
const isMac = useSyncExternalStore(subscribePlatform, getPlatformIsMac, getPlatformIsMacServer);
const pageHasHeader = useSyncExternalStore(
subscribePageHeader,
getPageHasHeader,
getPageHasHeaderServer
);
const pathname = usePathname();
const router = useRouter();
const isElectron = useIsElectron();
@@ -233,7 +265,8 @@ export default function Header({ onOpenCommandPalette }: HeaderProps) {
<Icon name="menu" size={18} />
</SidebarTrigger>
<div className="hidden min-w-0 items-center gap-3 lg:flex">
{(icon || providerId) && (
{/* The icon tile goes with the title: alone it would be an orphan glyph (review M-2). */}
{(icon || providerId) && !pageHasHeader && (
<span className="flex size-9 shrink-0 items-center justify-center rounded-control bg-accent-light text-heading">
{icon ? (
<Icon name={icon} size={20} />
@@ -242,7 +275,7 @@ export default function Header({ onOpenCommandPalette }: HeaderProps) {
)}
</span>
)}
{title && (
{title && !pageHasHeader && (
<div className="min-w-0">
<h1 className="ci-heading truncate text-lg">{title}</h1>
{description && <p className="truncate text-xs text-text-muted">{description}</p>}

View File

@@ -14,6 +14,7 @@ interface InfoTooltipProps {
export default function InfoTooltip({ text, className }: InfoTooltipProps) {
return (
<Tooltip content={text} multiline delayMs={100}>
{/* kit-exception: an inline 16 px info trigger; the kit icon Button is a 32 px control */}
<button
type="button"
aria-label={text}

View File

@@ -34,7 +34,7 @@ function CountryFlag({ emoji, alt }: { emoji: string; alt: string }) {
return (
<img
src={`https://flagcdn.com/w40/${countryCode}.png`}
className="w-4.5 h-3 object-cover rounded-2xs shrink-0 shadow-2xs border border-black/5 dark:border-white/5"
className="w-4.5 h-3 object-cover rounded-2xs shrink-0 shadow-2xs border border-border/50"
alt={alt}
onError={() => setError(true)}
/>

View File

@@ -11,6 +11,8 @@
import { useState, useEffect } from "react";
import { useRef } from "react";
import { useTranslations } from "next-intl";
import Button from "./Button";
import Icon from "./Icon";
export default function MaintenanceBanner() {
const [show, setShow] = useState(false);
@@ -65,23 +67,25 @@ export default function MaintenanceBanner() {
if (!show) return null;
return (
<div className="bg-amber-500/10 border-b border-amber-500/20 px-4 py-2.5 flex items-center justify-between gap-3 animate-in slide-in-from-top">
<div
role="status"
className="bg-warning-bg border-b border-warning/30 px-4 py-2.5 flex items-center justify-between gap-3 animate-in slide-in-from-top"
>
<div className="flex items-center gap-2.5">
<span className="material-symbols-outlined text-amber-500 text-[18px] animate-pulse">
warning
</span>
<span className="text-sm text-amber-200">{message}</span>
<Icon name="warning" size={18} className="text-warning animate-pulse" />
<span className="text-sm text-text-main">{message}</span>
</div>
<button
<Button
variant="ghost"
size="icon"
onClick={() => {
dismissedUntilRecoveryRef.current = true;
setShow(false);
}}
className="p-1 rounded hover:bg-white/5 text-text-muted hover:text-text-main transition-colors"
aria-label={t("close")}
>
<span className="material-symbols-outlined text-[16px]">close</span>
</button>
<Icon name="close" size={16} />
</Button>
</div>
);
}

View File

@@ -1,6 +1,6 @@
"use client";
import { useRef } from "react";
import { useRef, useState } from "react";
import { useTranslations } from "next-intl";
import {
Dialog,
@@ -68,11 +68,21 @@ const SIZES = {
full: "max-w-4xl",
} as const;
// The element focused right now, unless it is <body> (nothing to return to).
function currentFocus(): HTMLElement | null {
if (typeof document === "undefined") return null;
const active = document.activeElement;
return active instanceof HTMLElement && active !== document.body ? active : null;
}
// Initial focus, the focus trap, Escape, body scroll lock and the aria-labelledby
// wiring are Radix's (via the kit Dialog). Focus restoration is ours:
// Radix's modal content restores focus to its own DialogTrigger, which a controlled
// `isOpen` never uses, so we remember the opener when the dialog takes focus and put
// focus back on it when the dialog closes (nothing happens if it left the DOM).
// `isOpen` never uses, so we remember the opener and put focus back on it when the dialog
// closes (nothing happens if it left the DOM). The opener is captured while rendering the
// open transition, before the commit: a field with `autoFocus` takes focus during the commit,
// and Radix's FocusScope then skips onOpenAutoFocus (focus is already inside), so capturing
// there alone lost the opener and dropped focus on <body> (F1 checkpoint, "Create API Key").
export default function Modal({
isOpen,
onClose,
@@ -89,6 +99,16 @@ export default function Modal({
}: ModalProps) {
const t = useTranslations("common");
const openerRef = useRef<HTMLElement | null>(null);
// "Adjust state while rendering" (react.dev): runs before the commit that mounts the content.
const [wasOpen, setWasOpen] = useState(isOpen);
const [renderOpener, setRenderOpener] = useState<HTMLElement | null>(() =>
isOpen ? currentFocus() : null
);
// Kept (not cleared) on close: the closing render still feeds onCloseAutoFocus.
if (isOpen !== wasOpen) {
setWasOpen(isOpen);
if (isOpen) setRenderOpener(currentFocus());
}
const inlineMaxWidth = maxWidth && /\d/.test(maxWidth) ? maxWidth : undefined;
// Resolved only when a string title is missing, so a locale catalog that has not
// received `common.dialogTitleFallback` yet is never asked for it needlessly.
@@ -116,11 +136,11 @@ export default function Modal({
style={inlineMaxWidth ? { maxWidth: inlineMaxWidth } : undefined}
onOpenAutoFocus={() => {
const active = document.activeElement;
openerRef.current = active instanceof HTMLElement ? active : null;
openerRef.current = renderOpener ?? (active instanceof HTMLElement ? active : null);
}}
onCloseAutoFocus={(e) => {
e.preventDefault();
const opener = openerRef.current;
const opener = openerRef.current ?? renderOpener;
openerRef.current = null;
if (opener?.isConnected) opener.focus();
}}

View File

@@ -564,10 +564,12 @@ export default function RequestTimeline({
return (
<div className="flex flex-col h-full min-h-0 select-none">
{/* Header */}
{/* Header — HEADER_HEIGHT is a minimum, not a fixed height: below ~1100 px the controls
wrap to a second row instead of being clipped (390 px, F4). Nothing in the canvas
maths reads the header height (the canvas is the flex-1 sibling). */}
<div
className="flex items-center justify-between px-4 py-2 border-b border-border shrink-0"
style={{ height: HEADER_HEIGHT }}
className="flex flex-wrap items-center justify-between gap-x-3 gap-y-2 px-4 py-2 border-b border-border shrink-0"
style={{ minHeight: HEADER_HEIGHT }}
>
<div className="flex items-center gap-3">
<h2 className="text-sm font-semibold text-text-main">{t("title")}</h2>
@@ -575,7 +577,7 @@ export default function RequestTimeline({
{t("visibleCount", { visible: visibleLogs.length, total: logs.length })}
</span>
</div>
<div className="flex items-center gap-2">
<div className="flex flex-wrap items-center gap-2">
{/* Mode selector */}
<div role="group" aria-label={t("modeLabel")} className="flex items-center gap-0.5">
{(["follow", "live", "pan"] as ViewMode[]).map((m) => (

View File

@@ -31,7 +31,7 @@ import OmniRouteLogo, { OmniRouteLockup } from "./OmniRouteLogo";
import Icon from "./Icon";
import Button from "./Button";
import Input from "./Input";
import { ConfirmModal } from "./Modal";
import Modal, { ConfirmModal } from "./Modal";
import CloudSyncStatus from "./CloudSyncStatus";
import { useTranslations } from "next-intl";
import {
@@ -570,6 +570,8 @@ export default function Sidebar({ isMacElectron = false }: SidebarProps) {
)}
</SidebarMenuButton>
{showPin && (
// kit-exception: Native button on kit tokens (track F): the pin overlays the kit SidebarMenuButton
// (absolute, hover-revealed); the kit has no SidebarMenuAction slot.
<button
type="button"
onClick={(e) => {
@@ -608,6 +610,7 @@ export default function Sidebar({ isMacElectron = false }: SidebarProps) {
return (
<SidebarMenuItem key={child.id} className="mt-1">
{!separatorHidden && (
// kit-exception: Native disclosure button on kit tokens (track F): full-width subgroup header row.
<button
type="button"
aria-expanded={groupExpanded}
@@ -755,6 +758,8 @@ export default function Sidebar({ isMacElectron = false }: SidebarProps) {
return (
<SidebarGroup key={section.id}>
<SidebarGroupLabel className="group/header h-auto gap-1 px-0">
{/* kit-exception: Native disclosure button on kit tokens (track F): a full-width section header
inside the kit SidebarGroupLabel (the kit Button is a fixed-height pill). */}
<button
type="button"
onClick={() => toggleSection(sectionId)}
@@ -770,6 +775,8 @@ export default function Sidebar({ isMacElectron = false }: SidebarProps) {
/>
</button>
{sectionId !== "pinned" && (
// kit-exception: Native button on kit tokens (track F): a hover-revealed pin inside the kit
// SidebarGroupLabel; the kit has no SidebarGroupAction slot.
<button
type="button"
onClick={() => togglePin(sectionId)}
@@ -866,20 +873,26 @@ export default function Sidebar({ isMacElectron = false }: SidebarProps) {
loading={isRestarting}
/>
{isDisconnected && (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm">
<div className="text-center p-8">
<div className="flex items-center justify-center size-16 rounded-full bg-red-500/20 text-red-500 mx-auto mb-4">
<Icon name="power_off" size={32} />
</div>
<h2 className="text-xl font-semibold text-white mb-2">{t("serverDisconnected")}</h2>
<p className="text-text-muted mb-6">{t("serverDisconnectedMsg")}</p>
<Button variant="secondary" onClick={() => globalThis.location.reload()}>
{t("reloadPage")}
</Button>
{/* Blocking notice after shutdown: a kit dialog (focus trap, aria-modal) that cannot be
dismissed — Escape and the overlay are no-ops, reloading is the only way out. */}
<Modal
isOpen={isDisconnected}
onClose={() => {}}
title={t("serverDisconnected")}
closeOnOverlay={false}
showCloseButton={false}
size="sm"
>
<div className="text-center">
<div className="flex items-center justify-center size-16 rounded-full bg-error-bg text-error mx-auto mb-4">
<Icon name="power_off" size={32} />
</div>
<p className="text-text-muted mb-6">{t("serverDisconnectedMsg")}</p>
<Button variant="secondary" onClick={() => globalThis.location.reload()}>
{t("reloadPage")}
</Button>
</div>
)}
</Modal>
</>
);
}

View File

@@ -16,7 +16,6 @@ export { default as ThemeToggle } from "./ThemeToggle";
export { ThemeProvider } from "./ThemeProvider";
export { default as Sidebar } from "./Sidebar";
export { default as Header } from "./Header";
export { default as Footer } from "./Footer";
export { default as OAuthModal } from "./OAuthModal";
export { default as ModelSelectModal } from "./ModelSelectModal";
export { default as ModelSelectField } from "./ModelSelectField";

View File

@@ -11,8 +11,8 @@ export default function AuthLayout({ children }: AuthLayoutProps) {
return (
<div className="min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary">
{/* Background effects */}
<div className="fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0" />
<div className="fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3" />
<div className="fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0" />
<div className="fixed bottom-0 right-0 w-[600px] h-[600px] bg-warning/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3" />
{/* Theme toggle */}
<div className="absolute top-6 right-6 z-20">

View File

@@ -310,10 +310,48 @@ import {
SquareCode,
Stethoscope,
} from "lucide-react";
// F4 sweep (KEA-7886): the last null entries + lookup-object values the literal scanner missed.
// Droplet and Mail are imported by the blocks above.
import {
Aperture,
ArrowBigUp,
AudioWaveform,
BellRing,
Bird,
Box,
Boxes,
BrainCog,
BriefcaseBusiness,
Brush,
CircuitBoard,
CloudCheck,
Factory,
Fence,
Flower2,
Gem,
Handshake,
LayoutDashboard,
Leaf,
MicVocal,
PackageCheck,
PackageOpen,
PawPrint,
Plane,
Router,
ScanText,
ShieldPlus,
Smile,
Table2,
UserLock,
UsersRound,
Wand,
Wind,
} from "lucide-react";
/**
* Material Symbols name → Lucide icon. `null` = still rendered with the Material ligature by
* <Icon> (fallback) until the owning screen's lote maps it. Every name in use MUST have an
* <Icon> (fallback); no entry is null since the F4 sweep, and names in use must stay mapped
* (tests/unit/icon-map-object-values.test.ts). Every name in use MUST have an
* entry (tests/unit/icon-map-coverage.test.ts); `npm run gen:icon-map` prints the missing ones.
* Navigation uses one ink (no per-item accent) — SIDEBAR_ICON_ACCENTS was retired (spec §3.5).
*/
@@ -474,7 +512,7 @@ export const ICON_MAP: Record<string, LucideIcon | null> = {
account_circle: CircleUserRound,
add_circle: CirclePlus,
add_task: ListPlus,
air: null,
air: Wind,
alarm_add: AlarmClockPlus,
all_inclusive: InfinityIcon,
alt_route: Split,
@@ -483,7 +521,7 @@ export const ICON_MAP: Record<string, LucideIcon | null> = {
attach_file: Paperclip,
attach_money: DollarSign,
auto_delete: Trash,
auto_fix_normal: null,
auto_fix_normal: Wand,
autorenew: RefreshCw,
backup: DatabaseBackup,
badge: IdCard,
@@ -492,12 +530,12 @@ export const ICON_MAP: Record<string, LucideIcon | null> = {
battery_alert: BatteryWarning,
battery_charging_full: BatteryCharging,
battery_status_good: BatteryFull,
blur_on: null,
brush: null,
blur_on: Aperture,
brush: Brush,
build: Wrench,
build_circle: Wrench,
business: Building2,
business_center: null,
business_center: BriefcaseBusiness,
cable: Cable,
call_split: Split,
casino: Dices,
@@ -507,7 +545,7 @@ export const ICON_MAP: Record<string, LucideIcon | null> = {
chat_bubble: MessageSquare,
checklist: ListChecks,
cleaning_services: BrushCleaning,
cloud_done: null,
cloud_done: CloudCheck,
cloud_off: CloudOff,
cloud_queue: Cloud,
cloud_sync: CloudSync,
@@ -519,35 +557,37 @@ export const ICON_MAP: Record<string, LucideIcon | null> = {
construction: Construction,
contrast: Contrast,
cookie: Cookie,
dashboard: null,
dashboard: LayoutDashboard,
data_array: Brackets,
data_usage: ChartPie,
date_range: CalendarRange,
delete_forever: Trash2,
delete_sweep: ListX,
deployed_code_history: null,
developer_board: null,
deployed_code_history: PackageCheck,
developer_board: CircuitBoard,
devices: MonitorSmartphone,
diamond: null,
diversity_3: null,
diamond: Gem,
diversity_3: UsersRound,
do_not_disturb: CircleMinus,
do_not_disturb_on: CircleMinus,
document_scanner: ScanText,
done_all: CheckCheck,
download_done: HardDriveDownload,
downloading: CloudDownload,
drag_indicator: GripVertical,
dynamic_feed: GalleryVerticalEnd,
eco: null,
eco: Leaf,
edit_note: NotebookPen,
edit_square: SquarePen,
electrical_services: PlugZap,
email: Mail,
error_outline: CircleAlert,
event_available: CalendarCheck,
event_busy: CalendarX,
event_repeat: CalendarSync,
expand_all: ListChevronsUpDown,
explore: Compass,
face: null,
face: Smile,
fact_check: ClipboardCheck,
favorite: Heart,
fiber_manual_record: CircleDot,
@@ -557,21 +597,21 @@ export const ICON_MAP: Record<string, LucideIcon | null> = {
filter_list: ListFilter,
find_in_page: FileSearch,
fingerprint: Fingerprint,
flight: null,
flutter_dash: null,
flight: Plane,
flutter_dash: Bird,
folder_off: FolderX,
folder_open: FolderOpen,
folder_zip: FolderArchive,
function: SquareFunction,
gate: null,
gate: Fence,
gavel: Gavel,
generating_tokens: Sparkles,
gpp_bad: ShieldX,
gpp_maybe: ShieldAlert,
graphic_eq: AudioLines,
grid_view: LayoutGrid,
group_work: null,
handshake: null,
group_work: Boxes,
handshake: Handshake,
handyman: Hammer,
hearing: Ear,
history: History,
@@ -581,23 +621,23 @@ export const ICON_MAP: Record<string, LucideIcon | null> = {
input: ArrowRightToLine,
insert_drive_file: File,
install_desktop: MonitorDown,
inventory_2: null,
inventory_2: PackageOpen,
// Lucide has no key-off glyph; KeyRound is the closest key icon (the "no key" meaning comes from the label).
key_off: KeyRound,
key_vertical: KeyRound,
keyboard_arrow_down: ChevronDown,
keyboard_arrow_up: ChevronUp,
keyboard_capslock: null,
keyboard_capslock: ArrowBigUp,
label: Tag,
library_books: LibraryBig,
linear_scale: GitCommitHorizontal,
link_off: Unlink,
list: List,
local_fire_department: Flame,
local_florist: null,
local_florist: Flower2,
location_on: MapPin,
lock_clock: LockKeyhole,
lock_person: null,
lock_person: UserLock,
login: LogIn,
looks_3: Tally3,
looks_one: ListOrdered,
@@ -618,6 +658,7 @@ export const ICON_MAP: Record<string, LucideIcon | null> = {
network_ping: Radar,
neurology: BrainCircuit,
new_releases: BadgePlus,
notifications_active: BellRing,
notifications_off: BellOff,
open_in_browser: ExternalLink,
output: ArrowRightFromLine,
@@ -628,14 +669,14 @@ export const ICON_MAP: Record<string, LucideIcon | null> = {
pending: CircleDashed,
pending_actions: ClipboardClock,
percent: Percent,
pets: null,
pets: PawPrint,
photo_size_select_large: ImageUpscale,
pin: RectangleEllipsis,
play_circle: CirclePlay,
playlist_add: ListPlus,
precision_manufacturing: null,
precision_manufacturing: Factory,
priority_high: CircleAlert,
psychology_alt: null,
psychology_alt: BrainCog,
public_off: GlobeOff,
query_stats: ChartNoAxesCombined,
radio_button_checked: CircleDot,
@@ -649,7 +690,7 @@ export const ICON_MAP: Record<string, LucideIcon | null> = {
report: OctagonAlert,
restore: RotateCcw,
rocket_launch: Rocket,
router: null,
router: Router,
rss_feed: Rss,
rule: ListChecks,
scatter_plot: ChartScatter,
@@ -663,12 +704,12 @@ export const ICON_MAP: Record<string, LucideIcon | null> = {
settings_backup_restore: RotateCcw,
shield_lock: LockKeyhole,
shield_person: ShieldUser,
shield_with_heart: null,
shield_with_heart: ShieldPlus,
show_chart: ChartLine,
shuffle: Shuffle,
skip_next: SkipForward,
sort: ArrowDownWideNarrow,
spatial_audio: null,
spatial_audio: AudioWaveform,
stacked_line_chart: ChartArea,
stop_circle: CircleStop,
storefront: Store,
@@ -683,7 +724,7 @@ export const ICON_MAP: Record<string, LucideIcon | null> = {
sync_disabled: RefreshCwOff,
sync_problem: RefreshCwOff,
system_update_alt: MonitorDown,
table_chart: null,
table_chart: Table2,
tag: Hash,
task_alt: CircleCheckBig,
text_fields: Type,
@@ -708,15 +749,15 @@ export const ICON_MAP: Record<string, LucideIcon | null> = {
vertical_align_top: ArrowUpToLine,
videocam: Video,
view_agenda: Rows2,
view_in_ar: null,
view_in_ar: Box,
view_module: LayoutGrid,
voice_chat: null,
voice_chat: MicVocal,
volume_up: Volume2,
volunteer_activism: HandHeart,
vpn_key_off: ShieldOff,
vpn_lock: GlobeLock,
water: Droplet,
water_drop: null,
water_drop: Droplet,
web: AppWindow,
widgets: LayoutGrid,
width_normal: MoveHorizontal,

View File

@@ -183,7 +183,10 @@ export function resolveDisplayBaseUrl(
envValue?: string,
browserOrigin?: string,
browserPathname?: string,
envBasePath?: string
envBasePath?: string,
runtimePort: string | undefined = typeof process !== "undefined"
? process.env.NEXT_PUBLIC_PORT || process.env.PORT
: undefined
): string {
const configuredUrl = normalizeUrl(envValue);
const currentOrigin = normalizeUrl(browserOrigin);
@@ -209,10 +212,7 @@ export function resolveDisplayBaseUrl(
return joinOriginAndBasePath(configuredUrl, basePath);
}
const portFallback =
typeof process !== "undefined" && (process.env.NEXT_PUBLIC_PORT || process.env.PORT)
? `http://localhost:${process.env.NEXT_PUBLIC_PORT || process.env.PORT}`
: DEFAULT_DISPLAY_BASE_URL;
const portFallback = runtimePort ? `http://localhost:${runtimePort}` : DEFAULT_DISPLAY_BASE_URL;
const fallback = currentOrigin ?? configuredUrl ?? portFallback;
return joinOriginAndBasePath(fallback, basePath);
}
@@ -237,8 +237,19 @@ export function useDisplayBaseUrl(): string {
process.env.NEXT_PUBLIC_OMNIROUTE_BASE_PATH || process.env.OMNIROUTE_BASE_PATH
);
// The pre-mount value is rendered by SSR and by the client's hydration pass, so it may only
// read values both bundles share: NEXT_PUBLIC_* is inlined into the client, PORT is not
// (server-only), and a PORT-based fallback made the SSR text differ — React #418 on
// /dashboard/relay (F4). The effect below swaps in the live browser origin after mount.
const [url, setUrl] = useState<string>(() =>
resolveDisplayBaseUrl(envValue ?? undefined, undefined, undefined, envBasePath || undefined)
resolveDisplayBaseUrl(
envValue ?? undefined,
undefined,
undefined,
envBasePath || undefined,
// `|| ""`, not undefined: undefined would re-enable the PORT default parameter.
process.env.NEXT_PUBLIC_PORT || ""
)
);
useEffect(() => {

View File

@@ -0,0 +1,27 @@
import { Fragment, type ReactNode } from "react";
// next-intl's t.rich only accepts functions for <tag> placeholders; an ICU *argument* such as
// `{code}` takes string/number/Date. Passing a function there renders the function ("Functions
// are not valid as a React child"), passing a node is a type error. These helpers let a caller
// keep the catalog unchanged (`"Run via {code}"` in 67 locales) and still style the argument:
// the argument goes in as a sentinel string, then the sentinels are swapped for nodes.
const sentinel = (name: string) => `\u0000${name}\u0000`;
/** Sentinel string values to hand to `t(key, …)` for every node argument. */
export function nodeArgs(names: readonly string[]): Record<string, string> {
return Object.fromEntries(names.map((name) => [name, sentinel(name)]));
}
/** Replaces the sentinels in a translated string with the given nodes. */
export function interpolateNodes(text: string, nodes: Record<string, ReactNode>): ReactNode {
const parts = text.split(/\u0000([A-Za-z0-9_]+)\u0000/);
return parts.map((part, i) =>
i % 2 === 1 ? (
// Own keys only (no prototype lookup); a sentinel without a node renders nothing.
<Fragment key={i}>{Object.hasOwn(nodes, part) ? nodes[part] : null}</Fragment>
) : (
<Fragment key={i}>{part}</Fragment>
)
);
}

View File

@@ -47,7 +47,7 @@ test.describe("Group B — Activity Feed", () => {
});
test("activity page exists and returns 200", async ({ page }) => {
const response = await page.goto("http://localhost:20128/dashboard/activity", {
const response = await page.goto("/dashboard/activity", {
waitUntil: "domcontentloaded",
});
// After login redirect the page should settle on activity or login
@@ -59,9 +59,7 @@ test.describe("Group B — Activity Feed", () => {
await gotoDashboardRoute(page, "/dashboard/activity");
// The page header should be visible (h1 or title element)
const heading = page
.locator("h1, [data-testid='activity-title']")
.first();
const heading = page.locator("h1, [data-testid='activity-title']").first();
await expect(heading).toBeVisible({ timeout: 15000 });
// ActivityFeed renders <div role="status"> (empty state) or a
@@ -72,7 +70,7 @@ test.describe("Group B — Activity Feed", () => {
// the dashboard redirected to login without rendering the feed.
const feedContainer = page.locator(
"[data-testid='activity-feed'], [data-testid='activity-empty-state']," +
" .activity-feed, [role='status'], [role='list'], ul.divide-y, div.divide-y"
" .activity-feed, [role='status'], [role='list'], ul.divide-y, div.divide-y"
);
await expect(feedContainer.first()).toBeVisible({ timeout: 15000 });
});

View File

@@ -118,10 +118,9 @@ test.describe("Group B — Quota Plans Config", () => {
test("quota share page exists and returns 200", async ({ page }) => {
// /dashboard/costs/quota-share/plans does not exist as a standalone route;
// the plans wizard is embedded in /dashboard/costs/quota-share.
const response = await page.goto(
"http://localhost:20128/dashboard/costs/quota-share",
{ waitUntil: "domcontentloaded" }
);
const response = await page.goto("/dashboard/costs/quota-share", {
waitUntil: "domcontentloaded",
});
expect(response?.status()).not.toBe(404);
expect(response?.status()).not.toBe(500);
});

View File

@@ -46,17 +46,14 @@ test.describe("Group B — Quota Share Pools", () => {
});
test("quota-share page exists and returns 200", async ({ page }) => {
const response = await page.goto(
"http://localhost:20128/dashboard/costs/quota-share",
{ waitUntil: "domcontentloaded" }
);
const response = await page.goto("/dashboard/costs/quota-share", {
waitUntil: "domcontentloaded",
});
expect(response?.status()).not.toBe(404);
expect(response?.status()).not.toBe(500);
});
test("quota-share page renders QuotaConceptCard or pool list", async ({
page,
}) => {
test("quota-share page renders QuotaConceptCard or pool list", async ({ page }) => {
await gotoDashboardRoute(page, "/dashboard/costs/quota-share");
// Either the concept card (empty state) or a pool list should be visible

View File

@@ -15,10 +15,7 @@ test.describe("Group B — /logs/activity redirect", () => {
request,
}) => {
// Follow redirects and verify the final URL is /dashboard/activity
const response = await page.goto(
"http://localhost:20128/dashboard/logs/activity",
{ waitUntil: "domcontentloaded" }
);
const response = await page.goto("/dashboard/logs/activity", { waitUntil: "domcontentloaded" });
const finalUrl = page.url();
// After following redirects, should end up at /dashboard/activity
@@ -31,12 +28,9 @@ test.describe("Group B — /logs/activity redirect", () => {
request,
}) => {
// Make a non-follow-redirect request to verify the redirect status code.
const response = await request.get(
"http://localhost:20128/dashboard/logs/activity",
{
maxRedirects: 0,
}
);
const response = await request.get("/dashboard/logs/activity", {
maxRedirects: 0,
});
// Next.js permanentRedirect() returns 308 (or 307 in development mode).
// When auth is required the server may respond with a 302/307 to /login

View File

@@ -0,0 +1,61 @@
import test from "node:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
// F4 (KEA-7886): axe/console findings of the wave-2/3 checkpoint smoke on routes F4-B touched
// (`_tasks/reports/uikit/wave2-checkpoint.md` §6 items 3, 4, 7, 8, 11).
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
const read = (p: string) => fs.readFileSync(path.join(ROOT, p), "utf8");
test("console log timestamps and ids use the terminal's readable gray (§6.3, 17 contrast nodes)", () => {
const src = read("src/shared/components/ConsoleLogViewer.tsx");
assert.doesNotMatch(src, /#484f58/i); // 2.4:1 on #0d1117; #8b949e is ≈ 6:1
// Positive pins (review M-6): timestamp and correlation-id spans carry the readable gray.
assert.match(src, /<span className="text-\[#8b949e\] whitespace-nowrap shrink-0 select-none">/);
assert.match(src, /<span className="text-\[#8b949e\] ml-2">cid:/);
assert.doesNotMatch(src, /mt-1 opacity-60">\{tv\("emptyFileLoggingHint"\)/);
});
test("context engine rows are not dimmed with a list-wide opacity (§6.4, 19 contrast nodes)", () => {
assert.doesNotMatch(
read("src/app/(dashboard)/dashboard/context/settings/CompressionPanel.tsx"),
/divide-y divide-border \$\{config\.enabled \? "" : "opacity-60"\}/
);
// Positive pin (review M-6): the list states "off" through data-disabled, not through opacity.
const panel = read("src/app/(dashboard)/dashboard/context/settings/CompressionPanel.tsx");
assert.match(
panel,
/className="divide-y divide-border"\s+data-disabled=\{config\.enabled \? undefined : "true"\}/
);
});
test("the caveman prompt preview is a focusable scroll region (§6.7)", () => {
assert.match(
read("src/app/(dashboard)/dashboard/context/caveman/CavemanContextPageClient.tsx"),
/<pre\s[^>]*tabIndex=\{0\}[^>]*overflow-auto/
);
});
test("the inline Settings → Routing link on acp-agents is underlined (§6.8 link-in-text-block)", () => {
assert.match(
read("src/app/(dashboard)/dashboard/acp-agents/page.tsx"),
/href="\/dashboard\/settings\?tab=routing" className="text-primary underline"/
);
});
test("MCP/A2A step messages pass nodes, not functions, to their ICU {code} arguments (§6.11)", () => {
// The en messages use `{code}` arguments (not `<code>` tags); a function value there renders as
// "Functions are not valid as a React child".
const en = JSON.parse(read("src/i18n/messages/en.json"));
assert.match(en.mcpDashboard.mcpStep1, /\{code\}/);
assert.match(en.a2aDashboard.a2aStep1, /\{code\}/);
for (const page of ["mcp", "a2a"]) {
assert.doesNotMatch(
read(`src/app/(dashboard)/dashboard/${page}/page.tsx`),
/code\d?: \(chunks\) =>/,
`${page}/page.tsx`
);
}
});

View File

@@ -0,0 +1,161 @@
import test from "node:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
// F4 whole-tree P6 sweep (KEA-7886). The per-lote greps only covered the files each lote was
// assigned, so leftovers sat in unassigned files (CompressionSettingsTab, MitmProxyTab, shell
// widgets, landing icons). This guard runs the same greps on the whole app tree. Every kept
// exception is listed here with its reason; anything new fails.
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
const LEGACY = "src/shared/components/layouts/legacy/"; // removed by F4-A (Task 41)
function walk(dir: string, out: string[] = []): string[] {
if (!fs.existsSync(dir)) return out;
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const p = path.join(dir, entry.name);
if (entry.isDirectory()) {
if (!/node_modules|__tests__/.test(entry.name)) walk(p, out);
} else if (/\.tsx?$/.test(entry.name) && !/\.(test|spec)\./.test(entry.name)) out.push(p);
}
return out;
}
const rel = (p: string) => path.relative(ROOT, p).split(path.sep).join("/");
const files = (...dirs: string[]) =>
dirs.flatMap((d) => walk(path.join(ROOT, d))).filter((f) => !rel(f).startsWith(LEGACY));
const APP = files("src/app", "src/shared/components");
const DASHBOARD = files("src/app/(dashboard)", "src/shared/components");
function countBy(list: string[], re: RegExp): Record<string, number> {
const out: Record<string, number> = {};
for (const f of list) {
const n = (fs.readFileSync(f, "utf8").match(re) ?? []).length;
if (n) out[rel(f)] = n;
}
return out;
}
test("no Material Symbols ligature span is left in the app tree", () => {
const hits = countBy(APP, /material-symbols-outlined/g);
// Icon.tsx: the unmapped-name fallback branch, removed with the font by F4-A.
delete hits["src/shared/components/Icon.tsx"];
assert.deepEqual(hits, {});
});
test("no raw <select>, <textarea> or <table> outside the adapters (dashboard + shared)", () => {
const hits = countBy(DASHBOARD, /<(select|textarea|table)\b/g);
// The Select adapter renders the native <select class="ci-select-native"> branch.
delete hits["src/shared/components/Select.tsx"];
// Comment-only mentions of "<select>" (no JSX): ModelSelectField, StudioConfigPane.
for (const f of Object.keys(hits)) {
const jsx = fs
.readFileSync(path.join(ROOT, f), "utf8")
.split("\n")
.filter((l) => /<(select|textarea|table)\b/.test(l) && !/^\s*(\/\/|\*|\{\/\*)/.test(l));
if (jsx.length === 0) delete hits[f];
}
assert.deepEqual(hits, {});
});
// Comments blanked (newlines kept) so `<button>` mentioned inside a comment is not a site.
function blankComments(src: string): string {
const blank = (m: string) => m.replace(/[^\n]/g, " ");
return src.replace(/\/\*[\s\S]*?\*\//g, blank).replace(/\/\/[^\n]*/g, blank);
}
// The comment block that ends within the 3 lines above `i` (a `//` run or a `/* … */` block).
function commentAbove(lines: string[], i: number): string | null {
for (let j = i - 1; j >= Math.max(0, i - 3); j--) {
if (/^\s*\/\//.test(lines[j])) {
let k = j;
while (k > 0 && /^\s*\/\//.test(lines[k - 1])) k--;
return lines.slice(k, j + 1).join("\n");
}
if (lines[j].includes("*/")) {
let k = j;
while (k > 0 && !lines[k].includes("/*")) k--;
return lines.slice(k, j + 1).join("\n");
}
}
return null;
}
test("every raw <button>/<input> left in the dashboard tree carries a `kit-exception:` comment", () => {
// Adapters wrap the native element on purpose.
const ADAPTERS = new Set([
"src/shared/components/Select.tsx",
"src/shared/components/Checkbox.tsx",
"src/shared/components/Collapsible.tsx",
"src/shared/components/ModelSelectField.tsx",
]);
const unexplained: string[] = [];
let sites = 0;
for (const f of DASHBOARD) {
if (ADAPTERS.has(rel(f))) continue;
const src = fs.readFileSync(f, "utf8");
const lines = src.split("\n");
blankComments(src)
.split("\n")
.forEach((code, i) => {
if (!/<(button|input)\b/.test(code)) return;
sites++;
// An explicit marker, not loose words (aria-hidden / overflow-hidden used to pass).
if (!/kit-exception:/.test(commentAbove(lines, i) ?? ""))
unexplained.push(`${rel(f)}:${i + 1}`);
});
}
assert.ok(sites > 20, `found only ${sites} raw controls; the scan is broken`);
assert.deepEqual(unexplained, []);
});
test("the exception check rejects loose words and accepts the marker", () => {
const loose = [
'<div className="overflow-hidden" aria-hidden="true">',
' <button type="button">',
];
assert.equal(commentAbove(loose, 1), null);
const marked = [" {/* kit-exception: multi-line tile", " (icon, title) */}", " <button>"];
assert.match(commentAbove(marked, 2) ?? "", /kit-exception:/);
assert.doesNotMatch(blankComments("{/* a native <button> here */}"), /<button/);
});
test("hard-coded palette hues and dark: variants only where the exception is documented", () => {
const HUE =
/\b(?:text|bg|border|ring|from|to|via|fill|stroke|outline|divide|accent|decoration|shadow|placeholder|caret)-(?:red|green|blue|amber|yellow|emerald|rose|slate|gray|zinc|neutral|indigo|violet|purple|orange|cyan|sky|teal|lime|pink|fuchsia|stone)-\d/g;
// Category legend dots: 13 categories vs 5 chart tokens, shared by three files (lote 2b).
const HUE_ALLOWED: Record<string, number> = {
"src/app/(dashboard)/dashboard/providers/components/CategoryDot.tsx": 1,
"src/app/(dashboard)/dashboard/providers/components/NoAuthProvidersSection.tsx": 1,
"src/app/(dashboard)/dashboard/providers/components/ProviderCard.tsx": 11,
"src/app/(dashboard)/dashboard/providers/components/ProviderSummaryCard.tsx": 13,
"src/app/(dashboard)/dashboard/providers/page.tsx": 17,
};
assert.deepEqual(countBy(DASHBOARD, HUE), HUE_ALLOWED);
const DARK_ALLOWED: Record<string, number> = {
// Typography plugin colours flip with prose-invert (no kit prose).
"src/app/(dashboard)/dashboard/agent-skills/components/SkillPreviewPane.tsx": 1,
// Partner brand inks (Kimi, Cheaper Inference): dark brand hex on a dark surface (lote 2b).
"src/app/(dashboard)/dashboard/combos/KimiComboPresetCard.tsx": 1,
"src/app/(dashboard)/dashboard/providers/components/ProviderCard.tsx": 2,
};
assert.deepEqual(countBy(DASHBOARD, /(?<=["'`\s])dark:[a-z]/g), DARK_ALLOWED);
});
test("no hand-rolled role=dialog outside the Modal adapter", () => {
const hits = countBy(DASHBOARD, /role=["{']*dialog/g);
delete hits["src/shared/components/Modal.tsx"]; // doc comment on the kit DialogContent
// In-container dialog kept on purpose: pinned tests use window Escape/backdrop (lote 6 #1).
delete hits["src/shared/components/RequestLoggerDetail.tsx"];
assert.deepEqual(hits, {});
});
test("the dead shared Footer stays removed (landing renders its own)", () => {
// Rendered nowhere since the kit shell (track G); removal approved for F4.
assert.ok(!fs.existsSync(path.join(ROOT, "src/shared/components/Footer.tsx")));
const barrel = fs.readFileSync(path.join(ROOT, "src/shared/components/index.tsx"), "utf8");
assert.doesNotMatch(barrel, /\bas Footer\b/);
});

View File

@@ -0,0 +1,52 @@
import test from "node:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
// F4 (KEA-7886, lote 7 pendência 12): six lote-7 pages had no page title of their own — only the
// shell top bar, which is hidden below lg and now hides itself next to a PageHeader. Each page
// renders a kit PageHeader titled like its sidebar entry (same keys the shell title used).
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
const PAGES: Array<[string, string, string]> = [
["src/app/(dashboard)/dashboard/memory/page.tsx", "memory", "memorySubtitle"],
["src/app/(dashboard)/dashboard/mcp/page.tsx", "mcp", "mcpSubtitle"],
["src/app/(dashboard)/dashboard/a2a/page.tsx", "a2a", "a2aSubtitle"],
["src/app/(dashboard)/dashboard/cloud-agents/page.tsx", "cloudAgents", "cloudAgentsSubtitle"],
[
"src/app/(dashboard)/dashboard/agent-skills/AgentSkillsPageClient.tsx",
"agentSkills",
"agentSkillsSubtitle",
],
[
"src/app/(dashboard)/dashboard/omni-skills/OmniSkillsPageClient.tsx",
"omniSkills",
"omniSkillsSubtitle",
],
];
test("the six lote-7 pages render a kit PageHeader with their sidebar title", () => {
for (const [file, title, subtitle] of PAGES) {
const src = fs.readFileSync(path.join(ROOT, file), "utf8");
assert.match(src, /from "@omniroute\/ui-kit\/page-header"/, `${file}: PageHeader import`);
assert.match(
src,
new RegExp(
`<PageHeader[\\s\\S]{0,80}title=\\{tSidebar\\("${title}"\\)\\}[\\s\\S]{0,80}description=\\{tSidebar\\("${subtitle}"\\)\\}`
),
`${file}: <PageHeader title=sidebar.${title} description=sidebar.${subtitle}>`
);
}
});
test("the sidebar title keys exist in en, pt-BR and vi", () => {
for (const locale of ["en", "pt-BR", "vi"]) {
const sidebar = JSON.parse(
fs.readFileSync(path.join(ROOT, `src/i18n/messages/${locale}.json`), "utf8")
).sidebar;
for (const [, title, subtitle] of PAGES) {
assert.equal(typeof sidebar[title], "string", `${locale} sidebar.${title}`);
assert.equal(typeof sidebar[subtitle], "string", `${locale} sidebar.${subtitle}`);
}
}
});

View File

@@ -0,0 +1,23 @@
import test from "node:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
// F4 (track F note, KEA-7886): the dashboard skip link must be the first tab stop. The root
// layout also rendered a "Skip to content" link to #main-content — an id that only the dashboard
// shell's SidebarInset carries — so on dashboard routes the shell's link was the SECOND tab stop
// (two identical links in a row) and on every other route the root link pointed nowhere. The
// shell owns the only skip link (its first-focusable order is pinned in dashboard-layout-flag).
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
const read = (p: string) => fs.readFileSync(path.join(ROOT, p), "utf8");
test("the root layout renders no skip link of its own", () => {
assert.doesNotMatch(read("src/app/layout.tsx"), /href="#main-content"/);
});
test("the dashboard shell renders exactly one skip link and its #main-content target", () => {
const shell = read("src/shared/components/layouts/DashboardShell.tsx");
assert.equal((shell.match(/href="#main-content"/g) ?? []).length, 1);
assert.match(shell, /<SidebarInset\s+id="main-content"/);
});

View File

@@ -412,3 +412,17 @@ test("text-primary resolves to a readable primary ink; lime stays on bg/border/r
// The inline ::selection rule colours TEXT, so it reads the ink too.
assert.match(css, /::selection \{[^}]*\n\s*color: var\(--color-primary-ink\);/);
});
test("the primary Badge tone keeps dark ink in light and takes the lime ink in dark (F4)", () => {
// Light: near-black ink on lime-100. Dark: the kit keeps --ci-color-accent-foreground near-black
// while the surface becomes a 14 % lime tint over the dark background, so the "8 features"
// translator badge read near-black on near-black. Dark flips the ink to the lime itself.
assert.match(
css,
/\.ci-badge\[data-tone="primary"\] \{\s*color: var\(--ci-color-accent-foreground\);\s*background: var\(--ci-color-accent-surface-strong\);/
);
assert.match(
css,
/:root\[data-theme="dark"\] \.ci-badge\[data-tone="primary"\] \{\s*color: var\(--ci-color-accent\);/
);
});

View File

@@ -0,0 +1,27 @@
import test from "node:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
// F4 (KEA-7886, lote 6 pendência 18): four Playwright specs navigated to the absolute
// http://localhost:20128/... and failed with ERR_CONNECTION_REFUSED whenever the suite ran
// against another port (DASHBOARD_PORT/PORT feed playwright.config.ts baseURL). Specs navigate
// with paths so page.goto/request.get resolve against the configured baseURL.
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
const E2E = path.join(ROOT, "tests/e2e");
test("Playwright specs do not hard-code the dashboard origin", () => {
const offenders: string[] = [];
for (const name of fs.readdirSync(E2E)) {
if (!name.endsWith(".spec.ts")) continue;
fs.readFileSync(path.join(E2E, name), "utf8")
.split("\n")
.forEach((line, i) => {
if (/^\s*(\/\/|\*|\/\*)/.test(line)) return; // comments may mention the default port
if (/["'`]https?:\/\/(localhost|127\.0\.0\.1):\d+/.test(line))
offenders.push(`tests/e2e/${name}:${i + 1}`);
});
}
assert.deepEqual(offenders, []);
});

View File

@@ -0,0 +1,146 @@
import test from "node:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
// The literal scanner behind icon-map-coverage (scripts/dev/gen-icon-map.mjs) only sees names
// written straight into an icon slot (`<Icon name="x">`, `icon="x"`, `icon: "x"`). Names kept as
// VALUES of a lookup object (`const KIND_ICONS = { pagerduty: "notifications_active" }` read by
// `<Icon name={KIND_ICONS[kind]}>`) escaped it, so unmapped names silently rendered the Material
// ligature fallback (lote 8: five profile badge icons; F4 sweep: webhook "coming soon" tiles,
// the media OCR tab). This test finds those lookup objects and checks every value against
// ICON_MAP — a value must resolve to a Lucide icon, not be missing nor `null`.
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
const DIRS = ["src/app", "src/shared"];
function walk(dir: string, out: string[] = []): string[] {
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const p = path.join(dir, entry.name);
if (entry.isDirectory()) {
if (!/node_modules|__tests__/.test(entry.name)) walk(p, out);
} else if (/\.tsx?$/.test(entry.name) && !/\.test\./.test(entry.name)) out.push(p);
}
return out;
}
/** Text of the balanced `{…}` block whose opening brace is at `open` (exclusive of braces). */
function braceBody(src: string, open: number): string | null {
let depth = 0;
for (let i = open; i < src.length; i++) {
const c = src[i];
if (c === '"' || c === "'" || c === "`") {
const end = src.indexOf(c, i + 1);
if (end < 0) return null;
i = end;
} else if (c === "{") depth++;
else if (c === "}") {
depth--;
if (depth === 0) return src.slice(open + 1, i);
}
}
return null;
}
/** Expressions that end up as an icon name: <Icon name={…}>, icon={…}, icon: …, span content. */
export function iconSlotExpressions(src: string): string[] {
const slots: string[] = [];
const openers = [
/<Icon\b[^>]*?\bname=\{/g,
/\b(?:icon|iconRight|emptyIcon|leadingIcon)=\{/g,
/material-symbols-outlined[^>]*>\s*\{/g,
];
for (const re of openers)
for (const m of src.matchAll(re)) {
const body = braceBody(src, (m.index ?? 0) + m[0].length - 1);
if (body) slots.push(body);
}
// `icon: KIND_ICON[kind] ?? "category"` (options handed to SegmentedControl, Tabs…)
for (const m of src.matchAll(/\bicon:\s*([^,\n}]+)/g)) slots.push(m[1]);
// One hop: `const materialIcon = BADGE_ICONS[icon]; … <Icon name={materialIcon} />`
const hops: string[] = [];
for (const m of src.matchAll(/\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*([^;\n]+)/g)) {
const [, name, expr] = m;
if (slots.some((s) => new RegExp(`\\b${name.replace(/\$/g, "\\$")}\\b`).test(s)))
hops.push(expr);
}
return [...slots, ...hops];
}
/** `const NAME… = { key: "value", … }` objects whose NAME is read by an icon slot. */
export function iconLookupValues(src: string): Array<{ object: string; value: string }> {
const slots = iconSlotExpressions(src);
const found: Array<{ object: string; value: string }> = [];
for (const m of src.matchAll(/\bconst\s+([A-Za-z_$][\w$]*)\s*(?::[^=]+)?=\s*\{/g)) {
const name = m[1];
if (!slots.some((s) => new RegExp(`\\b${name.replace(/\$/g, "\\$")}\\b`).test(s))) continue;
const body = braceBody(src, (m.index ?? 0) + m[0].length - 1);
if (body == null) continue;
const flat = !/\{/.test(body);
// Flat lookup → every string value is an icon name; nested config objects → only `icon:`.
const re = flat
? /(?:^|[,{\n])\s*(?:[A-Za-z_$][\w$]*|"[^"]+"|'[^']+')\s*:\s*"([^"]*)"/g
: /\bicon:\s*"([^"]*)"/g;
for (const v of body.matchAll(re)) found.push({ object: name, value: v[1] });
}
return found;
}
test("the lookup-object detector reads icon maps and ignores non-icon objects", () => {
const source = `
const KIND_ICONS: Record<Kind, string> = { slack: "chat", pagerduty: "notifications_active" };
const KIND_COLORS = { slack: "text-chart-1" };
const BADGE_ICONS: Record<string, string> = { "git-merge": "merge", trophy: "emoji_events" };
const STATUS = { ok: { icon: "check_circle", color: "text-success" } };
function A({ kind }) { return <Icon name={KIND_ICONS[kind]} className={KIND_COLORS[kind]} />; }
function B({ icon }) { const materialIcon = icon ? BADGE_ICONS[icon] : null; return <Icon name={materialIcon} />; }
function C({ s }) { const config = STATUS[s]; return <Icon name={config.icon} />; }
const tabs = kinds.map((k) => ({ value: k, icon: TAB_ICON[k] ?? "category" }));
const TAB_ICON = { ocr: "document_scanner" };
`;
assert.deepEqual(
iconLookupValues(source).map((f) => `${f.object}:${f.value}`),
[
"KIND_ICONS:chat",
"KIND_ICONS:notifications_active",
"BADGE_ICONS:merge",
"BADGE_ICONS:emoji_events",
"STATUS:check_circle",
"TAB_ICON:document_scanner",
]
);
});
test("every icon name held as a lookup-object value resolves to a Lucide icon in ICON_MAP", async () => {
const { ICON_MAP } = await import("../../src/shared/constants/iconMap.ts");
const missing: string[] = [];
let checked = 0;
for (const dir of DIRS)
for (const file of walk(path.join(ROOT, dir))) {
for (const { object, value } of iconLookupValues(fs.readFileSync(file, "utf8"))) {
checked++;
if (!ICON_MAP[value]) missing.push(`${path.relative(ROOT, file)} ${object}: "${value}"`);
}
}
assert.ok(
checked > 50,
`the detector found only ${checked} lookup values; expected well over 50`
);
assert.deepEqual(
missing,
[],
`lookup values without a Lucide icon (map them in src/shared/constants/iconMap.ts):\n${missing.join("\n")}`
);
});
test("every Material name the literal scanner finds resolves to Lucide (no null entries in use)", async () => {
const { collectNames } = await import("../../scripts/dev/gen-icon-map.mjs");
const { ICON_MAP } = await import("../../src/shared/constants/iconMap.ts");
const unresolved = (collectNames(ROOT) as string[]).filter((n) => !ICON_MAP[n]);
assert.deepEqual(
unresolved,
[],
`names in use that still render the Material ligature:\n${unresolved.join("\n")}`
);
});

View File

@@ -63,6 +63,43 @@ describe("CommandPalette on the kit Dialog", () => {
}
);
// F4 (F1 checkpoint pendência): the palette has no DialogTrigger and its search field takes
// focus itself, so Radix had nothing to return focus to and Escape left it on <body>.
it(
"returns focus to the opener when Escape closes the palette",
{ timeout: 20_000 },
async () => {
function Harness() {
const [open, setOpen] = React.useState(false);
return (
<>
<button type="button" onClick={() => setOpen(true)}>
Open palette
</button>
<CommandPalette isOpen={open} onClose={() => setOpen(false)} />
</>
);
}
render(<Harness />);
const opener = screen.getByRole("button", { name: "Open palette" });
act(() => {
opener.focus();
opener.click();
});
const input = await screen.findByRole("searchbox");
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 60));
});
expect(document.activeElement).toBe(input);
fireEvent.keyDown(input, { key: "Escape" });
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 0));
});
expect(screen.queryByRole("dialog")).toBeNull();
expect(document.activeElement).toBe(opener);
}
);
it("renders nothing while closed", () => {
render(<CommandPalette isOpen={false} onClose={vi.fn()} />);
expect(screen.queryByRole("dialog")).toBeNull();

View File

@@ -85,10 +85,14 @@ async function renderTab() {
}
function cacheTtlInput(): HTMLInputElement {
// Kit Field: the <label for> names the input (no longer a <label> wrapping it).
const label = Array.from(container.querySelectorAll("label")).find((candidate) =>
candidate.textContent?.includes("compressionCacheTTL")
);
const input = label?.querySelector<HTMLInputElement>('input[type="number"]');
const forId = label?.getAttribute("for");
const input = forId
? container.querySelector<HTMLInputElement>(`input[type="number"][id="${forId}"]`)
: null;
expect(input).toBeTruthy();
return input!;
}

View File

@@ -144,8 +144,9 @@ async function settle() {
}
function inputFor(labelKey: string): HTMLInputElement {
const input = screen.getByText(labelKey).closest("label")?.querySelector("input");
if (!input) throw new Error(`no input next to ${labelKey}`);
// Kit Field: the <label for> names the input (no longer a <label> wrapping it).
const input = screen.getByLabelText(labelKey);
if (!(input instanceof HTMLInputElement)) throw new Error(`no input labelled ${labelKey}`);
return input;
}

View File

@@ -0,0 +1,52 @@
// @vitest-environment jsdom
/**
* F4 (KEA-7886, lote 8 pendência): React #418 on /dashboard/relay. useDisplayBaseUrl's first
* render fell back to `http://localhost:${process.env.PORT}` — PORT exists on the server but is
* not inlined into the client bundle, so the SSR text (the relay curl example) and the client's
* first render differed ("server rendered text didn't match the client"). The pre-mount value
* must be the same on both sides; the live browser origin replaces it after mount.
*/
import React, { act } from "react";
import { hydrateRoot } from "react-dom/client";
import { renderToString } from "react-dom/server";
import { afterEach, describe, expect, it } from "vitest";
import { useDisplayBaseUrl } from "@/shared/hooks/useDisplayBaseUrl";
(
globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT?: boolean }
).IS_REACT_ACT_ENVIRONMENT = true;
function CurlExample() {
const base = useDisplayBaseUrl();
return <pre>{`curl ${base}/v1/relay/chat/completions`}</pre>;
}
const savedPort = process.env.PORT;
afterEach(() => {
if (savedPort === undefined) delete process.env.PORT;
else process.env.PORT = savedPort;
});
describe("useDisplayBaseUrl hydration", () => {
it("renders the same pre-mount URL on the server (PORT set) and the client (PORT absent)", async () => {
process.env.PORT = "20191"; // server process: custom port
const html = renderToString(<CurlExample />);
delete process.env.PORT; // client bundle: PORT is not inlined
const container = document.createElement("div");
container.innerHTML = html;
document.body.appendChild(container);
const recoverable: unknown[] = [];
let root: ReturnType<typeof hydrateRoot> | undefined;
await act(async () => {
root = hydrateRoot(container, <CurlExample />, {
onRecoverableError: (error) => recoverable.push(error),
});
});
expect(recoverable.map(String)).toEqual([]);
// After mount the live origin wins (jsdom: http://localhost:3000 → not public → fallback chain).
expect(container.textContent).toMatch(/^curl http:\/\/localhost(:\d+)?\/v1\/relay/);
act(() => root?.unmount());
container.remove();
});
});

View File

@@ -0,0 +1,130 @@
// @vitest-environment jsdom
/**
* F4 (KEA-7886, review M-4): render tests for widgets the F4 sweep moved onto the kit adapters —
* MaintenanceBanner, CloudSyncStatus, MitmProxyTab. Each must render without Material ligatures,
* with token colours and the adapter controls.
*/
import React from "react";
import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
vi.mock("next-intl", () => ({
useTranslations: () => Object.assign((key: string) => key, { has: () => false }),
}));
const push = vi.fn();
vi.mock("next/navigation", () => ({ useRouter: () => ({ push, refresh: vi.fn() }) }));
const json = (body: unknown, ok = true) =>
({ ok, status: ok ? 200 : 500, json: async () => body }) as Response;
afterEach(() => {
cleanup();
vi.useRealTimers();
vi.unstubAllGlobals();
push.mockClear();
});
describe("MaintenanceBanner", () => {
it("shows a token-coloured warning after two failed pings and the ghost close button hides it", async () => {
vi.useFakeTimers();
vi.stubGlobal(
"fetch",
vi.fn(async () => json({}, false))
);
const { default: MaintenanceBanner } = await import("@/shared/components/MaintenanceBanner");
const { container } = render(<MaintenanceBanner />);
await act(async () => {
await vi.advanceTimersByTimeAsync(10_050);
});
const banner = container.querySelector<HTMLElement>('[role="status"]')!;
expect(banner).not.toBeNull();
expect(banner.className).toContain("bg-warning-bg");
expect(banner.className).not.toMatch(/amber-\d/);
expect(banner.querySelector('svg[data-icon="warning"]')).not.toBeNull();
expect(banner.querySelector(".material-symbols-outlined")).toBeNull();
const close = screen.getByRole("button", { name: "close" });
expect(close.className).toContain("ci-button");
act(() => fireEvent.click(close));
expect(container.querySelector('[role="status"]')).toBeNull();
});
});
describe("CloudSyncStatus", () => {
it("renders a ghost kit Button with a Lucide icon and success token ink when synced", async () => {
vi.stubGlobal(
"fetch",
vi.fn(async () => json({ enabled: true, connected: true, lastSync: null }))
);
const { default: CloudSyncStatus } = await import("@/shared/components/CloudSyncStatus");
render(<CloudSyncStatus />);
const button = await screen.findByRole("button", { name: "statusLabel" });
expect(button.className).toContain("ci-button");
const icon = button.querySelector('svg[data-icon="cloud_done"]')!;
expect(icon).not.toBeNull();
expect(icon.getAttribute("class")).toContain("text-success");
expect(button.querySelector(".material-symbols-outlined")).toBeNull();
expect(button.innerHTML).not.toMatch(/(green|blue|amber|red)-\d/);
act(() => fireEvent.click(button));
expect(push).toHaveBeenCalledWith("/dashboard/endpoint");
});
});
describe("MitmProxyTab", () => {
it(
"renders labelled adapter fields, kit badges and a kit table for the target routes",
{ timeout: 30_000 },
async () => {
// The kit Table watches its scroll container.
vi.stubGlobal(
"ResizeObserver",
class {
observe() {}
unobserve() {}
disconnect() {}
}
);
vi.stubGlobal(
"fetch",
vi.fn(async () =>
json({
running: true,
pid: 4242,
dnsConfigured: true,
certExists: false,
hasCachedPassword: false,
port: 443,
targets: [
{
id: "t1",
name: "Copilot",
targetHost: "api.example.com",
targetPort: 443,
localPort: 8443,
endpoints: ["/v1/chat"],
enabled: true,
},
],
stats: {
startedAt: null,
totalRequests: 3,
interceptedRequests: 2,
activeConnections: 1,
lastInterceptAt: null,
},
})
)
);
const { default: MitmProxyTab } =
await import("@/app/(dashboard)/dashboard/settings/components/MitmProxyTab");
const { container } = render(<MitmProxyTab />);
await screen.findByText("Copilot");
expect(screen.getByLabelText("port")).toBeTruthy();
expect(screen.getByLabelText("apiKey").getAttribute("type")).toBe("password");
expect(container.querySelector("table.ci-table")).not.toBeNull();
expect(screen.getByRole("button", { name: /stop/ }).className).toContain("ci-button");
expect(container.querySelectorAll(".ci-badge").length).toBeGreaterThan(2);
expect(container.querySelector(".material-symbols-outlined")).toBeNull();
expect(container.innerHTML).not.toMatch(/(emerald|amber|red)-\d/);
}
);
});

View File

@@ -1,39 +0,0 @@
// @vitest-environment jsdom
import React from "react";
import { cleanup, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it } from "vitest";
const { default: Footer } = await import("@/shared/components/Footer");
afterEach(() => cleanup());
describe("Footer on kit primitives", () => {
it(
"titles each column with a kit eyebrow, splits the bottom row with a kit Separator and names every link",
{ timeout: 20_000 },
() => {
const { container } = render(<Footer />);
const footer = screen.getByRole("contentinfo");
const eyebrows = Array.from(footer.querySelectorAll(".ci-eyebrow")).map(
(el) => el.textContent
);
expect(eyebrows).toEqual(["Product", "Resources", "Company"]);
expect(footer.querySelector(".ci-separator")).not.toBeNull();
// internal links used to render `link.label` (undefined) — every link needs a visible name
for (const name of [
"Features",
"Pricing",
"Documentation",
"API Reference",
"Terms",
"Privacy",
]) {
expect(screen.getAllByRole("link", { name }).length).toBeGreaterThan(0);
}
const external = screen.getByRole("link", { name: "Help Center" });
expect(external.getAttribute("target")).toBe("_blank");
expect(external.getAttribute("rel")).toBe("noopener noreferrer");
expect(container.innerHTML).not.toContain("hover:text-primary");
}
);
});

View File

@@ -1,6 +1,6 @@
// @vitest-environment jsdom
import React from "react";
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
import { SidebarProvider } from "@omniroute/ui-kit/sidebar";
@@ -56,6 +56,64 @@ describe("Header on the kit shell", () => {
}
);
// F4 (wave-1 checkpoint, api-manager/endpoint): 67+ dashboard pages render a kit PageHeader
// (its own h1), so the shell title repeated it ("API Keys" × "API Key Management") and the
// page carried two h1s. The shell drops its title while a PageHeader is mounted (removed from
// the DOM, not CSS-hidden, so h1 locators still find the page's own heading first).
it("drops its title and icon tile while the page renders a kit PageHeader, and brings them back after", async () => {
// The shell renders the Header inside #main-content (SidebarInset); the detection is scoped there.
render(
<SidebarProvider>
<main id="main-content">
<Header />
</main>
</SidebarProvider>
);
const shell = () => document.querySelector("header.ci-sidebar-shell-header")!;
const tile = () => shell().querySelector("span.size-9");
expect(shell().querySelector("h1")?.textContent).toMatch(/Providers/);
const hadTile = tile() !== null;
const pageHeader = document.createElement("header");
pageHeader.className = "ci-page-header";
pageHeader.innerHTML = "<h1>Providers page</h1>";
await act(async () => {
document.getElementById("main-content")!.appendChild(pageHeader);
await new Promise((resolve) => setTimeout(resolve, 50));
});
expect(shell().querySelector("h1")).toBeNull();
expect(tile()).toBeNull();
expect(screen.getAllByRole("heading", { level: 1 })).toHaveLength(1);
await act(async () => {
pageHeader.remove();
await new Promise((resolve) => setTimeout(resolve, 50));
});
expect(shell().querySelector("h1")?.textContent).toMatch(/Providers/);
expect(tile() !== null).toBe(hadTile);
});
it("ignores a PageHeader outside the content region (e.g. inside a portalled dialog)", async () => {
render(
<SidebarProvider>
<main id="main-content">
<Header />
</main>
</SidebarProvider>
);
const portal = document.createElement("div");
portal.setAttribute("role", "dialog");
portal.innerHTML = '<header class="ci-page-header"><h1>Dialog</h1></header>';
await act(async () => {
document.body.appendChild(portal);
await new Promise((resolve) => setTimeout(resolve, 50));
});
expect(document.querySelector("header.ci-sidebar-shell-header h1")?.textContent).toMatch(
/Providers/
);
portal.remove();
});
it(
"grows the kit header by the safe-area inset instead of squeezing its controls",
{ timeout: 20_000 },

View File

@@ -0,0 +1,64 @@
// @vitest-environment jsdom
/**
* F4 (wave-2/3 checkpoint §6.11): MCP/A2A step hints use ICU *arguments* (`Run via {code}`).
* t.rich takes functions only for <tag> placeholders, so `code: (chunks) => <code/>` rendered a
* function ("Functions are not valid as a React child") and a node is a type error. The helper
* passes sentinels through the real ICU formatter and swaps them for nodes.
*/
import React from "react";
import { render } from "@testing-library/react";
// The global setup mocks next-intl; its formatter lives in use-intl.
import { createTranslator } from "use-intl/core";
import { describe, expect, it } from "vitest";
import { interpolateNodes, nodeArgs } from "@/shared/utils/interpolateNodes";
import en from "@/i18n/messages/en.json";
const t = createTranslator({ locale: "en", messages: en as never, namespace: "mcpDashboard" });
const ta = createTranslator({ locale: "en", messages: en as never, namespace: "a2aDashboard" });
describe("interpolateNodes", () => {
it("renders the mcpStep1 hint with its command as a <code> node", () => {
const { container } = render(
<p>
{interpolateNodes(
(t as never as (k: string, v: object) => string)("mcpStep1", nodeArgs(["code"])),
{
code: <code>omniroute --mcp</code>,
}
)}
</p>
);
expect(container.textContent).toBe("Run via omniroute --mcp");
expect(container.querySelector("code")?.textContent).toBe("omniroute --mcp");
});
it("handles several arguments in one message (a2aStep2)", () => {
const { container } = render(
<p>
{interpolateNodes(
(ta as never as (k: string, v: object) => string)(
"a2aStep2",
nodeArgs(["code1", "code2", "code3"])
),
{
code1: <code>/a2a</code>,
code2: <code>message/send</code>,
code3: <code>message/stream</code>,
}
)}
</p>
);
expect([...container.querySelectorAll("code")].map((c) => c.textContent)).toEqual([
"/a2a",
"message/send",
"message/stream",
]);
expect(container.textContent).not.toMatch(/\u0000/);
});
it("ignores prototype keys and renders nothing for a sentinel without a node", () => {
const text = `a ${nodeArgs(["toString"]).toString} b ${nodeArgs(["missing"]).missing} c`;
const { container } = render(<p>{interpolateNodes(text, {})}</p>);
expect(container.textContent).toBe("a b c");
});
});

View File

@@ -7,7 +7,7 @@ vi.mock("next-intl", () => ({
useTranslations: () => (key: string) => key,
}));
const { default: Modal } = await import("../../../src/shared/components/Modal");
const { default: Modal, ConfirmModal } = await import("../../../src/shared/components/Modal");
const cleanups: Array<() => void> = [];
@@ -15,7 +15,7 @@ const cleanups: Array<() => void> = [];
// `setTimeout(0)` after the dialog unmounts — flush one macrotask inside act.
const flush = () => act(() => new Promise<void>((resolve) => setTimeout(resolve, 0)));
function Harness() {
function Harness({ autoFocusField = false }: { autoFocusField?: boolean }) {
const [isOpen, setIsOpen] = useState(false);
return (
@@ -24,17 +24,17 @@ function Harness() {
Open details
</button>
<Modal isOpen={isOpen} onClose={() => setIsOpen(false)} title="Details">
Modal body
{autoFocusField ? <input aria-label="Key name" autoFocus /> : "Modal body"}
</Modal>
</>
);
}
function renderHarness() {
function renderHarness(props: { autoFocusField?: boolean } = {}) {
const container = document.createElement("div");
document.body.appendChild(container);
const root = createRoot(container);
act(() => root.render(<Harness />));
act(() => root.render(<Harness {...props} />));
cleanups.push(() => {
act(() => root.unmount());
container.remove();
@@ -102,6 +102,120 @@ describe("shared Modal focus restoration", () => {
expect(document.activeElement).toBe(trigger);
});
// F4 (F1 checkpoint pendência): a field with autoFocus takes focus during the commit, before
// Radix's FocusScope mounts; FocusScope then skips onOpenAutoFocus (focus is already inside),
// so the opener was never captured and Escape dropped focus on <body> ("Create API Key").
it("returns focus to the trigger when a field inside the dialog has autoFocus", async () => {
const container = renderHarness({ autoFocusField: true });
const trigger = container.querySelector<HTMLButtonElement>("button")!;
act(() => {
trigger.focus();
trigger.click();
});
const field = getDialog()!.querySelector<HTMLInputElement>("input")!;
expect(document.activeElement).toBe(field);
act(() => {
document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
});
await flush();
expect(getDialog()).toBeNull();
expect(document.activeElement).toBe(trigger);
});
// Review M-5: the useState-initializer path (dialog mounted already open, e.g. `{show && <Modal isOpen />}`).
it("returns focus to the opener when the dialog mounts already open with an autoFocus field", async () => {
function Conditional() {
const [show, setShow] = useState(false);
return (
<>
<button type="button" onClick={() => setShow(true)}>
Open
</button>
{show && (
<Modal isOpen onClose={() => setShow(false)} title="Mounted open">
<input aria-label="Name" autoFocus />
</Modal>
)}
</>
);
}
const container = document.createElement("div");
document.body.appendChild(container);
const root = createRoot(container);
act(() => root.render(<Conditional />));
cleanups.push(() => {
act(() => root.unmount());
container.remove();
});
const trigger = container.querySelector<HTMLButtonElement>("button")!;
act(() => {
trigger.focus();
trigger.click();
});
expect(document.activeElement).toBe(getDialog()!.querySelector("input"));
act(() => {
document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
});
await flush();
expect(getDialog()).toBeNull();
expect(document.activeElement).toBe(trigger);
});
// Review M-5: a ConfirmModal opened from inside a Modal returns focus to the inner opener.
it("returns focus to the button inside the outer dialog when a nested ConfirmModal closes", async () => {
function Nested() {
const [outer, setOuter] = useState(false);
const [inner, setInner] = useState(false);
return (
<>
<button type="button" onClick={() => setOuter(true)}>
Open outer
</button>
<Modal isOpen={outer} onClose={() => setOuter(false)} title="Outer">
<button type="button" onClick={() => setInner(true)}>
Delete
</button>
</Modal>
<ConfirmModal
isOpen={inner}
onClose={() => setInner(false)}
onConfirm={() => setInner(false)}
message="Sure?"
/>
</>
);
}
const container = document.createElement("div");
document.body.appendChild(container);
const root = createRoot(container);
act(() => root.render(<Nested />));
cleanups.push(() => {
act(() => root.unmount());
container.remove();
});
act(() => container.querySelector<HTMLButtonElement>("button")!.click());
await flush();
const del = [
...document.body.querySelectorAll<HTMLButtonElement>('[role="dialog"] button'),
].find((b) => b.textContent === "Delete")!;
act(() => {
del.focus();
del.click();
});
await flush();
expect(document.body.querySelectorAll('[role="dialog"]').length).toBe(2);
act(() => {
document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
});
await flush();
expect(document.body.querySelectorAll('[role="dialog"]').length).toBe(1);
expect(document.activeElement).toBe(del);
});
it("does not try to focus an opener that was removed while the dialog was open", async () => {
const trigger = document.createElement("button");
document.body.appendChild(trigger);

View File

@@ -105,3 +105,26 @@ it("renders the public API URL instead of rebuilding an internal apiPort URL", a
expect(container.textContent).not.toContain(":20131/api/v1");
expect(replaceMock).not.toHaveBeenCalled();
});
// F4 (KEA-7886, lote 3): the page had no h1 (the step title was an h2) and the 6-step stepper
// (6 × 32 px dots + 5 × 32 px connectors + gaps) overflowed both sides at 390 px.
it("names the page with one h1 (the step title) and keeps the stepper narrow below sm", async () => {
await act(async () => {
root.render(<OnboardingWizard />);
});
await waitForText("getStarted");
const headings = container.querySelectorAll("h1");
expect(headings).toHaveLength(1);
expect(headings[0].textContent).toBe("welcome");
const stepper = container.querySelector("ol")!;
expect(stepper.className).toMatch(/\bgap-1\b/);
expect(stepper.className).toMatch(/\bsm:gap-2\b/);
const connectors = stepper.querySelectorAll('li > span[aria-hidden="true"]');
expect(connectors).toHaveLength(5);
for (const connector of connectors) {
expect(connector.className).toMatch(/\bw-3\b/);
expect(connector.className).toMatch(/\bsm:w-8\b/);
}
});

View File

@@ -0,0 +1,106 @@
// @vitest-environment jsdom
/**
* F4 (KEA-7886, lote 8 pendência): locked badge tiles on /dashboard/profile were dimmed with a
* tile-wide `opacity-50 grayscale`, which dragged the badge name and description under AA
* (36 axe color-contrast nodes). The locked look now lives in the border, the surface, a dimmed
* glyph and a lock mark; the text keeps full token ink and the state is announced.
*/
import React, { act } from "react";
import { createRoot } from "react-dom/client";
import { afterEach, describe, expect, it, vi } from "vitest";
(
globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT?: boolean }
).IS_REACT_ACT_ENVIRONMENT = true;
const translate = (key: string) => key;
vi.mock("next-intl", () => ({
useLocale: () => "en",
useTranslations: () => Object.assign(translate, { has: () => false }),
}));
const { default: ProfilePage } = await import("@/app/(dashboard)/dashboard/profile/page");
const roots: Array<{ root: ReturnType<typeof createRoot>; container: HTMLDivElement }> = [];
async function renderProfile() {
const badge = (id: string, name: string) => ({
id,
name,
description: `${name} description`,
icon: "rocket",
category: "usage",
rarity: "common",
criteria: '{"type":"requests","count":10}',
hidden: 0,
createdAt: "2026-08-26T00:00:00.000Z",
});
vi.stubGlobal(
"fetch",
vi.fn(async (input: RequestInfo | URL) => {
const url = String(input);
if (url.endsWith("/level")) {
return { ok: true, json: async () => ({ level: { totalXp: 0, currentLevel: 1 } }) };
}
if (url.endsWith("/earned")) {
return {
ok: true,
json: async () => ({
badges: [{ badgeId: "earned-one", unlockedAt: "2026-08-26T00:00:00.000Z" }],
}),
};
}
return {
ok: true,
json: async () => ({
badges: [badge("earned-one", "Earned"), badge("locked-one", "Locked")],
}),
};
})
);
const container = document.createElement("div");
document.body.appendChild(container);
const root = createRoot(container);
roots.push({ root, container });
act(() => root.render(<ProfilePage />));
for (let i = 0; i < 40 && container.querySelectorAll("button").length < 2; i++) {
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 10));
});
}
return container;
}
afterEach(() => {
for (const { root, container } of roots.splice(0)) {
act(() => root.unmount());
container.remove();
}
vi.unstubAllGlobals();
});
const tile = (container: HTMLElement, text: string) =>
Array.from(container.querySelectorAll("button")).find((b) =>
b.textContent?.includes(`${text} description`)
)!;
describe("Profile locked badge tiles", () => {
it("keeps the name and description at full opacity and marks the tile as locked", async () => {
const container = await renderProfile();
const locked = tile(container, "Locked");
expect(locked).toBeDefined();
expect(locked.className).not.toMatch(/\bopacity-|\bgrayscale\b/);
for (const text of [...locked.querySelectorAll("p")]) {
expect(text.closest("[class*='opacity-']")).toBeNull();
}
expect(locked.getAttribute("data-locked")).toBe("true");
expect(locked.className).toContain("border-dashed");
expect(locked.textContent).toContain("badgeLocked");
});
it("leaves earned tiles without the lock mark", async () => {
const container = await renderProfile();
const earned = tile(container, "Earned");
expect(earned.getAttribute("data-locked")).toBeNull();
expect(earned.textContent).not.toContain("badgeLocked");
});
});

View File

@@ -0,0 +1,77 @@
// @vitest-environment jsdom
/**
* F4 (KEA-7886): the category chips' "configured/total" count on /dashboard/providers. The
* "/total" part used to sit at opacity-70 on top of text-text-muted — 3.28:1 on the kit button
* (14 axe color-contrast nodes). It must keep the muted token ink at full opacity.
*/
import React from "react";
import { cleanup, render } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
import ProviderSummaryCard, {
type ProviderSummaryStats,
} from "@/app/(dashboard)/dashboard/providers/components/ProviderSummaryCard";
vi.mock("next-intl", () => ({ useTranslations: () => (k: string) => k }));
const stat = { configured: 2, total: 9 };
const stats = Object.fromEntries(
[
"all",
"free",
"noauth",
"oauth",
"apikey",
"compatible",
"webcookie",
"search",
"audio",
"local",
"upstreamproxy",
"cloudagent",
"ide",
"webfetch",
].map((k) => [k, stat])
) as unknown as ProviderSummaryStats;
const t = Object.assign((k: string) => k, { has: () => false });
afterEach(cleanup);
describe("ProviderSummaryCard category counts", () => {
it("renders the /total part without an opacity utility", () => {
const { container } = render(
<ProviderSummaryCard
activeCategory={null}
activeServiceKind={null}
onServiceKindChange={() => {}}
disabledConfigured={false}
displayMode={"grid" as never}
modelSearchQuery=""
onBatchTest={() => {}}
onCategoryChange={() => {}}
onDisplayModeChange={() => {}}
onNewProvider={() => {}}
onImportFromFile={() => {}}
searchQuery=""
setModelSearchQuery={() => {}}
setSearchQuery={() => {}}
showFreeOnly={false}
summaryStats={stats}
t={t}
tc={t}
testingMode={null}
/>
);
const chips = [...container.querySelectorAll<HTMLButtonElement>("button[aria-pressed]")].filter(
(b) => /2\/9/.test(b.textContent ?? "")
);
expect(chips.length).toBeGreaterThan(5);
for (const chip of chips) {
const total = [...chip.querySelectorAll("span")].find((s) => s.textContent === "/9");
expect(total, "the /total span is rendered").toBeTruthy();
expect(total!.className).not.toMatch(/\bopacity-/);
expect(total!.closest("[class*='opacity-']")).toBeNull();
expect(total!.closest(".text-text-muted")).toBeTruthy();
}
});
});

View File

@@ -0,0 +1,104 @@
// @vitest-environment jsdom
/**
* F4 (KEA-7886, review M-4): after Shutdown the Sidebar showed a hand-rolled black overlay with no
* dialog semantics. It is now a non-dismissible kit Modal: named by its title, Escape and the
* overlay do not close it, focus moves inside onto "Reload page".
*/
import React from "react";
import { act } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
process.env.NEXT_PUBLIC_OMNIROUTE_E2E_MODE = "1";
vi.setConfig({ testTimeout: 30_000 });
vi.mock("next-intl", () => ({
useTranslations: () => {
const translate = (key: string) => key;
translate.has = () => false;
return translate;
},
}));
vi.mock("next/navigation", () => ({ usePathname: () => "/dashboard/combos" }));
async function loadSidebar() {
const { SidebarProvider, Sidebar: KitSidebar } = await import("@omniroute/ui-kit/sidebar");
const { default: Sidebar } = await import("@/shared/components/Sidebar");
return function Harness() {
return (
<SidebarProvider>
<KitSidebar collapsible="icon">
<Sidebar />
</KitSidebar>
</SidebarProvider>
);
};
}
const flush = () => act(() => new Promise<void>((resolve) => setTimeout(resolve, 20)));
const dialogs = () => [...document.body.querySelectorAll<HTMLElement>('[role="dialog"]')];
describe("Sidebar disconnect notice", () => {
let root: Root | undefined;
let container: HTMLElement;
beforeEach(() => {
(
globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT?: boolean }
).IS_REACT_ACT_ENVIRONMENT = true;
vi.stubGlobal(
"fetch",
vi.fn(async () => ({ ok: true, status: 200, json: async () => ({}) }) as Response)
);
container = document.createElement("div");
document.body.appendChild(container);
});
afterEach(() => {
if (root) act(() => root!.unmount());
root = undefined;
document.body.innerHTML = "";
vi.unstubAllGlobals();
vi.resetModules();
});
it("is a named, non-dismissible kit dialog with focus on Reload page", async () => {
const Harness = await loadSidebar();
root = createRoot(container);
await act(async () => root!.render(<Harness />));
const shutdown = container.querySelector<HTMLButtonElement>('button[aria-label="shutdown"]')!;
expect(shutdown).not.toBeNull();
act(() => shutdown.click());
await flush();
const confirm = [...dialogs()[0].querySelectorAll("button")].find(
(b) => b.textContent?.trim() === "shutdown"
)!;
await act(async () => confirm.click());
await flush();
const notice = dialogs().find((d) => d.textContent?.includes("serverDisconnectedMsg"))!;
expect(notice).toBeDefined();
expect(notice.className).toContain("ci-dialog");
const labelledBy = notice.getAttribute("aria-labelledby");
expect(labelledBy && document.getElementById(labelledBy)?.textContent).toBe(
"serverDisconnected"
);
expect(notice.querySelector(".material-symbols-outlined")).toBeNull();
// No close button; focus lands on the only action.
const buttons = [...notice.querySelectorAll("button")];
expect(buttons.map((b) => b.textContent?.trim())).toEqual(["reloadPage"]);
expect(document.activeElement).toBe(buttons[0]);
// Escape and an outside pointer interaction leave it open.
act(() => {
document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
});
await flush();
act(() => {
document.body.dispatchEvent(new PointerEvent("pointerdown", { bubbles: true }));
});
await flush();
expect(dialogs().some((d) => d.textContent?.includes("serverDisconnectedMsg"))).toBe(true);
});
});

View File

@@ -0,0 +1,63 @@
// @vitest-environment jsdom
/**
* F4 (KEA-7886, lote 6 pendência 17): the timeline header was a fixed-height single row
* (style height = HEADER_HEIGHT) holding ~10 controls, so at 390 px the toolbar was clipped.
* HEADER_HEIGHT only sized the header (no canvas maths reads it), so it becomes a minimum and
* both the header and its control group wrap.
*/
import React, { act } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
vi.mock("next/navigation", () => ({
useRouter: () => ({ replace: vi.fn(), push: vi.fn(), prefetch: vi.fn(), refresh: vi.fn() }),
}));
const { default: RequestTimeline } = await import("../../../src/shared/components/RequestTimeline");
const { HEADER_HEIGHT } = await import("../../../src/shared/components/RequestTimeline.utils");
class FakeResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
}
let container: HTMLElement;
let root: Root;
beforeEach(() => {
vi.stubGlobal("ResizeObserver", FakeResizeObserver);
vi.stubGlobal(
"fetch",
vi.fn(async () => Response.json({ enabled: false }))
);
vi.useFakeTimers();
container = document.createElement("div");
document.body.appendChild(container);
root = createRoot(container);
});
afterEach(async () => {
await act(async () => root.unmount());
container.remove();
vi.useRealTimers();
vi.unstubAllGlobals();
});
describe("RequestTimeline header", () => {
it("wraps its toolbar instead of clipping it at a fixed height", async () => {
await act(async () => {
root.render(<RequestTimeline />);
});
await act(async () => {
await vi.advanceTimersByTimeAsync(50);
});
const group = container.querySelector('[data-testid="timeline-mode-follow"]')!.parentElement!;
const controls = group.parentElement!;
const header = controls.parentElement!;
expect(header.style.height).toBe("");
expect(header.style.minHeight).toBe(`${HEADER_HEIGHT}px`);
expect(header.className).toMatch(/\bflex-wrap\b/);
expect(controls.className).toMatch(/\bflex-wrap\b/);
});
});