Skip to content

Inbox: free layout of thread panes (behind inboxSplitView) - #3528

Draft
backnotprop wants to merge 10 commits into
mainfrom
feat/inbox-free-layout
Draft

backnotprop wants to merge 10 commits into
mainfrom
feat/inbox-free-layout

Conversation

@backnotprop

@backnotprop backnotprop commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Draft for the owner to try on a test Inbox before anything merges. Builds on #3477 (merged in, not rebased), so its commits show here too until it lands.

What it is

The free layout for several Inbox threads at once, behind the hidden switch inboxSplitView (config.json, off by default, no Settings row; the name stays from the two-pane form). Panes are placed by @pierre/layouts, vendored in packages/vendor-pierre-layouts/ (commit a745a6171d256822f895a06d5a3f0fdafda77d58, unchanged; its README says where it came from, how it is mirrored and how to check it against upstream).

There is no bar above the panes.

  • Open beside: a row's menu ("Open beside", right of the active pane), or drag the row from the list onto a pane: an edge (outer 28% / 30%) opens it there, the centre takes that pane's place. Targets and the tinted preview show only while dragging.
  • Rearrange: drag a pane by its header onto another pane's left, right, top or bottom half. Dividers resize (pointer and keyboard).
  • Menu ways (pane's ⋯, only beside other panes): Move pane left / right / up / down, Close pane. Focus stays in the moved pane; a polite live region says what moved where.
  • Close reflows the rest; the last pane is one thread, as today.
  • Remembered per browser tab (sessionStorage): threads, places, sizes, the active pane. A pane closes when its thread is deleted, archived while shown, or archived since the layout was kept.
  • Narrow window: each pane keeps 440 x 260 px. When the room beside the list is too small, the least recent panes step aside first (never the active one); below two columns (2 x 440 + gap) the active pane is alone. They come back in place when the window widens. Phones and stacked windows show one pane and never drag.
  • One active pane: keys, seen-on-sight and R go to it; a click or focus makes a pane active; new messages elsewhere stay new.
  • One drag system: packages/inbox/drag/threadDrag.ts holds sources and targets with layers (LAYER.pane 10, listEdge 20, reply 30). A thread carried over a pane's foot or reply box is declined by the pane, so a reply-box mention target (another branch) gets it.

Off, the Inbox is unchanged: twoSlots.test.tsx compares the off path to today's slot byte for byte.

Not in this PR

File tabs as a pane. How to add one: threads in panes/layoutModel.ts becomes contents by pane id (thread | file), PaneSlot draws by kind, and a file row registers as a drag source; the tree, verbs, room rules and drop target stay.

Notes

  • No Pi server change (the Inbox is Bun-only). No packages/ui change.
  • App.tsx shrank by 2 lines (ceiling lowered). New code is in packages/inbox/panes/ and packages/inbox/drag/ (only .ts in drag/, so no new @source).
  • Docs: inbox-window.md ("Free layout"), environment.md (inboxSplitView).

Perf

pn:record-refresh (event heard, list and open thread read, next frame drawn), compiled binary at 1920 px with the debug log on. Each row is 6 sent messages:

Panes Message lands in Median Max
1 the open thread 88.8 ms 102 ms
1 a thread not on screen 95.0 ms 102.2 ms
2 the active pane 88.8 ms 101.7 ms
2 the other pane 95.8 ms 101.2 ms
4 the active pane 90.0 ms 102.4 ms
4 another pane 93.6 ms 98.0 ms
4 a thread not on screen 96.9 ms 101.4 ms

The time stays flat from 1 to 4 panes: panes that are not active re-render only when their own thread changes (PaneBody memo on a digest).

e2e: inbox-open-beside.spec.ts

Records, catch-up, a linked machine's frames and held writes, a launched
session, the inbox refresh, the person's own writes and the stale-copy
re-read now read each thread a pane shows (panes/shownReads.ts), not only
the address's. Pick saves name the pane's own thread; Shift+R on a thread
refreshes the active pane's. App.tsx 6600 -> 6564 lines.
A hidden config.json key (inboxSplitView, default off, no Settings row)
lets a row's menu open its thread in a second pane beside the open one.
The two panes share the window as full screen does, each a ThreadSlot
with its own header, scroll, reply box and close. Only the active pane
counts what it shows as seen; a click or focus in the other makes it
active. Closing either pane is one pane again. A fixed 50/50 split with
one draggable divider. Offered only from 904 px wide (two 440 px thread
columns and the gutters); a narrower window collapses to one pane.

A pane the person leaves keeps showing its thread: useHeldThread takes
onScreen, so a copy already drawn is not hidden as an opening would.
- The thread title always sits in the pane's header bar (all users): the
  large in-body heading and the scroll-switched two-mode header are gone.
- Open beside: the list stays on the left and the two panes share the rest;
  offered only when the list and two 440 px threads fit beside the docked
  sidebar. The list's edge hides the list and the first pane's Inbox
  button brings it back; a pair that loses room covers the list.
…le name; Open beside's narrow check seeds its own rows
…for room

The item is offered whenever the list and two 440 px threads fit with the
sidebar folded (1292 px). Choosing it folds a docked sidebar that leaves too
little room, on screen only (the person's choice is not written), and
closing the second pane brings it back. A sidebar the person folded stays
folded. The on-screen fold moves out of App.tsx into panes/sidebarHold.ts.
Panes are placed by @pierre/layouts, vendored unchanged at a745a617 in
packages/vendor-pierre-layouts. A thread opens beside another from its
row menu or by dragging its row onto a pane (an edge opens it there, the
centre takes that pane's place); panes move by dragging their header
onto another's half, resize by the dividers, and the pane's ⋯ menu moves
and closes them. No bar above the panes.

The layout is kept per browser tab, closes panes whose thread is deleted
or archived while shown, and gives way in a narrow window (the least
recent panes step aside, below two columns the active one is alone).
One drag system (drag/threadDrag.ts) holds sources and targets with
layers, so a reply box's mention target can sit above the panes.

Off, the Inbox is unchanged (a byte-for-byte test).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant