diff --git a/orchestrator/templates/page-dom.js b/orchestrator/templates/page-dom.js index 77e2998..c96b6a6 100644 --- a/orchestrator/templates/page-dom.js +++ b/orchestrator/templates/page-dom.js @@ -73,7 +73,11 @@ } const faceParts = (key) => Faces.of(key).parts.map(([tag, attrs]) => s(tag, attrs)); - const talking = (key) => Boolean(speech.current && speech.current.who === key); + const speaker = () => { + const now = speech.current || speech.item; + return now && now.who ? now : null; + }; + const talking = (key) => Boolean(speaker() && speaker().who === key); const face = (who, big) => { const key = agentKey(who); return h("span", {class: `avatar${big ? " big" : ""}${talking(key) ? " speaking" : ""}`, "data-face": key, "aria-hidden": "true"}, diff --git a/orchestrator/templates/page-graph-layout.js b/orchestrator/templates/page-graph-layout.js index ce1a3c7..793f06e 100644 --- a/orchestrator/templates/page-graph-layout.js +++ b/orchestrator/templates/page-graph-layout.js @@ -121,7 +121,7 @@ function nodeMark(node, at, gap) { const r = RADIUS[node.kind]; - const classes = ["node", `k-${node.kind}`, node.claims.length ? "claimed" : "", speech.current && speech.current.who === node.id ? "speaking" : ""].filter(Boolean).join(" "); + const classes = ["node", `k-${node.kind}`, node.claims.length ? "claimed" : "", talking(node.id) ? "speaking" : ""].filter(Boolean).join(" "); const tasks = node.tasks.length ? ` ยท ${node.tasks.length} tasks` : ""; return s("g", { class: classes, transform: `translate(${fixed(at.x)} ${fixed(at.y)})`, tabindex: 0, role: "button", "aria-label": `${node.label}, ${NODE_KINDS[node.kind]}`, "data-pick": node.id, diff --git a/orchestrator/templates/page-radioview.js b/orchestrator/templates/page-radioview.js index 48d8d15..a8c86af 100644 --- a/orchestrator/templates/page-radioview.js +++ b/orchestrator/templates/page-radioview.js @@ -102,7 +102,7 @@ } function drawSpeaker() { - const now = speech.current && speech.current.who ? speech.current : null; + const now = speaker(); for (const art of document.querySelectorAll(".avatar[data-face]")) { art.classList.toggle("speaking", Boolean(now && art.dataset.face === now.who)); }