Skip to content

feat(workspace): simplify thread tabs and the file toolbar - #711

Merged
nixuuu merged 2 commits into
feat/workspace-v3-1from
feat/workspace-v3-2
Nov 14, 2026
Merged

nixuuu merged 2 commits into
feat/workspace-v3-1from
feat/workspace-v3-2

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 14, 2026

Copy link
Copy Markdown
Member

Change

Stage 2 of the workspace v3 redesign, based on stage 1.

Tabs.

  • Thread is always visible as the first tab.
  • The other tabs fill the row around the active one, which keeps its full name (up to 12 rem) while the others truncate first.
  • A +N chip lists the rest, with full paths and unsaved marks, only when they do not fit.
  • The header has no + and no permanent ⌄ tab menu.
  • Delete closes a focused tab, double-click keeps a preview, and the roving tabindex is unchanged.

File toolbar.

  • One 40 px row: the path (muted directory, emphasised name, both selectable), Source/Rendered for Markdown, and Edit. While editing, Discard changes/Stop editing and Save file take the same place.
  • One ⋯ menu holds Keep tab, Reload, Go to line, Copy path, Copy text, Open in default app, the tab actions (Move left/right, Close tab, Close other tabs, Close saved tabs) and, last after a separator, Delete file.
  • The repeated file name and the two identical copy buttons are gone.
  • copyText is now one shared clipboard helper.

Related: #640

Verification

  • Checks as in stage 1 (typecheck, lint, format, web build) on this head.
  • In the browser, with the bench workspace fixture: 4 kept tabs at 1100 px dark and light show Thread, the long-named tab truncated, the active tab-1.ts in full, and +2. The overflow menu lists the hidden tabs. The file menu order and the disabled states (Move left on the first tab, Close other tabs with one tab) were checked.

Copy audit (§8)

Before After Reason
Render Markdown / View source Segmented Source / Rendered (label View) Shows the state, not a toggle verb.
Delete file button in the bar Delete file last in File actions, after a separator Destructive action away from view toggles. No ellipsis, because §2 reserves it for ongoing actions.
Switch tab (N) button with a menu, plus Search and commands +N chip (N more tabs), menu More tabs Exists only on overflow. Search stays in the thread menu and the palette.
two copy icons Copy path, Copy text menu items Verb-first labels.
Reload, Keep tab, Go to line buttons same labels, now menu items Unchanged wording.

No new error or empty-state texts. Checked with short, long and very long file names at 1440, 1100 and 390 px.

@nixuuu
nixuuu added this pull request to stack #713 November 14, 2026 11:54
Thread is always visible as the first tab. The other tabs fill the row
around the active one, which keeps its full name, and a +N chip lists
the rest only when they do not fit. The header has no plus and no
permanent tab menu any more.

A file shows one row with its path, Source and Rendered for Markdown,
Edit (Save and Discard in the same place while editing) and one menu
for everything else, from Keep tab and Go to line to the tab actions,
with Delete file last.

Related: #640
@nixuuu
nixuuu force-pushed the feat/workspace-v3-2 branch from 10d9917 to 2903de8 Compare November 14, 2026 11:59
@nixuuu
nixuuu marked this pull request as ready for review November 14, 2026 12:39
@nixuuu
nixuuu merged commit a993e18 into dev Nov 14, 2026
17 of 19 checks passed
@nixuuu
nixuuu deleted the feat/workspace-v3-2 branch November 14, 2026 12:40
nixuuu added a commit that referenced this pull request Nov 14, 2026
nixuuu added a commit that referenced this pull request Nov 14, 2026
nixuuu added a commit that referenced this pull request Nov 14, 2026
Files panel and file tab view: one stable frame. Before this, opening a
file made the tree add and drop a "Loading files…" row, notices pushed
the text down, and the text reflowed when highlighting arrived.

## What changed
**Tree (web, mobile shares the domain fix)**
- A refresh of a directory that already has entries adds no row.
Watch-triggered revalidation used to append `Loading files…` after every
open. The directory row shows a spinner in its chevron slot; for the
root, the spinner sits in a reserved slot in the panel header. A state
row now appears only for a directory's first read (as a skeleton row
where its entries will appear) or for a next page, in place of `Load
more` under the same key.
- First load: skeleton rows on the tree grid, also while the tree chunk
loads (with the header strip).
- Git status, live-update status and errors are a pill over the bottom
of the list. The list gets bottom scroll room, so rows never move.
- Rows: `density-chrome`, a fixed chevron slot, folder/folder-open/file
icons, indentation guides, inset rounded hover/selected, a fixed
status-letter slot, truncated names. Extracted to `WorkspaceTreeRow` /
`WorkspaceTreeSkeleton`.

