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.

Mission board on a phone: lanes first, the week folds to one line (B3) (#311)

Oleksandr Ivanchenko55ab63267131
diff --git a/frontend/src/components/MissionBoardView.tsx b/frontend/src/components/MissionBoardView.tsx
index 8230d21f..6c60b4c8 100644
--- a/frontend/src/components/MissionBoardView.tsx
+++ b/frontend/src/components/MissionBoardView.tsx
@@ -94,6 +94,7 @@ import {
autofixErrorText,
fixTextShown,
needsYouCount,
+ defaultColumn,
recoveryText,
restoreErrorText,
skippedWithFixText,
@@ -418,7 +419,7 @@ export const InsightsStrip: React.FC<{
hint: 'A bot said done, then the check failed (last 7 days)',
tone: insights.false_success_7d > 0 ? 'rose' : undefined,
},
- { label: 'Needs you now', value: String(needsNow), hint: 'Waiting on a question, approval or step from you', tone: needsNow > 0 ? 'amber' : undefined },
+ { label: 'Board tasks waiting on you', value: String(needsNow), hint: 'Board tasks waiting on a question, approval or step from you. Your Inbox can hold more.', tone: needsNow > 0 ? 'amber' : undefined },
typeof blockedMin === 'number'
? {
label: 'Blocked this week',
@@ -464,6 +465,44 @@ export const InsightsStrip: React.FC<{
);
};
+/** The folded "This week" line on a phone: what the tiles would say first. */
+export function thisWeekSummary(insights: Insights): string {
+ const blocked = typeof insights.blocked_minutes_7d === 'number' ? `Blocked ${durationText(insights.blocked_minutes_7d)}` : `Blocked now ${insights.blocked_now}`;
+ return `Verified ${insights.verified_7d} · ${blocked}`;
+}
+
+/**
+ * The week's tiles and chart. A phone puts them under the board, folded to one line until opened
+ * (Mira's B3); from lg up they show as they always have, above the board.
+ */
+export const ThisWeek: React.FC<{ insights: Insights | null; needsYou?: number }> = ({ insights, needsYou }) => {
+ const [open, setOpen] = useState(false);
+ const bodyId = useId();
+ if (!insights) return null;
+ return (
+ <div className="order-1 lg:order-none flex flex-col gap-4 lg:block" data-this-week={open ? 'open' : 'closed'}>
+ <button
+ type="button"
+ aria-expanded={open}
+ aria-controls={bodyId}
+ onClick={() => setOpen((v) => !v)}
+ className={`lg:hidden w-full min-h-[44px] flex items-center gap-2 px-3 rounded-xl border border-zinc-800 bg-zinc-900/40 text-left ${focusRing}`}
+ data-this-week-toggle
+ >
+ {open ? <ChevronDown size={16} className="shrink-0 text-zinc-400" aria-hidden="true" /> : <ChevronRight size={16} className="shrink-0 text-zinc-400" aria-hidden="true" />}
+ <span className="shrink-0 text-[13px] leading-4 font-semibold text-zinc-100">This week</span>
+ <span className="ml-auto min-w-0 truncate text-[13px] leading-4 text-zinc-400 tabular-nums" data-this-week-summary>
+ {thisWeekSummary(insights)}
+ </span>
+ </button>
+ <div id={bodyId} className={`${open ? '' : 'hidden'} lg:block space-y-4`} data-this-week-body>
+ <InsightsStrip insights={insights} needsYou={needsYou} />
+ <MeasuresPanel insights={insights} />
+ </div>
+ </div>
+ );
+};
+
/**
* Phase C measures: verified tasks per active week over 8 weeks, and what one verified result cost.
* Renders nothing on a server that doesn't send them. An unknown cost is never shown as $0.
@@ -897,9 +936,9 @@ export const Board: React.FC<{
);
};
- const countPill = (key: Column, n: number | string, dark = false) => (
+ const countPill = (key: Column, n: number | string, dark = false, tab = false) => (
<span
- className={`min-w-[18px] px-1 rounded-full text-[10px] text-center tabular-nums ${
+ className={`min-w-[18px] px-1 rounded-full ${tab ? 'text-[12px] leading-4' : 'text-[10px]'} text-center tabular-nums ${
key === 'needs_you' && Number(n) > 0 ? 'bg-amber-500 text-zinc-950' : dark ? 'bg-zinc-700/70 text-zinc-200' : 'bg-zinc-800 text-zinc-300'
}`}
>
@@ -943,7 +982,7 @@ export const Board: React.FC<{
<>
{/* Phone and tablet: one column at a time, picked from tabs with counts */}
<div className="lg:hidden space-y-3" data-board="tabs">
- <div role="tablist" aria-label="Board columns" className="flex gap-1 overflow-x-auto -mx-1 px-1 pb-1 [scrollbar-width:none]">
+ <div role="tablist" aria-label="Board columns" className="flex gap-0.5 overflow-x-auto rounded-xl border border-zinc-800 bg-zinc-900/40 p-0.5 [scrollbar-width:none]">
{COLUMNS.map((c, i) => {
const on = c.key === column;
return (
@@ -958,12 +997,12 @@ export const Board: React.FC<{
tabIndex={on ? 0 : -1}
onKeyDown={(e) => onTabKey(e, i)}
onClick={() => onColumn(c.key)}
- className={`shrink-0 inline-flex items-center gap-1.5 min-h-[40px] px-3 rounded-lg text-xs font-medium ${focusRing} ${
+ className={`shrink-0 inline-flex items-center gap-1.5 min-h-[44px] px-3 rounded-lg text-[13px] leading-4 font-medium ${focusRing} ${
on ? 'bg-zinc-800 text-zinc-100 border border-zinc-700' : 'text-zinc-400 border border-transparent hover:text-zinc-200'
}`}
>
{c.label}
- {countPill(c.key, c.key === 'verified' ? (showOlder ? verifiedAll : verifiedRecent) : grouped[c.key].length, true)}
+ {countPill(c.key, c.key === 'verified' ? (showOlder ? verifiedAll : verifiedRecent) : grouped[c.key].length, true, true)}
</button>
);
})}
@@ -2749,7 +2788,7 @@ export const MissionBoardView: React.FC<MissionBoardViewProps> = ({
</div>
<div className="flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6" aria-busy={loading}>
- <div className="max-w-[1500px] mx-auto space-y-4">
+ <div className="max-w-[1500px] mx-auto flex flex-col gap-4 lg:block lg:space-y-4" data-board-page>
{needsToken && (
<div role="alert" className="px-3 py-2 rounded-lg border border-amber-500/30 bg-amber-500/10 flex flex-wrap items-center gap-2 text-xs text-amber-100">
<span>Only you can change the board. Confirm it’s you to continue.</span>
@@ -2785,21 +2824,22 @@ export const MissionBoardView: React.FC<MissionBoardViewProps> = ({
{liveShown && <LiveStrip bots={liveShown} teams={teams} workingCards={workingCards} now={now} onOpen={onOpenLive} />}
{firstVerified && !firstDone && <FirstMomentLine kind="verified" onDone={() => setFirstDone(true)} />}
- <InsightsStrip insights={insights} needsYou={needsYouCount(tasks)} />
- <MeasuresPanel insights={insights} />
- <FactsLedger names={names} taskTitles={taskTitles} onOpenTask={openTaskById} now={now} />
-
- <TierRequests names={names} now={now} />
-
- {/* Goals (0.6.5) on "All work". In a mission's own view only its drawer stays, so a "Goal:" chip opens it. */}
- <GoalsStrip
- names={names}
- now={now}
- spaceId={spaceId ?? null}
- hidden={!!missionId}
- onOpenTask={onOpenTaskId ?? openTaskById}
- onOpenMission={(id) => onMission(id)}
- />
+ <ThisWeek insights={insights} needsYou={needsYouCount(tasks)} />
+ <div className="order-1 lg:order-none space-y-4" data-board-notes>
+ <FactsLedger names={names} taskTitles={taskTitles} onOpenTask={openTaskById} now={now} />
+
+ <TierRequests names={names} now={now} />
+
+ {/* Goals (0.6.5) on "All work". In a mission's own view only its drawer stays, so a "Goal:" chip opens it. */}
+ <GoalsStrip
+ names={names}
+ now={now}
+ spaceId={spaceId ?? null}
+ hidden={!!missionId}
+ onOpenTask={onOpenTaskId ?? openTaskById}
+ onOpenMission={(id) => onMission(id)}
+ />
+ </div>
{visibleMissions.length > 0 && (
<div className="flex flex-wrap items-center gap-2">
@@ -2833,7 +2873,7 @@ export const MissionBoardView: React.FC<MissionBoardViewProps> = ({
/>
)}
{mission && onView && (
- <div role="group" aria-label="Show as" className="inline-flex rounded-lg border border-zinc-800 p-0.5" data-view-toggle>
+ <div role="group" aria-label="Show as" className="self-start lg:self-auto inline-flex rounded-lg border border-zinc-800 p-0.5" data-view-toggle>
{(['board', 'graph'] as const).map((v) => (
<button
key={v}
@@ -2942,7 +2982,11 @@ export const MissionBoardView: React.FC<MissionBoardViewProps> = ({
</p>
)}
- {showPerformance && !mission && !needsToken && <PerformancePanel names={names} refreshKey={refreshCount} />}
+ {showPerformance && !mission && !needsToken && (
+ <div className="order-2 lg:order-none">
+ <PerformancePanel names={names} refreshKey={refreshCount} />
+ </div>
+ )}
</>
)}
</div>
@@ -3174,6 +3218,13 @@ export const MissionBoardPage: React.FC<{
setOpenId(null);
setDetail(null);
};
+ // A phone opens on Needs you when something waits on the person, else Working, else Ready
+ useEffect(() => {
+ if (tasks === null || openTaskId) return;
+ setColumn(defaultColumn(tasks));
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [tasks === null]);
+
// A link from elsewhere (a lesson on a bot's Memory tab): open that task once the board has its list.
useEffect(() => {
if (!openTaskId || tasks === null) return;
diff --git a/frontend/src/missions.ts b/frontend/src/missions.ts
index 4b09eecd..67634238 100644
--- a/frontend/src/missions.ts
+++ b/frontend/src/missions.ts
@@ -524,7 +524,15 @@ export function columnOfTask(t: Pick<Task, 'state' | 'flags' | 'needs_you'>): Co
const PERSON_ITEMS = new Set<NeedsYouItem['kind']>(['autofix_suggested', 'fix_needed', 'workflow_change', 'check_approval', ENGINE_CANT_SANDBOX]);
/**
- * The "Needs you now" count: the cards the Needs you column holds across all work, so the tile and the
+ * The lane a phone opens on: Needs you when something waits on the person, else Working, else Ready.
+ */
+export function defaultColumn(tasks: Task[]): Column {
+ const g = groupByColumn(tasks);
+ return g.needs_you.length ? 'needs_you' : g.working.length ? 'working' : 'ready';
+}
+
+/**
+ * The "Board tasks waiting on you" count: the cards the Needs you column holds across all work, so the tile and the
* column never disagree. The server's `needs_you_now` counts the same tasks.
*/
export function needsYouCount(tasks: Task[]): number {
diff --git a/frontend/tests/missionAutofix.test.mjs b/frontend/tests/missionAutofix.test.mjs
index 4a3c163d..268f9306 100644
--- a/frontend/tests/missionAutofix.test.mjs
+++ b/frontend/tests/missionAutofix.test.mjs
@@ -146,7 +146,7 @@ test('the failure panel says each fact once, with the older server text and the
assert.equal(m.skippedWithFixText(attempt({ status: 'failed' })), undefined, 'only a skipped attempt is folded');
});
-test('"Needs you now" counts the same cards as the Needs you column', () => {
+test('"Board tasks waiting on you" counts the same cards as the Needs you column', () => {
const tasks = [
task({ id: 'q', state: 'needs_you' }),
failed({ id: 'f', needs_you: [{ kind: 'fix_needed', id: 'fl1', text: 'Usage limit reached.' }] }),
@@ -165,8 +165,8 @@ test('"Needs you now" counts the same cards as the Needs you column', () => {
// Eval 10: the server said 0 while 9 failed tasks waited on a fix; the tile follows the column.
const nine = Array.from({ length: 9 }, (_, i) => failed({ id: `f${i}`, needs_you: [{ kind: 'fix_needed', id: `fl${i}`, text: 'Sign in again.' }] }));
const ins = { verified_7d: 1, false_success_7d: 7, needs_you_now: 0, blocked_now: 0, tokens_7d: 0, tokens_per_verified_7d: null };
- assert.match(ui.insights({ insights: ins, needsYou: m.needsYouCount(nine) }), /Needs you now<\/dt><dd class="[^"]*text-amber-300[^"]*">9</);
- assert.match(ui.insights({ insights: ins }), /Needs you now<\/dt><dd[^>]*>0</, 'without the board it falls back to the server count');
+ assert.match(ui.insights({ insights: ins, needsYou: m.needsYouCount(nine) }), /Board tasks waiting on you<\/dt><dd class="[^"]*text-amber-300[^"]*">9</);
+ assert.match(ui.insights({ insights: ins }), /Board tasks waiting on you<\/dt><dd[^>]*>0</, 'without the board it falls back to the server count');
});
test('AutoFix tries come from the server count, not from counting failures in the browser', () => {
diff --git a/frontend/tests/mobileBoard0613.test.mjs b/frontend/tests/mobileBoard0613.test.mjs
new file mode 100644
index 00000000..0e69120c
--- /dev/null
+++ b/frontend/tests/mobileBoard0613.test.mjs
@@ -0,0 +1,170 @@
+// Mobile 0.6.13, B3 (Mira's audit P1-6): on a phone the board put eight stat tiles, a chart, Facts and
+// Goals above the first task card. Now a phone shows Live now, then the lanes as 44 px tabs that open on
+// the lane that matters, then a folded "This week" line, then Facts and Goals. Desktop keeps its order.
+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/s/spc_default/board', pretendToBeVisual: true });
+const g = globalThis;
+for (const k of ['window', 'document', 'navigator', 'HTMLElement', 'Element', 'Node', 'Event', 'MouseEvent', 'requestAnimationFrame', 'cancelAnimationFrame', 'getComputedStyle', 'localStorage']) {
+ if (!(k in dom.window)) continue;
+ Object.defineProperty(g, k, { value: dom.window[k], configurable: true, writable: true });
+}
+g.IS_REACT_ACT_ENVIRONMENT = false;
+
+const m = await loadBundled(`export * from './src/missions';`);
+const ui = await loadBundled(`
+ import React from 'react';
+ import { renderToStaticMarkup } from 'react-dom/server.browser';
+ export { createRoot } from 'react-dom/client';
+ export { React };
+ import { MissionBoardView, Board, InsightsStrip, ThisWeek, thisWeekSummary } from './src/components/MissionBoardView';
+ export { ThisWeek, thisWeekSummary };
+ const r = (c, p) => renderToStaticMarkup(React.createElement(c, p));
+ export const view = (p) => r(MissionBoardView, p);
+ export const board = (p) => r(Board, p);
+ export const insights = (p) => r(InsightsStrip, p);
+ export const thisWeek = (p) => r(ThisWeek, p);
+`);
+const parse = (html) => {
+ const d = document.createElement('div');
+ d.innerHTML = html;
+ return d;
+};
+const settle = async () => {
+ for (let i = 0; i < 20; i++) await new Promise((r) => setTimeout(r, 0));
+};
+
+const NOW = Date.parse('2026-11-05T12:00:00Z');
+const noop = () => {};
+const names = { k_lin: 'Lin', k_tw: 'TechWriter' };
+let n = 0;
+const task = (over = {}) => ({
+ id: `t${++n}`, space_id: 's1', mission_id: null, mission_title: null, title: 'Write the pricing copy', acceptance: '',
+ state: 'ready', priority: 1, owner_kwant_id: 'k_lin', owner_name: 'Lin', suggested_kwant_id: null, budget_tokens: 0,
+ spent_tokens: 0, attempts: 0, max_attempts: 3, blocked_reason: null, source_kind: 'person', source_id: null,
+ channel_id: null, direct_kwant_id: 'k_lin', thread_id: null, created_by: 'person', created_at: '2026-11-05T10:00:00Z',
+ updated_at: '2026-11-05T11:00:00Z', finished_at: null, depends_on: [], waiting_on: [], claim: null, needs_you: [],
+ checks_summary: { status: 'not_checked', passed: 0, failed: 0, total: 0 }, flags: [],
+ ...over,
+});
+const insightsData = { verified_7d: 0, false_success_7d: 0, needs_you_now: 0, blocked_now: 1, blocked_minutes_7d: 7 * 24 * 60, interventions_7d: 0, tokens_7d: 1200, tokens_per_verified_7d: null };
+// Mira's seed: Ready 2 · Working 1 · Needs you 0 · Review 1
+const seed = () => [task(), task({ title: 'Draft the FAQ' }), task({ state: 'working', title: 'Check the links' }), task({ state: 'review', title: 'Fix the footer' })];
+
+test('the phone opens on Needs you when something waits on the person, else Working, else Ready', () => {
+ assert.equal(m.defaultColumn([]), 'ready');
+ assert.equal(m.defaultColumn([task()]), 'ready');
+ assert.equal(m.defaultColumn(seed()), 'working');
+ assert.equal(m.defaultColumn([...seed(), task({ state: 'needs_you' })]), 'needs_you');
+ // a failed task waiting on a fix is in Needs you, as the lane counts it
+ assert.equal(m.defaultColumn([task({ state: 'failed', needs_you: [{ kind: 'fix_needed', id: 'f', text: 'Sign in again.' }] })]), 'needs_you');
+ assert.equal(m.defaultColumn([task({ state: 'review' })]), 'ready', 'Review alone does not pick itself: the spec order is Needs you, Working, Ready');
+});
+
+test('the lane tabs are a segmented row of 44 px, 13/16 tabs with counts that match the lanes', () => {
+ const tasks = seed();
+ const d = parse(ui.board({ tasks, names, column: 'working', now: NOW, onColumn: noop, onOpen: noop }));
+ const list = d.querySelector('[role="tablist"]');
+ assert.match(list.className, /rounded-xl border/, 'one segmented row');
+ const tabs = [...list.querySelectorAll('[role="tab"]')];
+ assert.equal(tabs.length, 5);
+ for (const t of tabs) {
+ assert.match(t.className, /min-h-\[44px\]/);
+ assert.match(t.className, /text-\[13px\] leading-4/);
+ assert.doesNotMatch(t.className, /min-h-\[40px\]|text-xs/);
+ }
+ const counts = Object.fromEntries(tabs.map((t) => [t.textContent.replace(/\d+$/, '').trim(), Number(t.textContent.match(/\d+$/)[0])]));
+ const g = m.groupByColumn(tasks);
+ assert.deepEqual(counts, { Ready: g.ready.length, Working: g.working.length, 'Needs you': g.needs_you.length, Review: g.review.length, Verified: 0 });
+ assert.deepEqual([counts.Ready, counts.Working, counts['Needs you'], counts.Review], [2, 1, 0, 1]);
+ assert.match(tabs[0].querySelector('span:last-child').className, /text-\[12px\] leading-4/, 'the badge reads at 12/16 in a tab');
+ // only the picked lane's cards show under the tabs
+ const panel = d.querySelector('[data-board="tabs"] [role="tabpanel"]');
+ assert.match(panel.textContent, /Check the links/);
+ assert.doesNotMatch(panel.textContent, /Draft the FAQ|Fix the footer/);
+});
+
+test('the Needs you tab count is amber when something waits; desktop lane pills keep their size', () => {
+ const tasks = [...seed(), task({ state: 'needs_you', title: 'Answer a question' })];
+ const d = parse(ui.board({ tasks, names, column: 'needs_you', now: NOW, onColumn: noop, onOpen: noop }));
+ const tab = [...d.querySelectorAll('[role="tab"]')].find((t) => /Needs you/.test(t.textContent));
+ assert.match(tab.querySelector('span:last-child').className, /bg-amber-500/);
+ const desk = d.querySelector('[data-board="columns"], [data-board="grid"]') ?? d.querySelector('.lg\\:grid, .hidden.lg\\:block, .hidden.lg\\:grid');
+ assert.ok(desk, 'the desktop board is still rendered');
+ assert.ok([...desk.querySelectorAll('span')].some((s) => /text-\[10px\]/.test(s.className)), 'its count pills stay 10 px');
+ assert.ok(![...desk.querySelectorAll('span')].some((s) => /text-\[12px\] leading-4/.test(s.className)));
+});
+
+test('"This week" folds the tiles and chart to one line on a phone; from lg up they show as before', () => {
+ assert.equal(ui.thisWeekSummary(insightsData), 'Verified 0 · Blocked 7 d');
+ assert.equal(ui.thisWeekSummary({ ...insightsData, blocked_minutes_7d: undefined, verified_7d: 3 }), 'Verified 3 · Blocked now 1', 'an older server without blocked minutes');
+ const d = parse(ui.thisWeek({ insights: insightsData, needsYou: 0 }));
+ const toggle = d.querySelector('[data-this-week-toggle]');
+ assert.equal(toggle.getAttribute('aria-expanded'), 'false');
+ assert.match(toggle.className, /lg:hidden/, 'desktop has no toggle');
+ assert.match(toggle.className, /min-h-\[44px\]/);
+ assert.equal(toggle.querySelector('[data-this-week-summary]').textContent, 'Verified 0 · Blocked 7 d');
+ const body = d.querySelector('[data-this-week-body]');
+ assert.equal(toggle.getAttribute('aria-controls'), body.id);
+ assert.match(body.className, /(^|\s)hidden(\s|$)/, 'tiles hidden on a phone until opened');
+ assert.match(body.className, /lg:block/, 'and always shown from lg up');
+ assert.ok(body.querySelector('[data-insights]'), 'the tiles are inside the fold');
+ assert.equal(d.querySelectorAll('[data-insights]').length, 1, 'rendered once, not a phone copy and a desktop copy');
+ assert.equal(ui.thisWeek({ insights: null }), '', 'nothing before the server answers');
+});
+
+test('tapping "This week" opens the tiles and tapping again folds them', async () => {
+ const host = document.createElement('div');
+ document.body.appendChild(host);
+ const root = ui.createRoot(host);
+ root.render(ui.React.createElement(ui.ThisWeek, { insights: insightsData, needsYou: 0 }));
+ await settle();
+ const toggle = host.querySelector('[data-this-week-toggle]');
+ const body = () => host.querySelector('[data-this-week-body]');
+ toggle.dispatchEvent(new window.MouseEvent('click', { bubbles: true }));
+ await settle();
+ assert.equal(toggle.getAttribute('aria-expanded'), 'true');
+ assert.doesNotMatch(body().className, /(^|\s)hidden(\s|$)/);
+ assert.match(body().querySelector('[data-insights] dl, [data-insights] .grid')?.className ?? body().innerHTML, /grid-cols-2/, 'tiles in two columns on a phone');
+ toggle.dispatchEvent(new window.MouseEvent('click', { bubbles: true }));
+ await settle();
+ assert.equal(toggle.getAttribute('aria-expanded'), 'false');
+ assert.match(body().className, /(^|\s)hidden(\s|$)/);
+ root.unmount();
+ host.remove();
+});
+
+test('the tile reads "Board tasks waiting on you", not the Inbox-like "Needs you now"', () => {
+ const html = ui.insights({ insights: insightsData, needsYou: 2 });
+ assert.match(html, /Board tasks waiting on you<\/dt>/);
+ assert.doesNotMatch(html, /Needs you now/);
+});
+
+test('on a phone the board comes right after Live now; This week, Facts and Goals follow it; desktop keeps its order', () => {
+ const html = ui.view({
+ tasks: seed(), missions: [], insights: insightsData, names, missionId: null, column: 'working', loading: false, error: null, now: NOW,
+ onMission: noop, onColumn: noop, onOpenTask: noop, onApproveMission: noop, onCancelMission: noop, onRefresh: noop,
+ live: m.liveBots([{ turn_id: 'u1', kwant_id: 'k_tw', context_id: 'k_tw', thread_id: null, state: 'running', since: '2026-11-05T11:55:00Z' }], { names, teams: [] }),
+ teams: [],
+ });
+ const d = parse(html);
+ const page = d.querySelector('[data-board-page]');
+ assert.match(page.className, /flex flex-col/);
+ assert.match(page.className, /lg:block lg:space-y-4/, 'desktop is a plain stack again');
+ const kids = [...page.children];
+ const order = (el) => (/(^|\s)order-2(\s|$)/.test(el.className) ? 2 : /(^|\s)order-1(\s|$)/.test(el.className) ? 1 : 0);
+ for (const el of kids) if (order(el)) assert.match(el.className, /lg:order-none/, 'every reorder is undone from lg up');
+ const name = (el) =>
+ el.matches('[aria-label="Live now"]') ? 'live'
+ : el.querySelector('[data-board="tabs"]') || el.matches('[data-board="tabs"]') ? 'board'
+ : el.matches('[data-this-week]') ? 'week'
+ : el.matches('[data-board-notes]') ? 'notes'
+ : null;
+ const phone = kids.map((el, i) => ({ el, i })).sort((a, b) => order(a.el) - order(b.el) || a.i - b.i).map(({ el }) => name(el)).filter(Boolean);
+ assert.deepEqual(phone, ['live', 'board', 'week', 'notes']);
+ const desktop = kids.map(name).filter(Boolean);
+ assert.deepEqual(desktop, ['live', 'week', 'notes', 'board'], 'source order, which desktop shows, is as before');
+});
diff --git a/frontend/tests/performance.test.mjs b/frontend/tests/performance.test.mjs
index 16bf0acd..0098399f 100644
--- a/frontend/tests/performance.test.mjs
+++ b/frontend/tests/performance.test.mjs
@@ -164,6 +164,6 @@ test('filters reload with by, class, bot and since; choices stay listed after fi
test('the board shows Performance on All work only, and Refresh reloads it', () => {
const src = readFileSync(new URL('../src/components/MissionBoardView.tsx', import.meta.url), 'utf8');
- assert.match(src, /showPerformance && !mission && !needsToken && <PerformancePanel names=\{names\} refreshKey=\{refreshCount\} \/>/);
+ assert.match(src, /showPerformance && !mission && !needsToken && \(\s*<div className="order-2 lg:order-none">\s*<PerformancePanel names=\{names\} refreshKey=\{refreshCount\} \/>/);
assert.match(src, /setRefreshCount\(\(n\) => n \+ 1\)/);
});
diff --git a/frontend/tests/truthLedger.test.mjs b/frontend/tests/truthLedger.test.mjs
index ad217feb..a00e6db7 100644
--- a/frontend/tests/truthLedger.test.mjs
+++ b/frontend/tests/truthLedger.test.mjs
@@ -287,8 +287,10 @@ test('a task whose fact changed can stop relying on it; a disputed one points to
test('wiring: the board shows Facts under the week strip, tasks label fact needs-you, a dispute notification opens the board', () => {
const board = readFileSync(new URL('../src/components/MissionBoardView.tsx', import.meta.url), 'utf8');
- // Measures (Insights) may sit between the week strip and Facts.
- assert.match(board, /<InsightsStrip [^>]*\/>\s*(?:<MeasuresPanel [^>]*\/>\s*)?<FactsLedger /);
+ // Measures (Insights) may sit between the week strip and Facts; since 0.6.13 both fold into "This week",
+ // and Facts follows it (in its own block that a phone moves under the board).
+ assert.match(board, /<InsightsStrip [^>]*\/>\s*<MeasuresPanel [^>]*\/>\s*<\/div>\s*<\/div>\s*\);\s*\};/, 'the week strip and measures close "This week"');
+ assert.match(board, /<ThisWeek [^>]*\/>\s*<div className="order-1 lg:order-none space-y-4" data-board-notes>\s*<FactsLedger /);
assert.match(board, /'A fact changed'/);
assert.match(board, /'Rests on a disputed fact'/);
assert.match(board, /isFactNeedsYou\(n\.kind\) \? \(\s*<FactNeedsYouAction /);