Fix variant-aware fleet card map labels (Refs #150)
CI / checks (push) Successful in 5m47s

This commit is contained in:
2026-10-12 19:55:26 -04:00
parent 106d3a5ded
commit bcd3b99ee4
5 changed files with 220 additions and 10 deletions
+19 -3
View File
@@ -5,7 +5,8 @@
import type { RosterPlayer, Health } from '$ui/stores/servers.js';
import { telemetryByServer, uiNow } from '$ui/stores/servers.js';
import { elapsedSince } from '$ui/duration.js';
import { mapTitle, serverIdentity, serverTitle } from '$ui/server-labels.js';
import { serverIdentity, serverTitle } from '$ui/server-labels.js';
import { fleetIdentity } from '$lib/fleet-overview.js';
import { decodeRconError, rconFixHint } from '$ui/rconError.js';
import Card from './primitives/Card.svelte';
import Badge from './primitives/Badge.svelte';
@@ -20,6 +21,9 @@
name: string;
players?: number | null;
map?: string | null;
game?: string | null;
mapSlug?: string | null;
gameMode?: string | null;
gametype?: string | null;
roster?: RosterPlayer[] | null;
health?: Health;
@@ -45,6 +49,9 @@
name,
players = null,
map = null,
game: serverGame = null,
mapSlug = null,
gameMode = null,
roster = null,
health = 'offline',
lastSeenAt = null,
@@ -76,8 +83,17 @@
const compact = $derived(compactEmpty && health === 'online' && players === 0 && !restarting);
const state = $derived(restarting ? 'restarting' : compact ? 'ready' : health);
const error = $derived(decodeRconError(lastError));
const mapLabel = $derived(mapTitle(map));
const showMap = $derived(mapLabel !== '—' && mapLabel !== title);
const mapLabel = $derived(
fleetIdentity({
name,
game: serverGame,
map,
last_map: null,
map_slug: mapSlug,
game_mode: gameMode
}).map
);
const showMap = $derived(map !== null && mapLabel !== '—' && mapLabel !== title);
const topRoster = $derived(
(roster ?? [])
.slice()