Perk-a-cola redesign + surface RCON map/gametype/roster/health
Themes the fleet manager around the Electric Cherry perk-a-cola from Mob of the Dead — cherry-red art-deco label with electric cyan discharge. New design tokens (Alfa Slab One + Inter + JetBrains Mono, self-hosted), full redesign of layout/dashboard/cards/detail page, tokens pass on deployments/betas/pipeline/beta/diff, cherry+lightning favicon. Lights up server data that RCON was already fetching but the UI dropped. parsePlayerRoster() extracts num/score/ping/guid/name from both status dialects. Worker persists last_map/last_gametype/last_roster/last_seen_at/ last_error (new columns with idempotent boot-time ALTERs) and emits them over SSE. Fleet cards now show health dot, map · gametype, top-3 roster preview, and last-seen. Detail page adds a sortable full roster with distinct empty-lobby vs offline states. New health classifier (online/stale/offline) drives the visual state. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,28 @@ import schemaSql from './schema.sql?raw';
|
||||
|
||||
let _db: Database.Database | null = null;
|
||||
|
||||
// Columns that were added to `servers` after v0.1 shipped. Applied on every
|
||||
// boot; better-sqlite3 has no `ADD COLUMN IF NOT EXISTS`, so we run each and
|
||||
// swallow the "duplicate column" error.
|
||||
const SERVERS_MIGRATIONS: Array<{ column: string; ddl: string }> = [
|
||||
{ column: 'last_map', ddl: 'ALTER TABLE servers ADD COLUMN last_map TEXT' },
|
||||
{ column: 'last_gametype', ddl: 'ALTER TABLE servers ADD COLUMN last_gametype TEXT' },
|
||||
{ column: 'last_roster', ddl: 'ALTER TABLE servers ADD COLUMN last_roster TEXT' },
|
||||
{ column: 'last_seen_at', ddl: 'ALTER TABLE servers ADD COLUMN last_seen_at TEXT' },
|
||||
{ column: 'last_error', ddl: 'ALTER TABLE servers ADD COLUMN last_error TEXT' }
|
||||
];
|
||||
|
||||
function migrateServers(handle: Database.Database): void {
|
||||
for (const m of SERVERS_MIGRATIONS) {
|
||||
try {
|
||||
handle.exec(m.ddl);
|
||||
} catch (err) {
|
||||
const msg = (err as Error).message ?? '';
|
||||
if (!/duplicate column name/i.test(msg)) throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function db(): Database.Database {
|
||||
if (_db) return _db;
|
||||
|
||||
@@ -14,6 +36,7 @@ export function db(): Database.Database {
|
||||
_db.pragma('journal_mode = WAL');
|
||||
_db.pragma('foreign_keys = ON');
|
||||
_db.exec(schemaSql);
|
||||
migrateServers(_db);
|
||||
|
||||
return _db;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,11 @@ CREATE TABLE IF NOT EXISTS servers (
|
||||
rcon_host TEXT, -- optional per-server override of RCON_HOST
|
||||
last_players INTEGER,
|
||||
last_checked_at TEXT,
|
||||
last_map TEXT, -- from RCON getstatus mapname
|
||||
last_gametype TEXT, -- from RCON getstatus g_gametype
|
||||
last_roster TEXT, -- JSON array of RconPlayer
|
||||
last_seen_at TEXT, -- ISO ts of last successful RCON reply
|
||||
last_error TEXT, -- last RCON failure reason (cleared on success)
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
export type Health = 'online' | 'stale' | 'offline';
|
||||
|
||||
const ONLINE_MAX_MS = 30_000;
|
||||
const STALE_MAX_MS = 120_000;
|
||||
|
||||
/**
|
||||
* Classify server health from its last successful RCON timestamp.
|
||||
* `offline` if we've never seen it, or if RCON just failed, or if the last
|
||||
* successful reply is >120s old. `stale` if the last reply is 30-120s old
|
||||
* (RCON glitchy). `online` if fresh.
|
||||
*/
|
||||
export function classifyHealth(lastSeenAt: string | null, lastError: string | null): Health {
|
||||
if (!lastSeenAt) return 'offline';
|
||||
const age = Date.now() - new Date(lastSeenAt).getTime();
|
||||
if (!Number.isFinite(age) || age < 0) return 'offline';
|
||||
if (age <= ONLINE_MAX_MS) {
|
||||
// Even with a fresh last_seen, a very recent error demotes to stale
|
||||
return lastError ? 'stale' : 'online';
|
||||
}
|
||||
if (age <= STALE_MAX_MS) return 'stale';
|
||||
return 'offline';
|
||||
}
|
||||
@@ -71,6 +71,11 @@ export interface ServerRow {
|
||||
rcon_host: string | null;
|
||||
last_players: number | null;
|
||||
last_checked_at: string | null;
|
||||
last_map: string | null;
|
||||
last_gametype: string | null;
|
||||
last_roster: string | null; // JSON array of RconPlayer, or null
|
||||
last_seen_at: string | null; // last successful RCON reply
|
||||
last_error: string | null; // cleared on success
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
@@ -116,7 +121,12 @@ export function setServerField(
|
||||
'game_port',
|
||||
'rcon_host',
|
||||
'last_players',
|
||||
'last_checked_at'
|
||||
'last_checked_at',
|
||||
'last_map',
|
||||
'last_gametype',
|
||||
'last_roster',
|
||||
'last_seen_at',
|
||||
'last_error'
|
||||
];
|
||||
if (!allowed.includes(field)) throw new Error(`refusing to set ${field}`);
|
||||
db().prepare(`UPDATE servers SET ${field} = ? WHERE name = ?`).run(value, name);
|
||||
|
||||
@@ -131,6 +131,61 @@ export function parseInfoLine(text: string): Record<string, string> {
|
||||
return out;
|
||||
}
|
||||
|
||||
export interface RconPlayer {
|
||||
num: number | null; // client slot — print dialect only
|
||||
score: number;
|
||||
ping: number;
|
||||
guid: string | null; // 32-hex — print dialect only
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract every player row from a `status` (print) or `getstatus`
|
||||
* (statusResponse) response. Returns [] when the payload has none.
|
||||
* Two dialects, same output shape:
|
||||
*
|
||||
* print: num score ping <32-hex-guid> <name-with-spaces>
|
||||
* statusResponse: score ping "<name>"
|
||||
*/
|
||||
export function parsePlayerRoster(text: string): RconPlayer[] {
|
||||
const lines = text.split(/\r?\n/);
|
||||
const sep = lines.findIndex((l) => /^-+\s+-+/.test(l.trim()));
|
||||
if (sep !== -1) {
|
||||
const out: RconPlayer[] = [];
|
||||
// Match: num score ping guid(32-hex) name-rest
|
||||
const re = /^\s*(\d+)\s+(-?\d+)\s+(\d+)\s+([0-9a-fA-F]{16,})\s+(.+?)\s*$/;
|
||||
for (let i = sep + 1; i < lines.length; i++) {
|
||||
const m = re.exec(lines[i]);
|
||||
if (!m) continue;
|
||||
out.push({
|
||||
num: Number(m[1]),
|
||||
score: Number(m[2]),
|
||||
ping: Number(m[3]),
|
||||
guid: m[4],
|
||||
name: m[5]
|
||||
});
|
||||
}
|
||||
return out;
|
||||
}
|
||||
// statusResponse dialect: rows after the info line, format: score ping "name"
|
||||
const info = lines.findIndex((l) => l.startsWith('\\'));
|
||||
if (info === -1) return [];
|
||||
const out: RconPlayer[] = [];
|
||||
const re = /^\s*(-?\d+)\s+(\d+)\s+"(.*)"\s*$/;
|
||||
for (let i = info + 1; i < lines.length; i++) {
|
||||
const m = re.exec(lines[i]);
|
||||
if (!m) continue;
|
||||
out.push({
|
||||
num: null,
|
||||
score: Number(m[1]),
|
||||
ping: Number(m[2]),
|
||||
guid: null,
|
||||
name: m[3]
|
||||
});
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export async function rconGetPlayerCount(server: string): Promise<number | null> {
|
||||
const ep = await endpointFor(server);
|
||||
if (!ep) return null;
|
||||
@@ -145,6 +200,7 @@ export interface RconStatus {
|
||||
players: number;
|
||||
map: string | null;
|
||||
gametype: string | null;
|
||||
roster: RconPlayer[];
|
||||
}
|
||||
|
||||
export async function rconGetStatus(server: string): Promise<RconStatus | null> {
|
||||
@@ -162,6 +218,7 @@ export async function rconGetStatus(server: string): Promise<RconStatus | null>
|
||||
return {
|
||||
players,
|
||||
map: info.mapname ?? info.sv_mapname ?? null,
|
||||
gametype: info.g_gametype ?? null
|
||||
gametype: info.g_gametype ?? null,
|
||||
roster: parsePlayerRoster(text)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
import { EventEmitter } from 'node:events';
|
||||
import type { RconPlayer } from '../integrations/rcon.js';
|
||||
import type { Health } from '../fleet/health.js';
|
||||
|
||||
// One in-process event bus, multiplexed by the SSE endpoints. Kept separate
|
||||
// from any specific subscriber so push/beta/sweep can emit without pulling
|
||||
// the whole worker module in.
|
||||
|
||||
export interface ServerStatusEntry {
|
||||
server: string;
|
||||
players: number | null;
|
||||
map: string | null;
|
||||
gametype: string | null;
|
||||
roster: RconPlayer[] | null;
|
||||
health: Health;
|
||||
lastSeenAt: string | null;
|
||||
lastError: string | null;
|
||||
}
|
||||
|
||||
export type PipelineEvent =
|
||||
| { type: 'deployment-opened'; deploymentId: string; action: string; servers: string[] }
|
||||
| { type: 'server-changed'; deploymentId: string; server: string; files: number }
|
||||
@@ -16,7 +29,7 @@ export type PipelineEvent =
|
||||
error: string | null;
|
||||
}
|
||||
| { type: 'sweep-tick'; frozen: boolean; reason?: string }
|
||||
| { type: 'server-status'; entries: Array<{ server: string; players: number | null; name?: string }> };
|
||||
| { type: 'server-status'; entries: ServerStatusEntry[] };
|
||||
|
||||
class Bus extends EventEmitter {
|
||||
constructor() {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { sweep } from './sweep.js';
|
||||
import { emit } from './bus.js';
|
||||
import type { ServerStatusEntry } from './bus.js';
|
||||
import { rconGetStatus } from '../integrations/rcon.js';
|
||||
import { listServers, seedServerRegistry } from '../fleet/servers.js';
|
||||
import { listServers, seedServerRegistry, setServerField } from '../fleet/servers.js';
|
||||
import { classifyHealth } from '../fleet/health.js';
|
||||
|
||||
const TICK_MS = 15_000;
|
||||
const STATUS_REFRESH_MS = 30_000;
|
||||
@@ -25,7 +27,7 @@ async function fanoutStatus(): Promise<void> {
|
||||
const servers = listServers();
|
||||
if (servers.length === 0) return;
|
||||
|
||||
const entries: Array<{ server: string; players: number | null; name?: string }> = new Array(servers.length);
|
||||
const entries: ServerStatusEntry[] = new Array(servers.length);
|
||||
let cursor = 0;
|
||||
|
||||
async function pump(): Promise<void> {
|
||||
@@ -34,11 +36,44 @@ async function fanoutStatus(): Promise<void> {
|
||||
if (i >= servers.length) return;
|
||||
const srv = servers[i];
|
||||
const status = await rconGetStatus(srv.name).catch(() => null);
|
||||
entries[i] = {
|
||||
server: srv.name,
|
||||
players: status?.players ?? null,
|
||||
name: status?.map ?? undefined
|
||||
};
|
||||
const now = new Date().toISOString();
|
||||
|
||||
if (status) {
|
||||
// Persist last-observed state. last_seen_at is the health anchor.
|
||||
setServerField(srv.name, 'last_players', status.players);
|
||||
setServerField(srv.name, 'last_map', status.map);
|
||||
setServerField(srv.name, 'last_gametype', status.gametype);
|
||||
setServerField(srv.name, 'last_roster', JSON.stringify(status.roster));
|
||||
setServerField(srv.name, 'last_seen_at', now);
|
||||
setServerField(srv.name, 'last_checked_at', now);
|
||||
setServerField(srv.name, 'last_error', null);
|
||||
entries[i] = {
|
||||
server: srv.name,
|
||||
players: status.players,
|
||||
map: status.map,
|
||||
gametype: status.gametype,
|
||||
roster: status.roster,
|
||||
health: classifyHealth(now, null),
|
||||
lastSeenAt: now,
|
||||
lastError: null
|
||||
};
|
||||
} else {
|
||||
// RCON unreachable — leave last_seen_at alone (health decays
|
||||
// to offline naturally), record the failure reason.
|
||||
const error = 'rcon unreachable';
|
||||
setServerField(srv.name, 'last_checked_at', now);
|
||||
setServerField(srv.name, 'last_error', error);
|
||||
entries[i] = {
|
||||
server: srv.name,
|
||||
players: srv.last_players,
|
||||
map: srv.last_map,
|
||||
gametype: srv.last_gametype,
|
||||
roster: srv.last_roster ? safeJson(srv.last_roster) : null,
|
||||
health: classifyHealth(srv.last_seen_at, error),
|
||||
lastSeenAt: srv.last_seen_at,
|
||||
lastError: error
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
await Promise.all(Array.from({ length: STATUS_CONCURRENCY }, pump));
|
||||
@@ -46,6 +81,14 @@ async function fanoutStatus(): Promise<void> {
|
||||
emit({ type: 'server-status', entries });
|
||||
}
|
||||
|
||||
function safeJson<T>(raw: string): T | null {
|
||||
try {
|
||||
return JSON.parse(raw) as T;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function startWorker(): void {
|
||||
if (started) return;
|
||||
started = true;
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
<div class="row"><span class="k">servers</span> {b.servers.join(', ')}</div>
|
||||
<div class="actions">
|
||||
<button onclick={() => act(b.slug, 'update')}>update</button>
|
||||
<button onclick={() => act(b.slug, 'promote')}>promote</button>
|
||||
<button class="primary" onclick={() => act(b.slug, 'promote')}>promote</button>
|
||||
<button class="danger" onclick={() => act(b.slug, 'rollback')}>rollback</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -125,77 +125,147 @@
|
||||
|
||||
<style>
|
||||
.panel {
|
||||
background: #141414;
|
||||
border: 1px solid #333;
|
||||
border-radius: 6px;
|
||||
padding: 16px;
|
||||
background: var(--cherry-925);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-md);
|
||||
padding: 20px 22px;
|
||||
}
|
||||
h3 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 13px;
|
||||
margin: 0 0 10px;
|
||||
font-family: var(--font-body);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
color: #aaa;
|
||||
letter-spacing: 1.5px;
|
||||
color: var(--ink-300);
|
||||
}
|
||||
h3:not(:first-of-type) { margin-top: 20px; }
|
||||
.empty { color: #666; font-size: 13px; margin: 0; }
|
||||
.staged { list-style: none; padding: 0; margin: 0 0 12px; }
|
||||
h3:not(:first-of-type) { margin-top: 24px; }
|
||||
.empty {
|
||||
color: var(--ink-500);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
}
|
||||
.staged { list-style: none; padding: 0; margin: 0 0 14px; }
|
||||
.staged li {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 4px 0;
|
||||
border-bottom: 1px solid #222;
|
||||
align-items: center;
|
||||
padding: 6px 0;
|
||||
border-bottom: 1px solid var(--cherry-700);
|
||||
}
|
||||
.staged code {
|
||||
color: var(--cream);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
}
|
||||
.staged code { color: #ddd; font-family: ui-monospace, monospace; font-size: 13px; }
|
||||
.tag {
|
||||
font-size: 11px;
|
||||
padding: 1px 6px;
|
||||
border-radius: 3px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 10px;
|
||||
padding: 2px 7px;
|
||||
border-radius: var(--r-sm);
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.tag.new {
|
||||
background: rgba(34, 224, 255, 0.1);
|
||||
border-color: rgba(34, 224, 255, 0.3);
|
||||
color: var(--spark-500);
|
||||
}
|
||||
.tag.replaces {
|
||||
background: rgba(242, 230, 200, 0.08);
|
||||
border-color: rgba(242, 230, 200, 0.25);
|
||||
color: var(--cream);
|
||||
}
|
||||
.tag.ambig {
|
||||
background: rgba(255, 48, 80, 0.1);
|
||||
border-color: rgba(255, 48, 80, 0.3);
|
||||
color: var(--danger-500);
|
||||
}
|
||||
.tag.new { background: #2d4a2d; color: #a8e6a8; }
|
||||
.tag.replaces { background: #2d3a4a; color: #a8c8e6; }
|
||||
.tag.ambig { background: #4a2d2d; color: #ff8080; }
|
||||
form {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
gap: 8px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
form input {
|
||||
flex: 1;
|
||||
background: #000;
|
||||
color: #ddd;
|
||||
border: 1px solid #444;
|
||||
border-radius: 3px;
|
||||
padding: 6px 8px;
|
||||
font-family: ui-monospace, monospace;
|
||||
background: var(--cherry-975);
|
||||
color: var(--ink-100);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 8px 10px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
}
|
||||
form input:focus {
|
||||
outline: none;
|
||||
border-color: var(--spark-500);
|
||||
box-shadow: var(--spark-glow);
|
||||
}
|
||||
button {
|
||||
background: #ff3030;
|
||||
color: #fff;
|
||||
border: 0;
|
||||
border-radius: 3px;
|
||||
padding: 6px 12px;
|
||||
background: var(--cherry-875);
|
||||
color: var(--ink-100);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 8px 14px;
|
||||
font-family: var(--font-body);
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
}
|
||||
button:hover:not(:disabled) {
|
||||
border-color: var(--spark-500);
|
||||
box-shadow: var(--spark-glow);
|
||||
}
|
||||
button:disabled { opacity: 0.4; cursor: default; }
|
||||
button.primary {
|
||||
background: linear-gradient(180deg, var(--cherry-500), var(--cherry-600));
|
||||
border-color: var(--cherry-400);
|
||||
color: var(--cream);
|
||||
font-weight: 600;
|
||||
}
|
||||
button.danger {
|
||||
background: var(--cherry-925);
|
||||
border-color: rgba(255, 48, 80, 0.4);
|
||||
color: var(--danger-500);
|
||||
}
|
||||
button:disabled { opacity: 0.5; cursor: default; }
|
||||
button.danger { background: #7a2020; }
|
||||
.beta {
|
||||
padding: 8px 10px;
|
||||
margin: 6px 0;
|
||||
background: #1a1a1a;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #2a2a2a;
|
||||
padding: 12px 14px;
|
||||
margin: 8px 0;
|
||||
background: var(--cherry-875);
|
||||
border-radius: var(--r-sm);
|
||||
border: 1px solid var(--cherry-700);
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 4px;
|
||||
align-items: baseline;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.head strong { color: var(--cream); font-weight: 600; }
|
||||
.rev {
|
||||
color: var(--ink-500);
|
||||
font-size: 11px;
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
.row {
|
||||
font-size: 12px;
|
||||
color: var(--ink-300);
|
||||
margin: 3px 0;
|
||||
}
|
||||
.k {
|
||||
color: var(--ink-500);
|
||||
margin-right: 8px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 10px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.8px;
|
||||
}
|
||||
.actions { display: flex; gap: 6px; margin-top: 10px; }
|
||||
.flash {
|
||||
color: var(--danger-500);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
margin: 14px 0 0;
|
||||
}
|
||||
.rev { color: #666; font-size: 11px; }
|
||||
.row { font-size: 12px; color: #bbb; margin: 2px 0; }
|
||||
.k { color: #666; margin-right: 6px; font-family: ui-monospace, monospace; }
|
||||
.actions { display: flex; gap: 4px; margin-top: 8px; }
|
||||
.flash { color: #ff6060; font-size: 12px; margin: 12px 0 0; }
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
}
|
||||
let { size = 'md' }: Props = $props();
|
||||
</script>
|
||||
|
||||
<span class="mark mark-{size}">
|
||||
<svg class="bolt" viewBox="0 0 12 20" aria-hidden="true">
|
||||
<path d="M7 0 L1 11 L5 11 L4 20 L11 8 L7 8 Z" />
|
||||
</svg>
|
||||
<span class="word">ELECTRIC CHERRY</span>
|
||||
</span>
|
||||
|
||||
<style>
|
||||
.mark {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-family: var(--font-display);
|
||||
color: var(--cream);
|
||||
letter-spacing: 2px;
|
||||
line-height: 1;
|
||||
animation: cherry-fizz 6s ease-in-out infinite;
|
||||
}
|
||||
.mark-sm .word { font-size: 12px; letter-spacing: 1.5px; }
|
||||
.mark-md .word { font-size: 16px; }
|
||||
.mark-lg .word { font-size: 26px; letter-spacing: 3px; }
|
||||
|
||||
.bolt {
|
||||
fill: var(--spark-500);
|
||||
filter: drop-shadow(0 0 4px rgba(34, 224, 255, 0.7));
|
||||
}
|
||||
.mark-sm .bolt { width: 10px; height: 16px; }
|
||||
.mark-md .bolt { width: 12px; height: 20px; }
|
||||
.mark-lg .bolt { width: 18px; height: 30px; }
|
||||
</style>
|
||||
@@ -7,9 +7,6 @@
|
||||
}
|
||||
let { before, after, verb, relPath }: Props = $props();
|
||||
|
||||
// A tiny line-by-line diff. Not LCS — just presence-based. For GSC scripts
|
||||
// this reads fine; if we want proper Myers diff later, swap in `diff` npm
|
||||
// package and render the same rows.
|
||||
interface Row {
|
||||
kind: 'ctx' | 'add' | 'del';
|
||||
text: string;
|
||||
@@ -24,7 +21,6 @@
|
||||
const bsetBase: Row[] = blines.map((t) => ({ kind: 'add' as const, text: t }));
|
||||
if (a === null) return bsetBase;
|
||||
if (b === null) return asetBase;
|
||||
// interleave shared-prefix / shared-suffix trimming for readability
|
||||
let i = 0;
|
||||
while (i < alines.length && i < blines.length && alines[i] === blines[i]) i++;
|
||||
let j = 0;
|
||||
@@ -55,41 +51,62 @@
|
||||
|
||||
<style>
|
||||
.diff {
|
||||
background: #0f0f0f;
|
||||
border: 1px solid #333;
|
||||
border-radius: 4px;
|
||||
background: var(--cherry-975);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-sm);
|
||||
margin: 8px 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
header {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding: 6px 10px;
|
||||
background: #1a1a1a;
|
||||
border-bottom: 1px solid #333;
|
||||
gap: 10px;
|
||||
padding: 8px 12px;
|
||||
background: var(--cherry-925);
|
||||
border-bottom: 1px solid var(--cherry-700);
|
||||
font-size: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
.verb {
|
||||
padding: 1px 6px;
|
||||
border-radius: 3px;
|
||||
font-family: ui-monospace, monospace;
|
||||
padding: 2px 8px;
|
||||
border-radius: var(--r-sm);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 10px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.8px;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.verb-added { background: #2d4a2d; color: #a8e6a8; }
|
||||
.verb-updated { background: #2d3a4a; color: #a8c8e6; }
|
||||
.verb-removed { background: #4a2d2d; color: #ff8080; }
|
||||
.verb-held { background: #3a2f00; color: #ffcc55; }
|
||||
.path { color: #ccc; font-family: ui-monospace, monospace; }
|
||||
.verb-added {
|
||||
background: rgba(34, 224, 255, 0.1);
|
||||
border-color: rgba(34, 224, 255, 0.3);
|
||||
color: var(--spark-500);
|
||||
}
|
||||
.verb-updated {
|
||||
background: rgba(242, 230, 200, 0.08);
|
||||
border-color: rgba(242, 230, 200, 0.25);
|
||||
color: var(--cream);
|
||||
}
|
||||
.verb-removed {
|
||||
background: rgba(255, 48, 80, 0.1);
|
||||
border-color: rgba(255, 48, 80, 0.3);
|
||||
color: var(--danger-500);
|
||||
}
|
||||
.verb-held {
|
||||
background: rgba(255, 176, 32, 0.1);
|
||||
border-color: rgba(255, 176, 32, 0.3);
|
||||
color: var(--amber-500);
|
||||
}
|
||||
.path { color: var(--ink-100); font-family: var(--font-mono); font-size: 12px; }
|
||||
pre {
|
||||
margin: 0;
|
||||
padding: 8px 10px;
|
||||
font-family: ui-monospace, monospace;
|
||||
padding: 10px 12px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
color: #ccc;
|
||||
line-height: 1.55;
|
||||
color: var(--ink-300);
|
||||
max-height: 500px;
|
||||
overflow: auto;
|
||||
}
|
||||
.ln { display: block; }
|
||||
.ln-add { background: rgba(45, 74, 45, 0.4); color: #a8e6a8; }
|
||||
.ln-del { background: rgba(74, 45, 45, 0.4); color: #ff8080; }
|
||||
.ln-add { background: rgba(34, 224, 255, 0.08); color: var(--spark-400); }
|
||||
.ln-del { background: rgba(255, 48, 80, 0.08); color: #ff8a9a; }
|
||||
</style>
|
||||
|
||||
@@ -8,24 +8,8 @@
|
||||
.slice(0, 8)
|
||||
);
|
||||
|
||||
function stateColor(state: string): string {
|
||||
switch (state) {
|
||||
case 'done': return '#2d4a2d';
|
||||
case 'failed': return '#4a2d2d';
|
||||
case 'pending': return '#3a2f00';
|
||||
case 'manual': return '#333';
|
||||
default: return '#222';
|
||||
}
|
||||
}
|
||||
|
||||
function stateFg(state: string): string {
|
||||
switch (state) {
|
||||
case 'done': return '#a8e6a8';
|
||||
case 'failed': return '#ff8080';
|
||||
case 'pending': return '#ffcc55';
|
||||
case 'manual': return '#aaa';
|
||||
default: return '#888';
|
||||
}
|
||||
function stateClass(state: string): string {
|
||||
return `chip chip-${state}`;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -46,8 +30,7 @@
|
||||
<div class="chips">
|
||||
{#each [...dep.servers.entries()] as [srv, meta] (srv)}
|
||||
<span
|
||||
class="chip"
|
||||
style="background:{stateColor(meta.state)};color:{stateFg(meta.state)}"
|
||||
class={stateClass(meta.state)}
|
||||
title={meta.error ?? (meta.players !== null ? `${meta.players}p` : meta.state)}
|
||||
>
|
||||
{srv}{meta.players !== null && meta.players > 0 ? ` ${meta.players}p` : ''}
|
||||
@@ -62,43 +45,84 @@
|
||||
|
||||
<style>
|
||||
.wrapper {
|
||||
background: #141414;
|
||||
border: 1px solid #333;
|
||||
border-radius: 6px;
|
||||
padding: 12px;
|
||||
background: var(--cherry-925);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-md);
|
||||
padding: 14px 16px;
|
||||
}
|
||||
header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-family: var(--font-body);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1.5px;
|
||||
color: var(--ink-300);
|
||||
}
|
||||
.empty {
|
||||
color: var(--ink-500);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
padding: 12px 0;
|
||||
}
|
||||
h3 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; color: #aaa; }
|
||||
.empty { color: #666; font-size: 13px; margin: 0; }
|
||||
.rows { display: grid; gap: 8px; }
|
||||
.row {
|
||||
display: block;
|
||||
color: #ddd;
|
||||
color: var(--ink-100);
|
||||
text-decoration: none;
|
||||
padding: 8px;
|
||||
background: #1a1a1a;
|
||||
border-radius: 4px;
|
||||
border: 1px solid transparent;
|
||||
padding: 10px 12px;
|
||||
background: var(--cherry-875);
|
||||
border-radius: var(--r-sm);
|
||||
border: 1px solid var(--cherry-700);
|
||||
transition: border-color 0.15s;
|
||||
}
|
||||
.row:hover { border-color: #444; }
|
||||
.row:hover { border-color: var(--spark-500); }
|
||||
.row-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.action { font-family: ui-monospace, monospace; font-size: 13px; }
|
||||
.count { color: #666; font-size: 12px; }
|
||||
.action { font-family: var(--font-mono); font-size: 12px; color: var(--cream); }
|
||||
.count { color: var(--ink-500); font-size: 11px; font-family: var(--font-mono); }
|
||||
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
|
||||
.chip {
|
||||
padding: 2px 6px;
|
||||
border-radius: 3px;
|
||||
padding: 2px 7px;
|
||||
border-radius: var(--r-sm);
|
||||
font-size: 11px;
|
||||
font-family: ui-monospace, monospace;
|
||||
font-family: var(--font-mono);
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.chip-done {
|
||||
background: rgba(34, 224, 255, 0.1);
|
||||
border-color: rgba(34, 224, 255, 0.3);
|
||||
color: var(--spark-500);
|
||||
}
|
||||
.chip-failed {
|
||||
background: rgba(255, 48, 80, 0.1);
|
||||
border-color: rgba(255, 48, 80, 0.3);
|
||||
color: var(--danger-500);
|
||||
}
|
||||
.chip-pending {
|
||||
background: rgba(255, 176, 32, 0.1);
|
||||
border-color: rgba(255, 176, 32, 0.3);
|
||||
color: var(--amber-500);
|
||||
}
|
||||
.chip-held {
|
||||
background: rgba(242, 230, 200, 0.08);
|
||||
border-color: rgba(242, 230, 200, 0.25);
|
||||
color: var(--cream);
|
||||
}
|
||||
.chip-manual {
|
||||
background: var(--cherry-925);
|
||||
border-color: var(--cherry-700);
|
||||
color: var(--ink-500);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
<script lang="ts">
|
||||
import type { RosterPlayer, Health } from '$ui/stores/servers.js';
|
||||
|
||||
interface Props {
|
||||
roster: RosterPlayer[] | null;
|
||||
health: Health;
|
||||
compact?: boolean; // hide guid column, cap rows
|
||||
limit?: number;
|
||||
}
|
||||
let { roster, health, compact = false, limit }: Props = $props();
|
||||
|
||||
let sorted = $derived(
|
||||
(roster ?? [])
|
||||
.slice()
|
||||
.sort((a, b) => b.score - a.score)
|
||||
.slice(0, limit ?? Infinity)
|
||||
);
|
||||
|
||||
function pingClass(ping: number): string {
|
||||
if (ping < 60) return 'ping-good';
|
||||
if (ping < 150) return 'ping-ok';
|
||||
return 'ping-bad';
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if health === 'offline'}
|
||||
<div class="state offline">server unreachable</div>
|
||||
{:else if !roster || roster.length === 0}
|
||||
<div class="state empty">lobby is empty</div>
|
||||
{:else}
|
||||
<table class="roster" class:compact>
|
||||
<thead>
|
||||
<tr>
|
||||
{#if !compact}<th class="col-num">#</th>{/if}
|
||||
<th class="col-name">player</th>
|
||||
<th class="col-score">score</th>
|
||||
<th class="col-ping">ping</th>
|
||||
{#if !compact}<th class="col-guid">guid</th>{/if}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each sorted as p (p.guid ?? p.name + '-' + p.num)}
|
||||
<tr>
|
||||
{#if !compact}<td class="col-num mono">{p.num ?? ''}</td>{/if}
|
||||
<td class="col-name">{p.name || '—'}</td>
|
||||
<td class="col-score mono">{p.score}</td>
|
||||
<td class="col-ping mono {pingClass(p.ping)}">{p.ping}</td>
|
||||
{#if !compact}<td class="col-guid mono">{p.guid ? p.guid.slice(0, 8) + '…' : '—'}</td>{/if}
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.state {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
padding: 10px 12px;
|
||||
border-radius: var(--r-sm);
|
||||
}
|
||||
.state.offline {
|
||||
color: var(--danger-500);
|
||||
background: rgba(255, 48, 80, 0.08);
|
||||
border: 1px solid rgba(255, 48, 80, 0.25);
|
||||
}
|
||||
.state.empty {
|
||||
color: var(--ink-500);
|
||||
background: var(--cherry-925);
|
||||
border: 1px dashed var(--cherry-700);
|
||||
}
|
||||
|
||||
.roster {
|
||||
width: 100%;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
font-family: var(--font-body);
|
||||
font-size: 13px;
|
||||
color: var(--ink-100);
|
||||
}
|
||||
.roster thead th {
|
||||
text-align: left;
|
||||
font-family: var(--font-body);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1.2px;
|
||||
color: var(--ink-500);
|
||||
padding: 6px 10px;
|
||||
border-bottom: 1px solid var(--cherry-700);
|
||||
}
|
||||
.roster tbody td {
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid rgba(74, 15, 30, 0.4);
|
||||
}
|
||||
.roster tbody tr:hover td {
|
||||
background: rgba(34, 224, 255, 0.04);
|
||||
}
|
||||
.roster.compact tbody td { padding: 4px 8px; font-size: 12px; }
|
||||
|
||||
.mono { font-family: var(--font-mono); }
|
||||
.col-num { width: 40px; color: var(--ink-500); }
|
||||
.col-name { color: var(--cream); font-weight: 500; }
|
||||
.col-score { width: 90px; color: var(--spark-500); }
|
||||
.col-ping { width: 80px; }
|
||||
.col-guid { width: 110px; color: var(--ink-500); }
|
||||
|
||||
.ping-good { color: var(--spark-400); }
|
||||
.ping-ok { color: var(--cream-dim); }
|
||||
.ping-bad { color: var(--amber-500); }
|
||||
</style>
|
||||
@@ -1,4 +1,8 @@
|
||||
<script lang="ts">
|
||||
import StatusDot from './StatusDot.svelte';
|
||||
import type { RosterPlayer, Health } from '$ui/stores/servers.js';
|
||||
import { gametypeLabel } from '$ui/gametype.js';
|
||||
|
||||
interface Held {
|
||||
target: string;
|
||||
slug: string;
|
||||
@@ -6,32 +10,89 @@
|
||||
interface Props {
|
||||
name: string;
|
||||
players?: number | null;
|
||||
map?: string | null;
|
||||
gametype?: string | null;
|
||||
roster?: RosterPlayer[] | null;
|
||||
health?: Health;
|
||||
lastSeenAt?: string | null;
|
||||
lastError?: string | null;
|
||||
held?: Held[];
|
||||
lastRestartedAt?: string | null;
|
||||
restarting?: boolean;
|
||||
}
|
||||
let { name, players = null, held = [], lastRestartedAt = null, restarting = false }: Props = $props();
|
||||
let {
|
||||
name,
|
||||
players = null,
|
||||
map = null,
|
||||
gametype = null,
|
||||
roster = null,
|
||||
health = 'offline',
|
||||
lastSeenAt = null,
|
||||
lastError = null,
|
||||
held = [],
|
||||
lastRestartedAt = null,
|
||||
restarting = false
|
||||
}: Props = $props();
|
||||
|
||||
function ago(iso: string | null): string {
|
||||
if (!iso) return 'never';
|
||||
const d = Date.now() - new Date(iso).getTime();
|
||||
if (d < 60_000) return 'just now';
|
||||
if (d < 60_000) return `${Math.max(1, Math.floor(d / 1000))}s ago`;
|
||||
if (d < 3_600_000) return `${Math.floor(d / 60_000)}m ago`;
|
||||
if (d < 86_400_000) return `${Math.floor(d / 3_600_000)}h ago`;
|
||||
return `${Math.floor(d / 86_400_000)}d ago`;
|
||||
}
|
||||
|
||||
let topRoster = $derived(
|
||||
(roster ?? [])
|
||||
.slice()
|
||||
.sort((a, b) => b.score - a.score)
|
||||
.slice(0, 3)
|
||||
);
|
||||
let showRoster = $derived(health !== 'offline');
|
||||
let mapLabel = $derived(map ?? '—');
|
||||
let gtLabel = $derived(gametypeLabel(gametype));
|
||||
</script>
|
||||
|
||||
<a class="card" href="/servers/{name}" class:restarting>
|
||||
<a class="card" href="/servers/{name}" class:restarting class:offline={health === 'offline'}>
|
||||
<div class="head">
|
||||
<strong>{name}</strong>
|
||||
<span class="players" class:has-players={players !== null && players > 0}>
|
||||
{players ?? '—'}
|
||||
</span>
|
||||
<div class="name-row">
|
||||
<StatusDot {health} />
|
||||
<strong class="name">{name}</strong>
|
||||
</div>
|
||||
{#if health !== 'offline'}
|
||||
<span class="players" class:has-players={players !== null && players > 0}>
|
||||
{players ?? '—'}
|
||||
</span>
|
||||
{:else}
|
||||
<span class="players offline-badge">offline</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="meta">
|
||||
restart: {ago(lastRestartedAt)}
|
||||
<span class="map">{mapLabel}</span>
|
||||
{#if gtLabel}
|
||||
<span class="dot-sep">·</span>
|
||||
<span class="gt">{gtLabel}</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if showRoster}
|
||||
{#if topRoster.length > 0}
|
||||
<ul class="roster">
|
||||
{#each topRoster as p (p.guid ?? p.name)}
|
||||
<li>
|
||||
<span class="pname">{p.name || '—'}</span>
|
||||
<span class="pscore">{p.score}</span>
|
||||
<span class="pping">{p.ping}ms</span>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{:else if health !== 'offline'}
|
||||
<div class="lobby-empty">lobby is empty</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if held.length > 0}
|
||||
<div class="held">
|
||||
{#each held as h (h.target)}
|
||||
@@ -39,6 +100,19 @@
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="foot">
|
||||
{#if health === 'offline' && lastError}
|
||||
<span class="err">{lastError}</span>
|
||||
{:else if lastSeenAt}
|
||||
<span>last seen {ago(lastSeenAt)}</span>
|
||||
{:else if lastRestartedAt}
|
||||
<span>restart {ago(lastRestartedAt)}</span>
|
||||
{:else}
|
||||
<span class="dim">no data</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if restarting}
|
||||
<div class="restarting-bar" aria-label="restarting"></div>
|
||||
{/if}
|
||||
@@ -46,50 +120,165 @@
|
||||
|
||||
<style>
|
||||
.card {
|
||||
display: block;
|
||||
background: #1a1a1a;
|
||||
border: 1px solid #333;
|
||||
border-radius: 6px;
|
||||
padding: 12px;
|
||||
color: #ddd;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
background:
|
||||
linear-gradient(180deg, var(--cherry-875) 0%, var(--cherry-925) 100%);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-md);
|
||||
padding: 14px 16px 12px;
|
||||
color: var(--ink-100);
|
||||
text-decoration: none;
|
||||
transition: border-color 0.15s;
|
||||
transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
|
||||
box-shadow: var(--shadow-card);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.card:hover { border-color: #555; }
|
||||
.card.restarting { border-color: #ffab00; }
|
||||
.card::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0 0 auto 0;
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, transparent, var(--cherry-500), transparent);
|
||||
opacity: 0.5;
|
||||
}
|
||||
.card:hover {
|
||||
border-color: var(--spark-500);
|
||||
box-shadow: var(--spark-glow), var(--shadow-card);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.card.restarting { border-color: var(--amber-500); box-shadow: var(--amber-glow); }
|
||||
.card.offline { opacity: 0.75; }
|
||||
|
||||
.head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
||||
.name {
|
||||
font-family: var(--font-body);
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.3px;
|
||||
color: var(--cream);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.players {
|
||||
background: #222;
|
||||
padding: 2px 8px;
|
||||
background: var(--cherry-925);
|
||||
border: 1px solid var(--cherry-700);
|
||||
padding: 3px 10px;
|
||||
border-radius: 999px;
|
||||
font-family: ui-monospace, monospace;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
color: #888;
|
||||
font-weight: 500;
|
||||
color: var(--ink-500);
|
||||
min-width: 34px;
|
||||
text-align: center;
|
||||
}
|
||||
.players.has-players { background: #2d4a2d; color: #a8e6a8; }
|
||||
.meta { color: #666; font-size: 12px; margin-top: 4px; }
|
||||
.held { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
|
||||
.players.has-players {
|
||||
color: var(--spark-500);
|
||||
border-color: var(--spark-500);
|
||||
box-shadow: var(--spark-glow);
|
||||
}
|
||||
.players.offline-badge {
|
||||
color: var(--danger-500);
|
||||
border-color: rgba(255, 48, 80, 0.4);
|
||||
font-family: var(--font-body);
|
||||
font-size: 10px;
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
color: var(--ink-300);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.map { color: var(--cream-dim); }
|
||||
.gt { color: var(--ink-300); }
|
||||
.dot-sep { color: var(--ink-500); }
|
||||
|
||||
.roster {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
.roster li {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto auto;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
padding: 2px 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
.pname {
|
||||
color: var(--cream);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.pscore {
|
||||
font-family: var(--font-mono);
|
||||
color: var(--spark-500);
|
||||
font-size: 11px;
|
||||
}
|
||||
.pping {
|
||||
font-family: var(--font-mono);
|
||||
color: var(--ink-300);
|
||||
font-size: 11px;
|
||||
min-width: 44px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.lobby-empty {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 11px;
|
||||
color: var(--ink-500);
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.held { display: flex; flex-wrap: wrap; gap: 4px; }
|
||||
.chip {
|
||||
background: #3a2f00;
|
||||
color: #ffcc55;
|
||||
border: 1px solid #665500;
|
||||
border-radius: 3px;
|
||||
background: rgba(242, 230, 200, 0.08);
|
||||
color: var(--cream);
|
||||
border: 1px solid rgba(242, 230, 200, 0.25);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 1px 6px;
|
||||
font-size: 11px;
|
||||
font-family: ui-monospace, monospace;
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
|
||||
.foot {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 10.5px;
|
||||
color: var(--ink-500);
|
||||
letter-spacing: 0.3px;
|
||||
margin-top: auto;
|
||||
padding-top: 4px;
|
||||
}
|
||||
.err { color: var(--danger-500); }
|
||||
.dim { color: var(--ink-700); }
|
||||
|
||||
.restarting-bar {
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, transparent, #ffab00, transparent);
|
||||
margin-top: 8px;
|
||||
animation: slide 1.2s infinite linear;
|
||||
}
|
||||
@keyframes slide {
|
||||
from { background-position: -100% 0; }
|
||||
to { background-position: 200% 0; }
|
||||
background: linear-gradient(90deg, transparent, var(--amber-500), var(--spark-500), transparent);
|
||||
background-size: 200% 100%;
|
||||
animation: spark-slide 1.2s infinite linear;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<script lang="ts">
|
||||
import type { Health } from '$ui/stores/servers.js';
|
||||
interface Props {
|
||||
health: Health;
|
||||
size?: number;
|
||||
label?: string | null;
|
||||
}
|
||||
let { health, size = 8, label = null }: Props = $props();
|
||||
</script>
|
||||
|
||||
<span
|
||||
class="dot dot-{health}"
|
||||
style="width:{size}px;height:{size}px"
|
||||
aria-label={label ?? `server ${health}`}
|
||||
title={label ?? health}
|
||||
></span>
|
||||
|
||||
<style>
|
||||
.dot {
|
||||
display: inline-block;
|
||||
border-radius: 999px;
|
||||
vertical-align: middle;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.dot-online {
|
||||
background: var(--spark-500);
|
||||
animation: electric-pulse 1.6s ease-in-out infinite;
|
||||
}
|
||||
.dot-stale {
|
||||
background: var(--amber-500);
|
||||
box-shadow: var(--amber-glow);
|
||||
}
|
||||
.dot-offline {
|
||||
background: var(--danger-500);
|
||||
opacity: 0.6;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,21 @@
|
||||
// Friendly names for CoD gametype codes reported over RCON.
|
||||
const NAMES: Record<string, string> = {
|
||||
zclassic: 'Zombies Classic',
|
||||
zstandard: 'Zombies Standard',
|
||||
zgrief: 'Grief',
|
||||
zcleansed: 'Cleansed',
|
||||
ztag: 'Tag der Toten',
|
||||
dm: 'Deathmatch',
|
||||
tdm: 'Team Deathmatch',
|
||||
sd: 'Search & Destroy',
|
||||
dom: 'Domination',
|
||||
war: 'War',
|
||||
hq: 'Headquarters',
|
||||
ctf: 'Capture the Flag'
|
||||
};
|
||||
|
||||
export function gametypeLabel(code: string | null | undefined): string {
|
||||
if (!code) return '';
|
||||
const key = code.toLowerCase();
|
||||
return NAMES[key] ?? code;
|
||||
}
|
||||
@@ -1,10 +1,25 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
export interface RosterPlayer {
|
||||
num: number | null;
|
||||
score: number;
|
||||
ping: number;
|
||||
guid: string | null;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type Health = 'online' | 'stale' | 'offline';
|
||||
|
||||
export interface ServerStatus {
|
||||
server: string;
|
||||
players: number | null;
|
||||
name?: string;
|
||||
map: string | null;
|
||||
gametype: string | null;
|
||||
roster: RosterPlayer[] | null;
|
||||
health: Health;
|
||||
lastSeenAt: string | null;
|
||||
lastError: string | null;
|
||||
}
|
||||
|
||||
export const statusByServer = writable<Map<string, ServerStatus>>(new Map());
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/* Electric Cherry — design tokens.
|
||||
Named after the perk-a-cola from Mob of the Dead (CoD Zombies):
|
||||
deep cherry-red art-deco label + electric cyan discharge. */
|
||||
|
||||
@import '@fontsource/alfa-slab-one/400.css';
|
||||
@import '@fontsource/inter/400.css';
|
||||
@import '@fontsource/inter/500.css';
|
||||
@import '@fontsource/inter/600.css';
|
||||
@import '@fontsource/inter/700.css';
|
||||
@import '@fontsource/jetbrains-mono/400.css';
|
||||
@import '@fontsource/jetbrains-mono/500.css';
|
||||
|
||||
:root {
|
||||
/* Cherry — surfaces + primary */
|
||||
--cherry-975: #0b0407;
|
||||
--cherry-925: #170a0f;
|
||||
--cherry-875: #22101a;
|
||||
--cherry-825: #2c1420;
|
||||
--cherry-700: #4a0f1e;
|
||||
--cherry-600: #7a0f22;
|
||||
--cherry-500: #c8102e;
|
||||
--cherry-400: #e93656;
|
||||
--cherry-300: #ff7a92;
|
||||
|
||||
/* Spark — electric cyan */
|
||||
--spark-600: #14b8d0;
|
||||
--spark-500: #22e0ff;
|
||||
--spark-400: #7ef1ff;
|
||||
--spark-glow: 0 0 8px rgba(34, 224, 255, 0.55);
|
||||
--spark-glow-lg: 0 0 14px rgba(34, 224, 255, 0.45);
|
||||
|
||||
/* Neutrals + label */
|
||||
--cream: #f2e6c8;
|
||||
--cream-dim: #c9b98f;
|
||||
--ink-100: #f5eaec;
|
||||
--ink-300: #c8a4ac;
|
||||
--ink-500: #7a5560;
|
||||
--ink-700: #4a2f36;
|
||||
|
||||
/* State colors */
|
||||
--amber-500: #ffb020;
|
||||
--amber-glow: 0 0 8px rgba(255, 176, 32, 0.4);
|
||||
--danger-500: #ff3050;
|
||||
--success-500: var(--spark-500);
|
||||
|
||||
/* Typography */
|
||||
--font-display: 'Alfa Slab One', 'Georgia', serif;
|
||||
--font-body: 'Inter', system-ui, -apple-system, sans-serif;
|
||||
--font-mono: 'JetBrains Mono', ui-monospace, monospace;
|
||||
|
||||
/* Radii */
|
||||
--r-sm: 3px;
|
||||
--r-md: 6px;
|
||||
--r-lg: 10px;
|
||||
|
||||
/* Shadows */
|
||||
--shadow-card: 0 2px 12px rgba(0, 0, 0, 0.5);
|
||||
--shadow-panel: 0 4px 24px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
@keyframes electric-pulse {
|
||||
0%, 100% {
|
||||
box-shadow: 0 0 0 0 rgba(34, 224, 255, 0.55), var(--spark-glow);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 0 0 6px rgba(34, 224, 255, 0), var(--spark-glow-lg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes cherry-fizz {
|
||||
0%, 100% { transform: translateY(0); }
|
||||
50% { transform: translateY(-1px); }
|
||||
}
|
||||
|
||||
@keyframes spark-slide {
|
||||
from { background-position: -100% 0; }
|
||||
to { background-position: 200% 0; }
|
||||
}
|
||||
Reference in New Issue
Block a user