Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a persisted app-wide "Reduced Motion" preference (system|always|never), centralizes motion handling via a new AppMotionProvider, flows the setting through bootstrap, API, import/export, reset, and settings UI, and updates tests and i18n to cover the behavior. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App as App.tsx
participant Query as ReactQuery
participant API as /api/settings
participant Motion as AppMotionProvider
participant UI as Components (Dialogs/Charts/Modal)
User->>App: Load app
App->>Query: fetchSettings()
Query->>API: GET /api/settings
API-->>Query: { reducedMotionPreference: "system" }
Query-->>App: settings
App->>Motion: Provide preference="system"
Motion->>UI: Provide shouldReduceMotion via context
UI-->>User: Render (animations on/off)
User->>UI: Open Settings Modal
User->>UI: Select "always"
UI->>Query: mutate PATCH /api/settings { reducedMotionPreference: "always" }
Query->>API: PATCH /api/settings
API-->>Query: Updated settings
Query-->>App: Updated settings
App->>Motion: Provide preference="always"
Motion->>UI: Update shouldReduceMotion (force reduce)
UI-->>User: Animations disabled
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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 docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
tests/unit/api.test.ts (1)
58-80: Test intent and assertion are slightly misaligned.Line 58 says “normalizes”, but the fixture at Line 65 already uses a valid value (
'never'), so this test verifies pass-through rather than normalization fallback. Consider renaming it or adding an invalid-value case that expects'system'.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/unit/api.test.ts` around lines 58 - 80, The test name says "normalizes reduced-motion preferences" but the stubbed response already returns a valid reducedMotionPreference ('never'), so it only verifies passthrough; update the test to either rename it to reflect pass-through (change the it(...) description) or change the stubbed fixture to return an invalid value (e.g., 'invalid' or null) and assert that fetchSettings() normalizes it to 'system'; target the test case containing the fetch stub and the call to fetchSettings().src/lib/motion.tsx (1)
74-76: Consider passingenabledto avoid unnecessary subscription.
useSystemReducedMotion()subscribes to media query changes even when the preference is'always'or'never', where the system value is unused. Passing theenabledargument would skip the subscription when not needed.♻️ Optional optimization
- const systemReducedMotion = useSystemReducedMotion() + const systemReducedMotion = useSystemReducedMotion(preference === 'system')🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/motion.tsx` around lines 74 - 76, The code always calls useSystemReducedMotion() which subscribes to media query changes even when preference is 'always' or 'never'; change the call to pass an enabled boolean so the hook only subscribes when needed (i.e., enabled = preference === 'system' or when preference is neither 'always' nor 'never'), then compute shouldReduceMotion as before using preference === 'always' ? true : preference === 'never' ? false : systemReducedMotion; update references to useSystemReducedMotion and the shouldReduceMotion assignment accordingly.
🤖 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/locales/de/common.json`:
- Around line 913-919: Translate and naturalize the German strings: change
dashboardSettingsTitle from "Dashboard Settings" to "Dashboard-Einstellungen",
adjust reducedMotionDescription to use German compound wording (e.g., replace
"Browser-Einstellung" with "Browsereinstellung" and prefer native terms like
"Toast-Benachrichtigungen" instead of "Toast-Feedback"), and change
reducedMotionOptions.always from "Ja" to a more natural option like "Immer" or
"Immer aktiv". Locate and update the keys dashboardSettingsTitle,
reducedMotionDescription, and reducedMotionOptions.always in the JSON.
---
Nitpick comments:
In `@src/lib/motion.tsx`:
- Around line 74-76: The code always calls useSystemReducedMotion() which
subscribes to media query changes even when preference is 'always' or 'never';
change the call to pass an enabled boolean so the hook only subscribes when
needed (i.e., enabled = preference === 'system' or when preference is neither
'always' nor 'never'), then compute shouldReduceMotion as before using
preference === 'always' ? true : preference === 'never' ? false :
systemReducedMotion; update references to useSystemReducedMotion and the
shouldReduceMotion assignment accordingly.
In `@tests/unit/api.test.ts`:
- Around line 58-80: The test name says "normalizes reduced-motion preferences"
but the stubbed response already returns a valid reducedMotionPreference
('never'), so it only verifies passthrough; update the test to either rename it
to reflect pass-through (change the it(...) description) or change the stubbed
fixture to return an invalid value (e.g., 'invalid' or null) and assert that
fetchSettings() normalizes it to 'system'; target the test case containing the
fetch stub and the call to fetchSettings().
🪄 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: d8922057-75ee-4e9d-ab54-18f1a7cbeab6
📒 Files selected for processing (19)
CHANGELOG.mdserver.jssrc/App.tsxsrc/components/Dashboard.tsxsrc/components/features/settings/SettingsModal.tsxsrc/hooks/use-app-settings.tssrc/hooks/use-dashboard-controller.tssrc/lib/api.tssrc/lib/app-settings.tssrc/lib/motion.tssrc/lib/motion.tsxsrc/locales/de/common.jsonsrc/locales/en/common.jsonsrc/types/index.tstests/e2e/dashboard.spec.tstests/frontend/motion-accessibility.test.tsxtests/frontend/settings-modal.test.tsxtests/integration/server.test.tstests/unit/api.test.ts
💤 Files with no reviewable changes (1)
- src/lib/motion.ts
Summary by CodeRabbit
New Features
Bug Fixes
Tests