hud chrome: remove Map window, pin top bar, dockable left/right panels (v0.5.0)
CI / build + unit + e2e (pull_request) Successful in 2m18s

This commit is contained in:
2026-10-11 17:40:01 +00:00
parent 762c120bbd
commit 6b167cb435
7 changed files with 357 additions and 122 deletions
+2 -29
View File
@@ -170,13 +170,6 @@ function clickHtml(countryName: string, region?: RegionOwner, nation?: Nation):
</div>`;
}
/** Minimal map API exposed to the floating zoom control (and any other UI). */
export interface MapApi {
zoomIn: () => void;
zoomOut: () => void;
reset: () => void;
}
interface Props {
regions: RegionMap;
playerNationId: string;
@@ -187,11 +180,6 @@ interface Props {
className?: string;
/** Called when a region is clicked, so the dossier can focus its owner. */
onFocusNation?: (id: string) => void;
/**
* Called with a minimal zoom/pan API once the map is ready (and with `null`
* on unmount), so the floating zoom control can drive it.
*/
onMapReady?: (api: MapApi | null) => void;
}
/**
@@ -201,8 +189,8 @@ interface Props {
* stable fills (the choropleth is the star), thin borders, a brighter/thicker
* border for the player, hover + click popups with
* owner + stats, a transient flash on territory changes, and a
* per-scenario initial camera. It exposes a tiny zoom/pan API so the floating
* zoom control can drive it (no MapLibre navigation controls are shown).
* per-scenario initial camera. Zoom and pan are driven directly by the user
* (MapLibre wheel/trackpad + drag) — no floating control and no external API.
*/
export default function WorldMap({
regions,
@@ -211,7 +199,6 @@ export default function WorldMap({
presetId,
className,
onFocusNation,
onMapReady,
}: Props) {
const containerRef = useRef<HTMLDivElement>(null);
const mapRef = useRef<maplibregl.Map | null>(null);
@@ -222,13 +209,11 @@ export default function WorldMap({
const playerRef = useRef(playerNationId);
const presetRef = useRef(presetId);
const onFocusNationRef = useRef(onFocusNation);
const onMapReadyRef = useRef(onMapReady);
regionsRef.current = regions;
nationsRef.current = nations;
playerRef.current = playerNationId;
presetRef.current = presetId;
onFocusNationRef.current = onFocusNation;
onMapReadyRef.current = onMapReady;
// Diffing state for the transient territory-change flash (owned by this component
// so a resync with identical data never re-flashes).
@@ -257,17 +242,6 @@ export default function WorldMap({
// Purely for testability; has no effect on rendering or behavior.
(containerRef.current as unknown as { __map?: maplibregl.Map }).__map = map;
// Expose a tiny zoom/pan API to the floating control (null on unmount).
const api: MapApi = {
zoomIn: () => map.zoomIn(),
zoomOut: () => map.zoomOut(),
reset: () => {
const c = cameraForPreset(presetRef.current);
map.easeTo({ center: c.center, zoom: c.zoom, duration: 600 });
},
};
onMapReadyRef.current?.(api);
const hoverPopup = new maplibregl.Popup({ closeButton: false, closeOnClick: false, offset: 10 });
const clickPopup = new maplibregl.Popup({ closeButton: true, closeOnClick: true, offset: 12 });
let lastHoverId: string | null = null;
@@ -482,7 +456,6 @@ export default function WorldMap({
cancelled = true;
cancelAnimationFrame(flashRaf);
flashApiRef.current = null;
onMapReadyRef.current?.(null);
map.remove();
mapRef.current = null;
if (containerRef.current) {