Skip to content

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.

feat(kanban): make Omni a scope of the kanban side, not a third view

reviewb35ab5dd6a3f
diff --git a/CLAUDE.md b/CLAUDE.md
index 23f3737ad..e72c10de2 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -6260,7 +6260,7 @@ the Settings section and ShortcutsPanel start disagreeing about what a chord mea
the phone's direct-SSH writer (`KanbanBoardWriter`) still appends without one — the next desktop
write into that column ranks it, and array order already shows it correctly. `KanbanDefaults`
should gain the three categories. All three are the iOS follow-up, not desktop work.
-- **Omni Kanban (global swimlanes)** (`components/kanban/GlobalKanbanView.tsx`; one swimlane per open project; `state/viewMode.ts` `globalKanban` (localStorage `nodeterm.globalKanban`, machine-local, like `viewByProject`) + `settings.omniKanbanEnabled` (feature gate, default OFF, `settings.json`) / `omniKanbanAsDefault` (when true, `view.kanbanToggle` — Cmd+Shift+B — opens Omni; otherwise per-project; `view.globalKanbanToggle` registry command — unbound, remappable — always opens Omni when enabled); `TabBar` and the menu IPC `onToggleKanban` share one `performKanbanToggle` decision, and `isGlobalKanbanOpen()` is the single gate (fail-closed, static import of `useSettings` — the earlier `require` failed open in the packaged renderer). Non-active lanes are derived from serialized `p.nodes` via `toKanbanSessionState` (the persisted-state counterpart to `toKanbanSession`); the ACTIVE project's lane is fed LIVE by Canvas (`GlobalKanbanLive`: the same `kanbanSessionsFrom(nodes)` cards + live `teamStations` the per-project board uses), because its edits reach the store only at the next ~800 ms autosave — a store-fed lane reverted the card modal's controlled sticky textarea on every keystroke and pruned the assignment of a card created a moment earlier. The open card modal is ONE overview-level fact reported to Canvas's `setKanbanModalNode` (watched for Eco, wake-on-open, dictation target), never per-lane state; each lane's board write resolves ITS project's session (`sessionForProject`) for the hosted read-only refusal and the board-log api; `pendingLaunch` never becomes `initialCommand` in the modal (the DAG launch must fire only when dependencies report done, and the canvas `TerminalNode` already delivers `initialCommand` via `writeWhenShellReady` after the `nodeterm:create-node` project switch). Active-project edits (rename / sticky / browser nav) route through Canvas live nodes (`setNodes` + `markDirty`), non-active through the store + `writeDisk`; delete uses `ConfirmDialog` (not `confirm`) and then `deleteNodes` (active project) or `closeStoredNodes` (any other) — the existing cross-project teardown funnel, never a hand-rolled copy. The top bar's project pills and Cmd/Ctrl+1..9 (`nodeterm:swimlane-jump`) jump to the lane; header hint shows the correct mod (`Cmd` on Mac, `Ctrl` elsewhere). Server Edition works as-is, Mobile N/A.
+- **Omni Kanban (global swimlanes)** (`components/kanban/GlobalKanbanView.tsx`; one swimlane per open project; `state/viewMode.ts` `globalKanban` (localStorage `nodeterm.globalKanban`, machine-local, like `viewByProject`) + `settings.omniKanbanEnabled` (feature gate, default OFF, `settings.json`) / `omniKanbanAsDefault` (when true, `view.kanbanToggle` — Cmd+Shift+B — opens Omni; otherwise per-project; `view.globalKanbanToggle` registry command — unbound, remappable — always opens Omni when enabled); **Omni is a SCOPE of the kanban side, not a third view**: the view toggle (tab icon, ⌘⇧B, the menu) flips canvas ⇄ board, and a board header's `KanbanScopeSwitch` ("This project" / "All projects", rendered only while the feature is on) moves between the two scopes — so leaving Omni through the switch lands on the project's board, and the view toggle from Omni lands on the canvas (it used to fall through to whatever the project's view happened to be, so "Canvas view" from Omni could land on a board). The decisions live once in `state/viewMode.ts` (`toggleBoardView` / `toggleAllProjectsBoard` / `showProjectBoard` / `showCanvas`), called by TabBar, the menu IPC and both registry commands; Omni has no close button. `globalKanban` deliberately stays independent of the active project, so a project switch made from a lane does not drop the user out of Omni. `isGlobalKanbanOpen()` is the single gate (fail-closed, static import of `useSettings` — the earlier `require` failed open in the packaged renderer). Non-active lanes are derived from serialized `p.nodes` via `toKanbanSessionState` (the persisted-state counterpart to `toKanbanSession`); the ACTIVE project's lane is fed LIVE by Canvas (`GlobalKanbanLive`: the same `kanbanSessionsFrom(nodes)` cards + live `teamStations` the per-project board uses), because its edits reach the store only at the next ~800 ms autosave — a store-fed lane reverted the card modal's controlled sticky textarea on every keystroke and pruned the assignment of a card created a moment earlier. The open card modal is ONE overview-level fact reported to Canvas's `setKanbanModalNode` (watched for Eco, wake-on-open, dictation target), never per-lane state; each lane's board write resolves ITS project's session (`sessionForProject`) for the hosted read-only refusal and the board-log api; `pendingLaunch` never becomes `initialCommand` in the modal (the DAG launch must fire only when dependencies report done, and the canvas `TerminalNode` already delivers `initialCommand` via `writeWhenShellReady` after the `nodeterm:create-node` project switch). Active-project edits (rename / sticky / browser nav) route through Canvas live nodes (`setNodes` + `markDirty`), non-active through the store + `writeDisk`; delete uses `ConfirmDialog` (not `confirm`) and then `deleteNodes` (active project) or `closeStoredNodes` (any other) — the existing cross-project teardown funnel, never a hand-rolled copy. The top bar's project pills and Cmd/Ctrl+1..9 (`nodeterm:swimlane-jump`) jump to the lane; header hint shows the correct mod (`Cmd` on Mac, `Ctrl` elsewhere). Server Edition works as-is, Mobile N/A.
- **Settings** (`SettingsPage.tsx`, ⚙ / ⌘,): font/cursor (live to xterm + Monaco), default
shell, grid + snap, **default node size** (`defaultNodeWidth`/`defaultNodeHeight` — new
terminal/agent nodes only, clamped in `terminalNodeSize()` in `state/workspace.ts`),
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 6aad1ea69..d5989e7dc 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -620,7 +620,16 @@ import { useNodesEpoch } from './nodesEpoch'
import { isHidden } from '../lib/ui-visibility'
import { boardLogEvents } from '../lib/boardLogDiff'
import { useBoardLog } from '../state/boardLog'
-import { isGlobalKanbanOpen, isKanbanOpen, isOmniKanbanEnabled, useViewMode, viewFor } from '../state/viewMode'
+import {
+ isGlobalKanbanOpen,
+ isKanbanOpen,
+ isOmniKanbanEnabled,
+ showCanvas,
+ toggleAllProjectsBoard,
+ toggleBoardView,
+ useViewMode,
+ viewFor
+} from '../state/viewMode'
import { GlobalKanbanView } from '../components/kanban/GlobalKanbanView'
import { useFocusNode, FOCUS_SURFACE_ID } from '../state/focusNode'
import { focusTargetId } from '../lib/focusTarget'
@@ -3216,29 +3225,18 @@ export function Canvas() {
// place: the IPC path bypasses the registry, so duplicating the omni/asDefault choice
// caused Cmd+Shift+B on desktop to ignore omniKanbanAsDefault and to toggle the per-project
// board underneath the global overlay.
- const performKanbanToggle = useCallback(() => {
- if (isGlobalKanbanOpen()) {
- useViewMode.getState().toggleGlobalKanban()
- return true
- }
- const settings = useSettings.getState().settings
- if (isOmniKanbanEnabled(settings) && settings.omniKanbanAsDefault === true) {
- commitActiveToStore()
- useViewMode.getState().toggleGlobalKanban()
- return true
- }
- const id = useProjects.getState().activeProjectId
- if (!id) return false
- useViewMode.getState().toggle(id)
- return true
- }, [commitActiveToStore])
+ // The decision itself is `toggleBoardView` / `toggleAllProjectsBoard` (state/viewMode.ts), which
+ // TabBar's board icon calls too. No commit is needed before Omni opens: its active lane reads
+ // the live canvas (GlobalKanbanLive), and the effect above commits for the other readers.
+ const performKanbanToggle = useCallback(
+ () => toggleBoardView(useProjects.getState().activeProjectId),
+ []
+ )
- const performGlobalKanbanToggle = useCallback(() => {
- if (!isOmniKanbanEnabled(useSettings.getState().settings)) return false
- if (!isGlobalKanbanOpen()) commitActiveToStore()
- useViewMode.getState().toggleGlobalKanban()
- return true
- }, [commitActiveToStore])
+ const performGlobalKanbanToggle = useCallback(
+ () => toggleAllProjectsBoard(useProjects.getState().activeProjectId),
+ []
+ )
// Mirror `dirty` into a ref so the external-change listener (mounted once) reads the
// live value without re-subscribing on every edit.
@@ -5289,8 +5287,7 @@ export function Canvas() {
// so the user actually sees the login node they must interact with. Same rationale as the
// Settings-overlay close in the add-account listeners above.
if (pid) {
- if (isGlobalKanbanOpen()) useViewMode.getState().toggleGlobalKanban()
- else if (isKanbanOpen(pid)) useViewMode.getState().toggle(pid)
+ if (isGlobalKanbanOpen() || isKanbanOpen(pid)) showCanvas(pid)
}
}
window.addEventListener('nodeterm:switch-system-account', onSwitchSystemAccount)
diff --git a/src/renderer/components/TabBar.tsx b/src/renderer/components/TabBar.tsx
index 5d5358707..a4568e9b2 100644
--- a/src/renderer/components/TabBar.tsx
+++ b/src/renderer/components/TabBar.tsx
@@ -1,7 +1,7 @@
import { useEffect, useMemo, useRef, useState, type DragEvent } from 'react'
import { createPortal } from 'react-dom'
import { useProjects } from '../state/projects'
-import { isOmniKanbanEnabled, useViewMode, viewFor } from '../state/viewMode'
+import { isOmniKanbanEnabled, toggleBoardView, useViewMode, viewFor } from '../state/viewMode'
import { useAgentStatus } from '../state/agentStatus'
import { useSettings } from '../state/settings'
import { accountsForProject, sshAccountsHint, systemAccountDisplay } from '../state/workspace'
@@ -415,21 +415,9 @@ export function TabBar({
aria-label={kanbanActive ? 'Canvas view' : 'Kanban view'}
onClick={(e) => {
e.stopPropagation() // a tab click switches projects, this flips the view
- const vm = useViewMode.getState()
- const settings = useSettings.getState().settings
- const omni = isOmniKanbanEnabled(settings)
- const asDefault = settings.omniKanbanAsDefault === true
- // Closing: the global overlay is exclusive, so any board toggle while
- // it is open closes it.
- if (vm.globalKanban) {
- vm.toggleGlobalKanban()
- return
- }
- if (omni && asDefault) {
- vm.toggleGlobalKanban()
- } else {
- vm.toggle(p.id)
- }
+ // One decision with ⌘⇧B and the menu (state/viewMode.ts): from any board
+ // to the canvas, from the canvas into the board.
+ toggleBoardView(p.id)
}}
>
{kanbanActive ? <IconCanvasView /> : <IconKanban />}
diff --git a/src/renderer/components/kanban/GlobalKanbanView.live.test.tsx b/src/renderer/components/kanban/GlobalKanbanView.live.test.tsx
index 46a8c33d3..90f5d1f59 100644
--- a/src/renderer/components/kanban/GlobalKanbanView.live.test.tsx
+++ b/src/renderer/components/kanban/GlobalKanbanView.live.test.tsx
@@ -16,6 +16,7 @@ import type { KanbanSession } from './KanbanView'
import { useProjects } from '../../state/projects'
import { useViewMode } from '../../state/viewMode'
import { useBoardLog } from '../../state/boardLog'
+import { useSettings } from '../../state/settings'
import { addColumn, defaultKanban } from '../../lib/kanban'
const localApi = { tag: 'local-api' }
@@ -162,3 +163,18 @@ describe("Omni overview — a lane's board belongs to its project's session", ()
for (const entry of appended) expect(entry.api).toBe(hostedApi)
})
})
+
+describe('Omni header — the scope switch replaces the close button', () => {
+ it('"This project" lands on the active project board, not the canvas', () => {
+ useSettings.setState((s) => ({ settings: { ...s.settings, omniKanbanEnabled: true } }))
+ useViewMode.setState({ globalKanban: true, viewByProject: { p1: 'canvas' } } as never)
+ mount([project('p1', [sticky('a', 'x')])])
+ expect(document.querySelector('.kanban-header__close')).toBeNull()
+ const thisProject = [...document.querySelectorAll('.kanban-scope-switch button')].find(
+ (b) => b.textContent === 'This project'
+ ) as HTMLElement
+ act(() => thisProject.click())
+ expect(useViewMode.getState().globalKanban).toBe(false)
+ expect(useViewMode.getState().viewByProject.p1).toBe('kanban')
+ })
+})
diff --git a/src/renderer/components/kanban/GlobalKanbanView.tsx b/src/renderer/components/kanban/GlobalKanbanView.tsx
index 886d6f896..c26c57364 100644
--- a/src/renderer/components/kanban/GlobalKanbanView.tsx
+++ b/src/renderer/components/kanban/GlobalKanbanView.tsx
@@ -14,7 +14,8 @@ import { SessionCard } from './SessionCard'
import { toKanbanSessionState } from '../../canvas/toKanbanSessionState'
import { createAgentNode, createBrowserNode, createStickyNode, createTerminalNode, flowToNodeStates, resolveNewNodeAccount } from '../../state/workspace'
import { markCanvasCovered } from '../../lib/canvasCovered'
-import { useViewMode } from '../../state/viewMode'
+import { showCanvas, useViewMode } from '../../state/viewMode'
+import { KanbanScopeSwitch } from './KanbanScopeSwitch'
import { sessionForProject } from '../../session/session'
import { isHostedReadOnly } from '../../state/hostedTeams'
import { activePermissionMode } from '../../state/permissionMode'
@@ -432,9 +433,11 @@ export const GlobalKanbanView = memo(function GlobalKanbanView({ live = null, on
window.dispatchEvent(new CustomEvent('nodeterm:global-set-icon', { detail: { projectId, nodeId, icon } }))
}, [])
- const onOpenNode = useCallback((nodeId: string, _projectId: string) => {
- const vm = useViewMode.getState()
- if (vm.globalKanban) vm.toggleGlobalKanban()
+ const onOpenNode = useCallback((nodeId: string, projectId: string) => {
+ // "Open on canvas" leaves the board for the OWNING project's canvas. Only clearing the scope
+ // would land on that project's own board whenever its view is the board, and focusNodeById
+ // then opens the card again instead of framing the node.
+ showCanvas(projectId)
// Let Canvas's focusNodeById handle project switching and canvas framing
setTimeout(() => window.dispatchEvent(new CustomEvent('nodeterm:focus-node', { detail: { nodeId } })), 50)
}, [])
@@ -442,7 +445,7 @@ export const GlobalKanbanView = memo(function GlobalKanbanView({ live = null, on
if (projects.length === 0) {
return (
<div className="kanban-overlay global-kanban" style={boardStyle}>
- <div className="kanban-header"><span className="kanban-header__name">All Projects — Kanban</span></div>
+ <div className="kanban-header"><span className="kanban-header__name">All Projects</span><KanbanScopeSwitch scope="all" /></div>
<div className="kanban-empty">No projects yet. Create a project to see its swimlane.</div>
</div>
)
@@ -452,14 +455,8 @@ export const GlobalKanbanView = memo(function GlobalKanbanView({ live = null, on
<div className="kanban-overlay global-kanban" ref={containerRef} style={boardStyle}>
<div className="kanban-header">
<span className="kanban-header__name">All Projects</span>
+ <KanbanScopeSwitch scope="all" />
<span className="kanban-swimlane__hint">{projects.length} projects — {mod}+1..{Math.min(9, projects.length)} to jump</span>
- <button
- className="kanban-header__close"
- title={`Back to canvas (${mod}+Shift+B)`}
- onClick={() => useViewMode.getState().toggleGlobalKanban()}
- >
- ✕
- </button>
</div>
<div className="global-kanban__scroll">
{projects.map((p, idx) => {
diff --git a/src/renderer/components/kanban/KanbanScopeSwitch.tsx b/src/renderer/components/kanban/KanbanScopeSwitch.tsx
new file mode 100644
index 000000000..54256c60a
--- /dev/null
+++ b/src/renderer/components/kanban/KanbanScopeSwitch.tsx
@@ -0,0 +1,40 @@
+import { useProjects } from '../../state/projects'
+import { useSettings } from '../../state/settings'
+import { isOmniKanbanEnabled, showAllProjectsBoard, showProjectBoard } from '../../state/viewMode'
+
+export type KanbanScope = 'project' | 'all'
+
+/**
+ * The board's scope: this project's board or every project's (Omni). Omni is a scope of the
+ * kanban side, so this switch — not a close button — is how the two boards reach each other;
+ * leaving the board for the canvas stays the view toggle's job (tab icon, ⌘⇧B). Renders nothing
+ * while the Omni feature is off, so a user who never enabled it sees the board exactly as before.
+ */
+export function KanbanScopeSwitch({ scope }: { scope: KanbanScope }): React.JSX.Element | null {
+ const omniEnabled = useSettings((s) => isOmniKanbanEnabled(s.settings))
+ if (!omniEnabled) return null
+ const options: { id: KanbanScope; label: string }[] = [
+ { id: 'project', label: 'This project' },
+ { id: 'all', label: 'All projects' }
+ ]
+ const choose = (next: KanbanScope): void => {
+ if (next === scope) return
+ if (next === 'all') showAllProjectsBoard()
+ else showProjectBoard(useProjects.getState().activeProjectId)
+ }
+ return (
+ <div className="kanban-source-filter kanban-scope-switch" role="group" aria-label="Board scope">
+ {options.map((option) => (
+ <button
+ key={option.id}
+ type="button"
+ className={scope === option.id ? 'kanban-source-filter__button is-active' : 'kanban-source-filter__button'}
+ aria-pressed={scope === option.id}
+ onClick={() => choose(option.id)}
+ >
+ {option.label}
+ </button>
+ ))}
+ </div>
+ )
+}
diff --git a/src/renderer/components/kanban/KanbanView.tsx b/src/renderer/components/kanban/KanbanView.tsx
index 07541f19a..d550c0ce2 100644
--- a/src/renderer/components/kanban/KanbanView.tsx
+++ b/src/renderer/components/kanban/KanbanView.tsx
@@ -1,3 +1,4 @@
+import { KanbanScopeSwitch } from './KanbanScopeSwitch'
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
import type { KanbanColumnCategory, KanbanLabel, KanbanSavedView, KanbanViewQuery, ProjectKanban } from '@shared/types'
import { deleteView, renameView, sameViewQuery, saveView, updateView, viewQuery } from '@shared/kanban-views'
@@ -995,6 +996,7 @@ export const KanbanView = memo(function KanbanView({
<div className="kanban-header">
<span className="kanban-header__dot" style={{ background: projectColor }} />
<span className="kanban-header__name">{projectName}</span>
+ <KanbanScopeSwitch scope="project" />
{progress && (
<span
className="kanban-progress"
diff --git a/src/renderer/state/viewMode.test.ts b/src/renderer/state/viewMode.test.ts
index ce8c21be0..05488970c 100644
--- a/src/renderer/state/viewMode.test.ts
+++ b/src/renderer/state/viewMode.test.ts
@@ -1,5 +1,17 @@
import { describe, it, expect, beforeEach, vi } from 'vitest'
-import { parseViewMap, useViewMode, isKanbanOpen, viewFor, openIssueOnBoard } from './viewMode'
+import {
+ parseViewMap,
+ useViewMode,
+ isKanbanOpen,
+ isGlobalKanbanOpen,
+ viewFor,
+ openIssueOnBoard,
+ showAllProjectsBoard,
+ showProjectBoard,
+ toggleAllProjectsBoard,
+ toggleBoardView
+} from './viewMode'
+import { useSettings } from './settings'
describe('parseViewMap', () => {
it('keeps canvas/kanban entries, tolerates garbage', () => {
@@ -85,3 +97,69 @@ describe('openIssueOnBoard (a node\'s #N chip)', () => {
expect(open).not.toHaveBeenCalled()
})
})
+
+describe('Omni is a scope of the kanban side, not a third view', () => {
+ const setOmni = (enabled: boolean, asDefault = false): void => {
+ useSettings.setState((s) => ({
+ settings: { ...s.settings, omniKanbanEnabled: enabled, omniKanbanAsDefault: asDefault }
+ }))
+ }
+ beforeEach(() => {
+ useViewMode.setState({ viewByProject: {}, defaultView: 'canvas', globalKanban: false })
+ setOmni(true)
+ })
+ const where = (projectId: string): 'canvas' | 'board' | 'omni' =>
+ isGlobalKanbanOpen() ? 'omni' : isKanbanOpen(projectId) ? 'board' : 'canvas'
+
+ it('the view toggle goes canvas → board → canvas', () => {
+ expect(toggleBoardView('p1')).toBe(true)
+ expect(where('p1')).toBe('board')
+ toggleBoardView('p1')
+ expect(where('p1')).toBe('canvas')
+ })
+
+ it('with Omni as default the view toggle opens the all-projects scope from the canvas', () => {
+ setOmni(true, true)
+ toggleBoardView('p1')
+ expect(where('p1')).toBe('omni')
+ })
+
+ it('the view toggle from Omni lands on the CANVAS even when the project view was its board', () => {
+ useViewMode.getState().setView('p1', 'kanban')
+ showAllProjectsBoard()
+ expect(where('p1')).toBe('omni')
+ toggleBoardView('p1')
+ expect(where('p1')).toBe('canvas')
+ })
+
+ it('leaving Omni through the scope switch lands on THIS project board, even from a canvas start', () => {
+ setOmni(true, true)
+ toggleBoardView('p1') // canvas → Omni
+ showProjectBoard('p1')
+ expect(where('p1')).toBe('board')
+ })
+
+ it('the dedicated command flips between the two scopes, never to the canvas', () => {
+ toggleAllProjectsBoard('p1')
+ expect(where('p1')).toBe('omni')
+ toggleAllProjectsBoard('p1')
+ expect(where('p1')).toBe('board')
+ toggleAllProjectsBoard('p1')
+ expect(where('p1')).toBe('omni')
+ })
+
+ it('a project switch while Omni is up keeps Omni (the scope is not per project)', () => {
+ showAllProjectsBoard()
+ expect(where('p2')).toBe('omni') // p2's own view is the canvas
+ })
+
+ it('does nothing Omni-shaped while the feature is off', () => {
+ setOmni(false, true)
+ expect(showAllProjectsBoard()).toBe(false)
+ expect(toggleAllProjectsBoard('p1')).toBe(false)
+ toggleBoardView('p1') // asDefault ignored while the feature is off
+ expect(where('p1')).toBe('board')
+ useViewMode.setState({ globalKanban: true }) // a stale persisted flag
+ expect(isGlobalKanbanOpen()).toBe(false)
+ })
+})
diff --git a/src/renderer/state/viewMode.ts b/src/renderer/state/viewMode.ts
index 481ea3911..b93521958 100644
--- a/src/renderer/state/viewMode.ts
+++ b/src/renderer/state/viewMode.ts
@@ -42,9 +42,12 @@ interface ViewModeState {
defaultView: ProjectView
setDefaultView(v: ProjectView): void
toggle(projectId: string): void
- /** Global swimlane overview — when true, kanban shows all projects as swimlanes instead of per-project tabs. */
+ /** Set a project's view explicitly (stored, so it overrides the default like `toggle`). */
+ setView(projectId: string, view: ProjectView): void
+ /** The board's SCOPE: true = all projects as swimlanes (Omni), false = the active project's
+ * board. Omni is a scope of the kanban side, not a third view — see `toggleBoardView`. */
globalKanban: boolean
- toggleGlobalKanban(): void
+ setGlobalKanban(on: boolean): void
/** Which swimlane is currently highlighted in the global overview (jump target). */
highlightedSwimlaneId: string | null
setHighlightedSwimlaneId(id: string | null): void
@@ -123,11 +126,19 @@ export const useViewMode = create<ViewModeState>((set) => ({
// the user just left, and firing it later would pop a card out of nowhere.
return { viewByProject: next, requestedCardNodeId: null, requestedIssue: null }
}),
- toggleGlobalKanban: () =>
+ setView: (projectId, view) =>
set((s) => {
- const next = !s.globalKanban
- saveGlobalKanban(next)
- return { globalKanban: next, requestedCardNodeId: null, requestedIssue: null, highlightedSwimlaneId: null }
+ if (s.viewByProject[projectId] === view) return s
+ const next: Record<string, ProjectView> = { ...s.viewByProject, [projectId]: view }
+ save(next)
+ return { viewByProject: next, requestedCardNodeId: null, requestedIssue: null }
+ }),
+ setGlobalKanban: (on) =>
+ set((s) => {
+ if (s.globalKanban === on) return s
+ saveGlobalKanban(on)
+ // Changing scope drops any unconsumed request, for the same reason `toggle` does.
+ return { globalKanban: on, requestedCardNodeId: null, requestedIssue: null, highlightedSwimlaneId: null }
})
}))
@@ -157,6 +168,71 @@ export function isGlobalKanbanOpen(): boolean {
return useViewMode.getState().globalKanban
}
+/**
+ * OMNI IS A SCOPE OF THE KANBAN SIDE, NOT A THIRD VIEW. The view toggle (tab icon, ⌘⇧B, the
+ * menu) flips canvas ⇄ board, and the board shows either this project or all projects. So:
+ * leaving Omni through the scope switch lands on THIS project's board, and the view toggle from
+ * Omni lands on the canvas. It used to be an overlay independent of the per-project view, so its
+ * close fell through to whatever the project's view happened to be — "Canvas view" from Omni
+ * could land on a board, and closing Omni opened from a board could land on the canvas.
+ *
+ * `globalKanban` stays independent of which project is active on purpose: Omni spans every
+ * project, and a project switch made from a lane (create a card there, open one) must not drop
+ * the user out of it because the new project's own view is the canvas.
+ *
+ * These are the only writers of `globalKanban`; TabBar, the menu IPC and the registry commands
+ * all come through here, so the decision exists once.
+ */
+
+/** Show the board with every project (Omni). No-op while the feature is off. */
+export function showAllProjectsBoard(): boolean {
+ if (!isOmniKanbanEnabled(useSettings.getState().settings)) return false
+ useViewMode.getState().setGlobalKanban(true)
+ return true
+}
+
+/** Show `projectId`'s own board — the scope switch's "This project", and where closing Omni lands. */
+export function showProjectBoard(projectId: string): void {
+ const vm = useViewMode.getState()
+ vm.setGlobalKanban(false)
+ if (projectId) vm.setView(projectId, 'kanban')
+}
+
+/** Leave the board entirely, whichever scope it shows, for `projectId`'s canvas. */
+export function showCanvas(projectId: string): void {
+ const vm = useViewMode.getState()
+ vm.setGlobalKanban(false)
+ if (projectId) vm.setView(projectId, 'canvas')
+}
+
+/**
+ * The view toggle (canvas ⇄ board). From any board it goes to the canvas; from the canvas it
+ * opens the board in the scope `omniKanbanAsDefault` picks. Returns false when there is nothing
+ * to toggle (no project and no Omni).
+ */
+export function toggleBoardView(projectId: string): boolean {
+ if (isGlobalKanbanOpen() || (projectId && isKanbanOpen(projectId))) {
+ showCanvas(projectId)
+ return true
+ }
+ const settings = useSettings.getState().settings
+ if (isOmniKanbanEnabled(settings) && settings.omniKanbanAsDefault === true) return showAllProjectsBoard()
+ if (!projectId) return false
+ showProjectBoard(projectId)
+ return true
+}
+
+/**
+ * The dedicated "All projects" command: from Omni back to this project's board, from anywhere
+ * else into Omni. False while the feature is off.
+ */
+export function toggleAllProjectsBoard(projectId: string): boolean {
+ if (!isOmniKanbanEnabled(useSettings.getState().settings)) return false
+ if (isGlobalKanbanOpen()) showProjectBoard(projectId)
+ else showAllProjectsBoard()
+ return true
+}
+
/**
* Show a GitHub issue from a node's `#N` chip. Only a board with GitHub sync can show it, so only
* then is the board brought up (the issue lane lives there) and asked to open it — toggling FIRST,
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 0ea7b8e11..4a99c9b7b 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -11348,21 +11348,6 @@ button.pull-checks__name {
border-color: var(--accent);
color: #fff;
}
-.kanban-header__close {
- margin-left: 12px;
- border: 0;
- background: rgba(var(--tint-rgb), 0.06);
- color: rgba(var(--tint-rgb), 0.6);
- width: 28px;
- height: 28px;
- border-radius: 6px;
- cursor: pointer;
- font-size: 14px;
-}
-.kanban-header__close:hover {
- background: rgba(var(--tint-rgb), 0.12);
- color: var(--text-strong);
-}
.kanban-empty {
padding: 40px 18px;
color: rgba(var(--tint-rgb), 0.5);