Skip to content

armgit / kwant

Public Imported from GitHub
0

Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.

14c shell polish: one name, phone labels, an answer that shows once (#640)

Oleksandr Ivanchenko81f216f7787e
diff --git a/frontend/src/chatsTab.ts b/frontend/src/chatsTab.ts
index 4ce2c559..d79765e8 100644
--- a/frontend/src/chatsTab.ts
+++ b/frontend/src/chatsTab.ts
@@ -79,9 +79,16 @@ export const directIds = <K extends { id: string; name: string }>(kwants: K[], s
*/
export type AttentionRank = 1 | 2 | 3 | 4 | 5 | 6 | 7;
-/** The ranks pinned in "Needs attention" on desktop, and given a dot on team rollups. */
+/** The ranks pinned in "Needs you" on desktop, and given a dot on team rollups. */
export const PINNED_RANK = 4;
+/**
+ * 14c: the one name for what waits on the person, on every screen: the desktop's pinned block and the
+ * phone's first Chats section say the same words, like the Inbox's "Waiting on you". "To review" stays only
+ * for real reviews (the Inbox group and rank 3).
+ */
+export const NEEDS_YOU_LABEL = 'Needs you';
+
export interface AttentionRow<K> {
kwant: K;
rank: AttentionRank;
diff --git a/frontend/src/components/ChatView.tsx b/frontend/src/components/ChatView.tsx
index ea935c09..3b4d1eb1 100644
--- a/frontend/src/components/ChatView.tsx
+++ b/frontend/src/components/ChatView.tsx
@@ -34,7 +34,7 @@ import { playSfx } from '../audio/chiptune';
import { groupDiscussionThreads, stripDiscussionMarkers } from '../discussionThreads';
import { PinnedInstructions, PinnedItem } from './Instructions';
import { DelegationMeta, parseDelegationMeta } from '../threads';
-import { QuestionMeta, parseMetaObject, parseQuestionMeta } from '../questions';
+import { QuestionMeta, foldedAnswerIds, parseMetaObject, parseQuestionMeta } from '../questions';
import { fromTelegram, sentToTelegram } from '../telegram';
import { AllowedFromTelegram, ViaTelegram } from './TelegramMarks';
import { HumanStep, HumanStepMeta, parseHumanStepMeta } from '../humanSteps';
@@ -1499,6 +1499,13 @@ export const ChatView: React.FC<ChatViewProps> = ({
const liveBot = liveRowShown && streamingSpeakerName ? streamingSpeakerName : null;
const arranged = useMemo(() => arrangeSharedFiles(messages, knownBots, liveBot), [messages, knownBots, liveBot]);
const liveShareIds = useMemo(() => new Set(arranged.live.map((m) => m.id)), [arranged.live]);
+ // 14c: an answer given on a question card shows once, on the card; its saved "You" message is not
+ // drawn while that card is loaded (nothing folds when this chat doesn't draw question cards).
+ const askCards = !!renderQuestion;
+ const listed = useMemo(() => {
+ const folded = askCards ? foldedAnswerIds(arranged.messages) : null;
+ return folded?.size ? arranged.messages.filter((m) => !folded.has(m.id)) : arranged.messages;
+ }, [arranged.messages, askCards]);
const liveNote = isStreaming ? liveSwitchNote(switchNotes ?? [], switchNoteFor, streamingSpeakerName || title) : null;
// Replies that arrive while the chat is open slide in; the first load and a stream handing over to its saved copy do not
@@ -2180,6 +2187,15 @@ export const ChatView: React.FC<ChatViewProps> = ({
requestAnimationFrame(() => checkMention(next, next.length));
};
+ // 14c: on a phone the header's icon buttons carry a small caption under the icon (no hover there,
+ // so a title alone was never seen); from sm up they keep their inline word.
+ const headLabel = (wide: string, short: string = wide) => (
+ <>
+ <span className="hidden sm:inline">{wide}</span>
+ <span className="sm:hidden text-[10px] leading-3 font-medium" data-head-caption>{short}</span>
+ </>
+ );
+ const headPhone = 'max-sm:flex-col max-sm:gap-0.5 max-sm:h-11 max-sm:min-w-11 max-sm:px-1';
return (
<div
ref={rootRef}
@@ -2260,12 +2276,12 @@ export const ChatView: React.FC<ChatViewProps> = ({
<button
type="button"
onClick={onManageTeam}
- className="kw-head-btn flex items-center justify-center gap-1.5 max-sm:min-w-11 px-2.5 py-1 rounded-lg text-xs font-medium text-zinc-200 bg-white/[0.04] hover:bg-white/[0.09] hover:text-zinc-50 border border-hairline-strong transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400"
+ className={`kw-head-btn ${headPhone} flex items-center justify-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-medium text-zinc-200 bg-white/[0.04] hover:bg-white/[0.09] hover:text-zinc-50 border border-hairline-strong transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400`}
title="Team members and settings"
aria-label="Manage team"
>
- <Settings2 size={12} className="text-zinc-400" />
- <span className="hidden sm:inline">Manage</span>
+ <Settings2 size={12} className="text-zinc-400" aria-hidden="true" />
+ {headLabel('Manage team', 'Team')}
</button>
)}
</div>
@@ -2275,12 +2291,12 @@ export const ChatView: React.FC<ChatViewProps> = ({
<button
type="button"
onClick={onEditInstructions}
- className="kw-head-btn flex items-center justify-center gap-1.5 max-md:min-w-11 px-2.5 py-1 rounded-lg text-xs font-medium text-zinc-200 bg-white/[0.04] hover:bg-white/[0.09] hover:text-zinc-50 border border-hairline-strong transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400"
+ className={`kw-head-btn ${headPhone} flex items-center justify-center gap-1.5 max-md:min-w-11 px-2.5 py-1 rounded-lg text-xs font-medium text-zinc-200 bg-white/[0.04] hover:bg-white/[0.09] hover:text-zinc-50 border border-hairline-strong transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400`}
title="Pin instructions every bot reads in this channel"
aria-label="Pin instructions"
>
- <Pin size={12} className="text-amber-300" />
- <span className="hidden sm:inline">Pin</span>
+ <Pin size={12} className="text-amber-300" aria-hidden="true" />
+ {headLabel('Pin')}
</button>
)}
@@ -2288,12 +2304,12 @@ export const ChatView: React.FC<ChatViewProps> = ({
<button
type="button"
onClick={onEditKwant}
- className="kw-head-btn flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-medium text-zinc-200 bg-white/[0.04] hover:bg-white/[0.09] hover:text-zinc-50 border border-hairline-strong transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400"
+ className={`kw-head-btn ${headPhone} flex items-center justify-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-medium text-zinc-200 bg-white/[0.04] hover:bg-white/[0.09] hover:text-zinc-50 border border-hairline-strong transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400`}
title={`Edit ${title}'s name, avatar, model and persona`}
aria-label={`Edit ${title}`}
>
- <Pencil size={12} className="text-zinc-400" />
- <span className="hidden sm:inline">Edit</span>
+ <Pencil size={12} className="text-zinc-400" aria-hidden="true" />
+ {headLabel('Edit')}
</button>
)}
@@ -2305,7 +2321,7 @@ export const ChatView: React.FC<ChatViewProps> = ({
playSfx('click');
toggleVm();
}}
- className={`kw-head-btn flex items-center justify-center gap-1.5 max-md:min-w-11 px-2.5 py-1 rounded-full text-xs font-medium transition-colors border cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400 ${
+ className={`kw-head-btn ${headPhone} max-sm:rounded-lg flex items-center justify-center gap-1.5 max-md:min-w-11 px-2.5 py-1 rounded-full text-xs font-medium transition-colors border cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400 ${
vmOpen
? 'text-sky-200 bg-sky-400/15 border-sky-300/40'
: 'text-zinc-200 bg-white/[0.04] hover:bg-white/[0.09] border-hairline-strong hover:text-zinc-50'
@@ -2315,7 +2331,7 @@ export const ChatView: React.FC<ChatViewProps> = ({
aria-pressed={vmOpen}
>
<Monitor size={12} aria-hidden="true" />
- <span className="hidden sm:inline">Bot browser</span>
+ {headLabel('Bot browser', 'Browser')}
</button>
</div>
</div>
@@ -2414,7 +2430,7 @@ export const ChatView: React.FC<ChatViewProps> = ({
/>
</div>
)}
- {groupDiscussionThreads(arranged.messages, { foldOpen: askOnly }).map((item, n, items) => {
+ {groupDiscussionThreads(listed, { foldOpen: askOnly }).map((item, n, items) => {
if (item.kind === 'message') {
const trial = trialCards.get(item.message.id);
const above = items[n - 1];
diff --git a/frontend/src/components/ImportDialog.tsx b/frontend/src/components/ImportDialog.tsx
index 74041fab..db4c5a16 100644
--- a/frontend/src/components/ImportDialog.tsx
+++ b/frontend/src/components/ImportDialog.tsx
@@ -505,7 +505,7 @@ export const DoneView: React.FC<{ applied: Applied; undo: UndoState; onUndo: (fo
{undo.kind === 'in_use' && (
<div role="alert" className="rounded-lg border border-zinc-700 bg-zinc-900 p-3">
<p className="text-xs text-zinc-300">
- {undo.names.length ? `${undo.names.join(', ')} ${undo.names.length === 1 ? 'has' : 'have'}` : 'Something it made has'} already been used, so this import can’t be undone in one step. Delete those bots yourself in Kwant bots.
+ {undo.names.length ? `${undo.names.join(', ')} ${undo.names.length === 1 ? 'has' : 'have'}` : 'Something it made has'} already been used, so this import can’t be undone in one step. Delete those bots yourself in Settings › This space › Bots.
</p>
</div>
)}
diff --git a/frontend/src/components/QuestionCard.tsx b/frontend/src/components/QuestionCard.tsx
index 7d158019..89379e1a 100644
--- a/frontend/src/components/QuestionCard.tsx
+++ b/frontend/src/components/QuestionCard.tsx
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from 'react';
import { ArrowUp, Check, CheckCircle2, Clock, HelpCircle, Loader2, MinusCircle } from 'lucide-react';
import { ModernAvatar } from './ModernAvatar';
import { ViaTelegram } from './TelegramMarks';
-import { ANSWER_MAX, Question, QuestionMeta, answerTextError, questionView } from '../questions';
+import { ANSWER_MAX, Question, QuestionMeta, answerTextError, answeredLine, questionView } from '../questions';
import { whyYouText } from '../decideFirst';
import { askedAgo } from '../waitingState';
@@ -45,6 +45,7 @@ export const QuestionCard: React.FC<QuestionCardProps> = ({ meta, messageId, kwa
const ago = open ? askedAgo(live?.created_at, now) : null;
const answer = view.answer ?? sent;
const headingId = `q-${messageId}`;
+ const line = answeredLine(answer, view.choices);
const whyYou = whyYouText(view.why_you);
const submit = async (a: { choice: number } | { text: string }) => {
@@ -89,17 +90,20 @@ export const QuestionCard: React.FC<QuestionCardProps> = ({ meta, messageId, kwa
<span className="inline-flex items-center gap-1.5 text-zinc-400">
<MinusCircle size={13} aria-hidden="true" /> Dismissed: {kwantName} was told you skipped it
</span>
- ) : !open && view.status === 'answered' && view.answered_via === 'telegram' ? (
- // Answered in Telegram (G4): the record says where the decision came from.
- <span className="inline-flex flex-wrap items-center gap-1.5 text-emerald-300" data-answered-via="telegram">
- <CheckCircle2 size={13} aria-hidden="true" />
- <b className="font-semibold">{answer && view.choices.includes(answer) ? `You picked ${answer}` : 'You answered'}</b>
- <span aria-hidden="true">·</span>
- <ViaTelegram />
- </span>
) : !open ? (
- <span className="inline-flex items-center gap-1.5 text-emerald-300">
- <CheckCircle2 size={13} aria-hidden="true" /> Answered{view.status === 'open' ? ', sending…' : ''}
+ // 14c: the card says what you answered, so the answer isn't drawn again as a "You" bubble.
+ // Answered in Telegram (G4): the record also says where the decision came from.
+ <span className="inline-flex flex-wrap items-baseline gap-x-1.5 gap-y-0.5 text-emerald-300" data-answered-line="" data-answered-via={view.answered_via === 'telegram' ? 'telegram' : undefined}>
+ <CheckCircle2 size={13} className="self-center shrink-0" aria-hidden="true" />
+ <b className="font-semibold">{line.lead}</b>
+ {line.text && <span className="min-w-0 text-sm text-zinc-100 whitespace-pre-wrap break-words" data-answer-text="">{line.text}</span>}
+ {view.status === 'open' && <span className="text-zinc-400">sending…</span>}
+ {view.answered_via === 'telegram' && (
+ <>
+ <span aria-hidden="true">·</span>
+ <ViaTelegram />
+ </>
+ )}
</span>
) : waiting ? (
// Not on a phone: the working strip under the chat already says the bot waits, and says it once (spec C2).
@@ -216,17 +220,9 @@ export const QuestionCard: React.FC<QuestionCardProps> = ({ meta, messageId, kwa
</button>
</div>
</form>
- ) : (
- answer &&
- !view.choices.includes(answer) && (
- <p className="mx-4 mb-2 px-3 py-2 rounded-xl bg-zinc-800/70 border border-zinc-700/60 text-sm text-zinc-100 whitespace-pre-wrap break-words">
- <span className="sr-only">Your answer: </span>
- {answer}
- </p>
- )
- )}
+ ) : null}
- <div className="px-4 pb-1 sm:pb-3 pt-0.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px]">
+ <div className={`px-4 ${open ? 'pb-1' : 'pb-3'} sm:pb-3 pt-0.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px]`}>
<p role="status" aria-live="polite" className="min-w-0">
{status}
</p>
diff --git a/frontend/src/components/ScrollRow.tsx b/frontend/src/components/ScrollRow.tsx
index 41673faa..3e0c9388 100644
--- a/frontend/src/components/ScrollRow.tsx
+++ b/frontend/src/components/ScrollRow.tsx
@@ -1,8 +1,13 @@
import React, { useEffect, useRef } from 'react';
-/** A sideways scroller whose right edge fades (phones only, see .kw-scroll-row) while there is
- * more to the right. `data-at-end` is "true" once it is scrolled to the end or everything already
- * fits, and then there is no fade. */
+/** A sideways scroller whose edges fade (phones only, see .kw-scroll-row) while there is more that
+ * way. `data-at-end` is "true" once it is scrolled to the end or everything already fits;
+ * `data-at-start` is "true" while it is scrolled all the way left (14c). No fade on a "true" side. */
+export const scrollEdges = (el: { scrollLeft: number; clientWidth: number; scrollWidth: number }) => ({
+ atStart: el.scrollLeft <= 1,
+ atEnd: el.scrollLeft + el.clientWidth >= el.scrollWidth - 1,
+});
+
export function ScrollRow({
as: Tag = 'div',
children,
@@ -11,7 +16,10 @@ export function ScrollRow({
const ref = useRef<HTMLElement>(null);
const update = () => {
const el = ref.current;
- if (el) el.dataset.atEnd = String(el.scrollLeft + el.clientWidth >= el.scrollWidth - 1);
+ if (!el) return;
+ const { atStart, atEnd } = scrollEdges(el);
+ el.dataset.atStart = String(atStart);
+ el.dataset.atEnd = String(atEnd);
};
useEffect(() => {
const el = ref.current;
diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx
index 54280cb6..416d47b7 100644
--- a/frontend/src/components/Sidebar.tsx
+++ b/frontend/src/components/Sidebar.tsx
@@ -16,7 +16,7 @@ import { teamChannelOf } from '../teamChannel';
import { layaRoutes } from '../channels';
import { InstallAppButton } from './InstallAppButton';
import { trapFocusTarget } from '../imports';
-import { type AttentionRow, type NeedsYouRow, PINNED_RANK, workingIds, directIds, rollupLabel } from '../chatsTab';
+import { type AttentionRow, type NeedsYouRow, PINNED_RANK, NEEDS_YOU_LABEL, workingIds, directIds, rollupLabel } from '../chatsTab';
import type { InboxItem } from '../api/inbox';
import { useDevMode } from './DevModeSwitch';
import { MovedPointer, SpaceSubline } from './FirstScreenBits';
@@ -158,7 +158,7 @@ export interface SidebarProps {
inboxCount?: number;
inboxActive?: boolean;
onOpenInbox?: () => void;
- /** Parallel Universe, behind "More". */
+ /** Parallel Universe, a plain row (14c: the one-item "More" menu is gone). */
parallelActive?: boolean;
onOpenParallel?: () => void;
/** Shows the Mission board row; the server's mission_board setting decides. */
@@ -230,80 +230,11 @@ export function botGroups(teams: Team[], kwants: Kwant[]): Array<{ team: Team |
return groups;
}
-/** "More": the places used less often, in a small menu. */
-const MoreMenu: React.FC<{
- className: string;
- active: boolean;
- items: Array<{ label: string; icon: React.ReactNode; active?: boolean; onClick: () => void }>;
-}> = ({ className, active, items }) => {
- const [open, setOpen] = useState(false);
- const ref = React.useRef<HTMLDivElement>(null);
- const menuId = React.useId();
- useEffect(() => {
- if (!open) return;
- const onKey = (e: KeyboardEvent) => {
- if (e.key !== 'Escape') return;
- e.stopPropagation();
- setOpen(false);
- ref.current?.querySelector<HTMLElement>('button')?.focus();
- };
- const onDown = (e: MouseEvent) => !ref.current?.contains(e.target as Node) && setOpen(false);
- window.addEventListener('keydown', onKey, true);
- window.addEventListener('mousedown', onDown);
- ref.current?.querySelector<HTMLElement>('[role=menuitem]')?.focus();
- return () => {
- window.removeEventListener('keydown', onKey, true);
- window.removeEventListener('mousedown', onDown);
- };
- }, [open]);
- return (
- <div ref={ref} className="relative" data-more-menu>
- <button
- type="button"
- onClick={() => {
- playSfx('click');
- setOpen((v) => !v);
- }}
- aria-haspopup="menu"
- aria-expanded={open}
- aria-controls={open ? menuId : undefined}
- className={className}
- >
- <MoreHorizontal size={15} className={active ? 'text-sky-400' : 'text-zinc-500'} aria-hidden="true" />
- <span className="truncate flex-1">More</span>
- <ChevronDown size={12} className={`shrink-0 text-zinc-500 transition-transform ${open ? 'rotate-180' : ''}`} aria-hidden="true" />
- </button>
- {open && (
- <div id={menuId} role="menu" aria-label="More" className="absolute left-0 right-0 top-full mt-1 z-30 rounded-lg border border-zinc-700/70 bg-zinc-900 p-1 shadow-xl">
- {items.map((it) => (
- <button
- key={it.label}
- type="button"
- role="menuitem"
- onClick={() => {
- setOpen(false);
- it.onClick();
- }}
- aria-current={it.active ? 'page' : undefined}
- className={`w-full flex items-center gap-2.5 px-2.5 py-1.5 rounded-md text-xs font-medium text-left focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-500 ${
- it.active ? 'bg-zinc-800 text-zinc-100' : 'text-zinc-300 hover:bg-zinc-800 hover:text-zinc-100'
- }`}
- >
- <span className={it.active ? 'text-sky-400' : 'text-zinc-500'}>{it.icon}</span>
- {it.label}
- </button>
- ))}
- </div>
- )}
- </div>
- );
-};
-
/** H5: the most rows the desktop's pinned block shows before "and n more in Inbox". */
export const PINNED_MAX = 5;
/**
- * H5 desktop: "Needs attention · n", ranks 1–4 above Channels. Gone when empty. The count is announced
+ * H5 desktop: "Needs you · n" (14c: the phone's name too), ranks 1–4 above Channels. Gone when empty. The count is announced
* politely, at most once per 10 s, from a live region holding only the heading's words.
*/
const NeedsAttention: React.FC<{ rows: AttentionRow<Kwant>[]; row: (a: AttentionRow<Kwant>) => React.ReactNode; onOpenInbox?: () => void }> = ({ rows, row, onOpenInbox }) => {
@@ -322,12 +253,12 @@ const NeedsAttention: React.FC<{ rows: AttentionRow<Kwant>[]; row: (a: Attention
const more = n - PINNED_MAX;
return (
<section data-needs-attention aria-labelledby="needs-attention-head" className="rounded-xl border border-hairline bg-white/[0.015] my-1.5 pb-1.5">
- <h2 id="needs-attention-head" className="px-2 pt-1.5 pb-1 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-[0.06em] text-amber-300" aria-label={`Needs attention, ${n}`}>
+ <h2 id="needs-attention-head" className="px-2 pt-1.5 pb-1 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-[0.06em] text-amber-300" aria-label={`${NEEDS_YOU_LABEL}, ${n}`}>
<Hand size={12} aria-hidden="true" />
- <span aria-hidden="true">Needs attention · {n}</span>
+ <span aria-hidden="true">{NEEDS_YOU_LABEL} · {n}</span>
</h2>
<span className="sr-only" aria-live="polite" data-needs-attention-live>
- {said !== n || lastSaid.current ? `Needs attention, ${said}` : ''}
+ {said !== n || lastSaid.current ? `${NEEDS_YOU_LABEL}, ${said}` : ''}
</span>
<div className="space-y-0.5 px-0.5">
{rows.slice(0, PINNED_MAX).map((a) => (
@@ -465,7 +396,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
const byRank = (r: number) => (chatsTab && attention ? attention.filter((a) => a.rank === r) : []);
const phoneSections = chatsTab && attention
? ([
- { key: 'needs', head: 'Needs you', tone: '!text-[11px] !leading-4 !tracking-[0.06em] !text-warn', rows: byRank(1) },
+ { key: 'needs', head: NEEDS_YOU_LABEL, tone: '!text-[11px] !leading-4 !tracking-[0.06em] !text-warn', rows: byRank(1) },
{ key: 'stuck', head: 'Stuck', tone: '!text-rose-300', rows: byRank(2) },
{ key: 'review', head: 'To review', tone: '!text-sky-300', rows: byRank(3) },
{ key: 'finished', head: 'Finished', tone: '', rows: byRank(4) },
@@ -1029,11 +960,11 @@ export const Sidebar: React.FC<SidebarProps> = ({
<IdeaJarRow active={ideaJarActive} count={ideaJarCount} onOpen={onOpenIdeaJar} onDrop={onDropIdea} className={navRow(ideaJarActive)} />
)}
{onOpenParallel && (
- <MoreMenu
- className={navRow(parallelActive)}
- active={parallelActive}
- items={[{ label: 'Parallel Universe', icon: <Split size={15} aria-hidden="true" />, active: parallelActive, onClick: onOpenParallel }]}
- />
+ // 14c: "More" held only this one place, so it is a plain row, like Routines.
+ <button type="button" onClick={onOpenParallel} aria-current={parallelActive ? 'page' : undefined} className={navRow(parallelActive)} data-parallel-row>
+ <Split size={15} className={parallelActive ? 'text-sky-400' : 'text-zinc-500'} aria-hidden="true" />
+ <span className="truncate flex-1">Parallel Universe</span>
+ </button>
)}
</div>
)}
@@ -1054,7 +985,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
{!attOn && needsRows.length > 0 && (
<section data-chats-section="needs" aria-labelledby="chats-needs-head">
<h2 id="chats-needs-head" className={`${sectionHead} !text-[11px] !leading-4 !tracking-[0.06em] !text-warn`}>
- Needs you · {needsRows.length}
+ {NEEDS_YOU_LABEL} · {needsRows.length}
</h2>
<div className="mt-1 space-y-0.5">
{needsRows.map((r) => botRow(kwants.find((k) => k.id === r.kwant_id)!, undefined, { needs: r }))}
diff --git a/frontend/src/components/SpaceSettings.tsx b/frontend/src/components/SpaceSettings.tsx
index 2bfb6d24..9b5452cd 100644
--- a/frontend/src/components/SpaceSettings.tsx
+++ b/frontend/src/components/SpaceSettings.tsx
@@ -50,7 +50,7 @@ export type { SettingsScope, SpaceSettingsTab };
const TABS: Array<{ id: SpaceSettingsTab; label: string; icon: React.ReactNode }> = [
{ id: 'general', label: 'General', icon: <Settings2 size={15} /> },
{ id: 'apps', label: 'Apps & accounts', icon: <LayoutGrid size={15} /> },
- { id: 'bots', label: 'Kwant bots', icon: <Bot size={15} /> },
+ { id: 'bots', label: 'Bots', icon: <Bot size={15} /> },
{ id: 'teams', label: 'Teams', icon: <Users size={15} /> },
{ id: 'docs', label: 'Documents', icon: <FileText size={15} /> },
{ id: 'skills', label: 'Skills', icon: <Sparkles size={15} /> },
@@ -323,7 +323,7 @@ const ImportTab: React.FC<TabProps> = ({ space, kwants, onOpenImport, onImported
} catch (err) {
if (err instanceof ImportError && err.code === 'edited') setConfirm({ record: r, names: err.names });
else if (err instanceof ImportError && err.code === 'in_use')
- setNotice(`${err.names.join(', ') || 'Something it made'} has already been used, so this import can’t be undone in one step. Delete those bots yourself in Kwant bots.`);
+ setNotice(`${err.names.join(', ') || 'Something it made'} has already been used, so this import can’t be undone in one step. Delete those bots yourself in Settings › This space › Bots.`);
else setNotice(importErrorText(err).detail || importErrorText(err).title);
} finally {
setUndoing(null);
diff --git a/frontend/src/questions.ts b/frontend/src/questions.ts
index a791130b..395e44f1 100644
--- a/frontend/src/questions.ts
+++ b/frontend/src/questions.ts
@@ -71,6 +71,32 @@ export function parseQuestionMeta(raw: unknown): QuestionMeta | null {
};
}
+/**
+ * 14c: an answer shows once. Answering on a card saves the answer as the person's message with
+ * `meta = {kind: "question_answer", question_id}` (kept for the bots' history). When that question's
+ * card is among `messages`, the card already says "You answered: …", so the message isn't drawn as
+ * its own bubble. When the card isn't loaded (an older page), the bubble stays; a message typed in
+ * the composer carries no such meta and always stays.
+ */
+export function foldedAnswerIds(messages: ReadonlyArray<{ id: string; meta?: unknown }>): Set<string> {
+ const cards = new Set<string>();
+ const answers: Array<[string, string]> = [];
+ for (const m of messages) {
+ const meta = m.meta ? parseMetaObject(m.meta) : null;
+ if (!meta || typeof meta.question_id !== 'string') continue;
+ if (meta.kind === 'ask_user') cards.add(meta.question_id);
+ else if (meta.kind === 'question_answer') answers.push([m.id, meta.question_id]);
+ }
+ return new Set(answers.filter(([, q]) => cards.has(q)).map(([id]) => id));
+}
+
+/** The closed card's line: "You picked <choice>" for a choice, "You answered:" before typed words. */
+export function answeredLine(answer: string | null | undefined, choices: readonly string[]): { lead: string; text: string | null } {
+ if (!answer) return { lead: 'Answered', text: null };
+ if (choices.includes(answer)) return { lead: `You picked ${answer}`, text: null };
+ return { lead: 'You answered:', text: answer };
+}
+
/** The chat a question lives in: the thread, else the channel, else the agent's direct chat. */
export const questionContextId = (q: Pick<Question, 'thread_id' | 'channel_id' | 'direct_kwant_id'>) =>
q.thread_id || q.channel_id || q.direct_kwant_id || null;
diff --git a/frontend/src/styles/modern.css b/frontend/src/styles/modern.css
index 054ca6a3..a7c8247f 100644
--- a/frontend/src/styles/modern.css
+++ b/frontend/src/styles/modern.css
@@ -193,7 +193,8 @@
}
/* Phone widths: sideways scrollers (chip rows, Space settings tabs) without a scrollbar, fading
- 24px at the right edge only while they can scroll further (ScrollRow sets data-at-end). */
+ 32px at each edge only while they can scroll further that way (ScrollRow sets data-at-start and
+ data-at-end). 14c: the fade was 24px on the right only, too faint to read as "this scrolls". */
@media (max-width: 767px) {
.kw-scroll-row {
scrollbar-width: none;
@@ -203,9 +204,19 @@
.kw-scroll-row::-webkit-scrollbar {
display: none;
}
+ .kw-scroll-row {
+ --kw-fade-l: 0px;
+ --kw-fade-r: 0px;
+ }
+ .kw-scroll-row[data-at-start='false'] {
+ --kw-fade-l: 32px;
+ }
.kw-scroll-row[data-at-end='false'] {
- mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
- -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
+ --kw-fade-r: 32px;
+ }
+ .kw-scroll-row:is([data-at-start='false'], [data-at-end='false']) {
+ mask-image: linear-gradient(to right, transparent, #000 var(--kw-fade-l), #000 calc(100% - var(--kw-fade-r)), transparent);
+ -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--kw-fade-l), #000 calc(100% - var(--kw-fade-r)), transparent);
}
}
@@ -1016,7 +1027,7 @@ button.dv-sha { cursor: copy; } button.dv-sha:hover { color: var(--accent); bord
.kw-prepush-flash::after { display: block; box-shadow: 0 0 0 2px rgb(167 139 250 / 0.6); opacity: 0; animation: kw-prepush-flash 1.2s linear 1 both; }
}
-/* H5: a row entering the pinned "Needs attention" block (reordering inside it is not animated) */
+/* H5: a row entering the pinned "Needs you" block (reordering inside it is not animated) */
@keyframes kw-pin-enter {
from { opacity: 0; transform: translateY(-4px); }
to { opacity: 1; transform: none; }
diff --git a/frontend/tests/attentionOrder.test.mjs b/frontend/tests/attentionOrder.test.mjs
index 21ab629f..f29df7b8 100644
--- a/frontend/tests/attentionOrder.test.mjs
+++ b/frontend/tests/attentionOrder.test.mjs
@@ -15,7 +15,7 @@ const m = await loadBundled(`
export { default as React } from 'react';
export { renderToStaticMarkup } from 'react-dom/server.browser';
export { Sidebar, PINNED_MAX } from './src/components/Sidebar';
- export { needsYouRows, attentionRows, attentionRank, attentionSort, rollupLabel, stuckLine } from './src/chatsTab';
+ export { needsYouRows, attentionRows, attentionRank, attentionSort, rollupLabel, stuckLine, NEEDS_YOU_LABEL } from './src/chatsTab';
export { AWAY_SECTIONS, AWAY_SORT_HINT, sortAwaySection } from './src/away';
export { AwayView } from './src/components/AwayView';
`);
@@ -88,12 +88,12 @@ const render = (over = {}) => m.renderToStaticMarkup(React.createElement(m.Sideb
}));
const doc = (html) => new DOMParser().parseFromString(`<body>${html}</body>`, 'text/html');
-test('desktop: pinned "Needs attention · 4" above Channels, copies with "Also listed in @core"', () => {
+test('desktop: pinned "Needs you · 4" above Channels, copies with "Also listed in @core"', () => {
const d = doc(render());
const block = d.querySelector('[data-needs-attention]');
assert.ok(block);
- assert.equal(block.querySelector('h2').getAttribute('aria-label'), 'Needs attention, 4');
- assert.match(block.querySelector('h2').textContent, /Needs attention · 4/);
+ assert.equal(block.querySelector('h2').getAttribute('aria-label'), 'Needs you, 4');
+ assert.match(block.querySelector('h2').textContent, /Needs you · 4/);
assert.match(block.querySelector('h2').getAttribute('class'), /text-amber-300/);
const pins = [...block.querySelectorAll('[data-pin-row]')];
assert.deepEqual(pins.map((p) => p.getAttribute('data-pin-row')), ['lin', 'pix', 'jun', 'iri']);
@@ -123,7 +123,7 @@ test('desktop: more than 5 shows 5 rows and "and n more in Inbox"; none, or befo
const d = doc(render({ attention: rows({ needs: m.needsYouRows(many, {}, new Set(kwants.map((k) => k.id))) }) }));
assert.equal(d.querySelectorAll('[data-pin-row]').length, m.PINNED_MAX);
assert.equal(d.querySelector('[data-needs-attention-more]').textContent, 'and 3 more in Inbox');
- assert.equal(d.querySelector('[data-needs-attention] h2').getAttribute('aria-label'), 'Needs attention, 8');
+ assert.equal(d.querySelector('[data-needs-attention] h2').getAttribute('aria-label'), 'Needs you, 8');
const calm = rows({ needs: [], failed: [], finished: [] });
assert.equal(doc(render({ attention: calm })).querySelector('[data-needs-attention]'), null);
assert.equal(doc(render({ attention: undefined })).querySelector('[data-needs-attention]'), null);
@@ -176,3 +176,13 @@ test('Inbox: Waiting on you, Failed or stuck, Finished; oldest first, finished u
assert.equal(hint('failed'), null, 'no hint on an empty section');
assert.ok(html.indexOf('id="away-waiting"') < html.indexOf('id="away-failed"') && html.indexOf('id="away-failed"') < html.indexOf('id="away-finished"'));
});
+
+test('14c one name: the desktop block and the phone section both say NEEDS_YOU_LABEL; "To review" only means review', () => {
+ assert.equal(m.NEEDS_YOU_LABEL, 'Needs you');
+ const desk = doc(render());
+ assert.match(desk.querySelector('[data-needs-attention] h2').textContent, new RegExp(`^${m.NEEDS_YOU_LABEL} · `));
+ assert.doesNotMatch(desk.body.textContent, /Needs attention/);
+ const phone = doc(render({ phone: true, section: 'chats' }));
+ assert.doesNotMatch(phone.body.textContent, /Needs attention/);
+ assert.match(phone.querySelector('#chats-needs-head').textContent, new RegExp(`^${m.NEEDS_YOU_LABEL} · `));
+});
diff --git a/frontend/tests/boardLiveFade.test.mjs b/frontend/tests/boardLiveFade.test.mjs
index 0db1e23d..fa144d99 100644
--- a/frontend/tests/boardLiveFade.test.mjs
+++ b/frontend/tests/boardLiveFade.test.mjs
@@ -48,12 +48,16 @@ test('Live now: the row fades while it can scroll, not at the end, and not when
size(row, { scrollWidth: 1000, clientWidth: 390, scrollLeft: 0 });
assert.equal(row.dataset.atEnd, 'false', 'more to the right: fade');
+ assert.equal(row.dataset.atStart, 'true', 'at the start: no left fade');
size(row, { scrollWidth: 1000, clientWidth: 390, scrollLeft: 300 });
assert.equal(row.dataset.atEnd, 'false', 'part way: still fades');
+ assert.equal(row.dataset.atStart, 'false', '14c: part way, the left edge fades too');
size(row, { scrollWidth: 1000, clientWidth: 390, scrollLeft: 610 });
assert.equal(row.dataset.atEnd, 'true', 'scrolled to the end: no fade');
+ assert.equal(row.dataset.atStart, 'false', 'at the end: only the left edge fades');
size(row, { scrollWidth: 390, clientWidth: 390, scrollLeft: 0 });
assert.equal(row.dataset.atEnd, 'true', 'everything fits: no fade');
+ assert.equal(row.dataset.atStart, 'true', 'everything fits: no fade');
root.unmount();
});
@@ -67,8 +71,12 @@ test('Live now: no row (and so no fade) when nobody is working', async () => {
root.unmount();
});
-test('the fade itself: a 24 px trailing mask on phones, only while data-at-end is false', () => {
+test('the fade itself (14c): 32 px on each side that can still scroll, phones only', () => {
const css = readFileSync(new URL('../src/styles/modern.css', import.meta.url), 'utf8');
const phone = css.slice(css.indexOf('@media (max-width: 767px)'));
- assert.match(phone, /\.kw-scroll-row\[data-at-end='false'\]\s*\{[^}]*mask-image: linear-gradient\(to right, #000 calc\(100% - 24px\), transparent\)/);
+ assert.match(phone, /\.kw-scroll-row\[data-at-start='false'\]\s*\{\s*--kw-fade-l: 32px;/);
+ assert.match(phone, /\.kw-scroll-row\[data-at-end='false'\]\s*\{\s*--kw-fade-r: 32px;/);
+ assert.match(phone, /\.kw-scroll-row:is\(\[data-at-start='false'\], \[data-at-end='false'\]\)\s*\{[^}]*mask-image: linear-gradient\(to right, transparent, #000 var\(--kw-fade-l\), #000 calc\(100% - var\(--kw-fade-r\)\), transparent\)/);
+ // Nothing masks a row that fits (both sides "true")
+ assert.doesNotMatch(phone.slice(0, phone.indexOf(':is(')), /\.kw-scroll-row \{[^}]*mask-image/);
});
diff --git a/frontend/tests/ia.test.mjs b/frontend/tests/ia.test.mjs
index 381ff39b..2e1d9c72 100644
--- a/frontend/tests/ia.test.mjs
+++ b/frontend/tests/ia.test.mjs
@@ -112,12 +112,15 @@ const base = {
onSummonKwant: noop, onCreateTeam: noop, onOpenInbox: noop, onOpenParallel: noop, onOpenMissions: noop, missionBoard: true,
};
-test('the top rows are Search, Inbox, Mission board and More, nothing else', () => {
+test('the top rows are Search, Inbox, Mission board and Parallel Universe, nothing else', () => {
const html = ui.sidebar(base);
const rows = html.match(/data-utility-rows[\s\S]*?<\/nav>|data-utility-rows[\s\S]*$/)[0];
- for (const t of ['Search', 'Inbox', 'Mission board', 'More']) assert.match(rows, new RegExp(t), t);
+ for (const t of ['Search', 'Inbox', 'Mission board', 'Parallel Universe']) assert.match(rows, new RegExp(t), t);
for (const gone of ['While you were away', 'Loose ends', 'Connections', 'Routines']) assert.doesNotMatch(html, new RegExp(gone), `${gone} is not a sidebar row`);
- assert.doesNotMatch(html, /Parallel Universe/, 'Parallel Universe sits behind More, closed by default');
+ // 14c: a "More" menu with one item is gone; its one place is a plain row
+ assert.doesNotMatch(html, /data-more-menu|aria-haspopup="menu"[^>]*>(?:(?!<\/button>)[\s\S])*More</, 'no one-item More menu');
+ assert.match(html, /data-parallel-row/);
+ assert.doesNotMatch(ui.sidebar({ ...base, onOpenParallel: undefined }), /Parallel Universe/, 'no row without the page');
});
test('the Inbox row keeps the unseen badge and marks the open page', () => {
diff --git a/frontend/tests/questions.test.mjs b/frontend/tests/questions.test.mjs
index f7b77170..a21ac2de 100644
--- a/frontend/tests/questions.test.mjs
+++ b/frontend/tests/questions.test.mjs
@@ -90,10 +90,11 @@ test('after the wait ran out the card stays answerable', () => {
test('answered and dismissed cards are closed', () => {
const answered = ui.render(props({ live: rec({ status: 'answered', answer: 'US' }) }));
assert.match(answered, /aria-pressed="true"/);
- assert.match(answered, /Answered/);
+ assert.match(answered, /You picked US/, '14c: the card says what you picked');
assert.doesNotMatch(answered, /Send answer|Skip question/);
const typed = ui.render(props({ live: rec({ status: 'answered', answer: 'Both, EU first' }) }));
- assert.match(typed, /Both, EU first/, 'a typed answer is shown');
+ assert.match(typed, /You answered:<\/b>.*Both, EU first/, '14c: a typed answer is in the closed line');
+ assert.equal((typed.match(/Both, EU first/g) || []).length, 1, 'and shown once');
const dismissed = ui.render(props({ meta: q.parseQuestionMeta(metaJson({ status: 'cancelled' })) }));
assert.match(dismissed, /Dismissed/);
assert.equal((dismissed.match(/disabled=""/g) || []).length, 2, 'every choice disabled');
diff --git a/frontend/tests/shellPolish.test.mjs b/frontend/tests/shellPolish.test.mjs
new file mode 100644
index 00000000..6b8804db
--- /dev/null
+++ b/frontend/tests/shellPolish.test.mjs
@@ -0,0 +1,114 @@
+// 14c shell polish (Pixel, brief autonomy/shell-polish/brief.md): an answer given on a question card shows
+// once (the card says "You answered: …", the saved answer message isn't drawn as a second "You" bubble
+// while its card is loaded), and the phone chat header's icon buttons carry visible captions.
+// Parts 1, 2, 4 and 5 are tested in attentionOrder, ia and boardLiveFade.
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { JSDOM } from 'jsdom';
+import { loadBundled } from './bundle.mjs';
+
+const dom = new JSDOM('<!doctype html><html><body></body></html>', { url: 'http://localhost/', pretendToBeVisual: true });
+for (const k of ['window', 'document', 'navigator', 'HTMLElement', 'HTMLButtonElement', 'HTMLInputElement', 'HTMLTextAreaElement', 'Element', 'Node', 'Event', 'KeyboardEvent', 'FocusEvent', 'MutationObserver', 'requestAnimationFrame', 'cancelAnimationFrame', 'getComputedStyle', 'CSS', 'DOMException']) {
+ if (!(k in dom.window)) continue;
+ Object.defineProperty(globalThis, k, { value: dom.window[k], configurable: true, writable: true });
+}
+const store = new Map();
+const ls = { getItem: (k) => (store.has(k) ? store.get(k) : null), setItem: (k, v) => void store.set(k, String(v)), removeItem: (k) => void store.delete(k) };
+Object.defineProperty(globalThis, 'localStorage', { value: ls, configurable: true, writable: true });
+Object.defineProperty(dom.window, 'localStorage', { value: ls, configurable: true });
+dom.window.matchMedia = (q) => ({ matches: false, media: q, addEventListener() {}, removeEventListener() {}, addListener() {}, removeListener() {} });
+globalThis.matchMedia = dom.window.matchMedia;
+globalThis.ResizeObserver ??= class { observe() {} unobserve() {} disconnect() {} };
+globalThis.IntersectionObserver ??= class { observe() {} unobserve() {} disconnect() {} };
+dom.window.HTMLElement.prototype.scrollIntoView ??= function () {};
+dom.window.HTMLElement.prototype.scrollTo ??= function () {};
+
+const ui = await loadBundled(`
+ import React from 'react';
+ import { flushSync } from 'react-dom';
+ import { createRoot } from 'react-dom/client';
+ import { ChatView } from './src/components/ChatView';
+ export const mount = (p) => {
+ const host = document.createElement('div');
+ document.body.appendChild(host);
+ const root = createRoot(host);
+ flushSync(() => root.render(React.createElement(ChatView, p)));
+ return { host, unmount: () => { root.unmount(); host.remove(); } };
+ };
+ export const act = (fn) => flushSync(fn);
+ export { foldedAnswerIds, answeredLine } from './src/questions';
+ export const questionStub = (msg) => React.createElement('section', { 'data-message-id': msg.id, 'data-card': '' });
+`);
+
+const props = (extra = {}) => ({
+ title: 'Frontend', subtitle: 'Pixel', messages: [], streamingText: '', streamingThinking: '', isStreaming: false,
+ pendingApprovals: [], onSendMessage: () => {}, onResolveApproval: () => {}, onCancelDiscussion: () => {}, kwants: [], teams: [],
+ home: { kind: 'bot', bot: { id: 'k-front', name: 'Frontend', title: 'Frontend engineer', avatar_sprite: 'Frontend' } }, ...extra,
+});
+
+// ---- part 6: an answer shows once ----
+const T = '2026-11-14T10:00:00Z';
+const card = (id, qid) => ({ id, sender_role: 'kwant', sender_id: 'k-front', text: 'Which region?', created_at: T,
+ meta: JSON.stringify({ kind: 'ask_user', question_id: qid, question: 'Which region?', choices: ['US', 'EU'], status: 'answered', answer: 'EU' }) });
+const cardAnswer = (id, qid, text = 'EU') => ({ id, sender_role: 'user', sender_id: 'user', text, created_at: T,
+ meta: JSON.stringify({ kind: 'question_answer', question_id: qid }) });
+const typed = (id, text) => ({ id, sender_role: 'user', sender_id: 'user', text, created_at: T });
+
+test('foldedAnswerIds: the card is loaded, so its answer message folds into it', () => {
+ assert.deepEqual([...ui.foldedAnswerIds([card('c1', 'q1'), cardAnswer('a1', 'q1')])], ['a1']);
+ // meta may also arrive already parsed
+ assert.deepEqual([...ui.foldedAnswerIds([{ ...card('c1', 'q1'), meta: JSON.parse(card('c1', 'q1').meta) }, cardAnswer('a1', 'q1')])], ['a1']);
+});
+
+test('foldedAnswerIds: the card is not loaded (an older page), so the answer stays a bubble', () => {
+ assert.equal(ui.foldedAnswerIds([cardAnswer('a1', 'q1')]).size, 0);
+ assert.equal(ui.foldedAnswerIds([card('c2', 'q2'), cardAnswer('a1', 'q1')]).size, 0, 'another question\'s card does not count');
+});
+
+test('foldedAnswerIds: a message typed in the composer to answer always stays', () => {
+ assert.equal(ui.foldedAnswerIds([card('c1', 'q1'), typed('t1', 'EU, please')]).size, 0);
+ assert.equal(ui.foldedAnswerIds([typed('t1', 'x'), { id: 'bad', meta: '{nope' }]).size, 0, 'bad meta is ignored');
+});
+
+test('answeredLine: "You picked <choice>", "You answered:" before typed words, "Answered" with no text', () => {
+ assert.deepEqual(ui.answeredLine('EU', ['US', 'EU']), { lead: 'You picked EU', text: null });
+ assert.deepEqual(ui.answeredLine('Both, EU first', ['US', 'EU']), { lead: 'You answered:', text: 'Both, EU first' });
+ assert.deepEqual(ui.answeredLine(null, ['US']), { lead: 'Answered', text: null });
+});
+
+const bubbles = (host) => [...host.querySelectorAll('[data-message-id]')].map((n) => n.getAttribute('data-message-id'));
+
+test('ChatView: with the card loaded the "You" bubble is not drawn; without it, it is', () => {
+ let v = ui.mount(props({ messages: [card('c1', 'q1'), cardAnswer('a1', 'q1'), typed('t1', 'thanks')], renderQuestion: ui.questionStub }));
+ assert.deepEqual(bubbles(v.host), ['c1', 't1'], 'one answer: on the card; the typed message stays');
+ v.unmount();
+ v = ui.mount(props({ messages: [cardAnswer('a1', 'q1'), typed('t1', 'thanks')], renderQuestion: ui.questionStub }));
+ assert.deepEqual(bubbles(v.host), ['a1', 't1'], 'card on an older page: the bubble stays');
+ v.unmount();
+ v = ui.mount(props({ messages: [card('c1', 'q1'), cardAnswer('a1', 'q1')] }));
+ assert.ok(bubbles(v.host).includes('a1'), 'a chat that draws no cards folds nothing');
+ v.unmount();
+});
+
+// ---- part 3: the phone header's icon buttons have names ----
+test('header: every icon button keeps its aria-label and has a phone caption under the icon', () => {
+ const v = ui.mount(props({ onEditKwant: () => {}, onEditInstructions: () => {}, onManageTeam: () => {},
+ teamMembers: [{ id: 'k-front', name: 'Frontend', title: 'Eng', avatar_sprite: 'Frontend' }] }));
+ const head = v.host.querySelector('[data-chat-header]');
+ const btns = [...head.querySelectorAll('.kw-head-btn')];
+ const named = btns.map((b) => [b.getAttribute('aria-label'), b.querySelector('[data-head-caption]')?.textContent]);
+ assert.deepEqual(named, [['Manage team', 'Team'], ['Pin instructions', 'Pin'], ['Edit Frontend', 'Edit'], ['Bot browser', 'Browser']]);
+ // One name per button: the desktop label is the same phrase the phone caption shortens
+ const wide = btns.map((b) => b.querySelector('.hidden.sm\\:inline')?.textContent);
+ assert.deepEqual(wide, ['Manage team', 'Pin', 'Edit', 'Bot browser']);
+ for (const b of btns) {
+ const cap = b.querySelector('[data-head-caption]');
+ assert.match(cap.className, /sm:hidden/, 'the caption is phone-only');
+ assert.match(b.className, /max-sm:flex-col/, 'icon above caption on a phone');
+ assert.match(b.className, /max-sm:h-11/, '44 px tall on a phone');
+ // Label in name: the visible caption is part of the accessible name
+ assert.ok(b.getAttribute('aria-label').toLowerCase().includes(cap.textContent.toLowerCase()));
+ assert.ok(b.getAttribute('title'), 'desktop keeps its tooltip');
+ }
+ v.unmount();
+});