From b6e8fa6f90ba87730bfd2c0e291365e5f38f59d4 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Mon, 2 Nov 2026 14:28:53 -0500 Subject: [PATCH] feat(frontend): make faction cards links with type-tag width and cover-image backgrounds Each faction card in the Mission Details FACTIONS section is now an anchor to /intelligence/factions/. The type badge (Player/Major/Minor/ Corporation/Special) uses width:fit-content so its colored background only spans the text instead of the full card, and a faction's coverImage (when present) renders as a centered object-cover background at low opacity that brightens on hover. --- .../frontend/intelligence/MissionFactions.tsx | 52 +++++++++++++------ 1 file changed, 36 insertions(+), 16 deletions(-) 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} + + + )} + ); })}