One thread template, one sidebar toggle

chat/index.html and chat/_thread.html held the same loop, so anything added
to the conversation -- a compaction divider, say -- would have had to be
written into both and kept in step by hand. index.html includes the partial
instead.

The sidebar toggle was a raw inline onclick, the only one left in the
application. app.js already delegates [data-toggle="#selector"] and gives
open/close, aria-expanded and an is-active button state for free; the chat
settings gear has used it all along. Also deletes the
.sidebar[data-collapsed="true"] rule, which nothing has ever set.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jaroslav Beneš
2026-08-01 00:31:26 +02:00
parent 4531cd75e3
commit 50484b2483
3 changed files with 13 additions and 10 deletions
+3 -1
View File
@@ -626,7 +626,9 @@ button, input, textarea, select {
z-index: 40; z-index: 40;
box-shadow: var(--shadow-lg); box-shadow: var(--shadow-lg);
} }
.sidebar[data-collapsed="true"] { display: none; } /* Hiding it is the `hidden` attribute, forced to win at the top of this
file. There used to be a `[data-collapsed="true"]` rule here that nothing
ever set. */
} }
/* --- Toasts ---------------------------------------------------------------- /* --- Toasts ----------------------------------------------------------------
+5 -1
View File
@@ -1,7 +1,11 @@
{# {#
The whole thread. Returned after a rewind, which changes an arbitrary number The whole thread. Returned after a rewind, which changes an arbitrary number
of messages at once -- replacing the lot is simpler and less error-prone than of messages at once -- replacing the lot is simpler and less error-prone than
working out which individual bubbles to remove. working out which individual bubbles to remove. Also included by
chat/index.html, so the conversation is described in exactly one place.
Deliberately has no root element: it is swapped with innerHTML into #thread,
and an outerHTML swap would take the container with it.
#} #}
{% for message in messages %} {% for message in messages %}
{% with body_html = bodies.get(message.id, "") %} {% with body_html = bodies.get(message.id, "") %}
+5 -8
View File
@@ -16,7 +16,7 @@
<main class="main"> <main class="main">
<header class="topbar"> <header class="topbar">
<button class="btn btn--icon" type="button" aria-label="Toggle sidebar" <button class="btn btn--icon" type="button" aria-label="Toggle sidebar"
onclick="document.getElementById('sidebar').toggleAttribute('hidden')"> aria-expanded="true" data-toggle="#sidebar">
{{ icon("sidebar") }} {{ icon("sidebar") }}
</button> </button>
@@ -161,13 +161,10 @@
</div> </div>
{% endif %} {% endif %}
{% for message in messages %} {# The same include the rewind response returns, so the conversation
{# Markdown was rendered server-side in pages.py, keyed by message is described in one place. Markdown was rendered server-side in
id, so this loop stays a lookup rather than a render. #} pages.py, keyed by message id. #}
{% with body_html = bodies.get(message.id, "") %} {% include "chat/_thread.html" %}
{% include "chat/_message.html" %}
{% endwith %}
{% endfor %}
</div> </div>
</div> </div>