import config from "@payload-config"; import { getPayload } from "payload"; import Link from "next/link"; import { headers as nextHeaders } from "next/headers"; 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, weatherStatClass, weatherStatLabel, worldMapScreenQuery, } from "@/lib/map/screen"; export const metadata: Metadata = { title: "World Map: Polaris Task Force", }; function basemapUrl(map: MapDoc): string | null { const image = map.basemapImage as Media | number | null | undefined; if (image && typeof image === "object" && image.url) return image.url; return null; } /** * Static preview for tile-mode maps: a 2x2 mosaic of the map's own zoom-1 * tiles covering the whole world square, center-cropped by the card frame. */ function tilePreviewUrls(template: string): string[] | null { if (!template.includes("{z}") || !template.includes("{x}") || !template.includes("{y}")) { return null; } return [0, 1].flatMap((y) => [0, 1].map((x) => template.replace("{z}", "1").replace("{x}", String(x)).replace("{y}", String(y)), ), ); } interface ReadoutCell { key: string; value: string; label: string; cls?: string; } export default async function MapPickerPage() { const payload = await getPayload({ config: await config }); // Maps stay world-readable (overrideAccess), but the reader is still passed so // populated factions run the discovery hook with the right clearance. const { user } = await payload.auth({ headers: await nextHeaders(), canSetHeaders: false, }); const mapsRes = await payload.find({ collection: "maps", where: worldMapScreenQuery(), sort: "name", limit: 100, depth: 1, overrideAccess: true, user, }); const maps = mapsRes.docs.filter((map) => isWorldMapEntry(map)); return (
No maps published to the world map yet. Maps are configured in the admin panel (World: Maps) with the "World Map Entry" flag.