feat: Hide keyword tags toggle#3071
Conversation
📝 WalkthroughWalkthroughThis PR introduces a reusable ChangesKeyword Tags Toggle Component
Sequence DiagramsequenceDiagram
participant Client as Client
participant Component as DetailsKeywordTags
participant Storage as localStorage
participant Tags as Keyword Tags
Client->>Component: Mount component
Component->>Storage: Load showKeywordTags setting
Storage-->>Component: showTags value (default true)
Component->>Component: Initialize showTags state
Component->>Client: Render toggle button
Client->>Component: Click toggle button
Component->>Component: Update showTags state
Component->>Storage: Persist showTags to storage
Component->>Tags: Conditionally render tag links
Tags-->>Client: Display or hide keywords
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 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/DetailsKeywordTags/index.tsx`:
- Around line 24-28: The component currently flashes tags because showTags
defaults to true then is corrected in useEffect; change initialization to read
persisted preference synchronously by replacing useState(true) with a lazy
initializer like useState(() => { if (typeof window === 'undefined') return
true; return window.localStorage.getItem('showKeywordTags') !== 'false'; }) in
DetailsKeywordTags, and remove the one-time useEffect that sets showTags (or
keep useEffect only to sync future changes to localStorage); reference the
showTags/setShowTags state and the useEffect in the file when making the change.
🪄 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: d7d84de3-21b8-45a7-83bd-67f9c86f3c32
📒 Files selected for processing (4)
src/components/DetailsKeywordTags/index.tsxsrc/components/MovieDetails/index.tsxsrc/components/TvDetails/index.tsxsrc/i18n/locale/en.json
Description
Keyword Tags in the details page are now toggleable. State is saved in localStorage.
AI was used for the css on the button and for questions about code base conventions.
How Has This Been Tested?
Tested interactively on both Movies and TV. Screenshots attached.
Screenshots / Logs (if applicable)
Checklist:
pnpm buildpnpm i18n:extractSummary by CodeRabbit
New Features
Refactor