feat(person): add sort controls to person credits page#3187
feat(person): add sort controls to person credits page#3187Maxwell2022 wants to merge 3 commits into
Conversation
Add a client-side sort dropdown on the person page so cast and crew credits can be ordered by release date, popularity, rating, title, or vote count. Defaults to newest release date first. Co-authored-by: Cursor <cursoragent@cursor.com>
…fault Drop popularity and TMDB rating sorts that produced misleading person filmography order. Default back to vote count descending to match the previous implicit behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
Move sortPersonCredits to server/utils so it can be covered by the existing node:test suite. Cover vote count, release date, title sorting, missing dates, and grouping duplicate credits. Co-authored-by: Cursor <cursoragent@cursor.com>
📝 WalkthroughWalkthroughA new ChangesPerson Credit Sorting Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/PersonDetails/index.tsx`:
- Around line 74-90: The JSON.parse call in the useEffect hook lacks error
handling, which will crash the component if localStorage contains malformed
JSON. Wrap the JSON.parse statement in a try-catch block to gracefully handle
parsing errors, and ensure the component continues to function normally by
returning early or skipping the state updates when an error occurs.
🪄 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: 28cbc55a-8a1c-4b6a-a06e-2a78bc12d538
📒 Files selected for processing (4)
server/utils/personCreditHelpers.test.tsserver/utils/personCreditHelpers.tssrc/components/PersonDetails/index.tsxsrc/i18n/locale/en.json
Description
Note
AI Disclosure: Code generation and implementation were assisted by Cursor AI. The changes were reviewed and tested locally before submission.
Adds a sort dropdown to the person page, alongside the existing media type filter (All / Movies / Series). Cast and crew credits are sorted client-side via
sortPersonCreditsinserver/utils/personCreditHelpers.ts.Sort options: vote count (ascending/descending), release date (ascending/descending), and title (A-Z / Z-A). The default is vote count descending, matching the previous implicit behavior. Release date sorting addresses browsing a person's filmography chronologically.
Popularity and TMDB rating sorts were considered but omitted — they produced misleading order on person filmographies compared to Discover pages.
This change reuses existing Seerr patterns rather than introducing new abstractions:
localStoragepersistence (pd-filter-settings, same approach asRequestListandIssueList)<select>filter controls (CircleStackIconfor media type,BarsArrowDownIconfor sort, consistent with list and Discover pages)flex-col sm:flex-rowtoolbar; desktop controls in the page header, mobile below the bio)Sort labels follow Discover wording where applicable. No new shared components, API changes, or settings changes.
How Has This Been Tested?
Tested locally on macOS with Node v25 (using
pnpm --config.engine-strict=falsewhere required; CI uses Node 22).pnpm i18n:extractpnpm typecheck:clientpnpm test server/utils/personCreditHelpers.test.ts(6 tests)pnpm linton changed filespnpm build:nextandpnpm build:serverpnpm dev— server starts on port 5055Manual verification:
pnpm cypress:preparefor a test admin account).localStorage.I've also added some basic unit test for the filters
Screenshots / Logs (if applicable)
Checklist:
pnpm buildpnpm i18n:extractSummary by CodeRabbit