import { BiohazardIcon, BinocularsIcon, CastleIcon, FlameIcon, HelicopterIcon, PackageIcon, PlaneIcon, PlaneTakeoffIcon, RadarIcon, RadioIcon, RocketIcon, ShieldIcon, ShipIcon, TruckIcon, UsersIcon, type LucideIcon, } from "lucide-react"; type Likelihood = "veryUnlikely" | "unlikely" | "possible" | "likely" | "veryLikely"; interface LikelihoodEntry { category: string; likelihood: Likelihood; id?: string | null; } interface MissionThreatAssessmentProps { likelihoods: LikelihoodEntry[] | null; /** Optional mission id, used to derive the deterministic REF code in the strip. */ missionId?: number; } /** * Tactical dossier readout of the analyst threat estimate. Higher likelihood of * an enemy force type reads as more dangerous, so the ramp runs cool (slate) for * "Very Unlikely" up to red for "Very Likely". The value is always spelled out, * so color is reinforcement only, never the sole signal. */ const likelihoodStyles: Record< Likelihood, { label: string; className: string; dot: string } > = { veryUnlikely: { label: "Very Unlikely", className: "text-slate-300", dot: "bg-slate-300" }, unlikely: { label: "Unlikely", className: "text-sky-400", dot: "bg-sky-400" }, possible: { label: "Possible", className: "text-amber-400", dot: "bg-amber-400" }, likely: { label: "Likely", className: "text-orange-400", dot: "bg-orange-400" }, veryLikely: { label: "Very Likely", className: "text-red-400", dot: "bg-red-400" }, }; /** * Heuristic force-type glyph. Categories are free text, so we match on * substrings in priority order (first hit wins): specific platforms before * generic domains, and air-defense before the bare "defense" catch-all. Unknown * categories simply render without an icon. Keywords are lowercase; matching is * case-insensitive `includes`. */ const CATEGORY_ICON_RULES: { Icon: LucideIcon; keywords: string[] }[] = [ { Icon: HelicopterIcon, keywords: ["heli", "rotary", "rotor", "chopper", "dustoff"] }, { Icon: PlaneIcon, keywords: [ "plane", "jet", "aircraft", "fighter", "bomber", "fixed-wing", "fixed wing", "air wing", "airwing", "air support", ], }, { Icon: PlaneTakeoffIcon, keywords: ["drone", "uav", "quadcopter", "fpv", "mavic", "loitering"] }, { Icon: ShieldIcon, keywords: [ "air defense", "air defence", "airdefence", "iads", "anti-air", "antiair", "surface-to-air", "sam site", "patriot", "tunguska", "pantsir", "shilka", "tor-m2", "tor m2", ], }, { Icon: RocketIcon, keywords: [ "rocket", "missile", "artillery", "arty", "mortar", "howitzer", "mlrs", "cannon", "gun line", "gunline", "field gun", ], }, { Icon: ShipIcon, keywords: [ "naval", "navy", "ship", "boat", "maritime", "amphibious", "harbor", "harbour", "riverine", "lhd", "srf", ], }, { Icon: TruckIcon, keywords: [ "armor", "armour", "tank", "afv", "apc", "ifv", "mbt", "mech", "technical", "gun truck", "mrap", ], }, { Icon: UsersIcon, keywords: [ "infantry", "rifle", "foot", "dismount", "soldier", "troop", "grunt", "para", "ranger", "commando", "squad", "insurgent", ], }, { Icon: CastleIcon, keywords: [ "static", "fortif", "bunker", "defense", "defence", "outpost", "emplacement", "objective", "obstacle", "minefield", "landmine", "ied", "ambush", ], }, { Icon: BinocularsIcon, keywords: [ "recon", "scout", "surveil", "observation", "spotter", "sniper", "designator", "jtac", "marc", ], }, { Icon: RadarIcon, keywords: ["radar", "sensor", "counter-battery", "counter battery", "sigint", "c4isr", "c4i"], }, { Icon: RadioIcon, keywords: ["comms", "communication", "radio", "electronic", "jammer", "ecm", "signal", "network"], }, { Icon: PackageIcon, keywords: [ "logistic", "supply", "resupply", "convoy", "fuel", "ammo", "ammunition", "transport", "cargo", "truck", ], }, { Icon: FlameIcon, keywords: ["flame", "incendiary", "thermite", "phosphorus"] }, { Icon: BiohazardIcon, keywords: ["chemical", "biochem", "cbrn", "nbc", "radiolog", "toxic", "nerve agent", "mustard"], }, ]; function resolveCategoryIcon(category: string): LucideIcon | null { const value = category.toLowerCase(); for (const rule of CATEGORY_ICON_RULES) { if (rule.keywords.some((keyword) => value.includes(keyword))) { return rule.Icon; } } return null; } export function MissionThreatAssessment({ likelihoods, missionId, }: MissionThreatAssessmentProps) { if (!likelihoods || likelihoods.length === 0) { return null; } const refCode = missionId != null ? String(missionId).padStart(3, "0") : null; return (
{/* Faint grid texture: constant opacity, never brightens. */}
); }