From 00092fe471bf6bc69361d273cfb073187a7562b0 Mon Sep 17 00:00:00 2001 From: philluiz2323 Date: Sat, 25 Jul 2026 21:09:14 -0400 Subject: [PATCH] fix(ui): ratchet-clean apps/ui components batch 2/5 (17 files, 47 violations) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #8168 Converts every `no-restricted-syntax` design-guardrail warning in the 17 listed `src/components/metagraphed/**` files to its named token, following the recipe merged in #8177 (packages/ui-kit) and mirrored by #8186 (batch 1). Zero behavioral change — the touched sizes are homogenized onto the type scale (≤2px snaps), matching #8177's intent. - 41 text snaps → `mg-type-*`: sans <12px → `mg-type-caption`; non-uppercase mono numeric → `mg-type-data`/`mg-type-data-sm` (nearest mono step), dropping the now-redundant `font-mono`/`leading-relaxed`. - 1 radius: `rounded-[1px]` → `rounded` (base; `rounded-sm` is off-scale). - 1 external link: the standalone "open" anchor → `` (the icon-only opt-in #8177 added), routing through `safeExternalUrl` with identical rendering. - 1 chip: dropped an `!text-[10px]` override so the cluster uses the Chip primitive's own size, matching the sibling overflow chip. Five sites have no token/primitive equivalent and carry a documented `eslint-disable` (per #8172's flag-don't-invent guidance): - 2× `scroll-mt-32` — anchor scroll-margin, not layout spacing; the guardrail's `mt` matcher flags it and no on-scale step equals 8rem. - 1× 20px mono latency stat — the scale tops out at `mg-type-data` (11px). - 1× the Open-URL anchor inside a Radix `` — must stay a raw `` because `` has no `forwardRef`. - 1× the snippet language switcher (`role="tablist"`) — a segmented control, not a card shell, so `` would impose card semantics. This batch does not touch `RATCHETED_DIRS` — that belongs to whichever batch clears the last file in `src/components/metagraphed/**`. `npx eslint ` reports 0 `no-restricted-syntax`; `tsc --noEmit`, `prettier --check`, and `vitest run src/components/metagraphed` (180 tests) are clean. --- .../metagraphed/charts/latency-heatmap.tsx | 14 +++++++------- .../metagraphed/charts/subnet-pulse-grid.tsx | 4 ++-- .../charts/validator-subnet-heatmap.tsx | 6 +++--- .../metagraphed/command-palette-body.tsx | 6 +++--- .../components/metagraphed/endpoint-card-list.tsx | 4 ++-- .../metagraphed/endpoint-chip-cluster.tsx | 2 +- .../metagraphed/endpoint-compare-panel.tsx | 2 +- .../metagraphed/endpoint-detail-drawer.tsx | 11 ++++++----- .../components/metagraphed/endpoint-kind-tabs.tsx | 2 +- .../src/components/metagraphed/endpoint-list.tsx | 15 ++++++++------- .../metagraphed/endpoint-operational-list.tsx | 6 ++++-- .../components/metagraphed/endpoint-snippet.tsx | 1 + .../metagraphed/endpoint-uptime-bar.tsx | 2 +- .../components/metagraphed/endpoints-glance.tsx | 2 +- .../metagraphed/endpoints-priority-strip.tsx | 9 ++++++--- .../components/metagraphed/entity-hover-card.tsx | 2 +- .../src/components/metagraphed/evidence-panel.tsx | 12 +++++++----- 17 files changed, 55 insertions(+), 45 deletions(-) diff --git a/apps/ui/src/components/metagraphed/charts/latency-heatmap.tsx b/apps/ui/src/components/metagraphed/charts/latency-heatmap.tsx index 074c2bb732..de4571f96a 100644 --- a/apps/ui/src/components/metagraphed/charts/latency-heatmap.tsx +++ b/apps/ui/src/components/metagraphed/charts/latency-heatmap.tsx @@ -184,7 +184,7 @@ export function LatencyHeatmap({ endpoints, minEndpoints = 1, maxProviders = 20 {k} - + {KIND_HINT[k] ?? k} @@ -209,7 +209,7 @@ export function LatencyHeatmap({ endpoints, minEndpoints = 1, maxProviders = 20 {p} - + {p} · {total} endpoint{total === 1 ? "" : "s"} @@ -277,7 +277,7 @@ function Cell({ cell }: { cell: Cell }) { title={title} aria-label={ariaSummary} className={classNames( - "relative h-7 w-full rounded flex items-center justify-center text-[10px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/70 focus-visible:ring-offset-1 focus-visible:ring-offset-card", + "relative h-7 w-full rounded flex items-center justify-center mg-type-caption font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/70 focus-visible:ring-offset-1 focus-visible:ring-offset-card", tone, )} > @@ -287,12 +287,12 @@ function Cell({ cell }: { cell: Cell }) { {cell.downCount > 0 || cell.warnCount > 0 ? ( {cell.downCount > 0 ? ( - + {cell.downCount} ) : null} {cell.warnCount > 0 ? ( - + {cell.warnCount} ) : null} @@ -363,7 +363,7 @@ function Cell({ cell }: { cell: Cell }) { SN{n} - + Jump to SN{n} · {cell.kind} endpoints @@ -434,7 +434,7 @@ function LegendBucket({ cls, label, hint }: { cls: string; label: string; hint: {label} - + {hint} diff --git a/apps/ui/src/components/metagraphed/charts/subnet-pulse-grid.tsx b/apps/ui/src/components/metagraphed/charts/subnet-pulse-grid.tsx index 373870fa82..3c8a181522 100644 --- a/apps/ui/src/components/metagraphed/charts/subnet-pulse-grid.tsx +++ b/apps/ui/src/components/metagraphed/charts/subnet-pulse-grid.tsx @@ -40,7 +40,7 @@ export function SubnetPulseGrid({ columns = 16 }: { columns?: number }) { } if (isError) { - return
Couldn't load subnet pulse.
; + return
Couldn't load subnet pulse.
; } const subs = data?.data ?? []; @@ -72,7 +72,7 @@ export function SubnetPulseGrid({ columns = 16 }: { columns?: number }) {
{s.name ?? `Subnet ${s.netuid}`}
-
health · {health}
+
health · {health}
); diff --git a/apps/ui/src/components/metagraphed/charts/validator-subnet-heatmap.tsx b/apps/ui/src/components/metagraphed/charts/validator-subnet-heatmap.tsx index 941c1188a6..7eb2c8aaa1 100644 --- a/apps/ui/src/components/metagraphed/charts/validator-subnet-heatmap.tsx +++ b/apps/ui/src/components/metagraphed/charts/validator-subnet-heatmap.tsx @@ -54,7 +54,7 @@ export function ValidatorSubnetHeatmap() {
Validator × subnet · stake intensity
-
+
top {rows.length} validators · top 10 subnets each (server-capped) @@ -75,7 +75,7 @@ export function ValidatorSubnetHeatmap() { {netuids.map((n) => ( {n} @@ -117,7 +117,7 @@ export function ValidatorSubnetHeatmap() { )} /> - + {summary} diff --git a/apps/ui/src/components/metagraphed/command-palette-body.tsx b/apps/ui/src/components/metagraphed/command-palette-body.tsx index 339bc32d27..1081213875 100644 --- a/apps/ui/src/components/metagraphed/command-palette-body.tsx +++ b/apps/ui/src/components/metagraphed/command-palette-body.tsx @@ -666,7 +666,7 @@ export function CommandPaletteBody({ open, onOpenChange }: CommandPaletteProps) @@ -725,7 +725,7 @@ export function CommandPaletteBody({ open, onOpenChange }: CommandPaletteProps) @@ -742,7 +742,7 @@ export function CommandPaletteBody({ open, onOpenChange }: CommandPaletteProps) diff --git a/apps/ui/src/components/metagraphed/endpoint-card-list.tsx b/apps/ui/src/components/metagraphed/endpoint-card-list.tsx index 52e06825f1..964daabc76 100644 --- a/apps/ui/src/components/metagraphed/endpoint-card-list.tsx +++ b/apps/ui/src/components/metagraphed/endpoint-card-list.tsx @@ -60,7 +60,7 @@ export function EndpointCardList({
{e.url ? (
- + {e.url} @@ -69,7 +69,7 @@ export function EndpointCardList({ "—" )}
-
+
{e.netuid != null ? ( {visible.map((c) => ( - + {c.label} ))} diff --git a/apps/ui/src/components/metagraphed/endpoint-compare-panel.tsx b/apps/ui/src/components/metagraphed/endpoint-compare-panel.tsx index 3171d531b9..35486e2a92 100644 --- a/apps/ui/src/components/metagraphed/endpoint-compare-panel.tsx +++ b/apps/ui/src/components/metagraphed/endpoint-compare-panel.tsx @@ -135,7 +135,7 @@ function CompareColumn({ Latency trend
-

+

Seeded from server probe history when published; augmented with client-observed samples as you monitor the endpoint.

@@ -179,7 +179,7 @@ export function EndpointDetailDrawer({
{index === 0 ? "Latest" : `Prior ${index}`}
{Math.round(p.v)}ms
-
+
{new Date(p.t).toLocaleString()}
@@ -240,7 +240,7 @@ export function EndpointDetailDrawer({
{rows.length === 0 ? ( -
+
{allRows.length === 0 ? "No incidents recorded for this endpoint in the retained window." : "No incidents match the current filter."} @@ -253,6 +253,7 @@ export function EndpointDetailDrawer({
  • {inc.message ? ( -
    +
    {inc.message}
    ) : null} @@ -307,7 +308,7 @@ export function EndpointDetailDrawer({ })} )} -

    +

    Incident intervals come from /api/v1/endpoint-incidents. Latency series merges published probe samples with locally-observed samples — no synthetic values are generated.

    diff --git a/apps/ui/src/components/metagraphed/endpoint-kind-tabs.tsx b/apps/ui/src/components/metagraphed/endpoint-kind-tabs.tsx index 1f128fa77c..bf773826ea 100644 --- a/apps/ui/src/components/metagraphed/endpoint-kind-tabs.tsx +++ b/apps/ui/src/components/metagraphed/endpoint-kind-tabs.tsx @@ -49,7 +49,7 @@ export function EndpointKindTabs({ value, counts, onChange }: Props) { {count != null ? ( diff --git a/apps/ui/src/components/metagraphed/endpoint-list.tsx b/apps/ui/src/components/metagraphed/endpoint-list.tsx index e18ca01e33..80ed87a454 100644 --- a/apps/ui/src/components/metagraphed/endpoint-list.tsx +++ b/apps/ui/src/components/metagraphed/endpoint-list.tsx @@ -13,6 +13,7 @@ import { safeExternalUrl, CopyIconToggle, Sparkline, + ExternalLink, } from "@jsonbored/ui-kit"; import { useCopy } from "@/hooks/use-copy"; import { Panel } from "@/components/metagraphed/primitives"; @@ -204,7 +205,7 @@ function Row({ ) : null} -
    {e.url ?? "—"}
    +
    {e.url ?? "—"}
    {e.region ?
    {e.region}
    : null} {showProvider ? ( @@ -278,6 +279,7 @@ function Row({
    : it's the child of a Radix , which clones it and injects a ref; is a plain function component (no forwardRef) so it can't receive that ref target="_blank" rel="noopener noreferrer" aria-label="Open URL" @@ -331,7 +333,7 @@ function MobileCard({
    -
    +
    {showProvider ? ( <>
    Provider
    @@ -376,14 +378,13 @@ function MobileCard({ copy {safeUrl ? ( -
    open - + ) : null}
    ) : null} @@ -406,7 +407,7 @@ function HeaderHint({ label, hint }: { label: string; hint: string }) { {label} - + {hint} diff --git a/apps/ui/src/components/metagraphed/endpoint-operational-list.tsx b/apps/ui/src/components/metagraphed/endpoint-operational-list.tsx index 0d6b781e0f..27f1bb295d 100644 --- a/apps/ui/src/components/metagraphed/endpoint-operational-list.tsx +++ b/apps/ui/src/components/metagraphed/endpoint-operational-list.tsx @@ -184,6 +184,7 @@ export function EndpointOperationalList({ id={`endpoint-${endpoint.id}`} role="listitem" className={classNames( + // eslint-disable-next-line no-restricted-syntax -- `scroll-mt-32` is anchor scroll-margin (8rem sticky-header clearance for deep-linked endpoint rows), not layout spacing; the guardrail's `mt` matcher flags it as a false positive and no on-scale step equals 8rem "group relative scroll-mt-32 transition-colors", idx > 0 && "border-t border-border", open ? "bg-surface/70" : "hover:bg-surface/50", @@ -297,7 +298,7 @@ export function EndpointOperationalList({
    ) : endpoint.provider ? ( -
    +
    {endpoint.provider}
    ) : null} @@ -326,6 +327,7 @@ export function EndpointOperationalList({
    would impose card padding/semantics. The rule's rounded+border+bg-card matcher is a false positive here className="mb-3 inline-flex rounded border border-border bg-card p-0.5" role="tablist" aria-label="Snippet language" diff --git a/apps/ui/src/components/metagraphed/endpoint-uptime-bar.tsx b/apps/ui/src/components/metagraphed/endpoint-uptime-bar.tsx index d8c52eb19b..320cfa80a7 100644 --- a/apps/ui/src/components/metagraphed/endpoint-uptime-bar.tsx +++ b/apps/ui/src/components/metagraphed/endpoint-uptime-bar.tsx @@ -62,7 +62,7 @@ export function EndpointUptimeBar({ {item.value}
    - {item.hint ?

    {item.hint}

    : null} + {item.hint ?

    {item.hint}

    : null} {item.rows.length > 0 ? (
      {item.rows.slice(0, 3).map((r) => ( -
    • +
    • {r.provider ?? r.provider_slug ?? r.id} {r.latency_ms != null ? ( @@ -129,7 +132,7 @@ function PriorityCard({ item }: { item: Item }) { ))}
    ) : ( -
    +
    Nothing to review
    )} diff --git a/apps/ui/src/components/metagraphed/entity-hover-card.tsx b/apps/ui/src/components/metagraphed/entity-hover-card.tsx index 9f3d675934..00d99d5f2b 100644 --- a/apps/ui/src/components/metagraphed/entity-hover-card.tsx +++ b/apps/ui/src/components/metagraphed/entity-hover-card.tsx @@ -162,7 +162,7 @@ function ProviderMiniProfile({ slug }: { slug: string }) {
    {slug}
    - {p.notes ?

    {p.notes}

    : null} + {p.notes ?

    {p.notes}

    : null}
    diff --git a/apps/ui/src/components/metagraphed/evidence-panel.tsx b/apps/ui/src/components/metagraphed/evidence-panel.tsx index 7e9796b518..22faf3887d 100644 --- a/apps/ui/src/components/metagraphed/evidence-panel.tsx +++ b/apps/ui/src/components/metagraphed/evidence-panel.tsx @@ -111,7 +111,7 @@ export function EvidencePanel({ netuid, pageSize = 50 }: Props) { return (
    -
    +
    Source