Skip to content

refactor(ui): split the publication wizard into a module with one file per step (#3096) - #3099

Merged
jgregoriorincon merged 2 commits into
opengeos:mainfrom
jgregoriorincon:refactor/3096-wizard-module
Nov 27, 2026
Merged

jgregoriorincon merged 2 commits into
opengeos:mainfrom
jgregoriorincon:refactor/3096-wizard-module

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Splits crates/ui-egui/src/publicationwizard.rs (907 lines) into the module publicationwizard/, so the steps still to come can be added in separate files. Nothing changes in the app.

  • mod.rs: Step, Orientation, Draft, the window (show), what several steps share, a #[cfg(test)] mod harness with the test helpers, and the tests that cross steps.
  • size.rs, style.rs, texts.rs, accent.rs, review.rs: one step each, with the tests of that step.

Items are moved whole. The only edits are the mod and use lines each file needs, pub(super) on the step functions and the test helpers, a one-line module comment per new file, and the harness wrapper. Review with git diff --color-moved=dimmed-zebra.

Testing

  • On the move commit: format, clippy, the workspace tests, doctests, the layer check and cargo xtask schema --check all passed.
  • On the head, after moving two imports: format and cargo clippy -p rustgis-ui-egui --all-targets -- -D warnings clean; cargo nextest run -p rustgis-ui-egui -E 'test(publicationwizard)': 19 passed, the same 19 tests as before the move; cargo check -p rustgis-web --target wasm32-unknown-unknown passed.

UI evidence

No visible UI change.

Related issue

Closes #3096

Summary by CodeRabbit

  • New Features
    • The publication wizard now guides you through selecting a page size and orientation, choosing a style, entering publication text, customizing the accent colour, and reviewing your choices before continuing.
    • Text fields for titles, subtitles, notes, sources, and credit lines have character limits, with a notice shown when a limit is reached.
    • Accent colours follow the selected style until customized; custom colours are retained when changing styles.
    • Figure layouts can be created from the size step, and orientation controls are unavailable for figures.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The publication wizard’s size, style, text, accent, and review steps now have separate modules. Shared helpers and test setup remain in the main module. Step-specific UI and tests are organized with the corresponding steps.

Changes: Publication wizard module split

Layer / File(s) Summary
Module split and shared test setup
crates/ui-egui/src/publicationwizard/mod.rs, crates/ui-egui/src/publicationwizard/*
The main module declares the five step modules and retains shared helpers. A shared test harness replaces duplicated setup, and inline step implementations are removed from the main module.
Size and style steps
crates/ui-egui/src/publicationwizard/mod.rs, crates/ui-egui/src/publicationwizard/size.rs, crates/ui-egui/src/publicationwizard/style.rs
The size step presents page and publication profile options, orientation controls, and figure-specific behavior. The style step lists styles and updates an uncustomized accent when the selected style changes.
Text and accent steps
crates/ui-egui/src/publicationwizard/mod.rs, crates/ui-egui/src/publicationwizard/texts.rs, crates/ui-egui/src/publicationwizard/accent.rs
The text step tracks title edits, enforces text limits, and disables the credit field when no credit line is selected. The accent step initializes and remembers custom colours in relation to the selected style.
Review step
crates/ui-egui/src/publicationwizard/mod.rs, crates/ui-egui/src/publicationwizard/review.rs
The review step displays size and, for non-figures, orientation, style, text, credit, and accent. Figure reviews display a caption note.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Possibly related issues

  • opengeos/RustGIS#2850 — This issue describes the five-step wizard that this change organizes into separate modules.

Possibly related PRs

  • opengeos/RustGIS#3056 — It changes accent re-seeding and default credit behavior in the wizard code moved into the step modules.
  • opengeos/RustGIS#3041 — It introduces accent, credit, and text-limit behavior that this change moves into separate step modules.
  • opengeos/RustGIS#2875 — It creates the wizard steps that this change splits across module files.

Suggested reviewers: ninhhaidang

Merge Risk: Minimal · up to 9de78

This is a structural split of the publication wizard into per-step modules with no intended behavior change. No actionable merge-blocking risk is evident, and the reported test count matches the pre-move count.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the publication wizard is refactored from a single file into a module with one file per step. It is specific and matches the changeset and the linked issue. Its length…
Description check Passed The description covers the Summary, Testing, and Related issue sections, and it explains the split and the verification steps. The UI evidence section states 'No visible UI change.', which the templat…
Linked Issues check Passed Issue #3096 asks for the 907-line publicationwizard.rs to become a publicationwizard/ module with no behaviour change. At the reviewed head, the module contains mod.rs, accent.rs, review.rs,…
Out of Scope Changes check Passed The changes are limited to the module split that #3096 requests. They consist of moved items, mod/use lines, pub(super) visibility on step functions and test helpers, one-line module comments, t…
Full details: Title check

Explanation

The title names the main change: the publication wizard is refactored from a single file into a module with one file per step. It is specific and matches the changeset and the linked issue. Its length (87 characters) is acceptable, and it includes a PR number, which is minor.

Full details: Description check

Explanation

The description covers the Summary, Testing, and Related issue sections, and it explains the split and the verification steps. The UI evidence section states 'No visible UI change.', which the template allows when no visible change exists. The description lists the moved files and the test results, so it is mostly complete.

Full details: Linked Issues check

Explanation

Issue #3096 asks for the 907-line publicationwizard.rs to become a publicationwizard/ module with no behaviour change. At the reviewed head, the module contains mod.rs, accent.rs, review.rs, size.rs, style.rs and texts.rs. mod.rs keeps Step, Orientation, Draft, show, the shared helpers (hex, size_label, step_name, figure_note, style_accent, default_credit, field_width), the constants, a #[cfg(test)] mod harness with the test helpers, and the cross-step tests. Each of the five steps (size_step, style_step, texts_step, accent_step, review_step) lives in its own file, and each file holds that step's tests. The step functions are pub(super), which the issue allows. The step bodies in show are dispatched through the same calls. The PR states that moved items are unchanged, that the test count stays at 19, and that the touched-file checks passed. I did not re-run those checks. The diff for mod.rs shows a new file because per-path diff does not follow the rename; the removed step code and tests are present in the step files per the file summaries. Requirement coverage: the file split, the per-step test placement, and the no-behaviour-change constraint are all met on the evidence reviewed.

Full details: Out of Scope Changes check

Explanation

The changes are limited to the module split that #3096 requests. They consist of moved items, mod/use lines, pub(super) visibility on step functions and test helpers, one-line module comments, the harness wrapper for test helpers, and the two imports fixed on the head. No new product behaviour appears in the reviewed mod.rs code or in the per-file summaries. The harness module and its pub(super) helpers exist only to share test setup across the split files, which supports the split. No unrelated file is listed in the changed scope.

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

A rabbit hops through modules bright,
Five little steps now sit just right.
The colours rest where picks belong,
Text stays trimmed and fields stay strong.
The review sums up the page,
Then hops away across the stage.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 8f636fc7-a590-46e2-a586-355075ea5b03
Commits

Reviewing files that changed from the base of the PR and between c7e0f6b and 9de78dd.

Files selected for processing: 6

  • crates/ui-egui/src/publicationwizard/accent.rs
  • crates/ui-egui/src/publicationwizard/mod.rs
  • crates/ui-egui/src/publicationwizard/review.rs
  • crates/ui-egui/src/publicationwizard/size.rs
  • crates/ui-egui/src/publicationwizard/style.rs
  • crates/ui-egui/src/publicationwizard/texts.rs

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

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no defects in this PR. It moves publicationwizard.rs into a publicationwizard/ module with one file per step, and I could not compile it here because I have no shell. The findings below come from reading the diff against the current source.

Bugs: none found. Confidence high.

  • Every moved step and test body matches the removed text, apart from pub(super) and the new use lines.
  • mod.rs no longer references MAX_PUBLICATION_TEXT or PUBLICATION_STYLES, and the remaining imports (PAGES, PUBLICATION_PROFILES, Tokens, Value, json, NodeT, Role, vec2) are all still used there, so no unused-import warnings are expected.
  • Each step file imports what it uses. The helpers they call (size_label, field_width, hex, default_credit, figure_note, style_accent) stay in mod.rs, and use super::* reaches them.
  • The #[cfg(test)] mod harness helpers resolve from the sibling test modules.
  • Nine #[test] functions were removed from mod.rs and nine were added across the step files, so the test count is unchanged.

Security: none. The change adds no input handling and no I/O.

Performance: none. Behaviour is unchanged.

Quality: none worth an inline comment. The only item I noticed is that some test modules repeat use super::harness::*; use super::*;, which is the intended pattern.

AGENTS.md: no violations found.

  • No new user-visible strings were added, and the tl! and i18n::fmt literals are unchanged, so the catalogs need no edit.
  • Nothing refers to the old publicationwizard.rs path except the module declaration in lib.rs and the dialogs.rs references, which still resolve.
  • No cfg, command, schema, asset, or wasm-relevant code changed.

Twins checked: not applicable. This is a refactor with no change in behaviour, so no format read route, overlay tool, add or open command, or wasm/desktop branch needed the same change.

Prior reviews: none existed on this PR, so no earlier concerns were left alone.

Not verified: build, clippy, and tests. The author's description reports them passing on the head commit, which I have not re-run.

Change size

Compared: the whole PR against main (merge base bf02b5d to PR head 9de78dd).

Measure Value
Files changed 6 (added 5, modified 0, removed 0, renamed 1)
Size before 39.9 KB (40,842 B)
Size after 41.2 KB (42,188 B)
Total size change +1.3 KB (+1,346 B)
Path Before After Change
crates/ui-egui/src/publicationwizard/mod.rs 39.9 KB 22.4 KB -17.5 KB
crates/ui-egui/src/publicationwizard/accent.rs 0 B 6.4 KB +6.4 KB
crates/ui-egui/src/publicationwizard/texts.rs 0 B 4.7 KB +4.7 KB
crates/ui-egui/src/publicationwizard/review.rs 0 B 2.6 KB +2.6 KB
crates/ui-egui/src/publicationwizard/style.rs 0 B 2.6 KB +2.6 KB
crates/ui-egui/src/publicationwizard/size.rs 0 B 2.5 KB +2.5 KB

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3099/
Web app https://preview.rustgis.app/pr-3099/app/
Commit 9de78dd

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 27, 2026
Merged via the queue into opengeos:main with commit ac78a68 Nov 27, 2026
28 checks passed
@jgregoriorincon
jgregoriorincon deleted the refactor/3096-wizard-module branch November 27, 2026 09:56
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.

[Feature]: Split the Publication Layout Wizard into a module with one file per step, with no change in behaviour

1 participant