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): remember the card modal's comments-panel choice

enese3474842f33f
diff --git a/src/renderer/components/kanban/CardModal.tsx b/src/renderer/components/kanban/CardModal.tsx
index 9e212859f..3138cd169 100644
--- a/src/renderer/components/kanban/CardModal.tsx
+++ b/src/renderer/components/kanban/CardModal.tsx
@@ -4,6 +4,7 @@ import { isTopDialog, nextDialogId, popDialog, pushDialog } from '../dialog-stac
import { IconChat, IconMic, IconSearch } from '../icons'
import { ContextMeter } from '../ContextMeter'
import { useAgentStatus } from '../../state/agentStatus'
+import { useCardPanel } from '../../state/cardPanel'
import { useSession } from '../../session/session'
import type { ProjectKanban } from '@shared/types'
import type { KanbanSession } from './KanbanView'
@@ -43,8 +44,10 @@ export function CardModal({ session, columnTitle, board, onChangeBoard, onClose,
const [searchOpen, setSearchOpen] = useState(false)
const agentSessionId = useAgentStatus((st) => st.byId[session.id]?.sessionId)
const [naming, setNaming] = useState(false)
- // Comments & activity panel: OPEN by default in the modal; the header 💬 collapses it.
- const [panelOpen, setPanelOpen] = useState(true)
+ // Comments & activity panel: OPEN by default in the modal; the header 💬 collapses it. The
+ // choice is remembered (localStorage) — once collapsed, later cards open collapsed too.
+ const panelOpen = useCardPanel((s) => s.open)
+ const togglePanel = useCardPanel((s) => s.toggle)
const isTerminal = session.kind === 'terminal'
const isBrowser = session.kind === 'browser'
@@ -161,7 +164,7 @@ export function CardModal({ session, columnTitle, board, onChangeBoard, onClose,
className="kanban-modal__action"
title={panelOpen ? 'Hide comments & activity' : 'Show comments & activity'}
aria-pressed={panelOpen}
- onClick={() => setPanelOpen((v) => !v)}
+ onClick={togglePanel}
>
<IconChat />
</button>
diff --git a/src/renderer/state/cardPanel.test.ts b/src/renderer/state/cardPanel.test.ts
new file mode 100644
index 000000000..1498df1a9
--- /dev/null
+++ b/src/renderer/state/cardPanel.test.ts
@@ -0,0 +1,21 @@
+import { describe, it, expect } from 'vitest'
+import { parseCardPanelOpen, useCardPanel } from './cardPanel'
+
+describe('parseCardPanelOpen', () => {
+ it('defaults to open, remembers only an explicit close', () => {
+ expect(parseCardPanelOpen(null)).toBe(true)
+ expect(parseCardPanelOpen('true')).toBe(true)
+ expect(parseCardPanelOpen('garbage')).toBe(true)
+ expect(parseCardPanelOpen('false')).toBe(false)
+ })
+})
+
+describe('toggle', () => {
+ it('flips the panel and keeps the flag in the store', () => {
+ expect(useCardPanel.getState().open).toBe(true)
+ useCardPanel.getState().toggle()
+ expect(useCardPanel.getState().open).toBe(false)
+ useCardPanel.getState().toggle()
+ expect(useCardPanel.getState().open).toBe(true)
+ })
+})
diff --git a/src/renderer/state/cardPanel.ts b/src/renderer/state/cardPanel.ts
new file mode 100644
index 000000000..6016f03c4
--- /dev/null
+++ b/src/renderer/state/cardPanel.ts
@@ -0,0 +1,42 @@
+import { create } from 'zustand'
+
+// Whether the kanban card modal opens with its comments & activity panel expanded — PERSONAL,
+// per machine: persisted in localStorage, deliberately never in the git-shared
+// .nodeterm/project.json (same rule as the view mode).
+//
+// Open is the default, so a fresh install still shows the feed the first time. Only an explicit
+// close/open is remembered: once the user collapses the panel, every card they open afterwards
+// (this session and after a restart) comes up collapsed until they expand it again.
+
+export const CARD_PANEL_KEY = 'nodeterm.cardCommentsOpen'
+
+/** Parses the persisted flag. Anything missing or unparseable means open (the default). */
+export function parseCardPanelOpen(raw: string | null): boolean {
+ return raw !== 'false'
+}
+
+function save(open: boolean): void {
+ try {
+ localStorage.setItem(CARD_PANEL_KEY, open ? 'true' : 'false')
+ } catch {
+ /* quota/private-mode: the panel state is a nicety, never fail the UI */
+ }
+}
+
+interface CardPanelState {
+ open: boolean
+ setOpen(open: boolean): void
+ toggle(): void
+}
+
+export const useCardPanel = create<CardPanelState>((set, get) => ({
+ // localStorage guard: this module is also imported by node-environment vitest suites.
+ open: parseCardPanelOpen(
+ typeof localStorage === 'undefined' ? null : localStorage.getItem(CARD_PANEL_KEY)
+ ),
+ setOpen: (open) => {
+ if (typeof localStorage !== 'undefined') save(open)
+ set({ open })
+ },
+ toggle: () => get().setOpen(!get().open)
+}))