1
0
Fork 0
polaris-task-force/src/components/frontend/dashboard/ProfileSummary.tsx
Z8MB1E 9c3870cf79 fix(mobile): meet the 24px tap-target floor across the app
Session A measured 159 targets under the WCAG 2.5.8 minimum on 42 routes;
this brings that to zero. Mostly one-line spacing changes: small caption
labels and text links were 14-21px tall because shadcn Label/Button use
leading-none and bare text links carry no vertical padding.

- shared Dialog close button: p-1 with right-3/top-3 so the 24px hit box
  keeps the icon where it was
- tour card: Skip all tours (13 routes), All boards on standings cards (6)
- detail pages: 27 Back links, journals All journals, wiki category
  links, voiceover card titles, factions batch link
- dashboard: 7 View all / View full record links
- account preferences: mute rows min-h-6, radio and tours labels, plus
  contacts filter labels and the campaigns show-completed label
- ribbon studio: mirror label and stripe/module remove buttons
- helpdesk ticket titles, radio tick-sound label
2026-10-12 22:17:51 -04:00

100 lines
3.5 KiB
TypeScript

import Link from "next/link";
import type { Assignment, Rank } from "@/payload-types";
import type { ResolvedLevel } from "@/utils/xp/resolveLevel";
import { UserIcon } from "lucide-react";
import { ReadoutFooter, TacticalFrame, refCodeFrom } from "./tactical";
interface ProfileSummaryProps {
displayName: string;
username: string;
rank: Pick<Rank, "name" | "abbreviation"> & { insigniaUrl?: string | null };
xpLevel: ResolvedLevel;
assignments: Pick<Assignment, "name" | "type" | "callsign">[];
}
export function ProfileSummary({
displayName,
username,
rank,
xpLevel,
assignments,
}: ProfileSummaryProps) {
const footerCells = [
{ label: "XP", value: xpLevel.xp.toLocaleString() },
{ label: "Level", value: xpLevel.levelName },
{ label: "Rank", value: rank.abbreviation || "-" },
{ label: "Assignments", value: String(assignments.length) },
];
return (
<TacticalFrame
classification="Personnel // Service Record"
refCode={`REF ${refCodeFrom(username)}`}
footer={<ReadoutFooter cells={footerCells} />}
>
<div className="flex items-center justify-between gap-2 px-4 pt-3">
<div className="flex min-w-0 items-center gap-2">
<UserIcon className="size-4 shrink-0 text-muted-foreground" />
<h3 className="truncate text-sm font-semibold uppercase tracking-wide">
Service Summary
</h3>
</div>
<Link
href={`/profile/${username}`}
className="shrink-0 py-1 text-xs text-muted-foreground transition-colors hover:text-primary"
>
View full record
</Link>
</div>
<div className="flex flex-col gap-4 p-4 pt-3">
<div className="flex items-start gap-4">
{rank.insigniaUrl && (
<img
src={rank.insigniaUrl}
alt={rank.name}
className="size-14 object-contain shrink-0"
/>
)}
<div className="flex flex-col gap-1 min-w-0">
<h4 className="text-lg font-bold tracking-tight uppercase">{displayName}</h4>
<div className="flex items-center gap-2 text-sm text-muted-foreground">
<span className="font-medium text-foreground">{rank.name}</span>
<span className="text-border">|</span>
<span className="uppercase tracking-wide text-xs font-semibold text-primary">
{xpLevel.levelName}
</span>
</div>
</div>
</div>
<div className="flex items-center gap-2">
<div className="flex-1 h-2 bg-border rounded-full overflow-hidden max-w-xs">
<div
className="h-full bg-primary rounded-full transition-all"
style={{ width: `${Math.min(xpLevel.progress, 100)}%` }}
/>
</div>
<span className="text-xs font-mono text-muted-foreground">
{xpLevel.xp.toLocaleString()} XP
</span>
</div>
{assignments.length > 0 && (
<div className="flex flex-wrap gap-2">
{assignments.map((a) => (
<span
key={a.name}
className="text-xs font-mono bg-muted border border-border px-2.5 py-1 rounded-sm"
>
{a.callsign ? `[${a.callsign}] ` : ""}
{a.name}
<span className="text-muted-foreground ml-1.5">({a.type})</span>
</span>
))}
</div>
)}
</div>
</TacticalFrame>
);
}