Let users choose the mobile bottom bar's entries
Part of #6022
Stacked on #6025 (the bar scrolls). Review that PR first; this one adds a single commit on top of it.
Fork pre-flight: jaysbeekay/sure#1047 (same branch, same commit)
Problem
On a phone the bottom bar shows every main nav entry. With PR 1 it scrolls once they don't fit, but a user who never opens Bills or Reports still can't free the room for the entries they do use.
Behaviour
- Settings > Appearance has a new Bottom bar section with a checkbox per entry the user can currently see. Home is always shown: its checkbox is checked and disabled. Entries the user can't see (Bills with recurring detection off; Bills and Portfolio without preview) aren't offered.
- Unticking an entry takes it off the phone bar only. The desktop sidebar is unaffected.
- Hiding Assistant removes chat from the phone, since the sidebar never shows it. The section's subtitle says so and that it can be turned back on there.
- The section is not shown in intro mode, matching the profile page's intro guard; intro mode's bar has no keys to choose from.
- The choice is per user, stored in
users.preferences["bottom_bar_hidden"].User#update_bottom_bar(hidden:, shown:)writes it underwith_locked_preferences, keeps only known entry keys, and never hideshome. When nothing is hidden, the key is removed. - Entries the form didn't offer keep their state. A user who hid Portfolio and then turned preview off and on again still has it hidden.
- Each main nav entry has a stable
key:(home,transactions,bills,reports,plan,portfolio,assistant). Plan and the pre-preview Budgets entry shareplan. The list moves from the layout toApplicationHelper#main_nav_items, so the settings page offers exactly the entries the layout renders. - The layout takes the desktop list first, then drops the hidden keys from the phone list. Intro mode's two entries have no key and are never filtered.
- The form follows the existing "Start expanded by default" checkboxes. Each offered entry posts a hidden
0, then1from its checkbox when ticked. Disabled Home posts nothing. The appearance update saves the bar after its own locked block, which would otherwise write its copy of the preferences over it. - Uses the existing checkbox classes and
settings_section. No new CSS, and no new JavaScript (it uses the existingauto-submit-form).
Not in this PR: reordering entries, and applying the choice to the desktop sidebar. Both are left out of v1 in the issue.
Validation
test/models/user_test.rb, 7 new tests: empty by default; unknown keys dropped;homeignored; shown and hidden applied while unoffered entries keep their state; the key cleared when nothing is hidden;section_order,collapsed_sectionsandpreview_features_enabledunchanged by an update; a preference saved by another request after this user was loaded survives the update.test/controllers/settings/appearances_controller_test.rb, 8 new tests:- The section offers a checkbox per visible entry, Assistant included. Home is checked, disabled and has no hidden field. Bills and Portfolio are absent without preview.
- The section is not offered in intro mode.
- Saving hides the unchecked entries.
- Saving with every entry checked clears the preference.
- Everything unchecked except Home, plus a forged
home=0, leaves Home alone on the bar. - A form without the bar fields leaves the hidden entries alone.
- A hidden entry leaves the bottom bar but stays in the sidebar. The sidebar links are read only from the desktop nav (
data-testid="desktop-nav"), so another list on the page linking the same pages cannot satisfy the check. - An entry that is unavailable anyway (Bills with recurring off; Portfolio without preview) stays off the bar whatever the preference says.
test/views/layouts/shared/nav_item_view_test.rb: the partial acceptskey:and renders the same markup.- Before the change, every new test failed: model and controller tests on
undefined method 'update_bottom_bar', the partial test onunknown local: :key. With the model in place but no layout filter, the layout test failed onExpected ["/", "/transactions", "/bills", "/reports", "/plan", "/portfolio", "/chats"] to not include "/reports". - Mutations, each run on a copy and each turning a test red:
- Filter applied to the desktop list too:
Expected ["/", "/transactions", "/plan", "/portfolio"] to include "/reports". - Home guard dropped:
Expected: ["bills"] Actual: ["home", "bills"], and the Home-alone controller test. - Unknown-key filter dropped: the unknown-keys model test.
with_locked_preferencesreplaced by a plainupdate!from the loaded copy: the concurrent-request test (Expected false to be truthy).
- Filter applied to the desktop list too:
- Full
bin/rails teston dac108517: 19562 runs, 1 failure, 8 errors. The failure is the known flaky lock-wait check inaccount_statement_import_concurrency_test.rb, which passed when rerun; the 8 errors areReleaseNotesWorkflowTest, from the local test environment, the same as on PR 1. - System tests: mobile_bottom_nav_scroll, mobile_bottom_nav_clearance, settings, settings/preferences, sidebar_narrow, sidebar_widths, sidebar_animation_rows, portfolios, bills_mobile, release_highlights. 67 runs, 0 failures.
- rubocop, erb_lint and Brakeman: clean. No JS changed.
Screenshots
Preview user with the assistant enabled. In "After", Bills and Reports are hidden. "Before" is PR 1 with no setting.
| Before | After | |
|---|---|---|
| Settings > Appearance, 390 px | ![]() | ![]() |
| Settings > Appearance, 1440 px | ![]() | ![]() |
| Bottom bar, 390 px | (seven entries, scrolls) | (five entries, no scrolling) |
| Desktop sidebar, 1440 px | ![]() | (unchanged, Bills and Reports still there) |
Summary by cubic
Lets users choose which entries the mobile bottom bar shows. Settings > Appearance now has a Bottom bar section with a checkbox per entry the user can currently see; the bar previously showed every main nav entry and scrolled when they didn't fit.
- Home is always shown, its checkbox is disabled, and the desktop sidebar is unaffected. The section's subtitle covers hiding any page on smaller screens, including Assistant removing chat, and that hidden pages can be shown again in the same section.
- The choice is per user, stored in
users.preferences["bottom_bar_hidden"]byUser#update_bottom_barunderwith_locked_preferences, which drops unknown keys, never hideshome, and clears the key when nothing is hidden. - Entries the user can't currently see (Bills and Portfolio without preview) aren't offered and keep their hidden state.
- The main nav list moved to
ApplicationHelper#main_nav_itemswith a stablekey:per entry; the layout drops hidden keys from the phone list only. Intro mode's two-entry bar has no keys and is never filtered, so the section isn't shown there. - The controller reads the form's choices through strong params, permitting
User::BOTTOM_BAR_KEYS, and a form without the bar fields leaves the preference alone.
Summary by CodeRabbit
- New Features
- Added settings to choose which pages appear in the mobile bottom bar. Home stays visible, and these choices do not affect desktop navigation.
- Added Assistant to mobile navigation when available. Pages available only in preview appear in the bottom-bar settings only when accessible.
- Bug Fixes
- Preserved existing bottom-bar preferences when saving settings without bottom-bar fields.
- Ensured unavailable pages remain off the bottom bar and Home cannot be hidden.




(seven entries, scrolls)
(five entries, no scrolling)
(unchanged, Bills and Reports still there)