Skip to content

ui: let an embedding host leave out the New sheet button - #4337

Open
liby wants to merge 1 commit into
storytold:mainfrom
liby:feat/host-chrome-new-sheet
Open

liby wants to merge 1 commit into
storytold:mainfrom
liby:feat/host-chrome-new-sheet

Conversation

@liby

@liby liby commented Nov 16, 2026 •

Copy link
Copy Markdown

Adds Chrome::new_sheet next to title_bar and file_tab. It defaults to true, so nothing changes for GridCraft itself.

We show workbooks read-only in a file preview. The sheet tabs are still how people move between sheets there, but the (+) after them offers a change the preview can't keep. With new_sheet: false the button and its gap are not drawn, and the tabs take that room up to the split handle.

Only the button goes. Shift+F11, Insert Sheet in the ribbon and the tab menu, and home.insertSheet still add sheets. The tab menu also offers Delete, Rename, Move or Copy and Hide, so refusing just the insert would not make the structure read-only. A protected workbook structure already refuses these in the engine, and a host-controlled read-only session is being worked on in #2354 and #2788. #3858 makes the same choice for the ribbon.

#3858 also adds a field to Chrome, so whichever merges second has a one-line conflict on the field, Default, the ?chrome=none literal and the end of host_chrome.rs. This PR writes the existing Chrome literals with ..Default::default(), so a later field won't need to touch them.

Tests: two in host_chrome.rs and one in tab_split.rs. The button and layout tests fail against main's tabs.rs; the Shift+F11 test pins that only the button is left out. cargo test -p gridcraft-ui-egui, cargo fmt --check, cargo clippy -p gridcraft-ui-egui -p gridcraft-web --all-targets -- -D warnings and cargo xtask wasm pass, except three ui-egui tests that fail the same way on main on a machine without craft-fonts (missing glyphs). I haven't run the full cargo xtask ci.

Summary by CodeRabbit

  • New Features
    • The New Sheet (+) button can now be hidden. It remains visible by default, and keyboard shortcuts for creating sheets continue to work when it is hidden.
  • Bug Fixes
    • When the New Sheet button is hidden, the tab strip can use the space it would otherwise occupy.
    • Choosing “none” for the chrome option hides the title bar and File tab while retaining other default chrome settings.

`Chrome::new_sheet`, on by default, lets a host that shows a workbook
without changing it (a file preview, say) drop the (+) after the sheet
tabs: the one editing button in a bar the viewer still needs for
switching sheets. Without the button the tabs take its room.

Only the button goes. Shift+F11, Insert Sheet in the ribbon and the tab
menu, and `home.insertSheet` still add sheets: the ribbon and tab menu
offer more structure edits than this one, a host driving commands may
add sheets itself, and refusing structure changes is already what a
workbook with its structure protected does in the engine. So unlike the
File tab, whose Backstage is UI only, nothing behind the button is
blocked.

The existing `Chrome` literals now fill the rest from the default, so
they keep compiling as fields are added.
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Chrome adds a new_sheet setting that controls the New sheet button. When the button is disabled, the tab strip omits its width and allows the tabs to use that space. Other sheet-creation commands, including Shift+F11, remain available.

Changes: Configurable New Sheet Control

Layer / File(s) Summary
Chrome setting and defaults
crates/ui-egui/src/services.rs, apps/gridcraft-web/src/web.rs
Chrome adds new_sheet, which defaults to true. The web “none” option uses Chrome::default() for fields it does not set.
Tab strip behavior and validation
crates/ui-egui/src/tabs.rs, crates/ui-egui/tests/it/host_chrome.rs, crates/ui-egui/tests/it/tab_split.rs
The New sheet button and its insertion action are conditional on new_sheet. The tab-width calculation accounts for whether the button is shown. Tests cover default visibility, hiding the button, Shift+F11, and tab alignment.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: hectorviov, echelon, aiongg

Merge Risk: Minimal · up to ee198

This adds an opt-in setting that lets a host hide the New sheet button. Default behavior is unchanged, and other sheet-insertion paths remain available. No actionable merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title says an embedding host can leave out the New sheet button. The changeset adds a Chrome::new_sheet flag, defaulting to true, that hides the New sheet (+) button in tabs.rs. Tests cover the …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title says an embedding host can leave out the New sheet button. The changeset adds a Chrome::new_sheet flag, defaulting to true, that hides the New sheet (+) button in tabs.rs. Tests cover the default display, hiding the button, and Shift+F11 still adding a sheet. The title names the main change and its purpose.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 19f07f3 and ee198c6.

Files selected for processing: 5

  • apps/gridcraft-web/src/web.rs
  • crates/ui-egui/src/services.rs
  • crates/ui-egui/src/tabs.rs
  • crates/ui-egui/tests/it/host_chrome.rs
  • crates/ui-egui/tests/it/tab_split.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

emrahoksak pushed a commit to emrahoksak/girdcraft- that referenced this pull request Nov 18, 2026

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