From 4673aa7a666ebf2a76206cc7c7c13227ebb4fc03 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Fri, 9 Oct 2026 17:56:22 -0400 Subject: [PATCH] feat(map): redesign world picker cards with overflow tooltips Redesign the World Map picker as 4:3 cards with cover imagery, a classification strip (REF code + campaign), corner brackets, and a readout footer (size/weather/access/faction). Add OverflowTooltip, a hover tooltip that only opens when the value is actually clipped, so truncated readouts stay readable. --- src/app/(frontend)/map/page.tsx | 206 ++++++++++++------ .../frontend/map/OverflowTooltip.tsx | 69 ++++++ 2 files changed, 212 insertions(+), 63 deletions(-) create mode 100644 src/components/frontend/map/OverflowTooltip.tsx diff --git a/src/app/(frontend)/map/page.tsx b/src/app/(frontend)/map/page.tsx index e95cfc5d..e396e0c4 100644 --- a/src/app/(frontend)/map/page.tsx +++ b/src/app/(frontend)/map/page.tsx @@ -1,10 +1,10 @@ import config from "@payload-config"; import { getPayload } from "payload"; -import { Fragment } from "react"; import Link from "next/link"; import type { Metadata } from "next"; import { Map as MapIcon, MapPinIcon } from "lucide-react"; import type { Campaign, Faction, Map as MapDoc, Media } from "@/payload-types"; +import { OverflowTooltip } from "@/components/frontend/map/OverflowTooltip"; import { easeStatClass, isWorldMapEntry, @@ -38,6 +38,13 @@ function tilePreviewUrls(template: string): string[] | null { ); } +interface ReadoutCell { + key: string; + value: string; + label: string; + cls?: string; +} + export default async function MapPickerPage() { const payload = await getPayload({ config: await config }); @@ -54,12 +61,15 @@ export default async function MapPickerPage() { return (
-
+

World Map

-
+
PTF Unit Command // Tactical Grid {maps.length} Active Grid{maps.length === 1 ? "" : "s"} @@ -76,7 +86,10 @@ export default async function MapPickerPage() {

) : ( -
+
{maps.map((map) => { const campaign = map.campaign && typeof map.campaign === "object" ? (map.campaign as Campaign) : null; @@ -89,92 +102,159 @@ export default async function MapPickerPage() { map.basemapMode === "tiles" && map.tileUrlTemplate ? tilePreviewUrls(map.tileUrlTemplate) : null; - const stats = [ - map.weather - ? { - key: `w-${map.id}`, - label: weatherStatLabel(map.weather), - cls: weatherStatClass(map.weather), - } - : null, - map.easeOfAccess - ? { - key: `e-${map.id}`, - label: `${map.easeOfAccess} access`, - cls: easeStatClass(map.easeOfAccess), - } - : null, - faction ? { key: `f-${map.id}`, label: faction.name, cls: "text-violet-400" } : null, - ].filter((stat) => stat !== null); + const refCode = String(map.id).padStart(3, "0"); + + // Readout footer cells: size is always known, intel fields join when set. + const cells: ReadoutCell[] = [ + { + key: `s-${map.id}`, + value: `${map.worldSizeWidth}×${map.worldSizeHeight}`, + label: "M", + }, + ]; + if (map.weather) { + cells.push({ + key: `w-${map.id}`, + value: weatherStatLabel(map.weather), + label: "WX", + cls: weatherStatClass(map.weather), + }); + } + if (map.easeOfAccess) { + cells.push({ + key: `e-${map.id}`, + value: map.easeOfAccess, + label: "Access", + cls: easeStatClass(map.easeOfAccess), + }); + } + if (faction) { + cells.push({ + key: `f-${map.id}`, + value: faction.name, + label: "Ctrl", + cls: "text-violet-400", + }); + } + return ( -
+ {/* Cover imagery: basemap photo or zoom-1 tile mosaic, dimmed under the overlays */} +
{url ? ( // eslint-disable-next-line @next/next/no-img-element ) : tileUrls ? ( -
-
-

{map.name}

- - {map.worldSizeWidth}×{map.worldSizeHeight} m - + + {/* Legibility gradient */} +