Skip to content

feat(categories): add custom category management (#48)#506

Open
dextro172-ui wants to merge 1 commit into
Smartdevs17:mainfrom
dextro172-ui:feat/48-custom-category-management
Open

feat(categories): add custom category management (#48)#506
dextro172-ui wants to merge 1 commit into
Smartdevs17:mainfrom
dextro172-ui:feat/48-custom-category-management

Conversation

@dextro172-ui
Copy link
Copy Markdown

@dextro172-ui dextro172-ui commented Jun 1, 2026

Pull Request Checklist

Quality Gates (All must pass before merge)

  • Lint: Code passes ESLint and Prettier checks
  • Type Check: TypeScript compilation succeeds
  • Tests: All tests pass
  • Build: Project builds successfully
  • Rust Format: Smart contract formatting is correct
  • Rust Clippy: Smart contract linting passes
  • Rust Tests: All smart contract tests pass
  • Rust Build: Smart contracts compile successfully

Additional Requirements

  • New code has appropriate TypeScript types
  • No hardcoded secrets or credentials
  • New features have corresponding tests
  • Documentation updated if needed

Reviewers

  • At least 1 approval required for merge
  • All CI checks must be green

This PR will not be mergeable until all quality gates pass.


Summary

Implements full custom category management for SubTrackr, allowing users to create, edit, and delete their own subscription categories while preserving the built-in defaults.

Related Issue

Closes #48

Changes Made

New Files

File Purpose
src/utils/constants/categories.ts Default category definitions, 20-color palette, 28 icon options, max limit constant
src/store/categoryStore.ts Zustand store with CRUD, validation, persistence, guards
src/components/CategorySelector.tsx Reusable picker with inline create/edit/delete modals
src/components/CategoryBadge.tsx Visual badge with color dot and category name
src/components/CategoryPieChart.tsx Analytics pie chart using category colors
src/screens/CategoryManagementScreen.tsx Full-screen management with FAB, cards, modals
src/components/index.ts Barrel export for new components
src/screens/index.ts Barrel export for new screens

Modified Files

File Change
src/types/subscription.ts Added CustomCategory, CustomCategoryFormData, CategoryValue types
src/store/subscriptionStore.ts Added reassignCategory() action for bulk category reassignment

Acceptance Criteria

  • User can create new category (name, icon, color)
  • Custom categories appear in selector alongside defaults
  • Categories can be edited (name, icon, color)
  • Categories can be deleted (with guardrails)
  • Default categories remain immutable
  • Maximum 20 custom categories enforced
  • Cannot delete category with active subscriptions (with reassign option)
  • Icon and color selection UI included

Technical Notes

  • Uses Zustand + zustand/middleware persist for offline-first storage
  • Duplicate name validation (case-insensitive) across all categories
  • reassignCategory() updates all subscriptions atomically and recalculates stats
  • Category data stored separately from subscriptions (subtrackr-categories key)
  • Full TypeScript typing with no any usage
  • All new code follows existing project patterns (errorHandler, debounced storage, etc.)

Testing Notes

  • Unit tests for categoryStore actions (add, update, delete, validation)
  • Integration tests for category CRUD flow
  • Verify stats recalculation after reassignCategory
  • Test max category limit edge case
  • Test duplicate name rejection
  • Test default category immutability

- Add CategoryStore with Zustand persist for custom categories
- Add CategorySelector component with inline CRUD
- Add CategoryBadge for visual category display
- Add CategoryManagementScreen for full management UI
- Add CategoryPieChart for analytics visualization
- Add category constants (defaults, colors, icons)
- Update Subscription type to support custom category IDs
- Add reassignCategory action to SubscriptionStore
- Enforce max 20 custom categories limit
- Prevent deletion of categories with active subscriptions
- Add duplicate name validation
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@dextro172-ui Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Smartdevs17
Copy link
Copy Markdown
Owner

⚠️ Merge failed — check CI status.

🤖 Drips Wave Merge Agent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🏷️ Add custom category management

3 participants