Files
ai-chess/public/index.html
T
ai-chess 0eec263fd8 feat(ui): floating moves under board, chat full-height right, refined eval bar
Layout (after iterative feedback):
- Two columns: board+eval (left, square) | chat full-height (right).
- Moves row floats just under the board as a compact one-row strip with
  the controls (new game / settings) — replaces the old right sidebar.
- Board sized imperatively via fitBoard + ResizeObserver; eval bar height
  matches the board exactly (no overflow into neighbours).

Eval bar:
- 36px wide (was 28); text fits without pill background.
- System sans-serif, 10.5px / 700 weight, tabular-nums.
- Text positioned on whichever side is winning (bottom-white-half when
  white ahead → dark text; top-black-half when black ahead → light).
- Sign now correct: backend stores raw cp from side-to-move; frontend
  flips when FEN says "b" so the bar always reflects white POV.

Replay:
- evalByFen on the client gets backfilled from /api/state's new `evals`
  list (backend keeps state.eval_cache per game). Clicking past bubbles
  now restores the stockfish eval for that ply.
- renderBoard clears stockfish arrow when no eval is known yet for the
  shown FEN, so the arrow no longer 'lags' onto the next position.

Auto-focus:
- Latest played move is highlighted in both the chat bubble list and
  the moves strip when in live mode (viewPly === null).
- scrollIntoView keeps the active bubble/SAN visible after each move.
2026-05-15 00:17:33 +03:00

59 lines
1.8 KiB
HTML

<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8" />
<title>ai-chess</title>
<link rel="stylesheet" href="/static/vendor/chessground.base.css" />
<link rel="stylesheet" href="/static/vendor/chessground.brown.css" />
<link rel="stylesheet" href="/static/vendor/chessground.cburnett.css" />
<link rel="stylesheet" href="/static/style.css" />
</head>
<body>
<main id="layout">
<section id="board-col">
<div id="board-row">
<div id="eval-col" title="stockfish eval">
<div id="eval-fill"></div>
<div id="eval-text">0.00</div>
</div>
<div id="board"></div>
</div>
<div id="board-footer">
<span id="status-line">…</span>
<span id="sf-pv"></span>
<button id="live-btn" hidden>live</button>
<button id="new-game">new game</button>
<button id="settings-btn" title="settings">⚙</button>
</div>
<div id="moves-floating">
<span class="moves-label">moves</span>
<ol id="history-list"></ol>
</div>
</section>
<aside id="chat-col">
<header class="col-header">
<span>chat</span>
<span id="chat-counter"></span>
</header>
<div id="chat-list"></div>
</aside>
</main>
<dialog id="settings-dialog">
<form method="dialog" id="settings-form">
<h3>settings</h3>
<label><input type="checkbox" name="allow_draw_resign" /> allow draw / resign</label>
<label><input type="checkbox" name="allow_illegal_moves" /> allow illegal moves</label>
<label>stockfish depth: <input type="number" name="stockfish_depth" min="6" max="30" /></label>
<menu>
<button value="cancel">cancel</button>
<button value="save" id="settings-save">save</button>
</menu>
</form>
</dialog>
<script src="/static/app.js" type="module"></script>
</body>
</html>