diff --git a/scripts/web-layout.test.mjs b/scripts/web-layout.test.mjs index 0dda374..1ce375d 100644 --- a/scripts/web-layout.test.mjs +++ b/scripts/web-layout.test.mjs @@ -545,3 +545,45 @@ test('every face of the chats panel scrolls to its last row, and the phone drawe served.close() } }) + +// The tab over the composer's top edge holds the linked task and the queued +// messages. It sits on the box and is one tab: the queue used to be a second tab +// tucked 22px under the box, which is see-through, so the tucked lip showed +// through the top of the box as a dark band. This draws the real Composer, +// TaskBar and QueuedMessages (web/src/chat/ComposerTab.harness.tsx). +test('the task and the queue share one tab that sits on the composer, never under it', { skip: !executablePath || !esbuild }, async () => { + const todo = { id: 'k1', title: 'Fictional task to install a connector', description: '', area: 'Personal', ventureTag: null, status: 'todo', priority: 1, dueDate: new Date().toISOString().slice(0, 10), recurrence: null, + snoozedUntil: null, position: 0, createdAt: ago(48), updatedAt: ago(1), completedAt: null, outcome: null, archivedAt: null, deletedAt: null, + tags: [], notes: [], relations: [], lists: [], externalLinks: [], issueLink: null, folderId: null } + const api = (url) => url.split('?')[0] === '/api/todos/board' ? { counts: { archived: 0, snoozed: 0, deleted: 0 }, todos: [todo] } : null + const served = await serveHarness({ entry: 'chat/ComposerTab.harness.tsx', styles: ['styles.css', 'shell.css', 'chat/chat.css', 'work/work.css'], api }) + const browser = await chromium.launch({ executablePath }) + try { + for (const v of ['both', 'task', 'queue', 'many']) { + for (const width of [1100, 390]) { + const where = `${v}, ${width}px` + const page = await browser.newPage({ viewport: { width, height: 500 } }) + await page.goto(`${served.url}?v=${v}`) + if (v !== 'queue') await page.waitForFunction(() => document.querySelector('.wk-taskbar-title')?.textContent?.startsWith('Fictional'), null, { timeout: 10000 }) + const got = await page.evaluate(() => { + const r = (e) => e && e.getBoundingClientRect() + const tab = document.querySelector('.vc-above') + const kids = [...tab.children].map((e) => { const b = r(e); const s = getComputedStyle(e); return { left: b.left, right: b.right, top: b.top, bottom: b.bottom, radius: s.borderTopLeftRadius, side: s.borderLeftWidth } }) + return { tab: r(tab), box: r(document.querySelector('.vc-box')), kids } + }) + assert.equal(got.kids.length, v === 'both' || v === 'many' ? 2 : 1, `${where}: one row per part`) + assert.ok(Math.abs(got.tab.bottom - got.box.top) <= 1, `${where}: the tab sits on the box (tab ends ${got.tab.bottom}, box starts ${got.box.top})`) + assert.ok(got.tab.left > got.box.left && got.tab.right < got.box.right, `${where}: the tab is inset from the box's corners`) + for (const k of got.kids) { + assert.ok(k.left >= got.tab.left && k.right <= got.tab.right, `${where}: a part runs the tab's width`) + assert.equal(k.side, '0px', `${where}: a part draws no tab of its own`) + } + for (let i = 1; i < got.kids.length; i++) assert.ok(Math.abs(got.kids[i].top - got.kids[i - 1].bottom) <= 1, `${where}: the parts stack with no gap`) + await page.close() + } + } + } finally { + await browser.close() + served.close() + } +}) diff --git a/web/src/chat/ComposerTab.harness.tsx b/web/src/chat/ComposerTab.harness.tsx new file mode 100644 index 0000000..00b63d7 --- /dev/null +++ b/web/src/chat/ComposerTab.harness.tsx @@ -0,0 +1,46 @@ +import React from 'react' +import { createRoot } from 'react-dom/client' +import Composer from './Composer' +import ContextMeter from './ContextMeter' +import QueuedMessages from './QueuedMessages' +import TaskBar from '../work/TaskBar' +import { loadWork } from '../work/state' +import type { ChatThread, QueuedMessage } from './types' + +// Not part of the app: scripts/web-layout.test.mjs bundles this page and draws the +// real composer with the tab over its top edge (the linked task and the queued +// messages), with the real CSS, in each combination: `?v=both|task|queue|many`. +// The test feeds the task through a fictional /api/todos/board. + +const noop = () => {} +const at = Date.now() +const queued = (n: number): QueuedMessage[] => + ['Fictional-errors.csv', 'Then check the second share too', 'And write up what changed'].slice(0, n).map((text, i) => ({ id: `q${i}`, text, createdAt: at + i })) +const v = new URLSearchParams(location.search).get('v') || 'both' +const task = v !== 'queue' +const queue = v === 'task' ? [] : queued(v === 'many' ? 3 : 1) +const thread = { id: 'fixture', taskId: task ? 'k1' : undefined } as unknown as ChatThread + +function Harness() { + return ( +
+
+ true} onQueue={() => true} busy + placeholder="Steer this reply: add context or change course" + leftSlot={} + rightSlot={Fictional model ยท Medium} + above={ +
+ + {queue.length > 0 && } +
+ } + /> +
+
+ ) +} + +void loadWork() +createRoot(document.getElementById('root')!).render() diff --git a/web/src/chat/chat.css b/web/src/chat/chat.css index 75a2d8f..a3e296a 100644 --- a/web/src/chat/chat.css +++ b/web/src/chat/chat.css @@ -1835,16 +1835,23 @@ button.vc-file-row:hover, .vc-file-row:hover { background: var(--vc-raise); } color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); } -/* Queued messages (QueuedMessages.tsx), T3 Code's drawer: a strip tucked under - the composer's top edge, the box drawn over its lower lip. */ -.vc-queue { - position: relative; margin: 0 30px -22px; padding: 4px 6px 26px; - border: 1px solid #ffffff17; border-bottom: 0; border-radius: 16px 16px 0 0; +/* Over the composer's top edge, one tab holds the linked task (TaskBar.tsx) and + the queued messages (QueuedMessages.tsx), divided by a hairline. It sits on the + box, never tucked under it: the box is see-through, so a tucked lip showed + through it as a dark band. */ +.vc-above { + position: relative; margin: 0 30px -1px; overflow: hidden; + border: 1px solid #ffffff17; border-bottom: 0; border-radius: 14px 14px 0 0; background: color-mix(in srgb, var(--vc-surface) 70%, transparent); - font-size: 12px; line-height: 16px; } -.vc.no-glow .vc-queue { background: var(--vc-surface); } +.vc-above:empty { display: none; } +.vc.no-glow .vc-above { background: var(--vc-surface); } +.vc-above > * + * { border-top: 1px solid #ffffff0f; } .vc-composer > .vc-box { position: relative; z-index: 1; } +@media (max-width: 720px) { .vc-above { margin: 0 14px -1px; } } + +/* Queued messages, T3 Code's drawer. */ +.vc-queue { padding: 2px 6px 6px; font-size: 12px; line-height: 16px; } .vc-queue-head { display: flex; align-items: center; gap: 6px; width: 100%; padding: 4px 6px; background: none; border: 0; color: var(--vc-soft); font: inherit; cursor: pointer; text-align: left; diff --git a/web/src/components/ChatView.tsx b/web/src/components/ChatView.tsx index 8a92192..6442ece 100644 --- a/web/src/components/ChatView.tsx +++ b/web/src/components/ChatView.tsx @@ -684,7 +684,7 @@ export default function ChatView({ onAuthError, visible = true, onOpenMenu, pane followUp={followUp} queueEdit={queueEdit && queueEdit.threadId === activeId ? { onSave: saveQueueEdit } : undefined} onResume={!busy && active?.queueHeld && queue.length && activeId ? () => { void updateQueue(activeId, { action: 'resume' }) } : undefined} - above={<>{queueEl}} + above={
{queueEl}
} onVoice={() => setVoice(true)} busy={busy} autoFocus={visible} diff --git a/web/src/work/work.css b/web/src/work/work.css index e5cf559..bb6a64d 100644 --- a/web/src/work/work.css +++ b/web/src/work/work.css @@ -158,14 +158,12 @@ button.wk-check:hover .wk-check-on { opacity: 1; transform: none; } .wk-combo-search input { font-size: 16px; } } -/* --- the task strip over the composer (TaskBar.tsx): a tab sitting on the box's top edge --- */ +/* --- the task strip over the composer (TaskBar.tsx): the first row of the tab on + the box's top edge (.vc-above in chat.css draws the tab) --- */ .wk-taskbar { - position: relative; display: flex; align-items: center; gap: 6px; margin: 0 30px -1px; padding: 4px 8px 5px 10px; - border: 1px solid #ffffff17; border-bottom: 0; border-radius: 14px 14px 0 0; - background: color-mix(in srgb, var(--vc-surface, var(--surface)) 70%, transparent); + position: relative; display: flex; align-items: center; gap: 6px; padding: 4px 8px 5px 12px; font-size: 12.5px; line-height: 18px; color: var(--vc-soft, var(--muted)); } -.vc.no-glow .wk-taskbar { background: var(--vc-surface, var(--surface)); } .wk-taskbar .ti { flex: none; } .wk-taskbar-icon { color: var(--accent); } .wk-taskbar-label { flex: none; color: var(--vc-faint, var(--muted)); } @@ -182,7 +180,6 @@ button.wk-check:hover .wk-check-on { opacity: 1; transform: none; } } .wk-taskbar-btn:hover { background: var(--vc-raise, var(--raise)); color: var(--text); } @media (max-width: 720px) { - .wk-taskbar { margin: 0 14px -1px; } .wk-taskbar-label { display: none; } .wk-taskbar-btn { height: 32px; min-width: 32px; } }