import { ShieldIcon } from "lucide-react"; import type { Faction } from "@/payload-types"; import { Item, ItemContent, ItemHeader, ItemTitle } from "@/components/ui/item"; interface FactionEntry { faction: Faction | number; threatLevel: "ally" | "friendly" | "neutral" | "hostile"; } interface MissionFactionsProps { factionsInvolved: FactionEntry[] | null; } const threatLevelColors: Record = { ally: "bg-green-500/20 text-green-400", friendly: "bg-blue-500/20 text-blue-400", neutral: "bg-yellow-500/20 text-yellow-400", hostile: "bg-red-500/20 text-red-400", }; export function MissionFactions({ factionsInvolved }: MissionFactionsProps) { if (!factionsInvolved || factionsInvolved.length === 0) { return (
Factions

No factions assigned.

); } return (

Factions Involved

{factionsInvolved.map((entry, index) => { const faction = typeof entry.faction === "object" ? entry.faction : null; return ( {faction?.name ?? `Faction #${entry.faction}`} {entry.threatLevel} {faction && ( {faction.type} )} ); })}
); }