1
0
Fork 0

feat(dashboard): apply the tactical dossier style to the remaining widgets

Wallet, Negotiations, My Tickets, Notifications, Upcoming Missions,
Active Campaigns and Recent Events were still conventional shadcn Item
cards while Service Summary, Mission Briefing and Situation Report already
used the dossier primitives. Wrap them in the shared TacticalFrame so the
whole dashboard reads as one board:

- classification strip naming the domain (Logistics // Banking,
  Helpdesk // Tickets, and so on), with a REF code on the wallet
- squared corners, corner brackets and the faint grid texture
- an inner header row of icon + uppercase title + action link, matching
  the Service Summary widget
- squared (rounded-sm, bordered) status pills for tickets and campaigns
- a ReadoutFooter on the wallet (account id + status) via the shared
  ReadoutFooter primitive

Empty and self-hiding states are preserved, and the wallet's no-account
path still returns the conventional MyWalletCard CTA. Also drops a dead
CLOSING_STATUSES import from MyTickets.
This commit is contained in:
Jason Fraley 2026-10-13 11:08:56 -04:00
parent 2a264a4530
commit e1cfdd3329
7 changed files with 216 additions and 226 deletions

View file

@ -1,6 +1,6 @@
import Link from "next/link";
import { Item, ItemContent, ItemHeader, ItemTitle } from "@/components/ui/item";
import { ChevronRightIcon, FlagIcon } from "lucide-react";
import { TacticalFrame } from "./tactical";
interface CampaignEntry {
id: number;
@ -14,73 +14,67 @@ interface ActiveCampaignsProps {
}
const statusColors: Record<string, string> = {
inProgress: "bg-blue-500/20 text-blue-400",
concept: "bg-muted text-muted-foreground",
onHold: "bg-amber-500/20 text-amber-400",
inProgress: "bg-blue-500/15 text-blue-400 border-blue-500/30",
concept: "bg-muted text-muted-foreground border-border",
onHold: "bg-amber-500/15 text-amber-400 border-amber-500/30",
};
export function ActiveCampaigns({ campaigns }: ActiveCampaignsProps) {
if (campaigns.length === 0) {
return (
<Item variant="outline">
<ItemHeader>
<div className="flex items-center gap-2">
<FlagIcon className="size-4 text-muted-foreground" />
<ItemTitle>Active Campaigns</ItemTitle>
</div>
</ItemHeader>
<ItemContent>
<p className="text-sm text-muted-foreground italic">No active campaigns.</p>
</ItemContent>
</Item>
);
}
const statusLabel = (status: string): string =>
status === "inProgress" ? "Active" : status === "onHold" ? "On Hold" : status;
export function ActiveCampaigns({ campaigns }: ActiveCampaignsProps) {
return (
<Item variant="outline">
<ItemHeader>
<div className="flex items-center gap-2">
<FlagIcon className="size-4 text-muted-foreground" />
<ItemTitle>Active Campaigns</ItemTitle>
<TacticalFrame classification="Intelligence // Campaigns">
<div className="flex items-center justify-between gap-2 px-4 pt-3">
<div className="flex min-w-0 items-center gap-2">
<FlagIcon className="size-4 shrink-0 text-muted-foreground" />
<h3 className="truncate text-sm font-semibold uppercase tracking-wide">
Active Campaigns
</h3>
</div>
<Link
href="/intelligence/campaigns"
className="py-1 text-xs text-muted-foreground hover:text-primary transition-colors"
>
View all
</Link>
</ItemHeader>
<ItemContent>
<div className="flex flex-col gap-2">
{campaigns.map((campaign) => (
<Link
key={campaign.id}
href={`/intelligence/campaigns/${campaign.id}`}
className="flex items-center gap-3 p-2 rounded-md hover:bg-muted/50 transition-colors group"
>
<FlagIcon className="size-4 text-muted-foreground shrink-0" />
<div className="flex flex-col gap-0.5 min-w-0 flex-1">
<div className="flex items-center gap-2">
<span className="text-sm font-medium truncate group-hover:text-primary transition-colors">
{campaign.name}
</span>
<span
className={`text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded shrink-0 ${statusColors[campaign.status] ?? "bg-muted text-muted-foreground"}`}
>
{campaign.status === "inProgress"
? "Active"
: campaign.status === "onHold"
? "On Hold"
: campaign.status}
</span>
{campaigns.length > 0 && (
<Link
href="/intelligence/campaigns"
className="shrink-0 py-1 text-xs text-muted-foreground transition-colors hover:text-primary"
>
View all
</Link>
)}
</div>
<div className="p-4 pt-3">
{campaigns.length === 0 ? (
<p className="text-sm italic text-muted-foreground">No active campaigns.</p>
) : (
<div className="flex flex-col gap-1">
{campaigns.map((campaign) => (
<Link
key={campaign.id}
href={`/intelligence/campaigns/${campaign.id}`}
className="group flex items-center gap-3 rounded-sm p-2 transition-colors hover:bg-muted/50"
>
<FlagIcon className="size-4 shrink-0 text-muted-foreground" />
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
<div className="flex items-center gap-2">
<span className="truncate text-sm font-medium transition-colors group-hover:text-primary">
{campaign.name}
</span>
<span
className={`shrink-0 rounded-sm border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider ${
statusColors[campaign.status] ?? "bg-muted text-muted-foreground border-border"
}`}
>
{statusLabel(campaign.status)}
</span>
</div>
<span className="truncate text-xs text-muted-foreground">{campaign.summary}</span>
</div>
<span className="text-xs text-muted-foreground truncate">{campaign.summary}</span>
</div>
<ChevronRightIcon className="size-3 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0" />
</Link>
))}
</div>
</ItemContent>
</Item>
<ChevronRightIcon className="size-3 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100" />
</Link>
))}
</div>
)}
</div>
</TacticalFrame>
);
}

View file

@ -1,12 +1,8 @@
import Link from "next/link";
import type { Ticket } from "@/payload-types";
import { Item, ItemContent, ItemHeader, ItemTitle } from "@/components/ui/item";
import { ChevronRightIcon, LifeBuoyIcon } from "lucide-react";
import {
CLOSING_STATUSES,
STATUS_STYLES,
statusLabel,
} from "@/lib/tickets/ticketMeta";
import { STATUS_STYLES, statusLabel } from "@/lib/tickets/ticketMeta";
import { TacticalFrame } from "./tactical";
interface MyTicketsProps {
readonly tickets: Ticket[];
@ -28,23 +24,26 @@ function timeAgo(dateStr: string): string {
export function MyTickets({ tickets, openCount }: MyTicketsProps) {
return (
<Item variant="outline">
<ItemHeader>
<div className="flex items-center gap-2">
<LifeBuoyIcon className="size-4 text-muted-foreground" />
<ItemTitle>My Tickets</ItemTitle>
<TacticalFrame classification="Helpdesk // Tickets">
<div className="flex items-center justify-between gap-2 px-4 pt-3">
<div className="flex min-w-0 items-center gap-2">
<LifeBuoyIcon className="size-4 shrink-0 text-muted-foreground" />
<h3 className="truncate text-sm font-semibold uppercase tracking-wide">My Tickets</h3>
{openCount > 0 && (
<span className="text-xs text-muted-foreground">{openCount} open</span>
<span className="shrink-0 text-xs text-muted-foreground">{openCount} open</span>
)}
</div>
<Link
href="/helpdesk"
className="py-1 text-xs text-muted-foreground transition-colors hover:text-primary"
>
View all
</Link>
</ItemHeader>
<ItemContent>
{tickets.length > 0 && (
<Link
href="/helpdesk"
className="shrink-0 py-1 text-xs text-muted-foreground transition-colors hover:text-primary"
>
View all
</Link>
)}
</div>
<div className="p-4 pt-3">
{tickets.length === 0 ? (
<p className="text-sm italic text-muted-foreground">No tickets yet.</p>
) : (
@ -53,10 +52,10 @@ export function MyTickets({ tickets, openCount }: MyTicketsProps) {
<Link
key={ticket.id}
href={`/helpdesk/${ticket.id}`}
className="group flex items-center gap-3 rounded-md p-2 transition-colors hover:bg-muted/50"
className="group flex items-center gap-3 rounded-sm p-2 transition-colors hover:bg-muted/50"
>
<span
className={`shrink-0 rounded border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider ${STATUS_STYLES[ticket.status]}`}
className={`shrink-0 rounded-sm border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider ${STATUS_STYLES[ticket.status]}`}
>
{statusLabel(ticket.status)}
</span>
@ -73,7 +72,7 @@ export function MyTickets({ tickets, openCount }: MyTicketsProps) {
))}
</div>
)}
</ItemContent>
</Item>
</div>
</TacticalFrame>
);
}

View file

@ -1,9 +1,9 @@
import Link from "next/link";
import type { MarketListing, MarketNegotiation } from "@/payload-types";
import { Item, ItemContent, ItemHeader, ItemTitle } from "@/components/ui/item";
import { ChevronRightIcon, HandshakeIcon } from "lucide-react";
import type { CurrencyConfig } from "@/lib/banking/format";
import { CurrencyAmount } from "@/components/frontend/banking/CurrencyAmount";
import { TacticalFrame } from "./tactical";
interface OpenNegotiationsProps {
readonly negotiations: MarketNegotiation[];
@ -40,21 +40,24 @@ export function OpenNegotiations({
const fmt = (n: number) => <CurrencyAmount value={n} currency={currencyConfig} />;
return (
<Item variant="outline">
<ItemHeader>
<div className="flex items-center gap-2">
<HandshakeIcon className="size-4 text-muted-foreground" />
<ItemTitle>Negotiations</ItemTitle>
<span className="text-xs text-muted-foreground">{negotiations.length} open</span>
<TacticalFrame classification="Logistics // Market">
<div className="flex items-center justify-between gap-2 px-4 pt-3">
<div className="flex min-w-0 items-center gap-2">
<HandshakeIcon className="size-4 shrink-0 text-muted-foreground" />
<h3 className="truncate text-sm font-semibold uppercase tracking-wide">Negotiations</h3>
<span className="shrink-0 text-xs text-muted-foreground">
{negotiations.length} open
</span>
</div>
<Link
href="/logistics/market"
className="py-1 text-xs text-muted-foreground transition-colors hover:text-primary"
className="shrink-0 py-1 text-xs text-muted-foreground transition-colors hover:text-primary"
>
Market
</Link>
</ItemHeader>
<ItemContent>
</div>
<div className="p-4 pt-3">
<div className="flex flex-col gap-1">
{negotiations.map((negotiation) => {
const listing = listingOf(negotiation);
@ -68,7 +71,7 @@ export function OpenNegotiations({
<Link
key={negotiation.id}
href="/logistics/market"
className="group flex items-center gap-3 rounded-md p-2 transition-colors hover:bg-muted/50"
className="group flex items-center gap-3 rounded-sm p-2 transition-colors hover:bg-muted/50"
>
<HandshakeIcon className="size-4 shrink-0 text-muted-foreground" />
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
@ -90,7 +93,7 @@ export function OpenNegotiations({
);
})}
</div>
</ItemContent>
</Item>
</div>
</TacticalFrame>
);
}

View file

@ -1,7 +1,7 @@
import type { GameStructure, User } from "@/payload-types";
import { Item, ItemContent, ItemHeader, ItemTitle } from "@/components/ui/item";
import { BookOpenTextIcon, LockIcon, ScrollTextIcon } from "lucide-react";
import { formatType } from "@/utils/event-log/formatType";
import { TacticalFrame } from "./tactical";
interface EventEntry {
id: number;
@ -33,75 +33,64 @@ function timeAgo(dateStr: string): string {
}
export function RecentEvents({ events, currentUserId }: RecentEventsProps) {
if (events.length === 0) {
return (
<Item variant="outline">
<ItemHeader>
<div className="flex items-center gap-2">
<ScrollTextIcon className="size-4 text-muted-foreground" />
<ItemTitle>Recent Events</ItemTitle>
</div>
</ItemHeader>
<ItemContent>
<p className="text-sm text-muted-foreground italic">No recent events recorded.</p>
</ItemContent>
</Item>
);
}
return (
<Item variant="outline">
<ItemHeader>
<div className="flex items-center gap-2">
<ScrollTextIcon className="size-4 text-muted-foreground" />
<ItemTitle>Recent Events</ItemTitle>
<TacticalFrame classification="Event Log // Recent">
<div className="flex items-center justify-between gap-2 px-4 pt-3">
<div className="flex min-w-0 items-center gap-2">
<ScrollTextIcon className="size-4 shrink-0 text-muted-foreground" />
<h3 className="truncate text-sm font-semibold uppercase tracking-wide">Recent Events</h3>
</div>
</ItemHeader>
<ItemContent>
<div className="flex flex-col">
{events.map((event, index) => {
const actor =
typeof event.actor === "object" && event.actor !== null
? (event.actor as User)
: null;
const actorId = actor?.id ?? (typeof event.actor === "number" ? event.actor : null);
const isYou = actorId != null && actorId === currentUserId;
const actorName = actor?.displayName ?? actor?.username ?? null;
const actorLabel = isYou ? "You" : actorName;
const isNarrative = event.system === false;
</div>
return (
<div key={event.id}>
<div
className={`flex items-start gap-3 py-2 text-sm ${isNarrative ? "pl-3 border-l-2 border-amber-500/40" : ""}`}
>
{isNarrative && (
<BookOpenTextIcon className="size-4 text-amber-400 shrink-0 mt-0.5" />
)}
<div className="flex-1 min-w-0 flex flex-col gap-0.5">
<div className="flex items-center gap-2 text-xs text-muted-foreground">
<span className="tabular-nums shrink-0">{timeAgo(event.timestamp)}</span>
{actorLabel && (
<span className={`font-medium ${isYou ? "text-foreground" : ""}`}>
{actorLabel}
</span>
)}
<span className="capitalize">{formatType(event.type)}</span>
{event.visibility === "restricted" && (
<LockIcon className="size-3 text-amber-400 shrink-0" />
)}
<div className="p-4 pt-3">
{events.length === 0 ? (
<p className="text-sm italic text-muted-foreground">No recent events recorded.</p>
) : (
<div className="flex flex-col">
{events.map((event, index) => {
const actor =
typeof event.actor === "object" && event.actor !== null
? (event.actor as User)
: null;
const actorId = actor?.id ?? (typeof event.actor === "number" ? event.actor : null);
const isYou = actorId != null && actorId === currentUserId;
const actorName = actor?.displayName ?? actor?.username ?? null;
const actorLabel = isYou ? "You" : actorName;
const isNarrative = event.system === false;
return (
<div key={event.id}>
<div
className={`flex items-start gap-3 py-2 text-sm ${isNarrative ? "border-l-2 border-amber-500/40 pl-3" : ""}`}
>
{isNarrative && (
<BookOpenTextIcon className="mt-0.5 size-4 shrink-0 text-amber-400" />
)}
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
<div className="flex items-center gap-2 text-xs text-muted-foreground">
<span className="shrink-0 tabular-nums">{timeAgo(event.timestamp)}</span>
{actorLabel && (
<span className={`font-medium ${isYou ? "text-foreground" : ""}`}>
{actorLabel}
</span>
)}
<span className="capitalize">{formatType(event.type)}</span>
{event.visibility === "restricted" && (
<LockIcon className="size-3 shrink-0 text-amber-400" />
)}
</div>
<span className={`min-w-0 ${isNarrative ? "text-amber-100/90" : ""}`}>
{event.message}
</span>
</div>
<span className={`min-w-0 ${isNarrative ? "text-amber-100/90" : ""}`}>
{event.message}
</span>
</div>
{index < events.length - 1 && <div className="border-t border-border" />}
</div>
{index < events.length - 1 && <div className="border-t border-border" />}
</div>
);
})}
</div>
</ItemContent>
</Item>
);
})}
</div>
)}
</div>
</TacticalFrame>
);
}

View file

@ -1,8 +1,8 @@
import Link from "next/link";
import type { UserNotification } from "@/payload-types";
import { Item, ItemContent, ItemHeader, ItemTitle } from "@/components/ui/item";
import { BellIcon } from "lucide-react";
import { MarkNotificationReadButton } from "@/components/frontend/dashboard/MarkNotificationReadButton";
import { TacticalFrame } from "./tactical";
interface RecentNotificationsProps {
readonly notifications: UserNotification[];
@ -31,30 +31,31 @@ export function RecentNotifications({
if (notifications.length === 0) return null;
return (
<Item variant="outline">
<ItemHeader>
<div className="flex items-center gap-2">
<BellIcon className="size-4 text-muted-foreground" />
<ItemTitle>Notifications</ItemTitle>
<TacticalFrame classification="Comms // Notifications">
<div className="flex items-center justify-between gap-2 px-4 pt-3">
<div className="flex min-w-0 items-center gap-2">
<BellIcon className="size-4 shrink-0 text-muted-foreground" />
<h3 className="truncate text-sm font-semibold uppercase tracking-wide">Notifications</h3>
{unreadCount > 0 && (
<span className="text-xs text-muted-foreground">{unreadCount} unread</span>
<span className="shrink-0 text-xs text-muted-foreground">{unreadCount} unread</span>
)}
</div>
<Link
href="/notifications"
className="py-1 text-xs text-muted-foreground transition-colors hover:text-primary"
className="shrink-0 py-1 text-xs text-muted-foreground transition-colors hover:text-primary"
>
Inbox
</Link>
</ItemHeader>
<ItemContent>
</div>
<div className="p-4 pt-3">
<div className="flex flex-col gap-1">
{notifications.map((notification) => {
const unread = !notification.read;
return (
<div
key={notification.id}
className="group flex items-start gap-1 rounded-md p-2 transition-colors hover:bg-muted/50"
className="group flex items-start gap-1 rounded-sm p-2 transition-colors hover:bg-muted/50"
>
<Link
href={notification.link ?? "/notifications"}
@ -93,7 +94,7 @@ export function RecentNotifications({
);
})}
</div>
</ItemContent>
</Item>
</div>
</TacticalFrame>
);
}

View file

@ -1,53 +1,46 @@
import Link from "next/link";
import { Item, ItemContent, ItemHeader, ItemTitle } from "@/components/ui/item";
import {
MissionCard,
type MissionCardProps,
} from "@/components/frontend/intelligence/MissionCard";
import { CrosshairIcon } from "lucide-react";
import { TacticalFrame } from "./tactical";
interface UpcomingMissionsProps {
readonly missions: MissionCardProps["mission"][];
}
export function UpcomingMissions({ missions }: UpcomingMissionsProps) {
if (missions.length === 0) {
return (
<Item variant="outline">
<ItemHeader>
<div className="flex items-center gap-2">
<CrosshairIcon className="size-4 text-muted-foreground" />
<ItemTitle>Upcoming Missions</ItemTitle>
</div>
</ItemHeader>
<ItemContent>
<p className="text-sm text-muted-foreground italic">No missions scheduled.</p>
</ItemContent>
</Item>
);
}
return (
<Item variant="outline">
<ItemHeader>
<div className="flex items-center gap-2">
<CrosshairIcon className="size-4 text-muted-foreground" />
<ItemTitle>Upcoming Missions</ItemTitle>
<TacticalFrame classification="Operations // Upcoming">
<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" />
<h3 className="truncate text-sm font-semibold uppercase tracking-wide">
Upcoming Missions
</h3>
</div>
<Link
href="/intelligence/missions"
className="py-1 text-xs text-muted-foreground transition-colors hover:text-primary"
>
View all
</Link>
</ItemHeader>
<ItemContent>
<div className="flex flex-col gap-2">
{missions.map((mission) => (
<MissionCard key={mission.id} mission={mission} showFullDetails={false} />
))}
</div>
</ItemContent>
</Item>
{missions.length > 0 && (
<Link
href="/intelligence/missions"
className="shrink-0 py-1 text-xs text-muted-foreground transition-colors hover:text-primary"
>
View all
</Link>
)}
</div>
<div className="p-4 pt-3">
{missions.length === 0 ? (
<p className="text-sm italic text-muted-foreground">No missions scheduled.</p>
) : (
<div className="flex flex-col gap-2">
{missions.map((mission) => (
<MissionCard key={mission.id} mission={mission} showFullDetails={false} />
))}
</div>
)}
</div>
</TacticalFrame>
);
}

View file

@ -1,10 +1,10 @@
import Link from "next/link";
import type { BankAccount } from "@/payload-types";
import { Item, ItemContent, ItemHeader, ItemTitle } from "@/components/ui/item";
import { WalletIcon } from "lucide-react";
import type { CurrencyConfig } from "@/lib/banking/format";
import { CurrencyAmount } from "@/components/frontend/banking/CurrencyAmount";
import { MyWalletCard } from "@/components/frontend/banking/MyWalletCard";
import { ReadoutFooter, TacticalFrame, refCodeFrom } from "./tactical";
interface WalletWidgetProps {
readonly account: BankAccount | null;
@ -12,25 +12,36 @@ interface WalletWidgetProps {
}
export function WalletWidget({ account, currencyConfig }: WalletWidgetProps) {
// No account yet: the call-to-action card owns its own conventional styling.
if (!account) {
return <MyWalletCard />;
}
const footerCells = [
{ label: "Acct", value: `#${account.id}` },
{ label: "Status", value: account.status ?? "open" },
];
return (
<Item variant="outline">
<ItemHeader>
<div className="flex items-center gap-2">
<WalletIcon className="size-4 text-muted-foreground" />
<ItemTitle>Wallet</ItemTitle>
<TacticalFrame
classification="Logistics // Banking"
refCode={`REF ${refCodeFrom(account.id)}`}
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">
<WalletIcon className="size-4 shrink-0 text-muted-foreground" />
<h3 className="truncate text-sm font-semibold uppercase tracking-wide">Wallet</h3>
</div>
<Link
href="/logistics/banking"
className="py-1 text-xs text-muted-foreground transition-colors hover:text-primary"
className="shrink-0 py-1 text-xs text-muted-foreground transition-colors hover:text-primary"
>
Banking
</Link>
</ItemHeader>
<ItemContent>
</div>
<div className="p-4 pt-3">
<Link
href={`/logistics/banking/${account.id}`}
className="group flex items-center justify-between gap-3"
@ -48,7 +59,7 @@ export function WalletWidget({ account, currencyConfig }: WalletWidgetProps) {
<CurrencyAmount value={account.balance ?? 0} currency={currencyConfig} />
</span>
</Link>
</ItemContent>
</Item>
</div>
</TacticalFrame>
);
}