Add Command Center web UI (no build step)

Static HTML/CSS/JS served by FastAPI (mounted at /ui, / redirects there),
talking to the existing JSON API — no node/npm, no bundler.

- games/versions sidebar with A/B version selectors
- visual 4-axis diff (types/methods/events/fields, +/- struct_layout) with
  +/-/~ rows, per-axis counts, class (owner) filter, moved-methods section
- single-snapshot browser (tabs + live filter)
- app.py mounts StaticFiles(html=True) last so API routes win; / -> /ui/

Smoke-tested live on uvicorn: /, /ui/ and assets serve 200; UI wiring drives
the same /games and /diff endpoints verified end-to-end. app.js passes
`node --check`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Patryk Gensch
2026-05-30 23:37:03 +02:00
parent bd03c56e98
commit 4542763936
5 changed files with 352 additions and 0 deletions

80
ams/api/static/style.css Normal file
View File

@@ -0,0 +1,80 @@
:root {
--bg: #0d1117; --panel: #131a23; --panel2: #1a2330; --border: #243140;
--fg: #c9d4e0; --dim: #6b7c8f; --accent: #4ea3ff; --accent2: #1f6feb;
--add: #3fb950; --del: #f85149; --chg: #d29922; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 13px/1.45 var(--mono); }
.topbar { display: flex; align-items: baseline; gap: 16px; padding: 10px 18px;
background: linear-gradient(180deg, #131c28, #0d1117); border-bottom: 1px solid var(--border); }
.brand { font-size: 16px; font-weight: 600; letter-spacing: .5px; color: #eaf2fb; }
.brand span { color: var(--accent); font-weight: 400; }
.sub { color: var(--dim); font-size: 12px; }
.layout { display: grid; grid-template-columns: 320px 1fr; height: calc(100% - 47px); }
.sidebar { border-right: 1px solid var(--border); overflow-y: auto; background: var(--panel); }
.panel-title { padding: 10px 14px; color: var(--dim); text-transform: uppercase; font-size: 11px;
letter-spacing: 1px; position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--border); }
.game { padding: 8px 10px 4px; }
.game-name { color: #eaf2fb; font-weight: 600; padding: 4px 4px; }
.snap { display: flex; align-items: center; gap: 6px; padding: 6px 8px; margin: 3px 0;
border: 1px solid var(--border); border-radius: 6px; background: var(--panel2); }
.snap:hover { border-color: var(--accent2); }
.snap .info { flex: 1; min-width: 0; cursor: pointer; }
.snap .bin { color: var(--fg); }
.snap .meta { color: var(--dim); font-size: 11px; }
.snap .pill { display: inline-block; padding: 0 5px; border-radius: 4px; background: #20303f; color: var(--dim); margin-left: 4px; }
.snap .ab { display: flex; gap: 4px; }
.snap .ab button { width: 24px; height: 24px; border: 1px solid var(--border); background: #16202c;
color: var(--dim); border-radius: 5px; cursor: pointer; font-family: var(--mono); }
.snap .ab button.on { background: var(--accent2); color: #fff; border-color: var(--accent); }
.main { display: flex; flex-direction: column; min-width: 0; }
.controls { display: flex; align-items: center; gap: 12px; padding: 10px 16px; flex-wrap: wrap;
border-bottom: 1px solid var(--border); background: var(--panel); }
.slots { color: var(--dim); }
.slot em { color: var(--accent); font-style: normal; }
.arrow { color: var(--dim); margin: 0 4px; }
.owner { background: #0c141d; border: 1px solid var(--border); color: var(--fg);
padding: 5px 8px; border-radius: 6px; font-family: var(--mono); width: 220px; }
.axes { display: flex; gap: 8px; color: var(--dim); }
.axes label { cursor: pointer; user-select: none; }
.compare { margin-left: auto; background: var(--accent2); color: #fff; border: 0;
padding: 7px 14px; border-radius: 6px; cursor: pointer; font-family: var(--mono); }
.compare:disabled { background: #223; color: #566; cursor: not-allowed; }
.results { padding: 16px; overflow-y: auto; }
.hint { color: var(--dim); text-align: center; margin-top: 60px; line-height: 1.8; }
.diff-head { color: var(--dim); margin-bottom: 14px; }
.diff-head b { color: var(--fg); }
.axis { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 14px; overflow: hidden; }
.axis > summary { list-style: none; cursor: pointer; padding: 9px 14px; background: var(--panel2);
display: flex; align-items: center; gap: 10px; }
.axis > summary::-webkit-details-marker { display: none; }
.axis .title { font-weight: 600; color: #eaf2fb; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 10px; }
.b-add { background: rgba(63,185,80,.15); color: var(--add); }
.b-del { background: rgba(248,81,73,.15); color: var(--del); }
.b-chg { background: rgba(210,153,34,.15); color: var(--chg); }
.axis .body { padding: 6px 14px 12px; }
.row { padding: 2px 0 2px 18px; position: relative; white-space: pre-wrap; word-break: break-word; }
.row::before { position: absolute; left: 0; font-weight: 700; }
.r-add::before { content: "+"; color: var(--add); }
.r-del::before { content: ""; color: var(--del); }
.r-chg::before { content: "~"; color: var(--chg); }
.r-del { color: var(--dim); }
.delta { color: var(--chg); }
.empty { color: var(--dim); font-style: italic; }
.moved { color: var(--accent); }
.browse-filter { margin-bottom: 10px; }
.btab { display: inline-block; padding: 4px 10px; margin-right: 6px; border: 1px solid var(--border);
border-radius: 6px; cursor: pointer; color: var(--dim); }
.btab.on { background: var(--accent2); color: #fff; border-color: var(--accent); }
.bitem { padding: 1px 0; }
.bitem .k { color: var(--dim); }
.err { color: var(--del); }