Merge branch 'main' into web-layout
Take main's newer smoke behaviour where they met: the binary capture is run 449 (opened through openRunDetail), and a running run must show no aggregate Changes section. Keep the layout's shell-aware checks and its L2-L4 rows; L7 stays todo with the view-level fixes recorded.
This commit is contained in:
+46
-22
@@ -1504,24 +1504,39 @@ function fillChatRows(rows) {
|
||||
|
||||
const active = filtered.filter((session) => !session.closed);
|
||||
const closed = filtered.filter((session) => session.closed);
|
||||
// Titles are often repeated ("New chat"); compute the duplicates once so the
|
||||
// per-row actions name can include the session id only when it is needed.
|
||||
const duplicateTitles = duplicateChatTitles(filtered);
|
||||
const groups = groupSessionsByDirectory(active);
|
||||
if (groups.length > 1) {
|
||||
for (const group of groups) {
|
||||
rows.append(h("div", { class: "chat-group-header", text: directoryLabel(group.directory) }));
|
||||
for (const session of group.sessions) rows.append(renderChatRow(session));
|
||||
for (const session of group.sessions) rows.append(renderChatRow(session, duplicateTitles));
|
||||
}
|
||||
} else {
|
||||
for (const session of active) rows.append(renderChatRow(session));
|
||||
for (const session of active) rows.append(renderChatRow(session, duplicateTitles));
|
||||
}
|
||||
if (closed.length > 0) {
|
||||
rows.append(h("div", { class: "chat-group-header", text: CLOSED_SECTION_LABEL }));
|
||||
for (const session of closed) rows.append(renderChatRow(session));
|
||||
for (const session of closed) rows.append(renderChatRow(session, duplicateTitles));
|
||||
}
|
||||
if (state.chatError) {
|
||||
rows.append(h("div", { class: "chat-error muted", text: state.chatError }));
|
||||
}
|
||||
}
|
||||
|
||||
/** The titles shared by more than one rendered session, for unique action names. */
|
||||
function duplicateChatTitles(sessions) {
|
||||
const counts = new Map();
|
||||
for (const session of sessions) {
|
||||
const title = sessionTitle(session);
|
||||
counts.set(title, (counts.get(title) ?? 0) + 1);
|
||||
}
|
||||
return new Set(
|
||||
[...counts.entries()].filter(([, count]) => count > 1).map(([title]) => title),
|
||||
);
|
||||
}
|
||||
|
||||
function chatEmpty(message) {
|
||||
return h("div", { class: "empty" }, h("span", { class: "muted", text: message }));
|
||||
}
|
||||
@@ -1531,7 +1546,7 @@ function chatEmpty(message) {
|
||||
* activity badge word, the work-label meta line and the close/reopen action.
|
||||
* Every server string is set with textContent.
|
||||
*/
|
||||
function renderChatRow(session) {
|
||||
function renderChatRow(session, duplicateTitles = new Set()) {
|
||||
const open = state.chatActiveId === session.id;
|
||||
const thread = state.chatThreads.get(session.id) ?? null;
|
||||
const unseen =
|
||||
@@ -1543,23 +1558,28 @@ function renderChatRow(session) {
|
||||
});
|
||||
const activity = sessionActivity(thread?.running === true, unseen);
|
||||
const badge = sessionActivityBadge(activity, open);
|
||||
// The row is a plain container (M6): the session title/meta area is the native
|
||||
// button and the Chat actions control is its sibling, not a child.
|
||||
const row = h("div", {
|
||||
class: `row chat-row${open ? " selected" : ""}`,
|
||||
role: "button",
|
||||
tabindex: "0",
|
||||
"data-session": session.id,
|
||||
onclick: () => openChatSession(session.id),
|
||||
onkeydown: (event) => {
|
||||
// Only the row itself opens on Enter/Space; the Chat actions menu handles
|
||||
// its own keyboard activation (and must not double-fire).
|
||||
if (event.target !== event.currentTarget) return;
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
openChatSession(session.id);
|
||||
}
|
||||
});
|
||||
// Keep background and programmatic clicks opening the session, but never
|
||||
// double-fire when a real control (session button or actions) was clicked.
|
||||
row.addEventListener("click", (event) => {
|
||||
const target = event.target;
|
||||
if (target instanceof Element && target.closest("button, a")) return;
|
||||
openChatSession(session.id);
|
||||
});
|
||||
const sessionButton = h("button", {
|
||||
class: "chat-session-button",
|
||||
type: "button",
|
||||
onclick: (event) => {
|
||||
event.stopPropagation();
|
||||
openChatSession(session.id);
|
||||
},
|
||||
});
|
||||
const head = h("div", { class: "row-head" });
|
||||
const head = h("span", { class: "row-head" });
|
||||
head.append(h("span", { class: "row-title chat-row-title", text: sessionTitle(session) }));
|
||||
const chip = sessionChipLabel(session);
|
||||
if (chip) head.append(h("span", { class: "chip chat-kind-chip", text: chip }));
|
||||
@@ -1572,14 +1592,14 @@ function renderChatRow(session) {
|
||||
),
|
||||
);
|
||||
}
|
||||
row.append(head);
|
||||
row.append(
|
||||
sessionButton.append(head);
|
||||
sessionButton.append(
|
||||
h("span", {
|
||||
class: "row-meta chat-row-meta",
|
||||
text: sessionMeta(session, sessionWorkLabel(session.busy === true, thread)),
|
||||
}),
|
||||
);
|
||||
row.append(renderChatActionsMenu(session));
|
||||
row.append(sessionButton, renderChatActionsMenu(session, duplicateTitles));
|
||||
return row;
|
||||
}
|
||||
|
||||
@@ -1707,18 +1727,22 @@ function renderChatCreate() {
|
||||
* Close chat… (open) or Reopen (closed), then Hide on this device. Closing is the
|
||||
* shared, server-side finish; hiding only affects this device and says so.
|
||||
*/
|
||||
function renderChatActionsMenu(session) {
|
||||
function renderChatActionsMenu(session, duplicateTitles = new Set()) {
|
||||
const wrap = h("div", { class: "chat-row-actions chat-menu-wrap" });
|
||||
const expanded = state.chatMenu === session.id;
|
||||
const title = sessionTitle(session);
|
||||
const actionLabel = duplicateTitles.has(title)
|
||||
? `${CHAT_ACTIONS_LABEL} for ${title} (${session.id})`
|
||||
: `${CHAT_ACTIONS_LABEL} for ${title}`;
|
||||
wrap.append(
|
||||
h("button", {
|
||||
class: "ghost chat-menu-button",
|
||||
type: "button",
|
||||
text: "⋯",
|
||||
"aria-label": CHAT_ACTIONS_LABEL,
|
||||
"aria-label": actionLabel,
|
||||
"aria-haspopup": "menu",
|
||||
"aria-expanded": expanded ? "true" : "false",
|
||||
title: CHAT_ACTIONS_LABEL,
|
||||
title: actionLabel,
|
||||
onclick: (event) => {
|
||||
event.stopPropagation();
|
||||
openChatMenu(session.id);
|
||||
|
||||
Reference in New Issue
Block a user