**File view**
- One 40px bar for every file type. The path holds the left edge and
controls keep their order from the right. `Source`/`Rendered` is shown
from the file name (disabled until the text loads), so it no longer pops
in.
- Notices (`Plain text` + `Enable highlighting`, preparing a large file,
`Showing the first 2 MB`, line outside the preview + `Go to line`,
`Unsaved changes`, watch status) are one compact pill in the bar
(`FileNoticePill`), with the full sentence in its tooltip. In a narrow
bar it shows the icon and a short action; at phone width the action
moves to the `⋯` menu and Edit becomes an icon. Conflict and error
banners stay, because they need a decision.
- The reader fixes its frame from the first paint, using one pass over
the text (`@canopy/syntax/layout`: line count, longest line, UTF-8
size). The gutter is at least 3 digits, so files up to 999 lines share
one width, and longer files get their width from the known count. The
plain-text decision and the scroll height no longer change when indexing
finishes. Highlighting only recolours.
- `Preparing the file…` appears only when indexing takes more than 300
ms.
- The reader module is loaded once for all tabs, so a loaded tab mounts
in the same frame (no empty `{#await}` flash). A file that is still
loading shows an empty surface, then, after 300 ms, skeleton lines on
the reader grid. Text fades in with `t-rise`. Reduced motion is
respected.
- Polish: 8px text inset, `bg-surface` behind both the gutter and the
text, subtle line numbers, a selection colour, and a `path:31` range
with a tinted gutter and a 2px accent marker.

**Mobile**: the reader's notices and the tree's status and errors became
an overlay pill. The plain-text decision is known before indexing. This
is JS-only: the iOS/Android fingerprints match `dev` (`138e0c6…`,
`906dc94…`).

## Layout-shift measurements
The fixture repo has 10 files, opened by clicking in the tree in this
order: AGENTS.md (4 lines), CHANGENOTES.md (260 KB, plain), CLAUDE.md
(modified), CURRENT_TASK.md, PROGRESS.md (1,500 lines), README.md,
yarn.lock (864 KB lockfile), logo.png, src/app.ts, src/generated.ts
(12,000 lines). Measured in Chromium per click over 2.5 s:
- `layout-shift` entries are summed, including those with
`hadRecentInput`.
- rAF sampling covers the first line's y, the text x and the bar height
(all within the same document), the tree row count and the last row's y.

| Run | CLS sum | First-line y moves | Text x moves | Bar height changes
| Tree row-count changes | Last tree row moves |
| --- | --- | --- | --- | --- | --- | --- |
| dev, dark, 1440 | 0.137 | 60 px | 45 px | 0 | 28 | 1120 px |
| **this PR**, dark, 1440 | **0** | **0** | **0** | 0 | **0** | **0** |
| dev, light, 1100 | 0.203 | 40 px | 23 px | 0 | 27 | 1184 px |
| **this PR**, light, 1100 | **0** | **0** | **0** | 0 | **0** | **0** |

Text x still changes between two different files when one has ≥1000
lines (a wider gutter). Within a file it never changes.

## Browser review
Done on a review machine with a disposable stack and fixture repo, both
removed afterwards. It covered light and dark at 1440 and 1100, and
phone at 390:
- small, large (plain), markdown (Source/Rendered), lockfile, binary,
image and long files;
- a `31-33` highlight;
- Files sheet on phone.

Not in this PR's scope: at 390 px the thread header's active tab name
overlaps the `Files` button. That belongs to the header/tabs, not the
file view.

## Copy audit (docs/copy.md §8)
| Before | After | Reason |
| --- | --- | --- |
| `Large files are shown as plain text to keep them responsive.` (row) |
Pill `Plain text`, same sentence in the tooltip | Short state label; the
sentence is kept |
| `Enable highlighting` | Same; `Highlight` in a narrow bar | Verb
first; a short form for limited width |
| `Preparing the rest of the file…` | `Preparing the file…` | Shorter;
one idea |
| `Showing the first 2 MB. This file is read only.` (row) | Pill
`Showing the first 2 MB`, full text in the tooltip | Docs term kept |
| `This line is outside the preview. Choose a visible line.` (row) |
Pill `Line outside the preview` + `Go to line`, full text in the tooltip
| The action replaces the instruction |
| `Unsaved changes` (row while editing) | Same text, as the pill | No
text change |
| `Loading files…` (row) | Skeleton row, same text for screen readers |
No visible text change |

The glossary is unchanged. Every new button starts with a verb, and no
fact is repeated. Short and long paths were checked at desktop and phone
widths. Status letters keep their accessible labels.

## Checks
- `bun install`, `gen:check`, `typecheck`, `lint`, `format:check`:
clean.
- Tests: `packages/syntax/src/layout.test.ts` (new, pure layout logic),
`tests/integration/thread-directory.test.ts` and
`tests/integration/thread-watch.test.ts` pass.
- The web build passes.
- `expo export` passes for iOS and Android.
- I did not run the full `check:tmp`.

