Files
LLeMbas/src/lembas/web/templates/partials/_chat_link.html
T
HomerandClaude Opus 5 28390095a9 A phone, and how much of this could not be used on one
The sidebar was a 280px panel laid over the page below the phone breakpoint,
opened from first paint, with the only control that closed it underneath it --
and that control existed on /chat and on none of the seven other pages carrying
a sidebar, Settings included. It starts closed at that width now, slides, dims
the page behind it, and closes by tapping beside it, by Escape, or by its own
button, which is inside the drawer where it can be reached.

Everything a finger has to hit was 36px, or 28 for renaming a chat, every action
on a message and every panel's close button. Raising --control-h under a coarse
pointer is the only fix that reaches all forty of them, which is what that token
is for. The row and message actions were also hover-only, so on a phone they did
not exist at all.

Installing: the splash and the browser chrome follow the instance's theme rather
than always being Moria's near-black; there are screenshots, so the install
offer is a dialog rather than a one-line bar; a new release no longer takes over
a page somebody is reading; the notification badge is a silhouette rather than a
grey square; and a browser rotating its own subscription no longer ends
notifications for good.

Every request now says it is happening -- nothing did before, so anything slower
than a few milliseconds looked like a click that had not registered.

A chat can be archived. The column has been filtered on in four places since
folders arrived and written by nothing, which is what made it look built.

chat.css may contain media queries. The ban protected the composer toolbar from
being "fixed" with a breakpoint; that guarantee is asserted directly now, and
the old test would have passed a version of the file that wrapped the toolbar
without one.

scripts/shoot.py is the instrument all of this was found with: it renders a page
through TestClient into a real headless browser at a real size and refuses to
run if an asset URL was left pointing at testserver.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-25 13:39:35 +00:00

54 lines
2.7 KiB
HTML

{% from "_macros.html" import icon %}
{#
A single chat row. `chat_item` rather than `chat` so this can be included
from a page that already has the open chat bound to `chat`.
#}
<div class="nav-item {% if chat and chat.id == chat_item.id %}is-active{% endif %}"
data-chat-id="{{ chat_item.id }}">
<a class="nav-item__link" href="/chat/{{ chat_item.id }}">
{# The kind, in the one place a person looks. Legible even with the switch
off, which is what it is for: a chat that can run commands should not look
like one that cannot. #}
{{ icon("terminal" if chat_item.kind == "agent" else "chat", "icon--sm") }}
<span class="nav-item__label" id="chat-link-label-{{ chat_item.id }}">{{ chat_item.title }}</span>
{# Toggled out of band by the unread poll; see /api/chats/unread. #}
<span id="unread-{{ chat_item.id }}" class="unread-dot"
{{ '' if chat_item.unread else 'hidden' }} title="New reply"></span>
</a>
<span class="nav-item__actions">
{# Works from any page carrying the sidebar, not only from inside the chat.
The response carries both out-of-band spans, so the heading follows if
this happens to be the open chat. #}
<button class="btn btn--icon btn--sm" type="button"
hx-patch="/api/chats/{{ chat_item.id }}" hx-swap="none"
data-prompt="What should this chat be called?"
data-prompt-title="Rename chat" data-prompt-field="title"
data-prompt-value="{{ chat_item.title }}"
aria-label="Rename chat" title="Rename chat">
{{ icon("pencil", "icon--sm") }}
</button>
{#
Archiving, and un-archiving, are the same control reading the opposite
way round -- so one button, and the sidebar re-renders because a row has
to leave one group and appear in the other.
#}
<button class="btn btn--icon btn--sm" type="button"
hx-patch="/api/chats/{{ chat_item.id }}"
hx-vals='{"archived": "{{ 0 if chat_item.archived else 1 }}"}'
hx-target="#sidebar-tree" hx-swap="outerHTML"
aria-label="{{ 'Restore chat' if chat_item.archived else 'Archive chat' }}"
title="{{ 'Put this chat back in the list' if chat_item.archived
else 'Hide this chat without deleting it' }}">
{{ icon("arrow-up" if chat_item.archived else "archive", "icon--sm") }}
</button>
<button class="btn btn--icon btn--sm" type="button"
hx-delete="/api/chats/{{ chat_item.id }}"
hx-confirm="Delete “{{ chat_item.title }}”? This cannot be undone."
data-confirm-title="Delete chat"
hx-swap="none"
aria-label="Delete chat">
{{ icon("trash", "icon--sm") }}
</button>
</span>
</div>