Description
This is a UI/UX issue. Several UX choices (theme, list density, page size, sort) need persistence and currently sprawl into ad-hoc localStorage usage. Introduce a single typed userPrefs store with helpers (getPref, setPref) and migrate ThemeContext.tsx plus future density/page-size to it for consistent UX continuity.
Requirements and Context
- Reference:
src/ThemeContext.tsx, src/ThemeToggle.tsx
- Single localStorage key
callora.prefs holds a JSON map
- Helpers handle JSON parse failures and migrate from any legacy keys
- Default values exported as constants
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b task/user-prefs-store
- Implement changes
src/utils/userPrefs.ts
- Migrate
ThemeContext.tsx to use it
- Add
format.test.ts-style unit tests for prefs
- Test and commit
npm test for new tests
- Verify legacy theme key still loads after migration
Example commit message
chore: introduce typed userPrefs store
Acceptance Criteria
Guidelines
- Strictly typed via TS generics
- No external state libraries
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
This is a UI/UX issue. Several UX choices (theme, list density, page size, sort) need persistence and currently sprawl into ad-hoc localStorage usage. Introduce a single typed
userPrefsstore with helpers (getPref,setPref) and migrateThemeContext.tsxplus future density/page-size to it for consistent UX continuity.Requirements and Context
src/ThemeContext.tsx,src/ThemeToggle.tsxcallora.prefsholds a JSON mapSuggested Execution
src/utils/userPrefs.tsThemeContext.tsxto use itformat.test.ts-style unit tests for prefsnpm testfor new testsExample commit message
Acceptance Criteria
callora.prefskey holds all preferencesGuidelines