From cd99fec867ee86671148a954b2c18d2cb9f6b946 Mon Sep 17 00:00:00 2001 From: Claudomator Agent Date: Fri, 13 Mar 2026 04:03:33 +0000 Subject: feat: show New Task button on all tabs Removed the switchTab() logic that hid btn-new-task on non-tasks tabs. The button lives in the global header so no structural changes were needed. Added new-task-button.test.mjs to contract-test the always-visible behavior. --- web/app.js | 7 +++---- web/test/new-task-button.test.mjs | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 web/test/new-task-button.test.mjs (limited to 'web') diff --git a/web/app.js b/web/app.js index 3121f28..187795f 100644 --- a/web/app.js +++ b/web/app.js @@ -278,6 +278,9 @@ export function filterActiveTasks(tasks) { return tasks.filter(t => _PANEL_ACTIVE_STATES.has(t.state)); } +// The New Task button is always visible regardless of active tab. +export function newTaskButtonShouldShowOnTab(_tab) { return true; } + export function filterTasksByTab(tasks, tab) { if (tab === 'active') return tasks.filter(t => ACTIVE_STATES.has(t.state)); if (tab === 'interrupted') return tasks.filter(t => INTERRUPTED_STATES.has(t.state)); @@ -2198,10 +2201,6 @@ function switchTab(name) { } }); - // Show/hide the header New Task button (only relevant on tasks tab) - document.getElementById('btn-new-task').style.display = - name === 'tasks' ? '' : 'none'; - if (name === 'running') { fetchTasks().then(renderRunningView).catch(() => { const currentEl = document.querySelector('.running-current'); diff --git a/web/test/new-task-button.test.mjs b/web/test/new-task-button.test.mjs new file mode 100644 index 0000000..45a3548 --- /dev/null +++ b/web/test/new-task-button.test.mjs @@ -0,0 +1,24 @@ +// new-task-button.test.mjs — visibility contract for the New Task button +// +// The New Task button lives in the global header and must be visible on all tabs. +// Run with: node --test web/test/new-task-button.test.mjs + +import { describe, it } from 'node:test'; +import assert from 'node:assert/strict'; +import { newTaskButtonShouldShowOnTab } from '../app.js'; + +const ALL_TABS = ['tasks', 'active', 'running', 'stats']; + +describe('new task button visibility', () => { + for (const tab of ALL_TABS) { + it(`is visible on "${tab}" tab`, () => { + assert.equal(newTaskButtonShouldShowOnTab(tab), true, `expected button to be visible on tab "${tab}"`); + }); + } + + it('is visible on any unknown future tab', () => { + assert.equal(newTaskButtonShouldShowOnTab('help'), true); + assert.equal(newTaskButtonShouldShowOnTab('templates'), true); + assert.equal(newTaskButtonShouldShowOnTab(''), true); + }); +}); -- cgit v1.2.3 From 99df4d68663a5fd77e8c29db59e3e854770cbf40 Mon Sep 17 00:00:00 2001 From: Claudomator Agent Date: Fri, 13 Mar 2026 05:00:42 +0000 Subject: fix: add .btn-resume CSS styling matching .btn-restart --- web/style.css | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'web') diff --git a/web/style.css b/web/style.css index 67e4962..9659ff5 100644 --- a/web/style.css +++ b/web/style.css @@ -290,6 +290,23 @@ main { cursor: not-allowed; } +.btn-resume { + font-size: 0.8rem; + font-weight: 600; + padding: 0.35em 0.85em; + border-radius: 0.375rem; + border: none; + cursor: pointer; + background: var(--text-muted); + color: #0f172a; + transition: opacity 0.15s; +} + +.btn-resume:disabled { + opacity: 0.5; + cursor: not-allowed; +} + .btn-accept { font-size: 0.8rem; font-weight: 600; -- cgit v1.2.3