Skip to content

fix: refactor settings sidebar with home/settings navigation#119

Merged
nchopra merged 3 commits intomainfrom
fix.menu
Mar 11, 2026
Merged

fix: refactor settings sidebar with home/settings navigation#119
nchopra merged 3 commits intomainfrom
fix.menu

Conversation

@nchopra
Copy link
Contributor

@nchopra nchopra commented Mar 11, 2026

Summary

  • Split the sidebar into a home view (notes + settings link) and a settings sub-view with back navigation
  • Change default route from /settings/history to /settings/notes
  • Add legacy route mappings for /history and /settings/account
  • Fix widget notification navigation paths to use updated routes
  • Add "Back to home" i18n translations (en, es, ja)

Test plan

  • Verify sidebar shows notes and settings link on the home view
  • Verify clicking settings shows the settings nav with a back button
  • Verify back button navigates to /settings/notes
  • Verify widget notification actions navigate to correct routes
  • Verify legacy routes redirect properly

Summary by CodeRabbit

  • New Features

    • Added "Back to home" navigation option in Settings (English, Spanish, Japanese).
  • Improvements

    • Reorganized sidebar navigation to separate home and settings items for clearer access.
    • Changed default landing route to the notes settings page.
    • Updated error-notification action targets for more relevant guidance.
    • Added legacy-route normalization to improve navigation compatibility.

Separate the sidebar into a home view (notes + settings link) and a
settings sub-view with back navigation. Update default route to
/settings/notes, add legacy route mappings, and fix widget notification
navigation paths.
@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Adds a Back-to-home locale key, splits home vs settings navigation items, updates the settings sidebar to render a back link on settings routes, adds legacy route normalization for navigation, and changes error-notification redirect targets and root route redirect.

Changes

Cohort / File(s) Summary
Localization Updates
apps/desktop/src/i18n/locales/en.json, apps/desktop/src/i18n/locales/es.json, apps/desktop/src/i18n/locales/ja.json
Added widget.sidebar.backToHome translations ("Back to home", "Volver al inicio", "ホームに戻る") and adjusted surrounding JSON commas.
Navigation Types & Data
apps/desktop/src/renderer/main/lib/settings-navigation.ts
Added SidebarNavItem base interface; refactored SettingsNavItem to extend it; introduced HOME_NAV_ITEMS and adjusted SETTINGS_NAV_ITEMS contents/shape.
Settings Sidebar Component
apps/desktop/src/renderer/main/components/settings-sidebar.tsx
Uses useLocation() to compute isHomeSidebar, selects HOME_NAV_ITEMS vs SETTINGS_NAV_ITEMS, and renders a back-to-home link (IconChevronLeft) when not on home sidebar.
Router & Legacy Navigation
apps/desktop/src/renderer/main/content.tsx
Added LEGACY_ROUTE_MAP and navigateToRoute helper to normalize legacy routes and parse query params before calling router.navigate.
Route Redirect Update
apps/desktop/src/renderer/main/routes/index.tsx
Changed root route beforeLoad redirect target from /settings/history to /settings/notes.
Error Notification Targets
apps/desktop/src/types/widget-notification.ts
Updated ERROR_CODE_CONFIG primary action targets to new routes (e.g., /settings/history, /settings/preferences, /settings/ai-models?tab=speech).

Sequence Diagram(s)

mermaid
sequenceDiagram
rect rgba(100,149,237,0.5)
participant User
end
rect rgba(60,179,113,0.5)
participant Sidebar as SettingsSidebar
end
rect rgba(255,165,0,0.5)
participant NavLib as SettingsNavigation
end
rect rgba(220,20,60,0.5)
participant Router
end
rect rgba(138,43,226,0.5)
participant Content as ContentModule
end

User->>Sidebar: open sidebar / click nav
Sidebar->>Sidebar: useLocation() -> determine isHomeSidebar
Sidebar->>NavLib: request NAV_ITEMS (HOME or SETTINGS)
Sidebar->>Router: trigger navigation (to url)
Router->>Content: route event with route string
Content->>Content: navigateToRoute() normalize via LEGACY_ROUTE_MAP
Content->>Router: router.navigate(pathname + search)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through keys and paths anew,

I stitched a link that leads to you,
Nav split clean, old routes made right,
A little hop, and home's in sight.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: refactoring the settings sidebar to support dual home/settings navigation modes with a back button.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix.menu

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

nchopra added 2 commits March 10, 2026 23:04
- Derive isHomeSidebar from SETTINGS_NAV_ITEMS instead of hardcoding,
  so any new home-level routes automatically get the home sidebar
- Move LEGACY_ROUTE_MAP outside component to avoid recreating on mount
- Add /settings -> /settings/preferences to legacy map
- Update NETWORK_ERROR navigateTo from /settings to /settings/preferences
- Parse query strings from route URLs and pass them as typed search
  params to router.navigate() instead of inlining in the `to` field
- Treat bare /settings and /settings/ as settings routes to prevent
  brief home sidebar flash during the index redirect
@nchopra nchopra merged commit 1b88bc9 into main Mar 11, 2026
3 of 4 checks passed
@nchopra nchopra deleted the fix.menu branch March 11, 2026 06:13
nchopra added a commit that referenced this pull request Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants