Redesign UI with new token system, primitives, and motion
Restraint-first design language: neutral gray surfaces + one blue accent (cyan/amber/red reserved for state), 8pt spacing, softer radii, one ambient + one raised shadow, standardized motion tokens. Alfa Slab One demoted to BrandMark only; Inter carries all page copy. New primitives (Button, Card, Badge, Stat, SectionHeader, Skeleton, EmptyState, Tabs, Breadcrumbs, StatusPip, Field, Input, Select, Textarea) plus motion utilities (tweenNumber, viewTransition) and a global toast system. All eight route surfaces rewritten on top: Fleet gains an overview hero, Server detail restructures into tabs, Deployments gets a collapsible drift summary + per-server pipeline visual, and the scripts/configs/plugins/betas flows adopt the new form primitives. Sticky translucent nav with backdrop blur, view-transition cross-fades between routes, staggered card entrance on Fleet, breathing status pip halo, tabular-numeric player counts. Gmail-style g-key nav shortcuts. Mobile stacks below 720px; prefers-reduced-motion neutralizes durations. Legacy tokens preserved as aliases so any un-migrated code still renders.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import Button from './primitives/Button.svelte';
|
||||
import Field from './primitives/Field.svelte';
|
||||
import Input from './primitives/Input.svelte';
|
||||
import Select from './primitives/Select.svelte';
|
||||
|
||||
interface T5MapEntry {
|
||||
friendly: string;
|
||||
@@ -34,8 +38,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Track prior open value manually — using $effect with `open` triggers on
|
||||
// every render and repeatedly re-shows the modal.
|
||||
let wasOpen = $state(false);
|
||||
$effect(() => {
|
||||
if (!dialog) return;
|
||||
@@ -54,35 +56,23 @@
|
||||
deploying = false;
|
||||
if (maps.length > 0 && !maps.some((m) => m.slug === mapSlug)) mapSlug = maps[0].slug;
|
||||
}
|
||||
function close(): void { open = false; }
|
||||
|
||||
function close(): void {
|
||||
open = false;
|
||||
}
|
||||
|
||||
// Click-outside-to-close (native <dialog> only supports Esc). Only treat
|
||||
// clicks whose target is the dialog element itself (the backdrop) as
|
||||
// outside — a bounding-rect check catches native <select> dropdown
|
||||
// options that render below the modal and closes the whole thing.
|
||||
function onDialogClick(e: MouseEvent): void {
|
||||
if (e.target === dialog) close();
|
||||
}
|
||||
|
||||
let selectedMap = $derived(maps.find((m) => m.slug === mapSlug));
|
||||
let previewName = $derived(
|
||||
selectedMap ? `t5_${gameMode}_${selectedMap.slug}_?` : ''
|
||||
);
|
||||
let previewName = $derived(selectedMap ? `t5_${gameMode}_${selectedMap.slug}_?` : '');
|
||||
|
||||
let modeOptions = [{ value: 'zombie', label: 'Zombies' }];
|
||||
let mapOptions = $derived(maps.map((m) => ({ value: m.slug, label: m.friendly })));
|
||||
|
||||
async function submit(e: SubmitEvent): Promise<void> {
|
||||
e.preventDefault();
|
||||
if (deploying) return;
|
||||
if (!selectedMap) {
|
||||
flash = 'pick a map';
|
||||
return;
|
||||
}
|
||||
if (plutoKey.trim().length === 0) {
|
||||
flash = 'pluto server key is required';
|
||||
return;
|
||||
}
|
||||
if (!selectedMap) { flash = 'Pick a map'; return; }
|
||||
if (plutoKey.trim().length === 0) { flash = 'Pluto server key is required'; return; }
|
||||
deploying = true;
|
||||
flash = null;
|
||||
try {
|
||||
@@ -91,15 +81,9 @@
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ gameMode, mapSlug: selectedMap.slug, plutoKey })
|
||||
});
|
||||
const body = (await res.json()) as {
|
||||
ok: boolean;
|
||||
name?: string;
|
||||
port?: number;
|
||||
error?: string;
|
||||
kind?: string;
|
||||
};
|
||||
const body = (await res.json()) as { ok: boolean; name?: string; port?: number; error?: string; kind?: string };
|
||||
if (!body.ok || !body.name) {
|
||||
flash = body.error ?? 'deploy failed';
|
||||
flash = body.error ?? 'Deploy failed';
|
||||
deploying = false;
|
||||
return;
|
||||
}
|
||||
@@ -114,167 +98,191 @@
|
||||
|
||||
<dialog bind:this={dialog} onclick={onDialogClick} onclose={() => (open = false)}>
|
||||
<form class="dlg" onsubmit={submit}>
|
||||
<h3>Deploy new server</h3>
|
||||
<header class="dlg-head">
|
||||
<h3>Deploy new server</h3>
|
||||
<button type="button" class="close" onclick={close} aria-label="Close">×</button>
|
||||
</header>
|
||||
|
||||
{#if mapsError}
|
||||
<p class="flash">failed to load map catalog: {mapsError}</p>
|
||||
<div class="alert alert-danger">Failed to load map catalog: {mapsError}</div>
|
||||
{:else if !mapsLoaded}
|
||||
<p class="hint">loading map catalog…</p>
|
||||
<div class="hint">Loading map catalog…</div>
|
||||
{:else}
|
||||
<div class="row">
|
||||
<span class="row-label">Game</span>
|
||||
<div class="readonly mono">Black Ops 1 (t5)</div>
|
||||
</div>
|
||||
<div class="fields">
|
||||
<Field label="Game">
|
||||
<div class="readonly">Black Ops 1 (t5)</div>
|
||||
</Field>
|
||||
|
||||
<div class="row">
|
||||
<label for="mode">Mode</label>
|
||||
<select id="mode" bind:value={gameMode} disabled={deploying}>
|
||||
<option value="zombie">Zombies</option>
|
||||
</select>
|
||||
</div>
|
||||
<Field label="Mode">
|
||||
<Select bind:value={gameMode} options={modeOptions} disabled={deploying} />
|
||||
</Field>
|
||||
|
||||
<div class="row">
|
||||
<label for="map">Map</label>
|
||||
<select id="map" bind:value={mapSlug} disabled={deploying}>
|
||||
{#each maps as m (m.slug)}
|
||||
<option value={m.slug}>{m.friendly}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
<Field label="Map">
|
||||
<Select bind:value={mapSlug} options={mapOptions} disabled={deploying} />
|
||||
</Field>
|
||||
|
||||
<div class="row">
|
||||
<label for="key">Pluto server key</label>
|
||||
<input
|
||||
id="key"
|
||||
type="password"
|
||||
bind:value={plutoKey}
|
||||
placeholder="paste each deploy — not stored"
|
||||
autocomplete="off"
|
||||
disabled={deploying}
|
||||
/>
|
||||
<Field label="Pluto server key" hint="Paste each deploy — not stored anywhere.">
|
||||
<Input
|
||||
type="password"
|
||||
bind:value={plutoKey}
|
||||
placeholder="paste key"
|
||||
autocomplete="off"
|
||||
disabled={deploying}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
|
||||
<div class="preview">
|
||||
<span class="k">will create</span>
|
||||
<span class="v mono">{previewName || '—'}</span>
|
||||
<span class="sub">(lobby number + port auto-assigned)</span>
|
||||
<span class="preview-k">Will create</span>
|
||||
<span class="preview-v">{previewName || '—'}</span>
|
||||
<span class="preview-sub">(lobby number + port auto-assigned)</span>
|
||||
</div>
|
||||
|
||||
<div class="dlg-actions">
|
||||
<button type="button" class="secondary" onclick={close} disabled={deploying}>cancel</button>
|
||||
<button type="submit" class="primary" disabled={deploying || !selectedMap}>
|
||||
{deploying ? 'deploying…' : 'deploy server'}
|
||||
</button>
|
||||
<div class="actions">
|
||||
<Button variant="ghost" onclick={close} disabled={deploying}>Cancel</Button>
|
||||
<Button
|
||||
type="submit"
|
||||
variant="primary"
|
||||
disabled={deploying || !selectedMap}
|
||||
loading={deploying}
|
||||
>
|
||||
Deploy server
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if flash}<p class="flash">{flash}</p>{/if}
|
||||
{#if flash}<div class="alert alert-danger">{flash}</div>{/if}
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
<style>
|
||||
dialog {
|
||||
background: var(--bg-nav);
|
||||
color: var(--ink-100);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--r-md);
|
||||
background: var(--surface);
|
||||
color: var(--text-primary);
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 0;
|
||||
max-width: 520px;
|
||||
max-width: 540px;
|
||||
width: calc(100vw - 40px);
|
||||
box-shadow: var(--shadow-raised);
|
||||
}
|
||||
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
|
||||
.dlg { display: flex; flex-direction: column; gap: 14px; padding: var(--pad-panel); }
|
||||
h3 {
|
||||
dialog[open] { animation: dlg-in var(--dur-base) var(--ease-standard); }
|
||||
@keyframes dlg-in {
|
||||
from { opacity: 0; transform: translateY(6px) scale(0.98); }
|
||||
to { opacity: 1; transform: translateY(0) scale(1); }
|
||||
}
|
||||
dialog::backdrop {
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
backdrop-filter: blur(6px);
|
||||
-webkit-backdrop-filter: blur(6px);
|
||||
}
|
||||
|
||||
.dlg {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-5);
|
||||
padding: var(--space-6);
|
||||
}
|
||||
.dlg-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.dlg h3 {
|
||||
margin: 0;
|
||||
font-family: var(--font-body);
|
||||
font-size: var(--text-xs);
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1.5px;
|
||||
color: var(--ink-300);
|
||||
font-size: var(--text-md);
|
||||
font-weight: var(--weight-semibold);
|
||||
color: var(--text-primary);
|
||||
letter-spacing: var(--tracking-tight);
|
||||
}
|
||||
.row {
|
||||
.close {
|
||||
appearance: none;
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--text-tertiary);
|
||||
font-size: var(--text-xl);
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
padding: 4px 8px;
|
||||
border-radius: var(--radius-sm);
|
||||
transition: color var(--dur-fast) var(--ease-standard), background-color var(--dur-fast) var(--ease-standard);
|
||||
}
|
||||
.close:hover { color: var(--text-primary); background: var(--surface-raised); }
|
||||
.close:focus-visible { outline: none; box-shadow: var(--focus-ring); }
|
||||
|
||||
.fields {
|
||||
display: grid;
|
||||
grid-template-columns: 130px 1fr;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
.row label, .row-label {
|
||||
color: var(--ink-500);
|
||||
font-family: var(--font-body);
|
||||
font-size: var(--text-xs);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.row select, .row input {
|
||||
background: var(--bg-page);
|
||||
color: var(--ink-100);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 10px 12px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--text-mono);
|
||||
width: 100%;
|
||||
}
|
||||
.row input:focus, .row select:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
box-shadow: var(--accent-glow);
|
||||
.fields :global(.field):nth-child(1),
|
||||
.fields :global(.field):nth-child(4) {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.readonly {
|
||||
color: var(--ink-300);
|
||||
padding: 10px 0;
|
||||
padding: 9px 12px;
|
||||
color: var(--text-secondary);
|
||||
font-family: var(--font-body);
|
||||
font-size: var(--text-sm);
|
||||
background: var(--surface-sunken);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.preview {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
gap: 10px;
|
||||
padding: 12px 14px;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border);
|
||||
border-left: 3px solid var(--accent);
|
||||
border-radius: var(--r-sm);
|
||||
font-size: var(--text-mono);
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-3) var(--space-4);
|
||||
background: var(--surface-sunken);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-left: 2px solid var(--accent-primary);
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
.preview .k {
|
||||
color: var(--ink-500);
|
||||
font-family: var(--font-body);
|
||||
.preview-k {
|
||||
font-size: var(--text-xs);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
letter-spacing: var(--tracking-label);
|
||||
color: var(--text-tertiary);
|
||||
font-weight: var(--weight-semibold);
|
||||
}
|
||||
.preview .v { color: var(--cream); }
|
||||
.preview .sub {
|
||||
color: var(--ink-500);
|
||||
font-family: var(--font-body);
|
||||
.preview-v {
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--text-sm);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.preview-sub {
|
||||
font-size: var(--text-xs);
|
||||
color: var(--text-tertiary);
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: var(--space-2);
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.alert {
|
||||
margin: 0;
|
||||
padding: var(--space-3) var(--space-4);
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid transparent;
|
||||
font-size: var(--text-sm);
|
||||
}
|
||||
.alert-danger {
|
||||
background: rgba(255, 86, 112, 0.08);
|
||||
border-color: rgba(255, 86, 112, 0.28);
|
||||
color: var(--state-danger);
|
||||
}
|
||||
.hint {
|
||||
color: var(--text-tertiary);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--text-xs);
|
||||
}
|
||||
.mono { font-family: var(--font-mono); }
|
||||
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
|
||||
button.primary {
|
||||
background: linear-gradient(180deg, var(--blue-500), var(--blue-600));
|
||||
border: 1px solid var(--blue-400);
|
||||
color: var(--cream);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 10px 16px;
|
||||
font-family: var(--font-body);
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.fields { grid-template-columns: 1fr; }
|
||||
}
|
||||
button.primary:disabled { opacity: 0.4; cursor: default; }
|
||||
button.secondary {
|
||||
background: var(--bg-card);
|
||||
color: var(--ink-100);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 10px 16px;
|
||||
font-family: var(--font-body);
|
||||
font-size: var(--text-sm);
|
||||
cursor: pointer;
|
||||
}
|
||||
button.secondary:hover:not(:disabled) { border-color: var(--accent); box-shadow: var(--accent-glow); }
|
||||
button.secondary:disabled { opacity: 0.4; cursor: default; }
|
||||
.flash { color: var(--danger-500); font-family: var(--font-mono); font-size: var(--text-mono); margin: 0; }
|
||||
.hint { color: var(--ink-500); font-family: var(--font-mono); font-size: var(--text-mono); margin: 0; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user