1
0
Fork 0

feat(dashboard): demo tactical dossier styling on hero widgets

- New shared TacticalFrame/ReadoutFooter primitives (classification strip,
  corner brackets, faint grid texture, mono readout bar) following the
  campaign-card recipe; each piece separable per widget
- ProfileSummary: full frame + service-record readout footer (XP/level/rank/assignments)
- MissionBriefing: frame + codename line, inner MissionCard kept conventional
- QuickStats: hairline-separated situation-report readout bar
- Dense widgets (events, tickets, notifications, wallet, negotiations) stay
  shadcn so the tactical surfaces stand out
This commit is contained in:
Jason Fraley 2026-10-12 13:26:21 -04:00
parent 3219142f88
commit 8fb97fdd1c
4 changed files with 194 additions and 83 deletions

View file

@ -1,10 +1,10 @@
import Link from "next/link"; import Link from "next/link";
import { Item, ItemContent, ItemHeader, ItemTitle } from "@/components/ui/item"; import { CrosshairIcon } from "lucide-react";
import { import {
MissionCard, MissionCard,
type MissionCardProps, type MissionCardProps,
} from "@/components/frontend/intelligence/MissionCard"; } from "@/components/frontend/intelligence/MissionCard";
import { CrosshairIcon } from "lucide-react"; import { TacticalFrame, refCodeFrom } from "./tactical";
interface MissionBriefingProps { interface MissionBriefingProps {
readonly mission: MissionCardProps["mission"] | null; readonly mission: MissionCardProps["mission"] | null;
@ -13,26 +13,31 @@ interface MissionBriefingProps {
export function MissionBriefing({ mission, heading = "Next Mission" }: MissionBriefingProps) { export function MissionBriefing({ mission, heading = "Next Mission" }: MissionBriefingProps) {
return ( return (
<Item variant="outline" className="items-start content-start"> <TacticalFrame
<ItemHeader> classification={`Operations // ${heading}`}
<div className="flex items-center gap-2"> refCode={mission ? `REF ${refCodeFrom(mission.id)}` : undefined}
<CrosshairIcon className="size-4 text-muted-foreground" /> >
<ItemTitle>{heading}</ItemTitle> <div className="flex items-center justify-between gap-2 px-4 pt-3">
<div className="flex min-w-0 items-center gap-2">
<CrosshairIcon className="size-4 shrink-0 text-muted-foreground" />
<span className="truncate font-mono text-xs uppercase tracking-widest text-muted-foreground">
{mission?.codeName ?? "Standby"}
</span>
</div> </div>
<Link <Link
href="/intelligence/missions" href="/intelligence/missions"
className="text-xs text-muted-foreground transition-colors hover:text-primary" className="shrink-0 text-xs text-muted-foreground transition-colors hover:text-primary"
> >
View all View all
</Link> </Link>
</ItemHeader> </div>
<ItemContent> <div className="p-4 pt-3">
{mission ? ( {mission ? (
<MissionCard mission={mission} showFullDetails /> <MissionCard mission={mission} showFullDetails />
) : ( ) : (
<p className="text-sm text-muted-foreground italic">No missions currently scheduled.</p> <p className="text-sm text-muted-foreground italic">No missions currently scheduled.</p>
)} )}
</ItemContent> </div>
</Item> </TacticalFrame>
); );
} }

View file

@ -1,8 +1,8 @@
import Link from "next/link"; import Link from "next/link";
import type { Assignment, Rank } from "@/payload-types"; import type { Assignment, Rank } from "@/payload-types";
import type { ResolvedLevel } from "@/utils/xp/resolveLevel"; import type { ResolvedLevel } from "@/utils/xp/resolveLevel";
import { Item, ItemContent, ItemHeader, ItemTitle } from "@/components/ui/item";
import { UserIcon } from "lucide-react"; import { UserIcon } from "lucide-react";
import { ReadoutFooter, TacticalFrame, refCodeFrom } from "./tactical";
interface ProfileSummaryProps { interface ProfileSummaryProps {
displayName: string; displayName: string;
@ -19,21 +19,35 @@ export function ProfileSummary({
xpLevel, xpLevel,
assignments, assignments,
}: ProfileSummaryProps) { }: 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 ( return (
<Item variant="outline" className="items-start content-start"> <TacticalFrame
<ItemHeader> classification="Personnel // Service Record"
<div className="flex items-center gap-2"> refCode={`REF ${refCodeFrom(username)}`}
<UserIcon className="size-4 text-muted-foreground" /> footer={<ReadoutFooter cells={footerCells} />}
<ItemTitle>Service Summary</ItemTitle> >
<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> </div>
<Link <Link
href={`/profile/${username}`} href={`/profile/${username}`}
className="text-xs text-muted-foreground hover:text-primary transition-colors" className="shrink-0 text-xs text-muted-foreground transition-colors hover:text-primary"
> >
View full record View full record
</Link> </Link>
</ItemHeader> </div>
<ItemContent className="flex flex-col gap-4">
<div className="flex flex-col gap-4 p-4 pt-3">
<div className="flex items-start gap-4"> <div className="flex items-start gap-4">
{rank.insigniaUrl && ( {rank.insigniaUrl && (
<img <img
@ -43,7 +57,7 @@ export function ProfileSummary({
/> />
)} )}
<div className="flex flex-col gap-1 min-w-0"> <div className="flex flex-col gap-1 min-w-0">
<h3 className="text-lg font-bold tracking-tight uppercase">{displayName}</h3> <h4 className="text-lg font-bold tracking-tight uppercase">{displayName}</h4>
<div className="flex items-center gap-2 text-sm text-muted-foreground"> <div className="flex items-center gap-2 text-sm text-muted-foreground">
<span className="font-medium text-foreground">{rank.name}</span> <span className="font-medium text-foreground">{rank.name}</span>
<span className="text-border">|</span> <span className="text-border">|</span>
@ -71,7 +85,7 @@ export function ProfileSummary({
{assignments.map((a) => ( {assignments.map((a) => (
<span <span
key={a.name} key={a.name}
className="text-xs font-mono bg-muted border border-border px-2.5 py-1 rounded-md" className="text-xs font-mono bg-muted border border-border px-2.5 py-1 rounded-sm"
> >
{a.callsign ? `[${a.callsign}] ` : ""} {a.callsign ? `[${a.callsign}] ` : ""}
{a.name} {a.name}
@ -80,7 +94,7 @@ export function ProfileSummary({
))} ))}
</div> </div>
)} )}
</ItemContent> </div>
</Item> </TacticalFrame>
); );
} }

View file

@ -1,5 +1,6 @@
import { Item, ItemContent, ItemDescription, ItemMedia, ItemTitle } from "@/components/ui/item"; import type { LucideIcon } from "lucide-react";
import { Building2Icon, CrosshairIcon, ShieldIcon, UsersIcon } from "lucide-react"; import { Building2Icon, CrosshairIcon, ShieldIcon, UsersIcon } from "lucide-react";
import { TacticalFrame } from "./tactical";
interface QuickStatsProps { interface QuickStatsProps {
activeCampaigns: number; activeCampaigns: number;
@ -9,6 +10,12 @@ interface QuickStatsProps {
totalMembers: number; totalMembers: number;
} }
interface StatCell {
label: string;
value: number;
icon: LucideIcon;
}
export function QuickStats({ export function QuickStats({
activeCampaigns, activeCampaigns,
totalMissions, totalMissions,
@ -16,63 +23,30 @@ export function QuickStats({
totalFactions, totalFactions,
totalMembers, totalMembers,
}: QuickStatsProps) { }: QuickStatsProps) {
const cells: StatCell[] = [
{ label: "Campaigns", value: activeCampaigns, icon: CrosshairIcon },
{ label: "Missions", value: totalMissions, icon: CrosshairIcon },
{ label: "Structures", value: totalStructures, icon: Building2Icon },
{ label: "Factions", value: totalFactions, icon: ShieldIcon },
{ label: "Operators", value: totalMembers, icon: UsersIcon },
];
return ( return (
<div className="grid grid-cols-2 md:grid-cols-3 2xl:grid-cols-5 gap-3"> <TacticalFrame classification="Theater // Situation Report" brackets={false}>
<Item variant="muted" size="sm"> {/* gap-px over a white/10 backdrop renders hairline separators in both directions */}
<ItemMedia variant="icon"> <div className="grid grid-cols-2 gap-px bg-white/10 sm:grid-cols-3 2xl:grid-cols-5">
<CrosshairIcon /> {cells.map((cell) => (
</ItemMedia> <div key={cell.label} className="flex flex-col gap-1 bg-card px-4 py-3">
<ItemContent> <span className="font-mono text-xl leading-none tabular-nums text-foreground">
<ItemTitle className="whitespace-nowrap">Active Campaigns</ItemTitle> {cell.value.toLocaleString()}
<ItemDescription className="text-2xl font-semibold text-foreground leading-none"> </span>
{activeCampaigns} <span className="flex items-center gap-1.5 text-[9px] uppercase tracking-widest text-muted-foreground">
</ItemDescription> <cell.icon aria-hidden="true" className="size-3 opacity-60" />
</ItemContent> {cell.label}
</Item> </span>
<Item variant="muted" size="sm"> </div>
<ItemMedia variant="icon"> ))}
<CrosshairIcon /> </div>
</ItemMedia> </TacticalFrame>
<ItemContent>
<ItemTitle className="whitespace-nowrap">Total Missions</ItemTitle>
<ItemDescription className="text-2xl font-semibold text-foreground leading-none">
{totalMissions}
</ItemDescription>
</ItemContent>
</Item>
<Item variant="muted" size="sm">
<ItemMedia variant="icon">
<Building2Icon />
</ItemMedia>
<ItemContent>
<ItemTitle className="whitespace-nowrap">Structures</ItemTitle>
<ItemDescription className="text-2xl font-semibold text-foreground leading-none">
{totalStructures}
</ItemDescription>
</ItemContent>
</Item>
<Item variant="muted" size="sm">
<ItemMedia variant="icon">
<ShieldIcon />
</ItemMedia>
<ItemContent>
<ItemTitle className="whitespace-nowrap">Factions</ItemTitle>
<ItemDescription className="text-2xl font-semibold text-foreground leading-none">
{totalFactions}
</ItemDescription>
</ItemContent>
</Item>
<Item variant="muted" size="sm">
<ItemMedia variant="icon">
<UsersIcon />
</ItemMedia>
<ItemContent>
<ItemTitle className="whitespace-nowrap">Operators</ItemTitle>
<ItemDescription className="text-2xl font-semibold text-foreground leading-none">
{totalMembers}
</ItemDescription>
</ItemContent>
</Item>
</div>
); );
} }

View file

@ -0,0 +1,118 @@
import type { ReactNode } from "react";
import { cn } from "@/lib/utils";
/**
* Shared tactical "dossier" primitives for dashboard hero widgets, following
* the recipe in src/components/frontend/AGENTS.md (reference implementation:
* CampaignCard). Each piece is separable: frames can take just the strip, or
* brackets, or a readout footer. Dense widgets stay conventional shadcn so
* these surfaces stand out.
*/
/** Deterministic 3-digit reference code derived from a seed (id, username...). */
export function refCodeFrom(seed: string | number): string {
const value = String(seed);
let hash = 5381;
for (let i = 0; i < value.length; i += 1) {
hash = ((hash << 5) + hash + value.charCodeAt(i)) >>> 0;
}
return String(hash % 1000).padStart(3, "0");
}
interface TacticalFrameProps {
/** Left classification-strip label, e.g. "Personnel // Service Record". */
classification: string;
/** Right strip label, e.g. "REF 042". Omit to hide. */
refCode?: string;
children: ReactNode;
/** Optional permanent readout bar pinned to the bottom edge. */
footer?: ReactNode;
/** Corner brackets, default on. Turn off for bar-shaped surfaces. */
brackets?: boolean;
className?: string;
}
export function TacticalFrame({
classification,
refCode,
children,
footer,
brackets = true,
className,
}: TacticalFrameProps) {
return (
<div
className={cn(
"group relative flex min-w-0 flex-col overflow-hidden rounded-none border border-border/70 bg-card transition-colors duration-300 hover:border-foreground/30",
className,
)}
>
{/* Faint grid texture: constant opacity, never brightens on hover. */}
<div
aria-hidden="true"
className="pointer-events-none absolute inset-0 opacity-[0.04]"
style={{
backgroundImage:
"linear-gradient(to right, white 1px, transparent 1px), linear-gradient(to bottom, white 1px, transparent 1px)",
backgroundSize: "28px 28px",
}}
/>
<div
aria-hidden="true"
className="relative z-20 flex items-center justify-between gap-2 border-b border-white/15 bg-black/50 px-4 py-1.5 backdrop-blur-sm"
>
<span className="truncate font-mono text-[9px] uppercase tracking-widest text-white/60">
{classification}
</span>
{refCode ? (
<span className="shrink-0 font-mono text-[9px] uppercase tracking-widest text-white/60">
{refCode}
</span>
) : null}
</div>
{brackets ? (
<div aria-hidden="true" className="pointer-events-none absolute inset-2 z-30">
<span className="absolute left-0 top-0 size-3 border-l border-t border-white/25 transition-colors duration-300 group-hover:border-white/60" />
<span className="absolute right-0 top-0 size-3 border-r border-t border-white/25 transition-colors duration-300 group-hover:border-white/60" />
<span className="absolute bottom-0 left-0 size-3 border-b border-l border-white/25 transition-colors duration-300 group-hover:border-white/60" />
<span className="absolute bottom-0 right-0 size-3 border-b border-r border-white/25 transition-colors duration-300 group-hover:border-white/60" />
</div>
) : null}
<div className="relative z-10 flex min-w-0 flex-1 flex-col">{children}</div>
{footer ? <div className="relative z-20 mt-auto">{footer}</div> : null}
</div>
);
}
export interface ReadoutCell {
label: string;
value: string;
}
/** Permanent single-line readout bar (hairline-separated mono cells). */
export function ReadoutFooter({ cells }: { cells: ReadoutCell[] }) {
return (
<div className="flex items-stretch border-t border-white/15 bg-black/60 px-2 py-1.5 backdrop-blur-sm">
{cells.map((cell, index) => (
<div
key={cell.label}
className={cn(
"flex min-w-0 flex-1 items-center justify-center gap-1.5 px-1",
index < cells.length - 1 && "border-r border-white/15",
)}
>
<span className="truncate font-mono text-xs tabular-nums text-white/80">
{cell.value}
</span>
<span className="shrink-0 text-[9px] uppercase tracking-wider text-white/50">
{cell.label}
</span>
</div>
))}
</div>
);
}