fix(ui): add text wrapping to error/warning message displays#617
fix(ui): add text wrapping to error/warning message displays#617thepastaclaw wants to merge 3 commits intodashpay:v1.0-devfrom
Conversation
📝 WalkthroughWalkthroughReplaces many inline label/error renders with wrap-enabled Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
1e2d16d to
4ac4058
Compare
There was a problem hiding this comment.
Actionable comments posted: 5
♻️ Duplicate comments (9)
src/ui/tokens/set_token_price_screen.rs (2)
1175-1181: Duplicate: user-facing error text must use MessageBanner.Same issue as Line 522—please render this via MessageBanner. As per coding guidelines: “User-facing messages must use the
MessageBannercomponent fromsrc/ui/components/message_banner.rs, with global banners rendered byisland_central_panel().”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/tokens/set_token_price_screen.rs` around lines 1175 - 1181, The error display currently builds an egui::Label with RichText (RichText::new(format!("Error: {}", msg)).color(error_color))—replace this user-facing message with the MessageBanner component: create a MessageBanner containing the same formatted error text (using msg and error_color) instead of egui::Label and render it via the central banner approach (island_central_panel/global banners). Locate the block that constructs the Label in set_token_price_screen (the variables msg and error_color are present) and instantiate MessageBanner with the error content so it is shown through the standard banner rendering path.
565-571: Duplicate: user-facing error text must use MessageBanner.Same issue as Line 522—please render this via MessageBanner. As per coding guidelines: “User-facing messages must use the
MessageBannercomponent fromsrc/ui/components/message_banner.rs, with global banners rendered byisland_central_panel().”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/tokens/set_token_price_screen.rs` around lines 565 - 571, The user-facing error is rendered with egui::Label (the ui.add(egui::Label::new(...)) call) but must use the project's MessageBanner component instead; replace this Label usage in set_token_price_screen (the block that shows "X Some tiers have invalid values") with the MessageBanner error variant (consistent with the earlier fix at the other occurrence around line 522) so global banners render via island_central_panel and follow the MessageBanner API from src/ui/components/message_banner.rs.src/ui/identities/keys/key_info_screen.rs (5)
499-501: Duplicate: user-facing error text must use MessageBanner.Same issue as Line 259—please render this via MessageBanner. As per coding guidelines: “User-facing messages must use the
MessageBannercomponent fromsrc/ui/components/message_banner.rs, with global banners rendered byisland_central_panel().”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/identities/keys/key_info_screen.rs` around lines 499 - 501, Replace the direct egui::Label user-facing error rendering with the MessageBanner component: inside the code that currently calls ui.add(egui::Label::new(format!("Error: {}", e)).wrap()) (in key_info_screen), construct and display a MessageBanner error variant using the same error text (use the MessageBanner API in src/ui/components/message_banner.rs, e.g. the error/banner constructor provided) instead of egui::Label; ensure the banner is created where the UI expects local banners or routed into island_central_panel() if it must be shown as a global banner so it follows the app-wide banner rendering conventions.
435-437: Duplicate: user-facing error text must use MessageBanner.Same issue as Line 259—please render this via MessageBanner. As per coding guidelines: “User-facing messages must use the
MessageBannercomponent fromsrc/ui/components/message_banner.rs, with global banners rendered byisland_central_panel().”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/identities/keys/key_info_screen.rs` around lines 435 - 437, The error label UI currently uses egui::Label::new(format!("Error: {}", e)).wrap() which duplicates a prior violation; replace it with the MessageBanner component from src/ui/components/message_banner.rs so the user-facing error is rendered as a banner (matching the earlier fix at the other occurrence around line 259). Locate the code that adds the label (the ui.add call in key_info_screen.rs) and construct a MessageBanner instance containing the error text (including the error variable e) and add/render that instead; ensure global banners remain handled via island_central_panel() as per guidelines.
290-296: Duplicate: user-facing error text must use MessageBanner.Same issue as Line 259—please render this via MessageBanner. As per coding guidelines: “User-facing messages must use the
MessageBannercomponent fromsrc/ui/components/message_banner.rs, with global banners rendered byisland_central_panel().”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/identities/keys/key_info_screen.rs` around lines 290 - 296, Replace the direct egui::Label that renders the error (the block that creates egui::RichText::new(format!("Error: {}", e)).color(...)) with the MessageBanner component so user-facing errors use the centralized banner UI; pass the error text (format!("Error: {}", e) or the same string variable) into MessageBanner (e.g., MessageBanner::error or MessageBanner::new with error severity) and ensure you add it to the same UI area that island_central_panel() expects for global banners, matching the same change made at the earlier duplicate location around the key info screen.
444-450: Duplicate: user-facing error text must use MessageBanner.Same issue as Line 259—please render this via MessageBanner. As per coding guidelines: “User-facing messages must use the
MessageBannercomponent fromsrc/ui/components/message_banner.rs, with global banners rendered byisland_central_panel().”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/identities/keys/key_info_screen.rs` around lines 444 - 450, Replace the egui::Label user-facing message in the key info UI with the MessageBanner component: instead of adding egui::Label::new(RichText::new("Key is in encrypted wallet")), construct a MessageBanner (using the same pattern as the earlier instance in this module) containing the "Key is in encrypted wallet" text and add it to the UI where banners are rendered (use the global banner area / island_central_panel or the existing banner container). Use the MessageBanner API from src/ui/components/message_banner.rs so the message appears as a user-facing banner rather than a plain label.
508-514: Duplicate: user-facing error text must use MessageBanner.Same issue as Line 259—please render this via MessageBanner. As per coding guidelines: “User-facing messages must use the
MessageBannercomponent fromsrc/ui/components/message_banner.rs, with global banners rendered byisland_central_panel().”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/identities/keys/key_info_screen.rs` around lines 508 - 514, Replace the direct egui::Label rendering of the user-facing string "Key is in encrypted wallet" with the MessageBanner component (use the error/danger variant) so the message is rendered via the global banner system; locate the block that currently calls ui.add(egui::Label::new(egui::RichText::new("Key is in encrypted wallet")...)) in key_info_screen and swap it to construct and show a MessageBanner (using MessageBanner::... with the same text) so it flows through the island_central_panel()/global banners as per the existing MessageBanner usage elsewhere.src/ui/tokens/update_token_config.rs (2)
1124-1130: Duplicate: user-facing error text must use MessageBanner.Same issue as Line 595—please render this via MessageBanner. As per coding guidelines: “User-facing messages must use the
MessageBannercomponent fromsrc/ui/components/message_banner.rs, with global banners rendered byisland_central_panel().”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/tokens/update_token_config.rs` around lines 1124 - 1130, Replace the direct egui::Label error rendering with the MessageBanner component: instead of ui.add(egui::Label::new(RichText::new(format!("Error: {}", msg))...)), construct and display a MessageBanner (using the existing MessageBanner type in src/ui/components/message_banner.rs) populated with the msg (and styled as error) and ensure it is displayed via the global banner rendering path (island_central_panel()) rather than an inline Label; update the code around the current occurrence (where msg and error_color are referenced) to create a MessageBanner instance and call the appropriate method to enqueue/show it through island_central_panel().
636-641: Duplicate: user-facing error text must use MessageBanner.Same issue as Line 595—please render this via MessageBanner. As per coding guidelines: “User-facing messages must use the
MessageBannercomponent fromsrc/ui/components/message_banner.rs, with global banners rendered byisland_central_panel().”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/tokens/update_token_config.rs` around lines 636 - 641, Replace the raw egui::Label that shows self.text_input_error with the MessageBanner component: locate the ui.add(...) call rendering egui::RichText of self.text_input_error in the update_token_config UI code and instantiate MessageBanner with the same error text (e.g., MessageBanner::new(self.text_input_error.clone()) or the project's MessageBanner error constructor), use the appropriate error/style variant, and add/show that banner instead of the label so user-facing error text uses the central MessageBanner system (consistent with island_central_panel global banners).
🧹 Nitpick comments (7)
src/ui/wallets/create_asset_lock_screen.rs (1)
618-624: ConsiderDashColors::error_color(dark_mode)for dark-mode consistency.
egui::Color32::DARK_REDis hardcoded and won't adapt in dark mode.dark_modeis already in scope from line 334, and other files changed in this PR useDashColors::error_color(dark_mode)instead.🎨 Proposed fix for dark-mode-aware color
if let Some(error_message) = self.error_message.as_ref() { ui.add( egui::Label::new( egui::RichText::new(error_message) - .color(egui::Color32::DARK_RED), + .color(DashColors::error_color(dark_mode)), ) .wrap(), );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/wallets/create_asset_lock_screen.rs` around lines 618 - 624, Replace the hardcoded egui::Color32::DARK_RED used when building the error label with the dark-mode-aware color helper: call DashColors::error_color(dark_mode) when constructing the RichText in the UI code that creates the error label (the block that references error_message and ui.add with egui::Label::new and egui::RichText::new). Ensure dark_mode (already in scope) is passed to DashColors::error_color so the label color adapts to theme.src/ui/wallets/add_new_wallet_screen.rs (1)
898-898: Error label missing color styling — inconsistent with the rest of the PR.Every other screen changed in this PR wraps a
RichTextwithDashColors::ERROR(orerror_color(dark_mode)). Here the label is plain text with no color applied, which is visually inconsistent and misses the intent of the broader fix.🎨 Proposed fix to apply consistent error color
- ui.add(egui::Label::new(error_message).wrap()); + ui.add( + egui::Label::new( + egui::RichText::new(error_message).color(DashColors::ERROR), + ) + .wrap(), + );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/wallets/add_new_wallet_screen.rs` at line 898, The error label is added as plain text (ui.add(egui::Label::new(error_message).wrap())) and needs to use a colored RichText to match the PR styling; replace the plain Label content with a RichText-colored label (use DashColors::ERROR or error_color(dark_mode) depending on surrounding code) so the call becomes a Label created from RichText::new/error_color and keep .wrap() to preserve wrapping; update the use site in the add_new_wallet_screen logic where error_message is rendered (around the block that currently calls ui.add(egui::Label::new(error_message).wrap())).src/ui/identities/withdraw_screen.rs (1)
649-668: NearbyErrorMessagearm still uses non-wrappingRichTextinside aFrame.The
WithdrawFromIdentityStatus::ErrorMessagerendering at line 660 usesRichText::new(...)directly as aui.label()argument (no.wrap()), making it susceptible to the same overflow for long error messages. This was out of scope of the PR change at lines 186–192, but worth addressing for completeness.🎨 Proposed fix to add wrap to the ErrorMessage arm
- ui.label( - RichText::new(format!("Error: {}", msg)).color(error_color), - ); + ui.add( + egui::Label::new( + RichText::new(format!("Error: {}", msg)).color(error_color), + ) + .wrap(), + );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/identities/withdraw_screen.rs` around lines 649 - 668, The ErrorMessage arm for WithdrawFromIdentityStatus uses RichText::new(...) passed to ui.label without wrapping, which can overflow for long messages; update the block handling WithdrawFromIdentityStatus::ErrorMessage (the code building the Frame and calling ui.label) to use RichText::new(format!("Error: {}", msg)).wrap(true) (or call .wrap() as appropriate) so the error text wraps inside the Frame, keeping the Dismiss button accessible and avoiding layout overflow.src/ui/identities/add_new_identity_screen/mod.rs (1)
1104-1130: Inline error rendering should useMessageBannerinstead of a customFrame/label pattern.This screen (and others in this PR) renders user-facing error messages inline via a custom styled
Frame+Labelpattern rather than the project-standardMessageBannercomponent. All screens across this PR share the same deviation.Migrating to
MessageBanner(rendered globally byisland_central_panel()) would centralize the styling, accessibility, and dismiss behavior in one place and ensure consistency across all screens.Based on learnings: "User-facing messages must use the
MessageBannercomponent fromsrc/ui/components/message_banner.rs, with global banners rendered byisland_central_panel()"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/identities/add_new_identity_screen/mod.rs` around lines 1104 - 1130, Replace the custom Frame/Label inline error rendering (the block that checks self.error_message and draws a styled egui::Frame with a "Dismiss" button) with the project-standard MessageBanner usage: stop drawing the inline frame and instead set/clear the shared/global banner state so island_central_panel() can render it via MessageBanner (use the same error text from self.error_message and preserve dismiss behavior by clearing that shared banner when dismissed). Locate the logic around self.error_message in this module and wire it to the existing MessageBanner/global banner API (the MessageBanner component in src/ui/components/message_banner.rs and the island_central_panel() rendering path) rather than rendering a local Frame.src/ui/tokens/tokens_screen/token_creator.rs (3)
74-83: Coding guideline: error displays should use theMessageBannercomponent.Per the project's coding guidelines, "User-facing messages must use the
MessageBannercomponent fromsrc/ui/components/message_banner.rs, with global banners rendered byisland_central_panel()." The inlineegui::Frame+egui::Labelerror pattern used here (and by this PR across 17 files) diverges from that guideline.Note that
add_new_identity_screen/mod.rsuses the same inline Frame+Label pattern, so this is an established codebase deviation rather than something introduced by this PR. Consider aligning all local error displays withMessageBannerin a follow-up. Based on learnings from CLAUDE.md: "User-facing messages must use theMessageBannercomponent fromsrc/ui/components/message_banner.rs, with global banners rendered byisland_central_panel()."Also applies to: 990-1012
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/tokens/tokens_screen/token_creator.rs` around lines 74 - 83, Replace the inline egui::Label/Frame error display with the project's MessageBanner component: locate the ui.add(egui::Label::new(...)) usage in token_creator.rs (and similar occurrences such as add_new_identity_screen::mod.rs) and construct a MessageBanner instance that displays the same error text styled as an error, then add it to the UI in place of the Label; ensure global banners follow the island_central_panel() pattern when appropriate and use the MessageBanner API from src/ui/components/message_banner.rs so the user-facing message conforms to the coding guideline.
74-83:Color32::DARK_REDis not dark-mode adaptive — useDashColors::ERRORfor consistency.Lines 80 and 565 use the hardcoded
Color32::DARK_RED, while the error display at lines 992–1005 usesDashColors::ERROR(the consistent project constant). Dark mode users will see a very dark, low-contrast red becauseDashColors::error_color(dark_mode)returnsColor32::from_rgb(255, 100, 100)for dark mode whereasColor32::DARK_REDis always the same dark shade.🎨 Proposed fix for consistent error color (applies to lines 80 and 565)
- .color(Color32::DARK_RED), + .color(DashColors::ERROR),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/tokens/tokens_screen/token_creator.rs` around lines 74 - 83, Replace usages of the hardcoded Color32::DARK_RED in the token creator UI with the project error color constant to make error text dark-mode adaptive: locate the egui::Label::new(...).color(Color32::DARK_RED) instances (e.g., the label building in token_creator.rs) and change them to use DashColors::ERROR (or DashColors::error_color(dark_mode) if you have access to the current theme flag) so the error color matches other places that already use DashColors::ERROR.
202-205: Threecolored_labelcalls in this file were not updated and can still overflow.The PR fixes wrapping for the identity-load error, duplicate-keyword error, and the bottom-of-screen error banner, but these sites remain:
Location Message Line 202–205 "No eligible key found for this identity…"Line 1050–1053 "Wallet is locked. Please unlock to continue."Line 1635–1637 "Schema validation error: {}"inrender_document_schemasEach can produce the same overflow that issue
#482describes if the message is long.♻️ Example fix pattern (apply to all three sites)
- ui.colored_label( - egui::Color32::from_rgb(200, 100, 100), - "No eligible key found for this identity. Please use Advanced Options or add a suitable key.", - ); + ui.add( + egui::Label::new( + egui::RichText::new("No eligible key found for this identity. Please use Advanced Options or add a suitable key.") + .color(egui::Color32::from_rgb(200, 100, 100)), + ) + .wrap(), + );Also applies to: 1050-1053, 1635-1637
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/tokens/tokens_screen/token_creator.rs` around lines 202 - 205, The three overflowing messages still use ui.colored_label which doesn't enable wrapping; replace those calls with adding an egui::Label that has wrapping enabled and the same color via RichText so long messages wrap instead of overflowing — specifically update the ui.colored_label call at the "No eligible key found for this identity…" site, the wallet-locked banner (the colored_label showing "Wallet is locked. Please unlock to continue."), and the Schema validation message emitted by render_document_schemas to use ui.add(egui::Label::new(...).wrap(true)) with the color applied through egui::RichText::new(...).color(...) so behavior/appearance is preserved but text wraps.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/ui/identities/keys/key_info_screen.rs`:
- Around line 259-265: Replace the inline egui::Label error display in
key_info_screen.rs with the MessageBanner component: construct a MessageBanner
containing the formatted error string (format!("Error: {}", e)) and render it
via the MessageBanner API instead of ui.add(egui::Label...). If this is a
global/central banner use island_central_panel() to render it per the guideline,
otherwise call the MessageBanner render/show method so the UI follows the shared
component from src/ui/components/message_banner.rs.
In `@src/ui/identities/register_dpns_name_screen.rs`:
- Around line 601-607: Replace the inline egui::Label error rendering with the
MessageBanner component and render it through island_central_panel() per UI
guidelines: remove the ui.add(egui::Label::new(RichText::new(format!("Error:
{}", msg)).color(error_color)).wrap()) call in register_dpns_name_screen.rs and
instead create and add a MessageBanner containing the formatted error text (use
the same msg and error_color) using the MessageBanner API from
src/ui/components/message_banner.rs and ensure it is placed via
island_central_panel() so the banner is treated as a global/user-facing message.
In `@src/ui/tokens/set_token_price_screen.rs`:
- Around line 522-530: Replace the egui::Label::new(... RichText ...) warning
block with the MessageBanner component (use the warning/alert variant) so the
user-facing warning uses the centralized MessageBanner UI; specifically locate
the egui::Label::new / egui::RichText usage in set_token_price_screen.rs and
swap it to MessageBanner (e.g., the warning variant) and ensure this banner is
rendered via the global island_central_panel() pipeline per guidelines.
In `@src/ui/tokens/update_token_config.rs`:
- Around line 595-601: Replace the inline egui::Label that renders
self.text_input_error with the MessageBanner component from
src/ui/components/message_banner.rs: remove the ui.add(egui::Label::new(...))
block and instead create a MessageBanner instance that displays
self.text_input_error with an error severity (e.g., MessageBanner::error(...) or
MessageBanner::new(...).severity(Error)), and render it in the appropriate
place; if this is a global banner (per guidelines) surface the MessageBanner via
island_central_panel() rather than inline in the local UI flow. Ensure you
reference self.text_input_error as the banner text and remove the previous
Color32::RED Label code.
In `@src/ui/wallets/wallets_screen/mod.rs`:
- Around line 1689-1695: Replace the inline egui::Label showing error_message
with the MessageBanner component: create a MessageBanner (e.g.,
MessageBanner::new(MessageKind::Error, error_message.clone()) or similar API)
and render it via the global banner area (island_central_panel()) instead of
directly adding the Label to ui; keep the error text and severity (error_color →
MessageKind::Error) and remove the old RichText label usage so the user-facing
message uses MessageBanner.
---
Duplicate comments:
In `@src/ui/identities/keys/key_info_screen.rs`:
- Around line 499-501: Replace the direct egui::Label user-facing error
rendering with the MessageBanner component: inside the code that currently calls
ui.add(egui::Label::new(format!("Error: {}", e)).wrap()) (in key_info_screen),
construct and display a MessageBanner error variant using the same error text
(use the MessageBanner API in src/ui/components/message_banner.rs, e.g. the
error/banner constructor provided) instead of egui::Label; ensure the banner is
created where the UI expects local banners or routed into island_central_panel()
if it must be shown as a global banner so it follows the app-wide banner
rendering conventions.
- Around line 435-437: The error label UI currently uses
egui::Label::new(format!("Error: {}", e)).wrap() which duplicates a prior
violation; replace it with the MessageBanner component from
src/ui/components/message_banner.rs so the user-facing error is rendered as a
banner (matching the earlier fix at the other occurrence around line 259).
Locate the code that adds the label (the ui.add call in key_info_screen.rs) and
construct a MessageBanner instance containing the error text (including the
error variable e) and add/render that instead; ensure global banners remain
handled via island_central_panel() as per guidelines.
- Around line 290-296: Replace the direct egui::Label that renders the error
(the block that creates egui::RichText::new(format!("Error: {}", e)).color(...))
with the MessageBanner component so user-facing errors use the centralized
banner UI; pass the error text (format!("Error: {}", e) or the same string
variable) into MessageBanner (e.g., MessageBanner::error or MessageBanner::new
with error severity) and ensure you add it to the same UI area that
island_central_panel() expects for global banners, matching the same change made
at the earlier duplicate location around the key info screen.
- Around line 444-450: Replace the egui::Label user-facing message in the key
info UI with the MessageBanner component: instead of adding
egui::Label::new(RichText::new("Key is in encrypted wallet")), construct a
MessageBanner (using the same pattern as the earlier instance in this module)
containing the "Key is in encrypted wallet" text and add it to the UI where
banners are rendered (use the global banner area / island_central_panel or the
existing banner container). Use the MessageBanner API from
src/ui/components/message_banner.rs so the message appears as a user-facing
banner rather than a plain label.
- Around line 508-514: Replace the direct egui::Label rendering of the
user-facing string "Key is in encrypted wallet" with the MessageBanner component
(use the error/danger variant) so the message is rendered via the global banner
system; locate the block that currently calls
ui.add(egui::Label::new(egui::RichText::new("Key is in encrypted wallet")...))
in key_info_screen and swap it to construct and show a MessageBanner (using
MessageBanner::... with the same text) so it flows through the
island_central_panel()/global banners as per the existing MessageBanner usage
elsewhere.
In `@src/ui/tokens/set_token_price_screen.rs`:
- Around line 1175-1181: The error display currently builds an egui::Label with
RichText (RichText::new(format!("Error: {}", msg)).color(error_color))—replace
this user-facing message with the MessageBanner component: create a
MessageBanner containing the same formatted error text (using msg and
error_color) instead of egui::Label and render it via the central banner
approach (island_central_panel/global banners). Locate the block that constructs
the Label in set_token_price_screen (the variables msg and error_color are
present) and instantiate MessageBanner with the error content so it is shown
through the standard banner rendering path.
- Around line 565-571: The user-facing error is rendered with egui::Label (the
ui.add(egui::Label::new(...)) call) but must use the project's MessageBanner
component instead; replace this Label usage in set_token_price_screen (the block
that shows "X Some tiers have invalid values") with the MessageBanner error
variant (consistent with the earlier fix at the other occurrence around line
522) so global banners render via island_central_panel and follow the
MessageBanner API from src/ui/components/message_banner.rs.
In `@src/ui/tokens/update_token_config.rs`:
- Around line 1124-1130: Replace the direct egui::Label error rendering with the
MessageBanner component: instead of
ui.add(egui::Label::new(RichText::new(format!("Error: {}", msg))...)), construct
and display a MessageBanner (using the existing MessageBanner type in
src/ui/components/message_banner.rs) populated with the msg (and styled as
error) and ensure it is displayed via the global banner rendering path
(island_central_panel()) rather than an inline Label; update the code around the
current occurrence (where msg and error_color are referenced) to create a
MessageBanner instance and call the appropriate method to enqueue/show it
through island_central_panel().
- Around line 636-641: Replace the raw egui::Label that shows
self.text_input_error with the MessageBanner component: locate the ui.add(...)
call rendering egui::RichText of self.text_input_error in the
update_token_config UI code and instantiate MessageBanner with the same error
text (e.g., MessageBanner::new(self.text_input_error.clone()) or the project's
MessageBanner error constructor), use the appropriate error/style variant, and
add/show that banner instead of the label so user-facing error text uses the
central MessageBanner system (consistent with island_central_panel global
banners).
---
Nitpick comments:
In `@src/ui/identities/add_new_identity_screen/mod.rs`:
- Around line 1104-1130: Replace the custom Frame/Label inline error rendering
(the block that checks self.error_message and draws a styled egui::Frame with a
"Dismiss" button) with the project-standard MessageBanner usage: stop drawing
the inline frame and instead set/clear the shared/global banner state so
island_central_panel() can render it via MessageBanner (use the same error text
from self.error_message and preserve dismiss behavior by clearing that shared
banner when dismissed). Locate the logic around self.error_message in this
module and wire it to the existing MessageBanner/global banner API (the
MessageBanner component in src/ui/components/message_banner.rs and the
island_central_panel() rendering path) rather than rendering a local Frame.
In `@src/ui/identities/withdraw_screen.rs`:
- Around line 649-668: The ErrorMessage arm for WithdrawFromIdentityStatus uses
RichText::new(...) passed to ui.label without wrapping, which can overflow for
long messages; update the block handling
WithdrawFromIdentityStatus::ErrorMessage (the code building the Frame and
calling ui.label) to use RichText::new(format!("Error: {}", msg)).wrap(true) (or
call .wrap() as appropriate) so the error text wraps inside the Frame, keeping
the Dismiss button accessible and avoiding layout overflow.
In `@src/ui/tokens/tokens_screen/token_creator.rs`:
- Around line 74-83: Replace the inline egui::Label/Frame error display with the
project's MessageBanner component: locate the ui.add(egui::Label::new(...))
usage in token_creator.rs (and similar occurrences such as
add_new_identity_screen::mod.rs) and construct a MessageBanner instance that
displays the same error text styled as an error, then add it to the UI in place
of the Label; ensure global banners follow the island_central_panel() pattern
when appropriate and use the MessageBanner API from
src/ui/components/message_banner.rs so the user-facing message conforms to the
coding guideline.
- Around line 74-83: Replace usages of the hardcoded Color32::DARK_RED in the
token creator UI with the project error color constant to make error text
dark-mode adaptive: locate the egui::Label::new(...).color(Color32::DARK_RED)
instances (e.g., the label building in token_creator.rs) and change them to use
DashColors::ERROR (or DashColors::error_color(dark_mode) if you have access to
the current theme flag) so the error color matches other places that already use
DashColors::ERROR.
- Around line 202-205: The three overflowing messages still use ui.colored_label
which doesn't enable wrapping; replace those calls with adding an egui::Label
that has wrapping enabled and the same color via RichText so long messages wrap
instead of overflowing — specifically update the ui.colored_label call at the
"No eligible key found for this identity…" site, the wallet-locked banner (the
colored_label showing "Wallet is locked. Please unlock to continue."), and the
Schema validation message emitted by render_document_schemas to use
ui.add(egui::Label::new(...).wrap(true)) with the color applied through
egui::RichText::new(...).color(...) so behavior/appearance is preserved but text
wraps.
In `@src/ui/wallets/add_new_wallet_screen.rs`:
- Line 898: The error label is added as plain text
(ui.add(egui::Label::new(error_message).wrap())) and needs to use a colored
RichText to match the PR styling; replace the plain Label content with a
RichText-colored label (use DashColors::ERROR or error_color(dark_mode)
depending on surrounding code) so the call becomes a Label created from
RichText::new/error_color and keep .wrap() to preserve wrapping; update the use
site in the add_new_wallet_screen logic where error_message is rendered (around
the block that currently calls ui.add(egui::Label::new(error_message).wrap())).
In `@src/ui/wallets/create_asset_lock_screen.rs`:
- Around line 618-624: Replace the hardcoded egui::Color32::DARK_RED used when
building the error label with the dark-mode-aware color helper: call
DashColors::error_color(dark_mode) when constructing the RichText in the UI code
that creates the error label (the block that references error_message and ui.add
with egui::Label::new and egui::RichText::new). Ensure dark_mode (already in
scope) is passed to DashColors::error_color so the label color adapts to theme.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (17)
src/ui/identities/add_new_identity_screen/mod.rssrc/ui/identities/keys/key_info_screen.rssrc/ui/identities/register_dpns_name_screen.rssrc/ui/identities/top_up_identity_screen/mod.rssrc/ui/identities/withdraw_screen.rssrc/ui/tokens/set_token_price_screen.rssrc/ui/tokens/tokens_screen/keyword_search.rssrc/ui/tokens/tokens_screen/token_creator.rssrc/ui/tokens/update_token_config.rssrc/ui/tokens/view_token_claims_screen.rssrc/ui/wallets/add_new_wallet_screen.rssrc/ui/wallets/create_asset_lock_screen.rssrc/ui/wallets/import_mnemonic_screen.rssrc/ui/wallets/send_screen.rssrc/ui/wallets/single_key_send_screen.rssrc/ui/wallets/wallets_screen/dialogs.rssrc/ui/wallets/wallets_screen/mod.rs
✅ Files skipped from review due to trivial changes (1)
- src/ui/wallets/single_key_send_screen.rs
🚧 Files skipped from review as they are similar to previous changes (5)
- src/ui/wallets/send_screen.rs
- src/ui/wallets/import_mnemonic_screen.rs
- src/ui/wallets/wallets_screen/dialogs.rs
- src/ui/identities/top_up_identity_screen/mod.rs
- src/ui/tokens/tokens_screen/keyword_search.rs
| ui.add( | ||
| egui::Label::new( | ||
| egui::RichText::new(format!("Error: {}", e)) | ||
| .color(egui::Color32::RED), | ||
| ) | ||
| .wrap(), | ||
| ); |
There was a problem hiding this comment.
Use MessageBanner for user-facing error text.
Inline error text should be rendered with the MessageBanner component to comply with UI guidelines. As per coding guidelines: “User-facing messages must use the MessageBanner component from src/ui/components/message_banner.rs, with global banners rendered by island_central_panel().”
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/ui/identities/keys/key_info_screen.rs` around lines 259 - 265, Replace
the inline egui::Label error display in key_info_screen.rs with the
MessageBanner component: construct a MessageBanner containing the formatted
error string (format!("Error: {}", e)) and render it via the MessageBanner API
instead of ui.add(egui::Label...). If this is a global/central banner use
island_central_panel() to render it per the guideline, otherwise call the
MessageBanner render/show method so the UI follows the shared component from
src/ui/components/message_banner.rs.
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/ui/tokens/set_token_price_screen.rs (1)
346-377:⚠️ Potential issue | 🟡 MinorRemove-pricing warning banner may leak on screen dismissal.
When
pricing_typeisRemovePricingand the screen is popped (e.g., user navigates back), the global banner posted at line 375 is never cleared. There is noDropimplementation or teardown logic for this screen.This is the same concern as in
update_token_config.rswithset_text_input_error. Consider clearing the banner when the screen is dismissed.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/tokens/set_token_price_screen.rs` around lines 346 - 377, The global remove-pricing MessageBanner set by MessageBanner::set_global when self.pricing_type == PricingType::RemovePricing is not cleared when this screen is dismissed; implement teardown to always call MessageBanner::clear_global(ui.ctx(), remove_pricing_warning) when the screen is dropped or closed (e.g., implement Drop for the SetTokenPriceScreen struct or add an explicit on_close/teardown method invoked by the navigator) and reset remove_pricing_warning_posted there; ensure you reference pricing_type, remove_pricing_warning_posted, MessageBanner::set_global and MessageBanner::clear_global so the banner is always cleared on screen dismissal.
♻️ Duplicate comments (1)
src/ui/identities/keys/key_info_screen.rs (1)
435-437:⚠️ Potential issue | 🟡 MinorUse MessageBanner for private-key retrieval errors.
Line 435-437 and Line 499-501 still render user-facing errors via inlineLabel, which diverges from the banner guideline. Consider switching these toMessageBanner::set_global(...)(and optionally a small inline “Unavailable” text) like other error paths.🔧 Suggested adjustment (apply in both error branches)
- ui.add(egui::Label::new(format!("Error: {}", e)).wrap()); + MessageBanner::set_global(ui.ctx(), &format!("Error: {}", e), MessageType::Error); + ui.label(RichText::new("Unavailable").color(text_primary));As per coding guidelines: “Use MessageBanner component (
src/ui/components/message_banner.rs) for user-facing messages. Global banners are rendered centrally byisland_central_panel().”Also applies to: 499-501
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/identities/keys/key_info_screen.rs` around lines 435 - 437, The inline egui::Label calls rendering errors in key_info_screen.rs should be replaced with the MessageBanner global mechanism; locate the error branches that call ui.add(egui::Label::new(format!("Error: {}", e)).wrap()) (and the similar branch around the other occurrence) and instead invoke MessageBanner::set_global(...) with a user-facing message (e.g., "Private key unavailable: <brief msg>") and optionally render a small inline "Unavailable" label instead of the full error; ensure you import/use the MessageBanner component from src/ui/components/message_banner.rs and apply the change in both error branches so the global banner system (island_central_panel) shows the message.
🧹 Nitpick comments (2)
src/ui/tokens/set_token_price_screen.rs (1)
800-810: Redundantif letmatch — the branch always matches.Line 802 sets
self.statustoErrorMessage(error), then line 803 immediately matches on it. Thisif letwill always succeed. Simplify by using theerrorvariable directly:♻️ Suggested simplification
fn set_error_state(&mut self, error: String) { - self.error_message = Some(error.clone()); - self.status = SetTokenPriceStatus::ErrorMessage(error); - if let SetTokenPriceStatus::ErrorMessage(ref msg) = self.status { - MessageBanner::set_global( - self.app_context.egui_ctx(), - &format!("Error: {}", msg), - MessageType::Error, - ); - } + self.error_message = Some(error.clone()); + MessageBanner::set_global( + self.app_context.egui_ctx(), + &format!("Error: {}", error), + MessageType::Error, + ); + self.status = SetTokenPriceStatus::ErrorMessage(error); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/tokens/set_token_price_screen.rs` around lines 800 - 810, The method set_error_state contains a redundant if let that always matches because you just assigned self.status = SetTokenPriceStatus::ErrorMessage(error); update set_error_state to set self.error_message and self.status as before, then call MessageBanner::set_global using the original error variable (or a local msg = error.clone()) and app_context.egui_ctx() directly instead of matching on self.status; keep references to SetTokenPriceStatus::ErrorMessage, MessageBanner::set_global, self.error_message, and app_context.egui_ctx() to locate the change.src/ui/wallets/wallets_screen/mod.rs (1)
1667-1703: Hardcoded banner text"Error: Incorrect Password"is duplicated across four locations.The same string is constructed or referenced at lines 1669, 1679, 1693, and 1703. If the message wording ever changes, a mismatch will leave stale banners.
Extract the banner text into a constant:
♻️ Suggested refactor
+const SK_UNLOCK_ERROR_BANNER: &str = "Error: Incorrect Password"; + // Then replace all occurrences: -MessageBanner::clear_global_message(ui.ctx(), "Error: Incorrect Password"); +MessageBanner::clear_global_message(ui.ctx(), SK_UNLOCK_ERROR_BANNER); -MessageBanner::set_global(ui.ctx(), "Error: Incorrect Password", MessageType::Error); +MessageBanner::set_global(ui.ctx(), SK_UNLOCK_ERROR_BANNER, MessageType::Error); -let banner_text = format!("Error: {}", error_message); +let banner_text = SK_UNLOCK_ERROR_BANNER; -MessageBanner::clear_global_message(ctx, "Error: Incorrect Password"); +MessageBanner::clear_global_message(ctx, SK_UNLOCK_ERROR_BANNER);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/wallets/wallets_screen/mod.rs` around lines 1667 - 1703, The string "Error: Incorrect Password" is hardcoded in multiple places (used in MessageBanner::clear_global_message, MessageBanner::set_global, the local banner_text format, and the final clear call); define a single constant (e.g., SK_INCORRECT_PASSWORD_BANNER) at the top of this module and replace all occurrences in WalletsScreen::show_sk_unlock_dialog handling—use the constant for MessageBanner::set_global/clear_global_message calls and for composing banner_text so the message is updated in one place; update references in the methods: MessageBanner::set_global(..., SK_INCORRECT_PASSWORD_BANNER), MessageBanner::clear_global_message(..., SK_INCORRECT_PASSWORD_BANNER), and when you build banner_text use format!("{}" , SK_INCORRECT_PASSWORD_BANNER) or otherwise reference the constant.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/ui/tokens/set_token_price_screen.rs`:
- Around line 1191-1199: The ErrorMessage branch for SetTokenPriceStatus
currently only renders a Dismiss button and clears the global MessageBanner,
leaving no inline error context; update the UI in the
SetTokenPriceStatus::ErrorMessage(msg) block to show the error text inline
(e.g., render a label with the formatted banner_text) alongside the Dismiss
button within the ui.horizontal closure so users always see the error even if
the global MessageBanner is not visible, while keeping the existing
MessageBanner::clear_global_message call and the transition to self.status =
SetTokenPriceStatus::NotStarted when the button is clicked.
In `@src/ui/wallets/wallets_screen/mod.rs`:
- Around line 1688-1696: The inline error text for SK password was removed so
only a Dismiss button remains; update the wallets_screen UI where
self.sk_error_message is handled (the block that creates banner_text and calls
ui.small_button("Dismiss")) to also render a brief inline error label (e.g.,
ui.label or a small colored label) next to or above the Dismiss button showing
error_message (or a truncated version) so the user retains context even if the
global MessageBanner disappears; keep the current dismiss behavior
(MessageBanner::clear_global_message(ui.ctx(), &banner_text) and set
self.sk_error_message = None) but add the inline display of error_message before
the button so both local context and banner dismissal remain.
---
Outside diff comments:
In `@src/ui/tokens/set_token_price_screen.rs`:
- Around line 346-377: The global remove-pricing MessageBanner set by
MessageBanner::set_global when self.pricing_type == PricingType::RemovePricing
is not cleared when this screen is dismissed; implement teardown to always call
MessageBanner::clear_global(ui.ctx(), remove_pricing_warning) when the screen is
dropped or closed (e.g., implement Drop for the SetTokenPriceScreen struct or
add an explicit on_close/teardown method invoked by the navigator) and reset
remove_pricing_warning_posted there; ensure you reference pricing_type,
remove_pricing_warning_posted, MessageBanner::set_global and
MessageBanner::clear_global so the banner is always cleared on screen dismissal.
---
Duplicate comments:
In `@src/ui/identities/keys/key_info_screen.rs`:
- Around line 435-437: The inline egui::Label calls rendering errors in
key_info_screen.rs should be replaced with the MessageBanner global mechanism;
locate the error branches that call ui.add(egui::Label::new(format!("Error: {}",
e)).wrap()) (and the similar branch around the other occurrence) and instead
invoke MessageBanner::set_global(...) with a user-facing message (e.g., "Private
key unavailable: <brief msg>") and optionally render a small inline
"Unavailable" label instead of the full error; ensure you import/use the
MessageBanner component from src/ui/components/message_banner.rs and apply the
change in both error branches so the global banner system (island_central_panel)
shows the message.
---
Nitpick comments:
In `@src/ui/tokens/set_token_price_screen.rs`:
- Around line 800-810: The method set_error_state contains a redundant if let
that always matches because you just assigned self.status =
SetTokenPriceStatus::ErrorMessage(error); update set_error_state to set
self.error_message and self.status as before, then call
MessageBanner::set_global using the original error variable (or a local msg =
error.clone()) and app_context.egui_ctx() directly instead of matching on
self.status; keep references to SetTokenPriceStatus::ErrorMessage,
MessageBanner::set_global, self.error_message, and app_context.egui_ctx() to
locate the change.
In `@src/ui/wallets/wallets_screen/mod.rs`:
- Around line 1667-1703: The string "Error: Incorrect Password" is hardcoded in
multiple places (used in MessageBanner::clear_global_message,
MessageBanner::set_global, the local banner_text format, and the final clear
call); define a single constant (e.g., SK_INCORRECT_PASSWORD_BANNER) at the top
of this module and replace all occurrences in
WalletsScreen::show_sk_unlock_dialog handling—use the constant for
MessageBanner::set_global/clear_global_message calls and for composing
banner_text so the message is updated in one place; update references in the
methods: MessageBanner::set_global(..., SK_INCORRECT_PASSWORD_BANNER),
MessageBanner::clear_global_message(..., SK_INCORRECT_PASSWORD_BANNER), and when
you build banner_text use format!("{}" , SK_INCORRECT_PASSWORD_BANNER) or
otherwise reference the constant.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/ui/identities/keys/key_info_screen.rssrc/ui/identities/register_dpns_name_screen.rssrc/ui/tokens/set_token_price_screen.rssrc/ui/tokens/update_token_config.rssrc/ui/wallets/wallets_screen/mod.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- src/ui/identities/register_dpns_name_screen.rs
| SetTokenPriceStatus::ErrorMessage(msg) => { | ||
| let error_color = DashColors::ERROR; | ||
| let msg = msg.clone(); | ||
| Frame::new() | ||
| .fill(error_color.gamma_multiply(0.1)) | ||
| .inner_margin(Margin::symmetric(10, 8)) | ||
| .corner_radius(5.0) | ||
| .stroke(egui::Stroke::new(1.0, error_color)) | ||
| .show(ui, |ui| { | ||
| ui.horizontal(|ui| { | ||
| ui.label(RichText::new(format!("Error: {}", msg)).color(error_color)); | ||
| ui.add_space(10.0); | ||
| if ui.small_button("Dismiss").clicked() { | ||
| self.status = SetTokenPriceStatus::NotStarted; | ||
| } | ||
| }); | ||
| }); | ||
| let banner_text = format!("Error: {}", msg); | ||
| ui.horizontal(|ui| { | ||
| if ui.small_button("Dismiss").clicked() { | ||
| MessageBanner::clear_global_message(ui.ctx(), &banner_text); | ||
| self.status = SetTokenPriceStatus::NotStarted; | ||
| } | ||
| }); | ||
| } |
There was a problem hiding this comment.
Error status only shows a dismiss button — no inline error context.
Same pattern as the SK unlock dialog in wallets_screen/mod.rs: the error text is only visible via the global MessageBanner. If the banner is no longer visible (auto-expired, pushed out, or rendered elsewhere), the user sees only a bare dismiss button with no indication of what went wrong.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/ui/tokens/set_token_price_screen.rs` around lines 1191 - 1199, The
ErrorMessage branch for SetTokenPriceStatus currently only renders a Dismiss
button and clears the global MessageBanner, leaving no inline error context;
update the UI in the SetTokenPriceStatus::ErrorMessage(msg) block to show the
error text inline (e.g., render a label with the formatted banner_text)
alongside the Dismiss button within the ui.horizontal closure so users always
see the error even if the global MessageBanner is not visible, while keeping the
existing MessageBanner::clear_global_message call and the transition to
self.status = SetTokenPriceStatus::NotStarted when the button is clicked.
| // Display error message if the password was incorrect | ||
| if let Some(error_message) = self.sk_error_message.clone() { | ||
| ui.add_space(5.0); | ||
| let error_color = DashColors::ERROR; | ||
| Frame::new() | ||
| .fill(error_color.gamma_multiply(0.1)) | ||
| .inner_margin(Margin::symmetric(10, 8)) | ||
| .corner_radius(5.0) | ||
| .stroke(egui::Stroke::new(1.0, error_color)) | ||
| .show(ui, |ui| { | ||
| ui.horizontal(|ui| { | ||
| ui.label(RichText::new(format!("Error: {}", error_message)).color(error_color)); | ||
| ui.add_space(10.0); | ||
| if ui.small_button("Dismiss").clicked() { | ||
| self.sk_error_message = None; | ||
| } | ||
| }); | ||
| }); | ||
| let banner_text = format!("Error: {}", error_message); | ||
| if ui.small_button("Dismiss").clicked() { | ||
| MessageBanner::clear_global_message(ui.ctx(), &banner_text); | ||
| self.sk_error_message = None; | ||
| } | ||
| } |
There was a problem hiding this comment.
Error text is no longer displayed inline — only a dismiss button remains.
After removing the inline label, the error message for an incorrect SK password is only visible via the global MessageBanner. The Dismiss button at line 1692 clears the banner but doesn't display the error text locally. If the global banner auto-expires or is pushed out by other banners (MAX_BANNERS), the user sees only a contextless dismiss button.
Consider keeping a brief inline indication (e.g., the error text or a short note) alongside the dismiss button so the error context is clear even if the banner is no longer visible.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/ui/wallets/wallets_screen/mod.rs` around lines 1688 - 1696, The inline
error text for SK password was removed so only a Dismiss button remains; update
the wallets_screen UI where self.sk_error_message is handled (the block that
creates banner_text and calls ui.small_button("Dismiss")) to also render a brief
inline error label (e.g., ui.label or a small colored label) next to or above
the Dismiss button showing error_message (or a truncated version) so the user
retains context even if the global MessageBanner disappears; keep the current
dismiss behavior (MessageBanner::clear_global_message(ui.ctx(), &banner_text)
and set self.sk_error_message = None) but add the inline display of
error_message before the button so both local context and banner dismissal
remain.
|
fixed in another pr |
Issue
Fixes #482
Warning and error messages in various screens do not wrap, causing them to overflow their containers and become unreadable when the message text is long.
Changes
Replace all
ui.label(),ui.colored_label(), andRichTexterror/warning displays with wrapped versions usingegui::Label::new(...).wrap()across 17 files in:Pattern
Validation
cargo check✅cargo clippy --all-features --all-targets -- -D warnings✅cargo +nightly fmt --all -- --check✅Summary by CodeRabbit
Bug Fixes
Improvements