Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(kanban): lift menu and keep swimlane tab
Alexcf482ff9d3cb
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex eb33c77aa..a7cc39621 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -6320,6 +6320,7 @@ export function Canvas() {if (!targetId) return falsee.preventDefault()if (isGlobalKanbanOpen()) {+ useViewMode.getState().setHighlightedSwimlaneId(targetId)window.dispatchEvent(new CustomEvent('nodeterm:swimlane-jump', { detail: { projectId: targetId } }))return true}diff --git a/src/renderer/components/TabBar.tsx b/src/renderer/components/TabBar.tsxindex 78c3f7ded..d42f2122e 100644--- a/src/renderer/components/TabBar.tsx+++ b/src/renderer/components/TabBar.tsx@@ -255,11 +255,12 @@ export function TabBar({>{projects.map((p) => {const active = isGlobal ? (highlightedId ? p.id === highlightedId : p.id === activeId) : p.id === activeId+ const swimlaneHighlight = isGlobal && p.id === highlightedIdconst unreadCount = p.nodes.filter((n) => unreadSet.has(n.id)).lengthreturn (<divkey={p.id}- className={`tab${active ? ' active' : ''}${p.unavailable ? ' unavailable' : ''}${dropId === p.id ? ' is-drop-before' : ''}`}+ className={`tab${active ? ' active' : ''}${swimlaneHighlight ? ' tab--swimlane-highlight' : ''}${p.unavailable ? ' unavailable' : ''}${dropId === p.id ? ' is-drop-before' : ''}`}style={active ? { color: p.color } : undefined}draggable={editingId !== p.id}onDragStart={(e) => {@@ -293,6 +294,7 @@ export function TabBar({// In global swimlane overview, clicking the top project tab jumps to its// swimlane instead of switching the canvas project (analog zu Cmd+1..9).if (isGlobal) {+ useViewMode.getState().setHighlightedSwimlaneId(p.id)window.dispatchEvent(new CustomEvent('nodeterm:swimlane-jump', { detail: { projectId: p.id } }))return}diff --git a/src/renderer/components/kanban/GlobalKanbanView.tsx b/src/renderer/components/kanban/GlobalKanbanView.tsxindex fb8285ea2..aafad26ea 100644--- a/src/renderer/components/kanban/GlobalKanbanView.tsx+++ b/src/renderer/components/kanban/GlobalKanbanView.tsx@@ -186,6 +186,7 @@ const Swimlane = memo(function Swimlane({const jumpToSelf = () => {document.getElementById(`swimlane-${projectId}`)?.scrollIntoView({ behavior: 'smooth', block: 'start' })+ useViewMode.getState().setHighlightedSwimlaneId(projectId)}return (<div@@ -257,7 +258,6 @@ export const GlobalKanbanView = memo(function GlobalKanbanView() {const jumpTo = useCallback((projectId: string) => {document.getElementById(`swimlane-${projectId}`)?.scrollIntoView({ behavior: 'smooth', block: 'start' })setHighlightId(projectId)- setTimeout(() => setHighlightId(null), 1500)}, [setHighlightId])// Expose scroll-to-swimlane for Cmd+1..9diff --git a/src/renderer/components/kanban/KanbanColumn.test.tsx b/src/renderer/components/kanban/KanbanColumn.test.tsxindex c0b465b9e..bbfd252c3 100644--- a/src/renderer/components/kanban/KanbanColumn.test.tsx+++ b/src/renderer/components/kanban/KanbanColumn.test.tsx@@ -43,4 +43,18 @@ describe('KanbanColumn lanes', () => {it('counts every lane, including totals larger than the cards fetched', () => {expect(render().querySelector('.kanban-col__count')?.textContent).toBe('9')})++ it('renders the new-session menu outside the column overflow container', async () => {+ const host = render({+ createOptions: [{ key: 'terminal', label: 'Terminal', choice: { kind: 'terminal' }, icon: <span /> }]+ })+ await act(async () => {+ host.querySelector<HTMLButtonElement>('.kanban-col__new')?.dispatchEvent(new MouseEvent('click', { bubbles: true }))+ })++ const menu = document.body.querySelector('.kanban-col__newmenu--portal')+ expect(menu).not.toBeNull()+ expect(menu?.parentElement).toBe(document.body)+ menu?.remove()+ })})diff --git a/src/renderer/components/kanban/KanbanColumn.tsx b/src/renderer/components/kanban/KanbanColumn.tsxindex d1bc652cd..362abfd1b 100644--- a/src/renderer/components/kanban/KanbanColumn.tsx+++ b/src/renderer/components/kanban/KanbanColumn.tsx@@ -1,4 +1,5 @@import { Fragment, memo, useLayoutEffect, useRef, useState } from 'react'+import { createPortal } from 'react-dom'import type { KanbanColumn as KanbanColumnT } from '@shared/types'import { NODE_COLORS } from '../../state/workspace'import type { KanbanCreateChoice, KanbanCreateOption } from './KanbanView'@@ -47,27 +48,50 @@ export const KanbanColumn = memo(function KanbanColumn({const [title, setTitle] = useState(column?.title ?? '')const [swatchesOpen, setSwatchesOpen] = useState(false)const [newMenuOpen, setNewMenuOpen] = useState(false)- // The "+ New session" menu normally drops DOWN (top:100%); a column near the window's bottom edge- // would push it off-screen, so we flip it UP when it doesn't fit below. Measured on open.- const [menuUp, setMenuUp] = useState(false)+ const newTriggerRef = useRef<HTMLButtonElement>(null)const newMenuRef = useRef<HTMLDivElement>(null)// Trello-style drop highlight: counted enter/leave (dragleave fires when crossing children).const [dragOverCount, setDragOverCount] = useState(0)useLayoutEffect(() => {- if (!newMenuOpen) {- setMenuUp(false)- return+ if (!newMenuOpen) return++ const positionMenu = () => {+ const trigger = newTriggerRef.current+ const menu = newMenuRef.current+ if (!trigger || !menu) return++ const triggerRect = trigger.getBoundingClientRect()+ const width = Math.min(triggerRect.width, Math.max(0, window.innerWidth - 16))+ const left = Math.max(8, Math.min(triggerRect.left, window.innerWidth - width - 8))+ const below = triggerRect.bottom + 4++ // The menu is initially hidden but measurable. Position it below first, then flip above+ // the trigger when the viewport has more room there. Fixed positioning plus the portal+ // keeps it out of the lane's horizontal overflow clip and above following swimlanes.+ menu.style.width = `${width}px`+ menu.style.left = `${left}px`+ menu.style.top = `${below}px`+ const menuHeight = menu.getBoundingClientRect().height+ const fitsBelow = below + menuHeight <= window.innerHeight - 8+ const above = triggerRect.top - menuHeight - 4+ const top = fitsBelow+ ? below+ : above >= 8+ ? above+ : Math.max(8, window.innerHeight - menuHeight - 8)+ menu.style.top = `${top}px`+ menu.style.visibility = 'visible'+ }++ positionMenu()+ window.addEventListener('resize', positionMenu)+ // Capture scroll events from the global board and each horizontally scrollable column.+ window.addEventListener('scroll', positionMenu, true)+ return () => {+ window.removeEventListener('resize', positionMenu)+ window.removeEventListener('scroll', positionMenu, true)}- const el = newMenuRef.current- if (!el) return- // Measured while rendered DOWN. If its bottom clears the viewport AND there's more room above- // the trigger than below it, flip up. (getBoundingClientRect includes the current position.)- const rect = el.getBoundingClientRect()- const overflowsBelow = rect.bottom > window.innerHeight - 8- const spaceAbove = rect.top // menu top ≈ just under the button- const spaceBelow = window.innerHeight - rect.top- if (overflowsBelow && spaceAbove > spaceBelow) setMenuUp(true)}, [newMenuOpen])const colId = column?.id ?? null@@ -171,8 +195,8 @@ export const KanbanColumn = memo(function KanbanColumn({))}</div><div className="kanban-col__footer">- {newMenuOpen && (- <div ref={newMenuRef} className={menuUp ? 'kanban-col__newmenu kanban-col__newmenu--up' : 'kanban-col__newmenu'}>+ {newMenuOpen && typeof document !== 'undefined' && createPortal(+ <div ref={newMenuRef} className="kanban-col__newmenu kanban-col__newmenu--portal">{createOptions.map((o) => (<buttonkey={o.key}@@ -185,9 +209,10 @@ export const KanbanColumn = memo(function KanbanColumn({{o.label}</button>))}- </div>+ </div>,+ document.body)}- <button className="kanban-col__new" onClick={() => setNewMenuOpen((v) => !v)}>+ <button ref={newTriggerRef} className="kanban-col__new" onClick={() => setNewMenuOpen((v) => !v)}>+ New session</button></div>diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 301481e58..f5c946dce 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -279,6 +279,14 @@ body,font-weight: 600;}+/* In the all-projects board the highlighted tab follows the selected swimlane, not necessarily+ the project whose canvas is mounted underneath. Keep that selection visible in the tab strip. */+.tab.tab--swimlane-highlight {+ background: rgba(var(--tint-rgb), 0.16);+ box-shadow: inset 0 -2px 0 currentColor;+ font-weight: 600;+}+/* Project whose folder/ref is missing or unreachable — greyed and not switchable. */.tab.unavailable {opacity: 0.45;@@ -8762,9 +8770,6 @@ button.group-node__setup:disabled {z-index: 1;box-shadow: 0 2px 12px rgba(0, 0, 0, calc(0.12 * var(--shadow-k)));}-.kanban-swimlane:has(.kanban-col__newmenu) {- z-index: 10;-}.kanban-swimlane:nth-child(even) {background: rgba(var(--tint-rgb), 0.035);}@@ -9047,12 +9052,19 @@ button.group-node__setup:disabled {display: flex;flex-direction: column;}-/* Flipped up when the column sits near the window's bottom edge (see KanbanColumn's layout effect). */-.kanban-col__newmenu--up {- top: auto;- bottom: 100%;- margin-top: 0;- margin-bottom: 4px;+/* Global swimlanes contain horizontally scrolling boards, so an in-column menu would be clipped+ before z-index can lift it above the next lane. The React portal is positioned against the+ viewport instead; the component supplies its measured coordinates after mounting. */+.kanban-col__newmenu--portal {+ position: fixed;+ top: 0;+ left: 0;+ right: auto;+ bottom: auto;+ margin: 0;+ width: 0;+ visibility: hidden;+ z-index: 29;}.kanban-col__newmenu button {display: flex;