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.

fix(welcome): lay the two start-screen lists out under the card row, side by side

review4e08f95cb0b0
diff --git a/src/renderer/components/RecentConversations.tsx b/src/renderer/components/RecentConversations.tsx
index 0ae0236a8..a573a7456 100644
--- a/src/renderer/components/RecentConversations.tsx
+++ b/src/renderer/components/RecentConversations.tsx
@@ -36,7 +36,7 @@ export function RecentConversations({ items, actionFor, onResume, now }: RecentC
{groups.map((g) => (
<div key={g.cwd ?? '\0'} className="welcome__convs-group">
<div className="welcome__convs-folder" title={g.cwd ?? 'The history does not name a folder'}>
- {folderLabel(g.cwd)}
+ <span className="welcome__convs-folder-name">{folderLabel(g.cwd)}</span>
{g.cwd && <span className="welcome__recent-path">{g.cwd}</span>}
</div>
{g.items.map((conv) => {
diff --git a/src/renderer/components/WelcomeScreen.test.tsx b/src/renderer/components/WelcomeScreen.test.tsx
index ae10d294c..b1b06126c 100644
--- a/src/renderer/components/WelcomeScreen.test.tsx
+++ b/src/renderer/components/WelcomeScreen.test.tsx
@@ -139,3 +139,68 @@ describe('WelcomeScreen — Recently closed filter (issue #506)', () => {
expect(host.querySelector('.welcome__recent')).toBeNull()
})
})
+
+/**
+ * The two lists under the cards live in ONE container (`.welcome__lists`), which styles.css makes
+ * exactly as wide as the card row and splits into two columns. Before, each list was its own
+ * centered max-width box: the page read as a ragged, left-leaning column (#1062 follow-up). The CSS
+ * half is pinned in styles.welcome-layout.test.ts; this pins the half the CSS depends on — both
+ * sections are direct children of the same container, conversations first, and a section that is not
+ * drawn leaves no placeholder behind (`:only-child` is what lets the other span both columns).
+ */
+describe('WelcomeScreen — one container for both lists', () => {
+ let root: Root
+ let host: HTMLElement
+ beforeEach(() => {
+ host = document.createElement('div')
+ document.body.appendChild(host)
+ root = createRoot(host)
+ })
+ afterEach(() => {
+ act(() => root.unmount())
+ host.remove()
+ })
+ const render = async (el: React.ReactElement): Promise<void> => {
+ await act(async () => root.render(el))
+ }
+ const base = { onNewProject: noop, onOpenFolder: noop, onCloneRepo: noop, onConnectSsh: noop }
+ const recent = {
+ recentConversations: [
+ { agentId: 'claude' as const, sessionId: 's1', cwd: '/w', lastActiveAt: 1, title: 'Fix it', titleSource: 'prompt' as const }
+ ],
+ recentActionFor: () => ({ label: 'Resume' }),
+ onResumeRecent: noop
+ }
+ const closedProjects = [{ id: 'p1', name: 'Web', cwd: '/w' }]
+ const lists = (): HTMLElement => {
+ const el = host.querySelector<HTMLElement>('.welcome__lists')
+ expect(el, 'no .welcome__lists container').not.toBeNull()
+ return el!
+ }
+
+ it('puts Recent conversations and Recently closed side by side in the same container, in that order', async () => {
+ await render(<WelcomeScreen {...base} {...recent} closedProjects={closedProjects} />)
+ const kids = [...lists().children]
+ expect(kids).toHaveLength(2)
+ expect(kids[0].classList.contains('welcome__recent--convs')).toBe(true)
+ expect(kids[1].classList.contains('welcome__recent--closed')).toBe(true)
+ // The container sits after the card row, as a sibling — not inside it, not before it.
+ expect(lists().previousElementSibling?.classList.contains('welcome__cards')).toBe(true)
+ })
+
+ it('a lone section is the container’s only child, so it takes the full width', async () => {
+ await render(<WelcomeScreen {...base} closedProjects={closedProjects} />)
+ expect([...lists().children].map((c) => c.className)).toEqual(['welcome__recent welcome__recent--closed'])
+ await render(<WelcomeScreen {...base} {...recent} closedProjects={[]} />)
+ expect(lists().children).toHaveLength(1)
+ expect(lists().firstElementChild!.classList.contains('welcome__recent--convs')).toBe(true)
+ })
+
+ it('an empty conversation list leaves no element behind', async () => {
+ await render(<WelcomeScreen {...base} {...recent} recentConversations={[]} closedProjects={closedProjects} />)
+ expect(lists().children).toHaveLength(1)
+ await render(<WelcomeScreen {...base} />)
+ // `:empty` hides it — no stray 28px margin under the cards on a first-run screen.
+ expect(lists().childNodes).toHaveLength(0)
+ })
+})
diff --git a/src/renderer/components/WelcomeScreen.tsx b/src/renderer/components/WelcomeScreen.tsx
index 0ed1c2ce4..0d66caf24 100644
--- a/src/renderer/components/WelcomeScreen.tsx
+++ b/src/renderer/components/WelcomeScreen.tsx
@@ -168,89 +168,95 @@ export function WelcomeScreen({
</button>
</div>
- {recentConversations && recentActionFor && onResumeRecent && (
- <RecentConversations
- items={recentConversations}
- actionFor={recentActionFor}
- onResume={onResumeRecent}
- />
- )}
+ {/* One container exactly as wide as the card row, centered with it: Recent conversations on
+ the left, Recently closed on the right, stacked below the breakpoint. A section that is
+ not drawn leaves the other one the full width (`:only-child` in styles.css), never a
+ half-width column on one side. */}
+ <div className="welcome__lists">
+ {recentConversations && recentActionFor && onResumeRecent && (
+ <RecentConversations
+ items={recentConversations}
+ actionFor={recentActionFor}
+ onResume={onResumeRecent}
+ />
+ )}
- {closedProjects.length > 0 && (
- <div className="welcome__recent">
- <div className="welcome__recent-title">Recently closed</div>
- {/* Shown only past the visible-row cap: with three closed projects a filter box is
- in the way, and past six the list is already scrolling. */}
- {closedProjects.length > RECENT_FILTER_THRESHOLD && (
- <input
- className="welcome__recent-filter"
- placeholder="Filter by name or folder…"
- value={query}
- onChange={(e) => setQuery(e.target.value)}
- onKeyDown={(e) => {
- // Esc clears the box before it reaches the screen's own close handler; on an
- // empty box it falls through and still closes the screen.
- if (e.key !== 'Escape' || query === '') return
- e.preventDefault()
- e.stopPropagation()
- setQuery('')
- }}
- />
- )}
- <div className="welcome__recent-list">
- {visibleClosed.length === 0 && (
- <div className="welcome__recent-empty">No closed projects match “{query.trim()}”.</div>
- )}
- {visibleClosed.map((p) => (
- <div
- key={p.id}
- className="welcome__recent-item"
- role="button"
- tabIndex={0}
- title={p.cwd || p.name}
- onClick={() => onReopen?.(p.id)}
+ {closedProjects.length > 0 && (
+ <div className="welcome__recent welcome__recent--closed">
+ <div className="welcome__recent-title">Recently closed</div>
+ {/* Shown only past the visible-row cap: with three closed projects a filter box is
+ in the way, and past six the list is already scrolling. */}
+ {closedProjects.length > RECENT_FILTER_THRESHOLD && (
+ <input
+ className="welcome__recent-filter"
+ placeholder="Filter by name or folder…"
+ value={query}
+ onChange={(e) => setQuery(e.target.value)}
onKeyDown={(e) => {
- if (e.key === 'Enter' || e.key === ' ') onReopen?.(p.id)
+ // Esc clears the box before it reaches the screen's own close handler; on an
+ // empty box it falls through and still closes the screen.
+ if (e.key !== 'Escape' || query === '') return
+ e.preventDefault()
+ e.stopPropagation()
+ setQuery('')
}}
- >
- <ProjectGlyph
- icon={p.icon}
- color={p.color}
- name={p.name}
- variant="monogram"
- size={15}
- className="welcome__recent-mark"
- />
- <span className="welcome__recent-name" title={p.name}>{p.name}</span>
- {p.cwd && <span className="welcome__recent-path">{p.cwd}</span>}
- {(sessionCounts?.[p.id] ?? 0) > 0 && (
- <span
- className="welcome__recent-sessions"
- title={`${sessionCounts![p.id]} tmux session${
- sessionCounts![p.id] === 1 ? ' from this project is' : 's from this project are'
- } still running on this machine. Reopen the project to pick them up, or × to delete it and end them.`}
- >
- {sessionCounts![p.id]} running
- </span>
- )}
- {onDeleteClosed && (
- <button
- className="welcome__recent-del"
- title="Delete permanently (ends its sessions)"
- aria-label="Delete permanently"
- onClick={(e) => {
- e.stopPropagation()
- onDeleteClosed(p.id)
- }}
- >
- <IconClose />
- </button>
- )}
- </div>
- ))}
+ />
+ )}
+ <div className="welcome__recent-list">
+ {visibleClosed.length === 0 && (
+ <div className="welcome__recent-empty">No closed projects match “{query.trim()}”.</div>
+ )}
+ {visibleClosed.map((p) => (
+ <div
+ key={p.id}
+ className="welcome__recent-item"
+ role="button"
+ tabIndex={0}
+ title={p.cwd || p.name}
+ onClick={() => onReopen?.(p.id)}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' || e.key === ' ') onReopen?.(p.id)
+ }}
+ >
+ <ProjectGlyph
+ icon={p.icon}
+ color={p.color}
+ name={p.name}
+ variant="monogram"
+ size={15}
+ className="welcome__recent-mark"
+ />
+ <span className="welcome__recent-name" title={p.name}>{p.name}</span>
+ {p.cwd && <span className="welcome__recent-path">{p.cwd}</span>}
+ {(sessionCounts?.[p.id] ?? 0) > 0 && (
+ <span
+ className="welcome__recent-sessions"
+ title={`${sessionCounts![p.id]} tmux session${
+ sessionCounts![p.id] === 1 ? ' from this project is' : 's from this project are'
+ } still running on this machine. Reopen the project to pick them up, or × to delete it and end them.`}
+ >
+ {sessionCounts![p.id]} running
+ </span>
+ )}
+ {onDeleteClosed && (
+ <button
+ className="welcome__recent-del"
+ title="Delete permanently (ends its sessions)"
+ aria-label="Delete permanently"
+ onClick={(e) => {
+ e.stopPropagation()
+ onDeleteClosed(p.id)
+ }}
+ >
+ <IconClose />
+ </button>
+ )}
+ </div>
+ ))}
+ </div>
</div>
- </div>
- )}
+ )}
+ </div>
</div>
)
}
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 8bf51af8d..e01612655 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -4065,14 +4065,22 @@ body,
/* ---- Welcome / empty state ---- */
.welcome {
+ /* The card row's width — four 150px cards and three 14px gaps. The lists below take exactly
+ this width so their outer edges line up with the first and last card. */
+ --welcome-row: calc(4 * 150px + 3 * 14px);
position: absolute;
inset: 0;
z-index: 5;
display: flex;
flex-direction: column;
align-items: center;
- justify-content: center;
+ /* `safe`: when the content is taller than the window (stacked lists on a phone), start at the
+ top and scroll instead of centering the overflow off both edges where nothing can reach it. */
+ justify-content: safe center;
gap: 6px;
+ padding: 24px 16px;
+ box-sizing: border-box;
+ overflow-y: auto;
background: var(--canvas-bg);
}
@@ -4139,11 +4147,56 @@ body,
color: var(--accent);
}
-/* ---- "Recently closed" projects list on the start screen ---- */
-.welcome__recent {
- margin-top: 28px;
+/* ---- The lists under the cards: Recent conversations | Recently closed ----
+ ONE container as wide as the card row, centered with it (the page's flex column centers it).
+ Each section used to be its own centered max-width box, so the two lists had different widths
+ and neither lined up with the cards. Two equal columns; a lone section spans both. */
+.welcome__lists {
width: 100%;
- max-width: 480px;
+ max-width: var(--welcome-row);
+ margin-top: 28px;
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
+ column-gap: 14px;
+ row-gap: 28px;
+ align-items: start;
+}
+
+.welcome__lists:empty {
+ display: none;
+}
+
+.welcome__lists > :only-child {
+ grid-column: 1 / -1;
+}
+
+/* Below the card row's own width (642px + the 16px page gutters) the four cards no longer fit
+ on one line: they become a 2×2 grid as wide as the lists, and the lists stack in reading order
+ — Recent conversations, then Recently closed. Above it two ~314px columns always fit, because
+ the container IS the card row. */
+@media (max-width: 700px) {
+ .welcome__cards {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
+ width: 100%;
+ max-width: var(--welcome-row);
+ }
+
+ .welcome__card {
+ width: auto;
+ min-width: 0;
+ }
+
+ .welcome__lists {
+ grid-template-columns: minmax(0, 1fr);
+ }
+}
+
+/* ---- "Recently closed" projects list on the start screen ----
+ Every line in a section — title, folder headers, rows, "Show all" — puts its text 10px in from
+ the column edge, and trailing bits (age, action, ×) sit 10px in from the right edge. */
+.welcome__recent {
+ min-width: 0;
}
.welcome__recent-title {
@@ -4153,7 +4206,7 @@ body,
text-transform: uppercase;
color: var(--muted);
margin-bottom: 8px;
- padding-left: 2px;
+ padding: 0 10px;
}
/* Issue #506: shown only past RECENT_FILTER_THRESHOLD rows, where the list is already
@@ -4164,7 +4217,8 @@ body,
box-sizing: border-box;
margin-bottom: 6px;
font-size: 12px;
- padding: 5px 8px;
+ /* 9px + the 1px border = the shared 10px text inset. */
+ padding: 5px 9px;
background: var(--panel);
color: var(--text);
border: 1px solid var(--border);
@@ -4189,7 +4243,8 @@ body,
display: flex;
align-items: center;
gap: 8px;
- padding: 8px 10px;
+ /* 9px + the 1px (hover) border = the shared 10px text inset. */
+ padding: 8px 9px;
border-radius: 8px;
border: 1px solid transparent;
color: var(--text);
@@ -4294,13 +4349,24 @@ body,
display: flex;
align-items: baseline;
gap: 8px;
+ min-width: 0;
padding: 2px 10px;
font-size: 11px;
font-weight: 600;
color: var(--muted);
}
+.welcome__convs-folder-name {
+ flex: 0 1 auto;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
.welcome__convs-folder .welcome__recent-path {
+ flex: 1 1 0;
+ min-width: 0;
font-weight: 400;
}
@@ -4313,23 +4379,32 @@ body,
white-space: nowrap;
}
+/* Age and action share ONE slot at the row's right edge: the age at rest, the action on hover /
+ focus. An invisible-but-present action used to reserve its width after the age, so every
+ timestamp stopped short of the edge by a different amount ("Resume" vs "Go to node"). */
.welcome__conv-age {
flex: none;
+ margin-left: auto;
font-size: 11px;
color: var(--muted);
}
.welcome__conv-action {
+ display: none;
flex: none;
+ margin-left: auto;
font-size: 11px;
color: var(--accent);
- opacity: 0;
- transition: opacity 0.12s;
+}
+
+.welcome__conv:hover .welcome__conv-age,
+.welcome__conv:focus-visible .welcome__conv-age {
+ display: none;
}
.welcome__conv:hover .welcome__conv-action,
.welcome__conv:focus-visible .welcome__conv-action {
- opacity: 1;
+ display: inline;
}
.welcome__conv--disabled {
@@ -4342,8 +4417,10 @@ body,
}
.welcome__convs-more {
- margin-top: 4px;
+ display: block;
+ margin: 4px 0 0;
padding: 2px 10px;
+ text-align: left;
font-size: 11px;
color: var(--muted);
background: transparent;
diff --git a/src/renderer/styles.welcome-layout.test.ts b/src/renderer/styles.welcome-layout.test.ts
new file mode 100644
index 000000000..c08b1a055
--- /dev/null
+++ b/src/renderer/styles.welcome-layout.test.ts
@@ -0,0 +1,82 @@
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { join } from 'node:path'
+
+/**
+ * The start screen's lists line up with its card row (#1062 follow-up).
+ *
+ * MEASURED in headless Chrome against the real component + these rules (2000px window): the cards
+ * span x 679–1321 and so does `.welcome__lists`; Recent conversations is 679–993 and Recently closed
+ * 1007–1321; the section title, folder headers, row icons and "Show all" all start their text at
+ * 689. Before, both lists were separate 480px boxes (760–1240) and those four lines started at
+ * 2/10/11/~16px in. At 420px the card row overflowed the window; it is now a 2×2 grid at 16–404.
+ *
+ * Each rule below is one half of that, and every one is invisible in review: a `max-width` that
+ * drifts from the card math, or a dropped `:only-child`, restores a lopsided page with nothing
+ * failing. `\r\n` is normalized as in every other file-reading test here.
+ */
+const CSS = readFileSync(join(__dirname, 'styles.css'), 'utf8').replace(/\r\n/g, '\n')
+
+/** The body of a top-level multi-line rule (`.sel {` on its own line). */
+function rule(sel: string, from = 0): string {
+ const i = CSS.indexOf(`\n${sel} {\n`, from)
+ expect(i, `no rule for ${sel}`).toBeGreaterThan(-1)
+ return CSS.slice(i, CSS.indexOf('\n}', i))
+}
+
+describe('welcome screen: the lists share the card row’s width', () => {
+ it('derives the row width from the cards’ own width and gap', () => {
+ const card = rule('.welcome__card').match(/\n {2}width: (\d+)px;/)
+ const gap = rule('.welcome__cards').match(/gap: (\d+)px;/)
+ expect(card && gap).toBeTruthy()
+ expect(rule('.welcome')).toContain(`--welcome-row: calc(4 * ${card![1]}px + 3 * ${gap![1]}px);`)
+ })
+
+ it('makes .welcome__lists exactly that wide, as two equal columns', () => {
+ const lists = rule('.welcome__lists')
+ expect(lists).toContain('width: 100%')
+ expect(lists).toContain('max-width: var(--welcome-row)')
+ expect(lists).toContain('grid-template-columns: minmax(0, 1fr) minmax(0, 1fr)')
+ expect(lists).toContain('column-gap: 14px')
+ })
+
+ it('lets a lone section span both columns instead of sitting half-width on one side', () => {
+ expect(rule('.welcome__lists > :only-child')).toContain('grid-column: 1 / -1')
+ })
+
+ it('no section re-imposes its own narrower width', () => {
+ expect(rule('.welcome__recent')).not.toMatch(/max-width/)
+ })
+
+ it('stacks the lists and wraps the cards to the same width below the breakpoint', () => {
+ const at = CSS.indexOf('@media (max-width: 700px) {')
+ expect(at).toBeGreaterThan(-1)
+ const block = CSS.slice(at, CSS.indexOf('\n}', at))
+ expect(block).toMatch(/\.welcome__cards \{[^}]*max-width: var\(--welcome-row\)/)
+ expect(block).toMatch(/\.welcome__lists \{[^}]*grid-template-columns: minmax\(0, 1fr\);/)
+ })
+})
+
+describe('welcome screen: one left edge, one right edge per column', () => {
+ it('title, folder header and "Show all" inset their text 10px; bordered boxes 9px + 1px border', () => {
+ expect(rule('.welcome__recent-title')).toContain('padding: 0 10px')
+ expect(rule('.welcome__convs-folder')).toContain('padding: 2px 10px')
+ expect(rule('.welcome__convs-more')).toContain('padding: 2px 10px')
+ expect(rule('.welcome__recent-item')).toContain('padding: 8px 9px')
+ expect(rule('.welcome__recent-filter')).toContain('padding: 5px 9px')
+ })
+
+ it('the hidden row action does not reserve width beside the age', () => {
+ // An `opacity: 0` action kept its width, so every timestamp stopped short of the edge by a
+ // different amount. It is now out of the layout until hover/focus, when it replaces the age.
+ expect(rule('.welcome__conv-action')).toContain('display: none')
+ expect(rule('.welcome__conv-age')).toContain('margin-left: auto')
+ })
+
+ it('long folder names ellipsize', () => {
+ const name = rule('.welcome__convs-folder-name')
+ expect(name).toContain('min-width: 0')
+ expect(name).toContain('text-overflow: ellipsis')
+ expect(name).toContain('white-space: nowrap')
+ })
+})