Add canvas pane size selector (1:1 / 2:1)#87
Merged
Merged
Conversation
Add a CanvasSize option (Ratio1To1 default, Ratio2To1) alongside the canvas dock position. Two buttons in the pane header toggle between 1:1 (even split) and 2:1, where the open pane takes two-thirds of the layout. The choice persists to global config and is restored on first load, mirroring the existing position selector.
…ggle button Merge the identical .canvas-size-group CSS into .canvas-pos-group, and factor positionButton/sizeButton onto a shared toggleButton helper.
There was a problem hiding this comment.
Pull request overview
This PR adds a size selector to the canvas pane header, letting users choose between a 1:1 (even split, default) and 2:1 (canvas takes two-thirds of the layout) ratio when the pane is open. It cleanly threads a new CanvasSize domain type through the Shared, Server, and Client layers, persists the choice in global config (mirroring the existing CanvasPosition plumbing), and reflects the choice via a canvas-size-2to1 CSS layout class. A small refactor factors the position and size buttons onto a shared toggleButton helper and merges their CSS selectors.
Changes:
- New
CanvasSizeDU (Ratio1To1|Ratio2To1) added toDashboardResponse,IWorktreeApi, and persisted server-side viareadCanvasSize/writeCanvasSize. - Client wiring:
SetCanvasSizemessage,CanvasUpdate.setCanvasSize,CanvasState.CanvasSize,1:1/2:1buttons, and acanvas-size-2to1layout class applied inApp.fs. - CSS, spec docs, and the
ArchiveTestsJSON fixture updated for the new field.
Show a summary per file
| File | Description |
|---|---|
| src/Shared/Types.fs | Adds CanvasSize DU and threads it into DashboardResponse and IWorktreeApi. |
| src/Server/WorktreeApi.fs | Adds read/writeCanvasSize persistence and updates both API implementations and getWorktrees. |
| src/Server/DemoFixture.fs | Sets CanvasSize default on the base dashboard fixture. |
| src/Client/AppTypes.fs | Adds the SetCanvasSize message. |
| src/Client/App.fs | Applies size from response on first load and builds the canvas-size-* layout class. |
| src/Client/CanvasState.fs | Adds CanvasSize field with Ratio1To1 default. |
| src/Client/CanvasUpdate.fs | Adds setCanvasSize update + persistence command. |
| src/Client/CanvasView.fs | Wires SetSize callback and passes size to CanvasPane.view. |
| src/Client/CanvasPane.fs | Adds size buttons and factors a shared toggleButton helper. |
| src/Client/index.html | Adds canvas-size-2to1 flex rule and merges position/size CSS selectors. |
| src/Tests/ArchiveTests.fs | Updates dashboard JSON fixture with the CanvasSize field. |
| docs/spec/canvas-pane.md | Documents the new size selector. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 1
- Review effort level: Medium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When open, the canvas pane could only ever take half the layout. For doc-heavy work the fixed 50/50 split is often too cramped for the canvas, with no way to give it more room.
Changes
Adds a size selector to the canvas header, beside the existing position selector. It offers
1:1(default, even split) and2:1(the open pane takes two-thirds of the layout), and the choice persists in global config.CanvasSizetype inShared/Types.fs(Ratio1To1|Ratio2To1), threaded throughDashboardResponseandIWorktreeApi.Server/WorktreeApi.fs(readCanvasSize/writeCanvasSizeagainst thecanvasSizeconfig key), mirroring howCanvasPositionis stored;DemoFixture.fsand the read-only/fixture APIs updated.SetCanvasSizemessage,CanvasUpdate.setCanvasSize, theCanvasState.CanvasSizefield, and1:1/2:1buttons inCanvasPane.fs(App.fsapplies the layout class).index.html: acanvas-size-2to1rule giving the pane66.667%flex, reusing the existing position-button styling.docs/spec/canvas-pane.md.The second commit simplifies the feature: it merges the duplicate
.canvas-size-groupCSS into.canvas-pos-group, and factors the position/size buttons onto one sharedtoggleButtonhelper.Tests
dotnet build src/Client/Client.fsproj— succeeds, 0 warnings / 0 errors.dotnet test src/Tests/Tests.fsproj --filter "Category=Fast"— 959 passed, 0 failed.ArchiveTestsdashboard JSON fixture updated for the newCanvasSizefield.