refactor(inbox): kami literary rewrite — drop tiles, cards, red stripe

The Inbox rendered every row as a heavy card: a 36x36 solid-fill icon
tile in ink-blue / destructive / warm-silver, a rounded border, a 3pt
red left stripe on urgent items, and a hover that fired a drop shadow
plus translate-y. Six loud signals, all fighting for the reader, all
breaking kami rules (no pure-hue tiles, no red accents outside
destructive buttons, no hard drop shadows, no unnecessary chrome).

Per Jony + Jobs consensus the surface collapses to one quiet canvas:

  - 36x36 color tile  -> removed. Icon is an 18px inline glyph, single
    ink-blue stroke for every type. Type meaning lives in the glyph
    shape (ShieldCheck / XCircle / Eye / ChatCircle / ...), not in
    background color.
  - 3pt red severity stripe -> removed. Urgency compresses to one
    signal: a 5px ink-blue dot before the timestamp, visible only for
    critical/high rows. Title also shifts from font-medium to
    font-semibold at the same threshold so the row carries a little
    more weight without shouting.
  - Card chrome (border, rounded, bg-card) -> removed. Rows sit flat
    on parchment, separated by a single border-b at --border/60
    hairline. Reads like a printed contents page instead of a trello
    board of cards.
  - Hover shadow-md + -translate-y-px -> removed (kami rule 8 bans
    hard drop shadows). Hover tints the row with bg-muted/40, which
    is the kami whisper-shadow equivalent for a list item.

AttentionRow gains a variant prop ("card" | "line", default "card")
so Dashboard's three existing call-sites keep their card rendering
untouched. The "line" branch rejects iconTileBg / rowBgClass /
borderAccentClass overrides — the two variants are orthogonal, not a
half-mixed code path.

inbox-helpers.tsx sheds every token that became dead after the
rewrite: typeConfig.color (constant var(--primary) for every type
after Jony's unification), severityColors, severityBorderClass, and
the unused bg field. Inbox routes icon color through tone="info"
instead of passing the redundant iconColor per row.

Note: the page shows 6 duplicate "Escalation from Maya Rodriguez"
rows and 5 duplicate "Escalation from Taylor Park" rows. That is a
backend dedup bug (same entity + same severity pushed multiple
times), not a visual issue. Flag for a dedicated follow-up; do not
paper over it in the renderer.

Reviewed by Karpathy against /karpathy-guidelines:
  - Surgical: pass
  - No overcomplication: pass
  - Variants orthogonal: pass
  - Orphans cleared: pass
  - API stability for Dashboard callers: pass
  - request_changes item (typeConfig.color is a constant dressed as
    data) addressed in this commit by dropping the field and routing
    through tone="info".

Typecheck and build:verify clean.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-21 14:25:26 -04:00
1 parent f9b505569c
commit 86ca568b90
3 files changed
+58 -41

No files matched your search

+39 -14
View File
@@ -6,6 +6,7 @@ const ATTENTION_STAGGER_MAX = 8;
const ATTENTION_STAGGER_STEP = 0.04;
export type AttentionTone = "warn" | "danger" | "info" | "neutral";
export type AttentionVariant = "card" | "line";
export interface AttentionRowProps {
icon: ElementType;
@@ -21,6 +22,7 @@ export interface AttentionRowProps {
borderAccentClass?: string;
showArrow?: boolean;
iconWeight?: "fill" | "bold" | "regular";
variant?: AttentionVariant;
}
const toneIconClass: Record<AttentionTone, string> = {
@@ -51,30 +53,53 @@ export function AttentionRow({
borderAccentClass,
showArrow = true,
iconWeight,
variant = "card",
}: AttentionRowProps) {
const iconClass = iconColor ? "" : toneIconClass[tone];
const bgClass = rowBgClass ?? toneBgClass[tone];
const delay = Math.min(index, ATTENTION_STAGGER_MAX) * ATTENTION_STAGGER_STEP;
const borderClass = borderAccentClass ?? "border-[color:var(--destructive)] border-opacity-20 hover:border-opacity-40";
const isButton = typeof onClick === "function";
const commonClass = `focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 flex w-full items-center gap-3 rounded-lg border ${borderClass} ${bgClass} px-4 py-3 text-left transition`;
const iconElement = iconTileBg ? (
<div
className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg"
style={{ backgroundColor: iconTileBg }}
>
<Icon size={18} weight={iconWeight} className={iconClass} style={iconColor ? { color: iconColor } : undefined} />
</div>
) : (
<Icon size={18} weight={iconWeight} className={`shrink-0 ${iconClass}`} style={iconColor ? { color: iconColor } : undefined} />
);
const chromeClass =
variant === "line"
? "border-b border-border/60 hover:bg-muted/40 px-2 py-3"
: (() => {
const bgClass = rowBgClass ?? toneBgClass[tone];
const borderClass =
borderAccentClass ??
"border-[color:var(--destructive)] border-opacity-20 hover:border-opacity-40";
return `rounded-lg border ${borderClass} ${bgClass} px-4 py-3`;
})();
const commonClass = `focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 flex w-full items-center gap-3 text-left transition ${chromeClass}`;
const iconElement =
variant === "card" && iconTileBg ? (
<div
className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg"
style={{ backgroundColor: iconTileBg }}
>
<Icon
size={18}
weight={iconWeight}
className={iconClass}
style={iconColor ? { color: iconColor } : undefined}
/>
</div>
) : (
<Icon
size={18}
weight={iconWeight}
className={`shrink-0 ${iconClass}`}
style={iconColor ? { color: iconColor } : undefined}
/>
);
const titleWeightClass = variant === "line" ? "" : "font-medium";
const inner = (
<>
{iconElement}
<div className="min-w-0 flex-1">
<div className="truncate text-[13px] font-medium text-foreground">{title}</div>
<div className={`truncate text-[13px] ${titleWeightClass} text-foreground`}>{title}</div>
{subtitle ? <div className="mt-0.5 text-[11px] text-muted-foreground">{subtitle}</div> : null}
</div>
{rightMeta}