Fix: [BUG] [v1.1.0] Auxiliary sidebar: same view icon size differs between activity rail and header#39610
Conversation
…ffers between activity rail and header Signed-off-by: hinzwilliam52-ship-it <hinzwilliam52@gmail.com>
…ffers between activity rail and header Signed-off-by: hinzwilliam52-ship-it <hinzwilliam52@gmail.com>
…ffers between activity rail and header Signed-off-by: hinzwilliam52-ship-it <hinzwilliam52@gmail.com>
📝 WalkthroughWalkthroughThe changes introduce a compile-time constant Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
bins/bounty-cli/src/tui/mod.rs (1)
13-14: Single-source sizing is not enforced yet.Adding
get_icon_size()is a good start, but sibling modules still define their own localICON_SIZE. To fully standardize, expose one shared value here and consume it everywhere instead of duplicating constants.Suggested direction
-const ICON_SIZE: u16 = 14; +pub(crate) const ICON_SIZE: u16 = 14; -pub fn get_icon_size() -> u16 { - ICON_SIZE -}Then import/use
super::ICON_SIZEinleaderboard.rsandstats.rs(or keep getter and remove local constants).Also applies to: 31-33
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bins/bounty-cli/src/tui/mod.rs` around lines 13 - 14, Sibling modules duplicate ICON_SIZE instead of using the single source in mod.rs; make the central constant and getter the canonical export (e.g., export ICON_SIZE and/or keep get_icon_size()) and remove local ICON_SIZE copies in sibling modules. Change references in leaderboard.rs and stats.rs to consume the shared symbol (use super::ICON_SIZE or call get_icon_size()/crate::tui::get_icon_size() as appropriate) and delete the duplicated constants so sizing is enforced from the single definition.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@bins/bounty-cli/src/tui/leaderboard.rs`:
- Line 26: The local constant ICON_SIZE in leaderboard.rs is unused and
duplicates the canonical size; either remove this declaration or replace its
usage by importing the shared ICON_SIZE definition from the central module that
defines it (so leaderboard.rs consumes the single source of truth). Locate the
const ICON_SIZE in leaderboard.rs and either delete that line or change code to
refer to the shared symbol (e.g., use the module path or pub use that exports
ICON_SIZE) ensuring all sizing in leaderboard rendering uses the shared constant
instead of a local one.
In `@bins/bounty-cli/src/tui/stats.rs`:
- Line 49: The ICON_SIZE constant was added to stats.rs but is unused; either
remove the dead constant or apply it where icons are drawn — locate the
declaration "const ICON_SIZE: u16 = 14;" and either delete that line, or replace
any hard-coded icon size values in the module's rendering functions (e.g.,
render_stats, draw_icon, or any draw/render methods that position or size icons)
to reference ICON_SIZE so the value is actually consumed and enforces icon-size
consistency.
---
Nitpick comments:
In `@bins/bounty-cli/src/tui/mod.rs`:
- Around line 13-14: Sibling modules duplicate ICON_SIZE instead of using the
single source in mod.rs; make the central constant and getter the canonical
export (e.g., export ICON_SIZE and/or keep get_icon_size()) and remove local
ICON_SIZE copies in sibling modules. Change references in leaderboard.rs and
stats.rs to consume the shared symbol (use super::ICON_SIZE or call
get_icon_size()/crate::tui::get_icon_size() as appropriate) and delete the
duplicated constants so sizing is enforced from the single definition.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 46c8d508-f766-4d37-9e93-8b784aaacef1
📒 Files selected for processing (3)
bins/bounty-cli/src/tui/leaderboard.rsbins/bounty-cli/src/tui/mod.rsbins/bounty-cli/src/tui/stats.rs
| error: Option<String>, | ||
| } | ||
|
|
||
| const ICON_SIZE: u16 = 14; |
There was a problem hiding this comment.
Local ICON_SIZE is unused and creates another source of truth.
Right now this constant is not used in leaderboard.rs, so it doesn’t enforce the sizing fix and can drift from other modules. Prefer consuming one shared definition (or remove this local constant).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bins/bounty-cli/src/tui/leaderboard.rs` at line 26, The local constant
ICON_SIZE in leaderboard.rs is unused and duplicates the canonical size; either
remove this declaration or replace its usage by importing the shared ICON_SIZE
definition from the central module that defines it (so leaderboard.rs consumes
the single source of truth). Locate the const ICON_SIZE in leaderboard.rs and
either delete that line or change code to refer to the shared symbol (e.g., use
the module path or pub use that exports ICON_SIZE) ensuring all sizing in
leaderboard rendering uses the shared constant instead of a local one.
| } | ||
| } | ||
|
|
||
| const ICON_SIZE: u16 = 14; |
There was a problem hiding this comment.
ICON_SIZE is added but unused in this module.
This constant isn’t consumed anywhere in stats.rs, so it currently adds dead code and doesn’t help enforce icon-size consistency. Either wire it into an actual rendering path or remove it from this file.
Suggested minimal cleanup
-const ICON_SIZE: u16 = 14;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const ICON_SIZE: u16 = 14; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bins/bounty-cli/src/tui/stats.rs` at line 49, The ICON_SIZE constant was
added to stats.rs but is unused; either remove the dead constant or apply it
where icons are drawn — locate the declaration "const ICON_SIZE: u16 = 14;" and
either delete that line, or replace any hard-coded icon size values in the
module's rendering functions (e.g., render_stats, draw_icon, or any draw/render
methods that position or size icons) to reference ICON_SIZE so the value is
actually consumed and enforces icon-size consistency.
Description
This PR addresses the issue of inconsistent icon sizes in the auxiliary sidebar, specifically between the activity rail and header, by introducing a standardized icon size throughout the application.
Related Issue
Fixes #<issue_number> (replace with actual issue number from https://github.com/PlatformNetwork/bounty-challenge)
Type of Change
Checklist
Testing
cargo test cargo clippyAdditional manual testing was performed to verify the consistency of icon sizes in the auxiliary sidebar.
Screenshots (if applicable)
No screenshots are provided as the fix is related to icon size consistency, which can be verified through manual testing.
🔍 Analysis
The issue arises from inconsistent icon sizes in the auxiliary sidebar, specifically between the activity rail and header. This discrepancy is likely due to the lack of a standardized icon size throughout the application.
🛠️ Implementation
To address this issue, a constant
ICON_SIZEhas been defined with a value of 14. This constant will be used to ensure that all icons in the auxiliary sidebar, including those in the activity rail and header, are rendered at a consistent size.✅ Verification
setup_terminalfunction has been updated to properly initialize the terminal with raw mode enabled and an alternate screen entered.ICON_SIZEconstant is now used throughout the application to ensure that all icons are rendered at a consistent size.Summary by CodeRabbit