From 4192d9db26c393ddd2b1ccbf491b6ae760b99a74 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Tue, 21 Apr 2026 18:11:19 -0700 Subject: [PATCH] fix(tasks): rename NewWorkspacePage to TaskPage and give it a proper titlebar (#921) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(tasks): rename NewWorkspacePage to TaskPage and unblock Close on collapsed sidebar Rename the full-page work-item view to TaskPage (file, component, store actions, and the `activeView` literal) so the name matches the surface the user sees. Also fix a regression where the page's Close button was unreachable in workspace view with the sidebar collapsed — the floating titlebar-left strip (traffic lights + sidebar toggle + agent badge) overlapped the Close button, leaving the user stuck. Mirror the TabGroupPanel fix by reserving `var(--collapsed-sidebar-header-width)` of left padding on the Close row, which App.tsx already keeps in sync with the live measured width of that floating header. * fix(tasks): give TaskPage its own 42px titlebar and drop Close below it Rather than cramming the Close button into the same horizontal band that App.tsx uses for the floating traffic-lights/sidebar-toggle strip, give TaskPage its own 42px "Tasks" titlebar (matching the sidebar header and tab rows) and move the Close (X) button into a dedicated row below it. The titlebar is drag-region so the window stays movable from this band. Skipped in non-workspace mode where App.tsx already owns the full-width titlebar, to avoid a duplicate band. * fix(tasks): keep sidebar-expand toggle visible over TaskPage titlebar When the left sidebar is collapsed, App.tsx floats the titlebar-left strip (traffic lights, sidebar-expand toggle, agent badge) over the top-left of the page at z-10. TaskPage's own 42px strip sat at the same stacking level and painted later in DOM, so its solid background hid the expand toggle. Split the strip: keep the reserved region transparent so the floating controls show through, and only paint bg/border on the remainder. The floating titlebar-left already carries the matching bg + border-bottom, so the two segments still read as one continuous band. * fix(tasks): let clicks reach sidebar toggle under TaskPage titlebar The reserved spacer in TaskPage's titlebar strip sits on top of App.tsx's floating titlebar-left (which hosts the sidebar-expand toggle and agent badge). Two things were swallowing clicks meant for the toggle: 1. The outer strip carried WebkitAppRegion='drag', so Electron treated the whole 42px row as window-drag — even the transparent reserved region. 2. The transparent div itself absorbed pointer events before they reached the underlying toggle. Scope the drag region to just the painted "Tasks" segment, and mark the reserved spacer pointer-events-none with an explicit no-drag override. * fix(tasks): stop TaskPage wrapper from blocking sidebar-expand toggle The TaskPage's inner column had z-10, the same z-index as App.tsx's floating titlebar-left cluster (traffic lights, sidebar toggle, agent badge) that hovers in the top-left when the sidebar is collapsed. Tie on z-index + later in DOM meant TaskPage painted over titlebar-left, so clicks on the reserved spacer region fell through pointer-events-none into the wrapper behind the spacer rather than reaching the toggle. Dropping z-10 from the inner column lets titlebar-left paint above the page content and receive clicks cleanly, without changing the visual layout. --- src/renderer/src/App.tsx | 26 +++--- .../{NewWorkspacePage.tsx => TaskPage.tsx} | 88 ++++++++++++++++--- src/renderer/src/components/Terminal.tsx | 6 +- .../src/components/sidebar/SidebarNav.tsx | 12 +-- .../src/components/sidebar/WorktreeCard.tsx | 6 +- .../src/components/sidebar/WorktreeList.tsx | 6 +- src/renderer/src/hooks/resolve-zoom-target.ts | 2 +- src/renderer/src/hooks/useComposerState.ts | 8 +- src/renderer/src/lib/new-workspace.ts | 8 +- src/renderer/src/lib/worktree-activation.ts | 6 +- src/renderer/src/store/slices/ui.test.ts | 14 +-- src/renderer/src/store/slices/ui.ts | 55 ++++++------ 12 files changed, 149 insertions(+), 88 deletions(-) rename src/renderer/src/components/{NewWorkspacePage.tsx => TaskPage.tsx} (89%) diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index b1270451e..2c3a4683c 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -15,7 +15,7 @@ import Sidebar from './components/Sidebar' import Terminal from './components/Terminal' import { shutdownBufferCaptures } from './components/terminal-pane/TerminalPane' import Landing from './components/Landing' -import NewWorkspacePage from './components/NewWorkspacePage' +import TaskPage from './components/TaskPage' import Settings from './components/settings/Settings' import RightSidebar from './components/right-sidebar' import QuickOpen from './components/QuickOpen' @@ -447,9 +447,9 @@ function App(): React.JSX.Element { // full-width titlebar is replaced by a sidebar-width left header so the // terminal + tab groups extend to the very top of the window. const workspaceActive = activeView !== 'settings' && activeWorktreeId !== null - // Why: suppress right sidebar controls on new-workspace page since that - // surface is intentionally distraction-free (no right sidebar). - const showRightSidebarControls = activeView !== 'settings' && activeView !== 'new-workspace' + // Why: suppress right sidebar controls on the tasks page since that surface + // is intentionally distraction-free (no right sidebar). + const showRightSidebarControls = activeView !== 'settings' && activeView !== 'tasks' const handleToggleExpand = (): void => { if (!effectiveActiveTabId) { @@ -509,9 +509,9 @@ function App(): React.JSX.Element { // (contentEditable) or a browser guest webContents, both of which bypass // this renderer-side window keydown listener. - // Why: the new-workspace composer should not be able to reveal the right - // sidebar at all, because that surface is intentionally distraction-free. - if (activeView === 'new-workspace') { + // Why: the tasks page should not be able to reveal the right sidebar at + // all, because that surface is intentionally distraction-free. + if (activeView === 'tasks') { return } @@ -739,9 +739,9 @@ function App(): React.JSX.Element { ) : null useEffect(() => { - if (activeView === 'new-workspace' && rightSidebarOpen) { - // Why: hide the right sidebar immediately when entering the composer so - // a previous open state can't bleed into the dedicated workspace flow. + if (activeView === 'tasks' && rightSidebarOpen) { + // Why: hide the right sidebar immediately when entering the tasks page + // so a previous open state can't bleed into that distraction-free view. actions.setRightSidebarOpen(false) } }, [activeView, rightSidebarOpen, actions]) @@ -759,7 +759,7 @@ function App(): React.JSX.Element { {/* Why: in workspace view (split groups always enabled), the full-width titlebar is removed so tab groups + terminal extend to the top of the window. Left titlebar controls move to a header above the sidebar. - Settings, landing, and new-workspace views keep the full-width titlebar. */} + Settings, landing, and the tasks page keep the full-width titlebar. */} {!workspaceActive ? (
{activeView === 'settings' ? : null} - {activeView === 'new-workspace' ? : null} + {activeView === 'tasks' ? : null} {activeView === 'terminal' && !activeWorktreeId ? : null}
{/* Why: keep RightSidebar mounted even when closed so that its child components (FileExplorer, SourceControl, etc.) and their filesystem watchers + cached directory trees survive across - open/close toggles. Unmount on new-workspace view since that + open/close toggles. Unmount on the tasks view since that surface is intentionally distraction-free. */} {showRightSidebarControls ? : null} diff --git a/src/renderer/src/components/NewWorkspacePage.tsx b/src/renderer/src/components/TaskPage.tsx similarity index 89% rename from src/renderer/src/components/NewWorkspacePage.tsx rename to src/renderer/src/components/TaskPage.tsx index 8d45e4aa3..60bfb4690 100644 --- a/src/renderer/src/components/NewWorkspacePage.tsx +++ b/src/renderer/src/components/TaskPage.tsx @@ -139,10 +139,10 @@ function getTaskStatusTone(item: GitHubWorkItem): string { return 'border-cyan-500/30 bg-cyan-500/10 text-cyan-700 dark:text-cyan-200' } -export default function NewWorkspacePage(): React.JSX.Element { +export default function TaskPage(): React.JSX.Element { const settings = useAppStore((s) => s.settings) - const pageData = useAppStore((s) => s.newWorkspacePageData) - const closeNewWorkspacePage = useAppStore((s) => s.closeNewWorkspacePage) + const pageData = useAppStore((s) => s.taskPageData) + const closeTaskPage = useAppStore((s) => s.closeTaskPage) const activeModal = useAppStore((s) => s.activeModal) const repos = useAppStore((s) => s.repos) const activeRepoId = useAppStore((s) => s.activeRepoId) @@ -150,6 +150,18 @@ export default function NewWorkspacePage(): React.JSX.Element { const updateSettings = useAppStore((s) => s.updateSettings) const fetchWorkItems = useAppStore((s) => s.fetchWorkItems) const getCachedWorkItems = useAppStore((s) => s.getCachedWorkItems) + // Why: in workspace view (a worktree is active) App.tsx hides its + // full-width titlebar, so this page renders its own 42px titlebar strip to + // keep the top band continuous with the sidebar header and tab rows. When + // the sidebar is also collapsed, App.tsx floats its titlebar-left controls + // (traffic lights, sidebar toggle, agent badge) over our strip — reserve + // the measured width of those controls on the left so our "Tasks" label + // never sits behind them. In non-workspace mode App.tsx already owns the + // top titlebar, so skip our strip to avoid a duplicate band. + const sidebarOpen = useAppStore((s) => s.sidebarOpen) + const activeWorktreeId = useAppStore((s) => s.activeWorktreeId) + const workspaceActive = activeWorktreeId !== null + const reserveCollapsedHeaderSpace = workspaceActive && !sidebarOpen const eligibleRepos = useMemo(() => repos.filter((repo) => isGitRepoKind(repo)), [repos]) @@ -489,27 +501,79 @@ export default function NewWorkspacePage(): React.JSX.Element { } event.preventDefault() - closeNewWorkspacePage() + closeTaskPage() } window.addEventListener('keydown', onKeyDown, { capture: true }) return () => window.removeEventListener('keydown', onKeyDown, { capture: true }) - }, [activeModal, closeNewWorkspacePage, drawerWorkItem, newIssueOpen]) + }, [activeModal, closeTaskPage, drawerWorkItem, newIssueOpen]) return (
-
- {/* Why: left-aligned so it doesn't collide with the app sidebar on the - right edge. The GitHub preview is a modal sheet that overlays the - whole surface, so this button is hidden behind it while it's open. */} -
+ {/* Why: no z-index here. App.tsx's floating titlebar-left (traffic lights + + sidebar-expand toggle + agent badge) is absolutely positioned at + z-10 in the root stacking context when the sidebar is collapsed. If + this wrapper also sits at z-10 it ties with titlebar-left on + z-index and wins on DOM order (later sibling), so even though our + top-left spacer is pointer-events-none, the click still lands on + this wrapper behind the spacer instead of falling through to the + sidebar toggle. Keeping this at z-auto lets titlebar-left's z-10 + paint above our content and receive the click cleanly. */} +
+ {/* Why: in workspace view App.tsx suppresses its full-width titlebar, + so render a matching 42px strip here to keep the top band + continuous with the sidebar header and tab rows. When the sidebar + is collapsed, App.tsx floats its titlebar-left controls (traffic + lights, sidebar toggle, agent badge) over the top-left of this + page at z-10, and the page wrapper stays at z-auto so that float + always paints above our content. Keep the reserved region + transparent so the floating titlebar-left's own bg + border-bottom + is what the user sees on the left — the two segments then read as + one continuous band. The painted remainder is a drag-region so the + window stays movable here, matching other top chrome. Skipped in + non-workspace mode because App.tsx already owns the top titlebar + and a second strip would produce a duplicate band. */} + {workspaceActive ? ( +
+ {reserveCollapsedHeaderSpace ? ( + // Why: the floating titlebar-left hosts real interactive chrome + // (sidebar-expand toggle, agent badge) under this segment. Both + // pointer-events-none AND WebkitAppRegion='no-drag' are needed: + // without pointer-events-none, this transparent div absorbs + // clicks before they reach the toggle; without no-drag, Electron + // marks the area as window-drag and still consumes clicks even + // when the element itself is click-through. +
+ ) : null} +
+ Tasks +
+
+ ) : null} + + {/* Why: Close sits in its own row below the titlebar strip so it can + never overlap the floating macOS traffic lights. Kept left-aligned + to stay out of the app sidebar on the right edge. */} +