feat(ui): Settings mode switch, Shift+H help, My Trades UX#53
Conversation
- Add Switch Mode as first Settings action; remove M key shortcut - SettingsInstructionsPopup (Shift+H) with styled admin/user option reference - Wire Enter, Esc, navigation; update README and short Ctrl+H copy - My Trades: reserve up to 3 footer rows; single Paragraph for wrapped hints - Order chat list: sort by trade_index descending (newest trades first) Made-with: Cursor
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 1 minutes and 13 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis PR introduces a new settings instructions popup accessible via Shift+H on the Settings tab, replacing the previous M-key mode switch with a menu-driven "Switch Mode" option that persists settings. The change adds comprehensive help documentation for all settings options and updates the UI navigation accordingly, while also sorting order chats by trade_index descending. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant KeyHandler as Key Handler
participant AppState as App State
participant DrawEngine as Draw Engine
participant HelpPopup as Help Popup
User->>KeyHandler: Press Shift+H on Settings tab
KeyHandler->>AppState: Set mode to SettingsInstructionsPopup(role, previous_mode)
AppState->>DrawEngine: Update app.mode
DrawEngine->>HelpPopup: Call render_settings_instructions_popup(f, role)
HelpPopup-->>DrawEngine: Render popup with role-specific help entries
DrawEngine-->>User: Display settings instructions overlay
User->>KeyHandler: Press Esc/Enter/Shift+H/Ctrl+H
KeyHandler->>AppState: Restore previous_mode
AppState-->>User: Dismiss popup, return to Settings tab
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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: 1
🧹 Nitpick comments (2)
src/ui/tabs/order_in_progress_tab.rs (2)
335-350: Footer height heuristic looks reasonable, but worth noting the chat area can collapse to 0.
footer_heightis chosen fromspare_below_header_input(=main_area.height − header_height − input_height). When that spare is exactly 3 and the 3-line footer is selected, theMin(0)chat constraint at Line 356 collapses to 0 rows and the chat becomes invisible (only header + input + footer remain). On very small terminals this is probably acceptable, but you may want to bias toward leaving at least 1 row for chat — e.g. requirespare_below_header_input >= 4for the 3-line footer and>= 3for the 2-line footer.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/tabs/order_in_progress_tab.rs` around lines 335 - 350, The footer_height selection can consume the last available chat row when spare_below_header_input equals the footer size; update the heuristic in the block that computes spare_below_header_input/footer_height (variables: spare_below_header_input, footer_height, main_area, header_height, input_height) to bias leaving at least one chat row by raising thresholds — e.g. require spare_below_header_input >= 4 to pick a 3-line footer and >= 3 to pick a 2-line footer (so the chat's Min(0) constraint does not collapse the chat to 0 height).
424-534: Footer refactor LGTM.Collapsing the per-line
Paragraphs into a singleParagraph::new(footer_text).wrap(Wrap { trim: true })over the full footer rect correctly addresses the “wrapped hints have nowhere to go” problem described in the PR objectives. The 3/2/1-line content variants are consistent across the input-enabled / disabled branches and use the same separator style.One small nit: in the 3-line input-enabled variant (Lines 439-442), middle line only contains
SHIFT_C | SHIFT_Fwhile the surrounding lines pack four hints each — feels a bit lopsided. Consider rebalancing (e.g. movingSHIFT_R_RELEASEorSHIFT_V_RATEup to line 2) for visual symmetry. Non-blocking.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/tabs/order_in_progress_tab.rs` around lines 424 - 534, The 3-line footer variant when app.order_chat_input_enabled (in the footer_height >= 3 branch) has an unbalanced middle line containing only FOOTER_MYTRADES_SHIFT_C_CANCEL and FOOTER_MYTRADES_SHIFT_F_FIAT_SENT; move one of FOOTER_MYTRADES_SHIFT_R_RELEASE or FOOTER_MYTRADES_SHIFT_V_RATE from the third line up into that middle Line (the block that constructs Text::from(vec![ Line::from(format!(...)), Line::from(format!(...)), Line::from(format!(...)) ]) under the app.order_chat_input_enabled branch) so the three lines are more visually balanced while keeping the same separators and overall content.
🤖 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/help_popup.rs`:
- Around line 80-109: The popup currently builds content as multiple lines and
passes them to Paragraph::new(lines), which causes height overflow on 24-row
terminals; change the content construction so each option is a single Spans line
combining a bold Span for the title and one or more Spans for the description
(instead of separate title+description+blank lines), reduce or remove extra
blank spacer lines, and pass a Vec<Spans> (or Text) into Paragraph::new(...) so
the Paragraph renders compactly with existing Wrap { trim: true }; update where
"lines" is built and keep using Span::styled, Paragraph::new(lines), Wrap, and
the same block/inner layout variables (block, inner, popup) so the popup fits on
constrained terminals without clipping.
---
Nitpick comments:
In `@src/ui/tabs/order_in_progress_tab.rs`:
- Around line 335-350: The footer_height selection can consume the last
available chat row when spare_below_header_input equals the footer size; update
the heuristic in the block that computes spare_below_header_input/footer_height
(variables: spare_below_header_input, footer_height, main_area, header_height,
input_height) to bias leaving at least one chat row by raising thresholds — e.g.
require spare_below_header_input >= 4 to pick a 3-line footer and >= 3 to pick a
2-line footer (so the chat's Min(0) constraint does not collapse the chat to 0
height).
- Around line 424-534: The 3-line footer variant when
app.order_chat_input_enabled (in the footer_height >= 3 branch) has an
unbalanced middle line containing only FOOTER_MYTRADES_SHIFT_C_CANCEL and
FOOTER_MYTRADES_SHIFT_F_FIAT_SENT; move one of FOOTER_MYTRADES_SHIFT_R_RELEASE
or FOOTER_MYTRADES_SHIFT_V_RATE from the third line up into that middle Line
(the block that constructs Text::from(vec![ Line::from(format!(...)),
Line::from(format!(...)), Line::from(format!(...)) ]) under the
app.order_chat_input_enabled branch) so the three lines are more visually
balanced while keeping the same separators and overall content.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c51b4cba-be88-49e4-aae5-96892eccd5e1
📒 Files selected for processing (13)
README.mdsrc/ui/app_state.rssrc/ui/constants.rssrc/ui/draw.rssrc/ui/help_popup.rssrc/ui/helpers/order_chat_projection.rssrc/ui/key_handler/enter_handlers.rssrc/ui/key_handler/esc_handlers.rssrc/ui/key_handler/mod.rssrc/ui/key_handler/navigation.rssrc/ui/key_handler/settings.rssrc/ui/tabs/order_in_progress_tab.rssrc/ui/tabs/settings_tab.rs
There was a problem hiding this comment.
Looks good to me overall.
I re-checked the main risk in this PR, which was the My Trades selection/action coupling. Moving both the sidebar rendering and the Enter/action target resolution onto build_active_order_chat_list fixes the previous desync class properly, and the trade-index ordering is deterministic.
The Settings changes also look coherent: the explicit mode switch is much more discoverable than the old hidden shortcut, the new Shift+H overlay is wired consistently, and the footer/help layout changes are a net UX improvement.
I still think the full Settings instructions popup could benefit from scroll support in a future follow-up on very small terminals, but I do not see that as a blocker for this PR.
Approving.
Summary
user_modeas before.order_id.Motivation
Breaking / behavior changes
Mno longer switches User/Admin anywhere; use Settings → Switch Mode (or the flow you document for users).Summary by CodeRabbit
New Features
Documentation