This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -7,13 +7,12 @@ export function gameTitle(game: string | null | undefined, compact = false): str
|
||||
}
|
||||
|
||||
export function mapTitle(map: string | null | undefined): string {
|
||||
return (
|
||||
[...T5_ZOMBIE_MAPS, ...T6_ZOMBIE_MAPS].find(
|
||||
(entry) => entry.canonical === map?.toLowerCase()
|
||||
)?.friendly ??
|
||||
map ??
|
||||
'—'
|
||||
const matches = [...T5_ZOMBIE_MAPS, ...T6_ZOMBIE_MAPS].filter(
|
||||
(entry) => entry.canonical === map?.toLowerCase()
|
||||
);
|
||||
// Engine identifiers alone cannot distinguish selections such as Town and TranZit.
|
||||
if (matches.length > 1) return `${map} (variant unknown)`;
|
||||
return matches[0]?.friendly ?? map ?? '—';
|
||||
}
|
||||
|
||||
export function serverTitle(name: string): string {
|
||||
|
||||
Reference in New Issue
Block a user