Repository navigation
feat(layout): expose layout.publication defaults and text limit to the wizard (#2874) - #3041
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| let default = style_accent(&d.style, app_accent); | ||
| if !ticked { | ||
| d.picked = d.accent; | ||
| d.picked = d.accent.filter(|&c| c != default); |
There was a problem hiding this comment.
Stale colour remembered after a style change while the box is ticked (about 70% confident).
style_step changes d.style but leaves d.accent alone. So with Banner selected, ticking the box sets accent to Banner's brown. If the user then picks Poster while the box is still ticked, accent stays Banner's brown. Unticking then runs d.picked = d.accent.filter(|&c| c != default) with Poster's default, which keeps Banner's brown as a "custom" colour. The next time the box is ticked, d.picked.unwrap_or(default) gives Banner's colour rather than the new style's accent. That is the stale-colour case this PR says it fixes, and the new test accent_starts_from_the_chosen_styles_own_colour does not cover a style change while ticked.
A possible fix is to re-seed accent when the style changes, for example if accent equals the previous style's default, set it to the new style's default. Also add a test for that path.
Category: bug
| } | ||
|
|
||
| /// The accent step: the style's own colour, or one picked. | ||
| fn accent_step(ui: &mut egui::Ui, d: &mut Draft, app_accent: egui::Color32) { |
There was a problem hiding this comment.
The credit line's English template is no longer a wrapped literal.
The old code was tl!("Made with RustGIS · today's date"), so the whole line could be translated. Now "Made with RustGIS · {date}" comes from a const in the engine and reaches i18n::fmt unwrapped. The catalog extraction (see docs/i18n.md) only sees tl!/tl_raw! literals, so this key never gets a catalog entry and the line stays English in every language. The wizard should keep the template wrapped in its own tl_raw!, with a test (the existing default_credit_matches_the_engines_constant) tying it to PUBLICATION_DEFAULT_CREDIT, so the translator can see the wording.
Category: agents-md
Code reviewI read the full diff, the base-branch AGENTS.md, and the surrounding code (the Bugs
Security
Performance
Quality
AGENTS.md
Checked and not raised
Change sizeCompared with main (merge base e185e02 to PR head 26b57a0). Sizes are file sizes, not line counts.
|
📖 Docs previewCommit |
Summary
Expose
layout.publication's defaults and text limit fromrustgis-engineand use them in the Publication Layout Wizard so the UI stays in sync with the engine instead of hard-coding copies or falling back to the app accent:crates/engine/src/cmd/layout.rs:PUBLICATION_DEFAULT_CREDIT("Made with RustGIS · {date}"),MAX_PUBLICATION_TEXT(2000), andpublication_style_accent(style: &str) -> Option<Rgba>besidePUBLICATION_STYLES.Style::parsebetweenpublication_style_accentandlayout.publication, and usePUBLICATION_DEFAULT_CREDITwhen"author"is omitted.crates/ui-egui/src/publicationwizard.rs:publication_style_accent(&d.style)(falling back to the app accent only for unknown style ids), and update the checkbox hover text. Unticking without changing away from the style's own accent leaves no stale custom colour remembered so switching styles starts from the new style's accent.default_credit()fromi18n::fmt(PUBLICATION_DEFAULT_CREDIT, &[("date", tl_raw!("today's date"))])for both the Texts hint and the Review row.Title,Subtitle,Note,Sources,Credit line) with.char_limit(MAX_PUBLICATION_TEXT)and show a weak notice (Each field takes at most 2000 characters.) when any active field reaches the limit.Reach every surface
rustgis-ui-egui's Publication Layout Wizard (wasm32-unknown-unknownchecked cleanly).layout.publicationalready enforced these defaults and limits).ui-touch): does not expose the desktop Publication Layout Wizard.edit.undo.Testing
cargo test -p rustgis-engine --lib publication_defaults_match_the_command— verifies every style inPUBLICATION_STYLESreturns an opaque accent (unknown returnsNone), omittedauthorwritesPUBLICATION_DEFAULT_CREDIT, andMAX_PUBLICATION_TEXTmatches the exact acceptance/rejection boundary.cargo test -p rustgis-ui-egui --lib publicationwizard::tests(18/18 passed), including 3 new tests:accent_starts_from_the_chosen_styles_own_colourtexts_enforce_the_engines_character_limit_and_say_sodefault_credit_matches_the_engines_constantcargo test -p rustgis-engine --lib command_surface_matches_the_snapshot&hostile_params_never_panic(8/8 passed)cargo test -p rustgis-ui-egui --test command_ids(2/2 passed)cargo fmt --all --check,cargo clippy --all-targets -- -D warnings(all 9 changed/dependent packages),cargo xtask layers,cargo xtask attribution,cargo xtask rows(768/768),cargo xtask test-hygieneRUSTFLAGS='-D warnings' cargo check --locked --target wasm32-unknown-unknown -p rustgis-webui_shot.UI evidence
Verified with headless
ui_shotscreenshots of the Publication Layout Wizard:Made with RustGIS · today's datefromPUBLICATION_DEFAULT_CREDIT; clean fields show no extra limit text, while reaching2000characters caps input and displaysEach field takes at most 2000 characters..Bannerselected, ticking Pick a colour of your own initializes the colour swatch to Banner's deep brown (#4A3426) instead of the app's blue accent (#2563EB).Credit line: Made with RustGIS · today's dateandAccent: #4A3426.Related issue
Closes #2874
Summary by CodeRabbit