diff --git a/src/components/frontend/intelligence/MissionFactions.tsx b/src/components/frontend/intelligence/MissionFactions.tsx index a9321908..ba375691 100644 --- a/src/components/frontend/intelligence/MissionFactions.tsx +++ b/src/components/frontend/intelligence/MissionFactions.tsx @@ -1,5 +1,5 @@ import { ShieldIcon } from "lucide-react"; -import type { Faction } from "@/payload-types"; +import type { Faction, Media } from "@/payload-types"; import { Item, ItemContent, ItemHeader, ItemTitle } from "@/components/ui/item"; interface FactionEntry { @@ -56,24 +56,44 @@ export function MissionFactions({ factionsInvolved }: MissionFactionsProps) {
{factionsInvolved.map((entry, index) => { const faction = typeof entry.faction === "object" ? entry.faction : null; + const coverImage = + faction && typeof faction.coverImage === "object" && faction.coverImage !== null + ? (faction.coverImage as Media) + : null; + const coverUrl = coverImage?.url ?? null; + const factionId = typeof entry.faction === "object" ? entry.faction.id : entry.faction; return ( - - - {faction?.name ?? `Faction #${entry.faction}`} - - {entry.threatLevel} - - - {faction && ( - - - {FACTION_TYPE_LABELS[faction.type] ?? faction.type} + + + {coverUrl && ( + + )} + + {faction?.name ?? `Faction #${entry.faction}`} + + {entry.threatLevel} - - )} + + {faction && ( + + + {FACTION_TYPE_LABELS[faction.type] ?? faction.type} + + + )} + ); })}