feat(desktop): add setting to disable sidebar line-change stats#2635
feat(desktop): add setting to disable sidebar line-change stats#2635martin-ro wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughA new user-toggleable setting is introduced that controls the display of diff line statistics (additions/deletions counts) across the application. The setting is persisted to the database, exposed via TRPC endpoints, integrated into the Settings UI, and wired into multiple sidebar and changes-view components to conditionally render line-change statistics. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
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)
📝 Coding Plan
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.
No issues found across 17 files
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/desktop/src/renderer/routes/_authenticated/settings/utils/settings-search/settings-search.test.ts (1)
65-70: Consider reorganizing the test into its own describe block.The new test for "lines changed" is placed within the
"settings search - font settings"describe block, but it's testing a behavior setting rather than font settings. This is a minor organizational concern.♻️ Suggested reorganization
describe("settings search - font settings", () => { // ... existing font-related tests ... - - it('searching "lines changed" returns the behavior toggle for sidebar stats', () => { - const results = searchSettings("lines changed"); - const ids = getIds(results); - expect(ids).toContain(SETTING_ITEM_ID.BEHAVIOR_SHOW_LINE_CHANGE_STATS); - }); }); + +describe("settings search - behavior settings", () => { + it('searching "lines changed" returns the behavior toggle for sidebar stats', () => { + const results = searchSettings("lines changed"); + const ids = getIds(results); + expect(ids).toContain(SETTING_ITEM_ID.BEHAVIOR_SHOW_LINE_CHANGE_STATS); + }); +});🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/desktop/src/renderer/routes/_authenticated/settings/utils/settings-search/settings-search.test.ts` around lines 65 - 70, The test that calls searchSettings("lines changed") and asserts SETTING_ITEM_ID.BEHAVIOR_SHOW_LINE_CHANGE_STATS is misplaced in the "settings search - font settings" describe; move this it(...) into its own describe block (e.g., "settings search - behavior settings") or create a new describe specifically for behavior-related searches so the test and any future behavior tests are grouped logically; update or add a describe wrapper around the test containing the existing it(...) that uses searchSettings, getIds, and SETTING_ITEM_ID.BEHAVIOR_SHOW_LINE_CHANGE_STATS.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/utils/settings-search/settings-search.test.ts`:
- Around line 65-70: The test that calls searchSettings("lines changed") and
asserts SETTING_ITEM_ID.BEHAVIOR_SHOW_LINE_CHANGE_STATS is misplaced in the
"settings search - font settings" describe; move this it(...) into its own
describe block (e.g., "settings search - behavior settings") or create a new
describe specifically for behavior-related searches so the test and any future
behavior tests are grouped logically; update or add a describe wrapper around
the test containing the existing it(...) that uses searchSettings, getIds, and
SETTING_ITEM_ID.BEHAVIOR_SHOW_LINE_CHANGE_STATS.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1fbb9d8e-842b-4d74-9c6c-dfaee0215ace
📒 Files selected for processing (17)
apps/desktop/src/lib/trpc/routers/settings/index.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/DashboardSidebarWorkspaceItem.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsxapps/desktop/src/renderer/routes/_authenticated/settings/behavior/components/BehaviorSettings/BehaviorSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/utils/settings-search/settings-search.test.tsapps/desktop/src/renderer/routes/_authenticated/settings/utils/settings-search/settings-search.tsapps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/CommitItem/CommitItem.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/hooks/useOrderedSections/useOrderedSections.test.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/hooks/useOrderedSections/useOrderedSections.tsxapps/desktop/src/renderer/screens/main/components/WorkspacesListView/WorkspaceRow/WorkspaceRow.tsxapps/desktop/src/shared/constants.tspackages/local-db/drizzle/0037_add_show_line_change_stats_setting.sqlpackages/local-db/drizzle/meta/0037_snapshot.jsonpackages/local-db/drizzle/meta/_journal.jsonpackages/local-db/src/schema/schema.ts
Summary
Show lines changed(default: on)+/-line-change badges in the left workspace sidebar when disabled+/-line-change badges in the right Changes sidebar (including commit file lists) when disabledshow_line_change_statsScreenshot
Verification
bun test src/renderer/routes/_authenticated/settings/utils/settings-search/settings-search.test.tsbun test src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/hooks/useOrderedSections/useOrderedSections.test.tsxbun run typecheck(inapps/desktop)Summary by cubic
Adds a new “Show lines changed” setting (default on) to toggle the +/- line-change badges in both sidebars. This reduces sidebar noise when disabled.
New Features
getShowLineChangeStatsandsetShowLineChangeStatsandDEFAULT_SHOW_LINE_CHANGE_STATS.Migration
settings.show_line_change_statsvia migration0037; no manual steps required.Written for commit 1ea2271. Summary will update on new commits.
Summary by CodeRabbit