Event viewer: index-based move selection, new board analyser layout

This commit is contained in:
claude committed 2026-10-10 16:01:57 +02:00
1 parent 9fba5f41b7
commit 309754bb08
2 files changed
+168 -111

No files matched your search

+116 -64
View File
@@ -1,9 +1,10 @@
{% extends "OpenBench/base.html" %}
{% load static %}
{% load uitags %}
{% block scripts %}
<script src="{% static 'chess.js' %}?{{ static_version }}" defer></script>
<script src="{% static 'board.js' %}?{{ static_version }}" defer></script>
<script src="{% static 'event_viewer.js' %}?{{ static_version }}" defer></script>
{% endblock %}
@@ -81,6 +82,7 @@
{% if game.time_control %}<div><dt>Time control</dt><dd class="mono">{{ game.time_control }}</dd></div>{% endif %}
{% if game.date %}<div><dt>Date</dt><dd class="mono">{{ game.date }}</dd></div>{% endif %}
{% if game.duration %}<div><dt>Duration</dt><dd class="mono">{{ game.duration }}</dd></div>{% endif %}
{% if game.chess960 %}<div><dt>Variant</dt><dd class="mono">Chess960</dd></div>{% endif %}
{% if game.fen %}<div><dt>Start FEN</dt><dd class="mono">{{ game.fen }}</dd></div>{% endif %}
</dl>
@@ -99,82 +101,131 @@
{% if game.rows %}
<div class="ev-grid">
<div class="bd-layout">
<section class="card bd-card">
<section class="card">
<header class="card-head">
<h2 class="card-title">Moves</h2>
<span class="count">{{ game.ply_count }}</span>
<h2 class="card-title">Board</h2>
{% if game.chess960 %}<span class="badge badge-info">Chess960</span>{% endif %}
</header>
<div class="ev-movelist" id="ev-movelist" role="listbox" aria-label="Moves">
{% for row in game.rows %}
<div class="ev-row">
<span class="ev-num">{{ row.num }}.</span>
<div class="bd-body">
{% if row.w %}
<button type="button" class="ev-move{% if row.w.final %} is-final{% endif %}" role="option" data-ply="{{ row.w.ply }}">
<span class="ev-san">{{ row.w.san }}</span>{% if row.w.eval %}<em class="ev-eval {{ row.w.tone }}">{{ row.w.eval }}</em>{% endif %}
</button>
{% else %}
<span class="ev-move ev-empty">&hellip;</span>
{% endif %}
<div class="bd-grid">
{% if row.b %}
<button type="button" class="ev-move{% if row.b.final %} is-final{% endif %}" role="option" data-ply="{{ row.b.ply }}">
<span class="ev-san">{{ row.b.san }}</span>{% if row.b.eval %}<em class="ev-eval {{ row.b.tone }}">{{ row.b.eval }}</em>{% endif %}
</button>
{% else %}
<span class="ev-move ev-empty"></span>
{% endif %}
<div class="bd-player is-black" id="bd-top">
<i class="ev-piece"></i>
<strong class="bd-name">{{ game.black }}</strong>
<span class="bd-caps"></span>
<span class="bd-mat"></span>
</div>
{% endfor %}
<div class="bd-eval" id="bd-eval" aria-hidden="true">
<div class="bd-eval-fill"></div>
<span class="bd-eval-label on-white">&ndash;</span>
</div>
<div class="bd-board" id="bd-board"><noscript><p class="bd-nojs">The board needs JavaScript.</p></noscript></div>
<div class="bd-player is-white" id="bd-bottom">
<i class="ev-piece"></i>
<strong class="bd-name">{{ game.white }}</strong>
<span class="bd-caps"></span>
<span class="bd-mat"></span>
</div>
</div>
<p class="bd-status" id="bd-status">&nbsp;</p>
<div class="bd-controls">
<button type="button" class="bd-btn" id="bd-first" title="First position (Home)" aria-label="First position"><i class="fa-solid fa-backward-step"></i></button>
<button type="button" class="bd-btn" id="bd-prev" title="Previous move (Left arrow)" aria-label="Previous move"><i class="fa-solid fa-chevron-left"></i></button>
<button type="button" class="bd-btn bd-btn-main" id="bd-play" title="Play or pause (Space)" aria-label="Play"><i class="fa-solid fa-play"></i></button>
<button type="button" class="bd-btn" id="bd-next" title="Next move (Right arrow)" aria-label="Next move"><i class="fa-solid fa-chevron-right"></i></button>
<button type="button" class="bd-btn" id="bd-last" title="Last position (End)" aria-label="Last position"><i class="fa-solid fa-forward-step"></i></button>
<button type="button" class="bd-btn bd-btn-flip" id="bd-flip" title="Flip the board (F)" aria-label="Flip the board"><i class="fa-solid fa-retweet"></i></button>
</div>
<div class="bd-fen">
<span class="bd-fen-label">FEN</span>
<code id="bd-fen"></code>
<button type="button" class="bd-btn bd-btn-icon" id="bd-copy" title="Copy FEN" aria-label="Copy FEN"><i class="fa-regular fa-copy"></i></button>
</div>
</div>
</section>
<aside class="ev-side">
<div class="ev-right">
<div class="ev-right-inner">
<section class="card">
<header class="card-head">
<h2 class="card-title">Selected move</h2>
<span class="mono muted" id="sel-counter">&ndash;</span>
</header>
<div class="ev-sel">
<div class="ev-sel-main">
<span class="ev-sel-label mono" id="sel-label">&ndash;</span>
<span class="ev-sel-san mono" id="sel-san">&ndash;</span>
</div>
<div class="ev-sel-stats">
<div><span>Eval</span><strong class="mono" id="sel-eval">&ndash;</strong></div>
<div><span>Depth</span><strong class="mono" id="sel-depth">&ndash;</strong></div>
<div><span>Time</span><strong class="mono" id="sel-time">&ndash;</strong></div>
</div>
<p class="ev-sel-note" id="sel-note" hidden></p>
<div class="ev-nav">
<button type="button" class="anchorbutton btn-start" id="ev-first" title="First move (Home)" aria-label="First move"><i class="fa-solid fa-backward-step"></i></button>
<button type="button" class="anchorbutton btn-start" id="ev-prev" title="Previous move (Left arrow)" aria-label="Previous move"><i class="fa-solid fa-chevron-left"></i></button>
<button type="button" class="anchorbutton btn-start" id="ev-next" title="Next move (Right arrow)" aria-label="Next move"><i class="fa-solid fa-chevron-right"></i></button>
<button type="button" class="anchorbutton btn-start" id="ev-last" title="Last move (End)" aria-label="Last move"><i class="fa-solid fa-forward-step"></i></button>
</div>
<p class="ev-hint"><kbd>&larr;</kbd> <kbd>&rarr;</kbd> step through the game, <kbd>Home</kbd> <kbd>End</kbd> jump to the ends</p>
</div>
</section>
<section class="card ev-moves-card">
<section class="card ev-board-card" id="ev-board-slot">
<header class="card-head">
<h2 class="card-title">Board</h2>
<span class="badge badge-muted">Coming soon</span>
</header>
<div class="ev-board" aria-hidden="true">
<div class="ev-board-msg">
<i class="fa-solid fa-chess-board"></i>
<strong>Board analyser</strong>
<span>Follow the game position by position.</span>
</div>
</div>
</section>
<header class="card-head">
<h2 class="card-title">Moves</h2>
<span class="count">{{ game.ply_count }}</span>
</header>
</aside>
<div class="ev-sel">
<div class="ev-sel-main">
<span class="ev-sel-label mono" id="sel-label"></span>
<span class="ev-sel-san mono" id="sel-san">&ndash;</span>
<span class="ev-sel-counter mono" id="sel-counter"></span>
</div>
<div class="ev-sel-stats">
<div><span>Eval</span><strong class="mono" id="sel-eval">&ndash;</strong></div>
<div><span>Depth</span><strong class="mono" id="sel-depth">&ndash;</strong></div>
<div><span>Time</span><strong class="mono" id="sel-time">&ndash;</strong></div>
</div>
<p class="ev-sel-note" id="sel-note" hidden></p>
</div>
<div class="ev-movelist" id="ev-movelist" role="listbox" aria-label="Moves">
{% for row in game.rows %}
<div class="ev-row">
<span class="ev-num">{{ row.num }}.</span>
{% if row.w %}
<button type="button" class="ev-move{% if row.w.final %} is-final{% endif %}" role="option" data-ply="{{ row.w.ply }}">
<span class="ev-san">{{ row.w.san }}</span>{% if row.w.eval %}<em class="ev-eval {{ row.w.tone }}">{{ row.w.eval }}</em>{% endif %}
</button>
{% else %}
<span class="ev-move ev-empty">&hellip;</span>
{% endif %}
{% if row.b %}
<button type="button" class="ev-move{% if row.b.final %} is-final{% endif %}" role="option" data-ply="{{ row.b.ply }}">
<span class="ev-san">{{ row.b.san }}</span>{% if row.b.eval %}<em class="ev-eval {{ row.b.tone }}">{{ row.b.eval }}</em>{% endif %}
</button>
{% else %}
<span class="ev-move ev-empty"></span>
{% endif %}
</div>
{% endfor %}
</div>
<footer class="ev-moves-foot">
<span><kbd>&larr;</kbd> <kbd>&rarr;</kbd> step</span>
<span><kbd>Space</kbd> play</span>
<span><kbd>F</kbd> flip</span>
</footer>
</section>
<section class="card bd-graph-card" id="bd-graph-card">
<header class="card-head">
<h2 class="card-title">Evaluation</h2>
<span class="mono muted" id="bd-graph-label"></span>
</header>
<div class="bd-graph-wrap">
<div class="bd-graph" id="bd-graph"></div>
</div>
</section>
</div>
</div>
</div>
@@ -190,6 +241,7 @@
{% endif %}
{{ moves_json|json_script:"ev-moves" }}
{{ game_json|json_script:"ev-game" }}
{% elif kind == 'log' %}