Related: #640, #711
nixuuu added a commit that referenced this pull request Nov 14, 2026
Long active file names could extend outside the workspace tab strip and
overlap Files at phone widths. The non-shrinking active tab was
introduced in #711.

The title now gives space to tabs first. Thread keeps its slot, file
names truncate within the available strip, and extra tabs collapse into
+N using a rem-based width budget. Files uses an icon with an accessible
name and tooltip below 40 rem. Its slot and the existing thread actions
stay fixed when tabs open or close. The responsive Files control is
extracted into WorkspaceFilesToggle; workspace documentation reflects
the behavior.

Fixes: #711

### Validation

- Passed with nice and TMPDIR under /var/tmp: bun install, bun run
typecheck (including Svelte: 0 errors/warnings), bun run lint, bun run
format:check, bun run --filter @canopy/web build. Ran bun run format
after edits.
- Browser review against a disposable remote stack: light and dark at
320, 390, 768, 1100 and 1440 px, plus 1920 px bounds. Checked
short/typical/164-character titles, 11 kept file tabs, the long active
filename, Thread and its summary pill. No page-level horizontal
overflow; active tabs stay inside the strip.
- Files x positions before/after closing/reopening a tab were unchanged:
280, 350, 684.5, 1016.5, 1356.5 and 1836.5 px respectively at
320/390/768/1100/1440/1920 px. The +N menu selects the long file and
returns focus to its visible tab.
- No UI test suites added or run. Review servers, database container,
tunnel and temporary directories cleaned up.

### Copy audit (§8)

Files text button → Files icon-only on phones; the same English
accessible name is preserved and becomes the tooltip. Desktop copy is
unchanged. No new error or empty-state text. Checked short and long
labels at phone and desktop widths; the icon is not the only accessible
cue.

Based on dev including #734. #735 was still open during validation; its
files-view changes are not included in this PR.
nixuuu added a commit that referenced this pull request Nov 14, 2026
The thread header now separates project and action chrome from a rounded
tab surface that continues into thread and file content. Tabs gain
quieter inactive surfaces, separators, reserved close slots, hover
feedback and reduced-motion-aware transitions while retaining #737
overflow behaviour.

Windows and Linux use custom window controls (`titleBarStyle: hidden`,
no native title-bar overlay); they inherit the chrome palette and retain
the existing reserved width. macOS keeps left traffic lights.
Summary-card internals and column centring are unchanged.

Related: #711, #737

Validation passed: `bun install`, `bun run typecheck`, `bun run lint`,
`bun run format:check`, and `bun run --filter @canopy/web build`. The
final CSS adjustment was rechecked with web typecheck, lint,
format:check and the web build. Checks ran with `nice` and private
temporary files outside the repository.

Browser review used a disposable remote stack, isolated database and
synthetic files, constrained to one CPU. Light/dark, Thread + three file
tabs, active file, 390 px phone, 640/768/1024/1440 px, short/long names,
overflow selection, summary and Files were reviewed. Header bounds
stayed at y=0 / height=48 before and after tab switches at every
measured width; page scroll width matched the viewport. Hovering an
inactive tab preserved its label bounds. Opaque reverse corners were
reviewed at DPR 1 and actual DPR 2 (2880×1800 PNGs for a 1440×900
viewport). Browser development mode emitted the existing `derived_inert`
warnings on both base and changed code, with no errors in the completed
review.

Windows/Linux browser simulation rendered the actual custom controls:
header and controls resolved to the same chrome colour, with a 120 px
reserve. With Files open that reserve moved to the panel's header.
Computed app regions were `drag` on the header and `no-drag` on tab
buttons; the macOS simulation retained an 88 px left clearance with the
sidebar hidden. These checks do not exercise a native Electron window.

PNG screenshots are retained outside git in
`/var/tmp/canopy-tabs-shots/`:
`{before,after}-{light,dark}-{1440,390}-{thread,file}.png`, plus
`after-{light,dark}-1440-{thread,file}-2x.png`, summary/Files captures
and Windows/Linux/macOS simulations. The path index is `paths.txt` in
that directory. The disposable stack and review directory are cleaned
after capture.

No UI test suites were added or run. Copy audit: not applicable; no
user-facing text changed. The documentation update describes the new
surfaces only.

Native manual checks before merge:

1. Windows/Linux: drag from empty left/right chrome; tab buttons, close
buttons, menus and Files must stay clickable without dragging.
2. Minimize, maximize/restore and close; verify the Close red hover,
light/dark appearance changes and alignment after zoom/fullscreen
changes.
3. Open/close Files and the sidebar; window controls must retain chrome
backing and never overlap action buttons.
4. macOS: traffic-light alignment and dragging with the sidebar
open/closed, including zoom/fullscreen changes.
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