132 lines
5.2 KiB
Markdown
132 lines
5.2 KiB
Markdown
---
|
|
phase: 06-category-icons
|
|
plan: 01
|
|
subsystem: database, api, ui
|
|
tags: [drizzle, sqlite, lucide-react, icons, migration]
|
|
|
|
requires:
|
|
- phase: none
|
|
provides: existing emoji-based categories schema
|
|
provides:
|
|
- Categories table with icon column (Lucide icon names)
|
|
- Zod schemas validating icon field
|
|
- All services returning categoryIcon instead of categoryEmoji
|
|
- LucideIcon render component for dynamic icon display
|
|
- Curated icon data with 119 icons across 8 groups
|
|
- EMOJI_TO_ICON_MAP for migration compatibility
|
|
affects: [06-02, 06-03]
|
|
|
|
tech-stack:
|
|
added: [lucide-react]
|
|
patterns: [kebab-case icon names with PascalCase runtime lookup]
|
|
|
|
key-files:
|
|
created:
|
|
- src/client/lib/iconData.ts
|
|
- drizzle/0001_rename_emoji_to_icon.sql
|
|
modified:
|
|
- src/db/schema.ts
|
|
- src/shared/schemas.ts
|
|
- src/server/services/category.service.ts
|
|
- src/server/services/item.service.ts
|
|
- src/server/services/thread.service.ts
|
|
- src/server/services/setup.service.ts
|
|
- src/server/services/totals.service.ts
|
|
- src/db/seed.ts
|
|
- tests/helpers/db.ts
|
|
|
|
key-decisions:
|
|
- "Used ALTER TABLE RENAME COLUMN for SQLite migration instead of table recreation"
|
|
- "Applied migration directly via Bun SQLite API since drizzle-kit requires interactive input"
|
|
- "119 curated icons across 8 groups for comprehensive gear coverage"
|
|
|
|
patterns-established:
|
|
- "LucideIcon component: render any Lucide icon by kebab-case name string"
|
|
- "Icon names stored as kebab-case strings in database and API"
|
|
|
|
requirements-completed: [CAT-03]
|
|
|
|
duration: 5min
|
|
completed: 2026-03-15
|
|
---
|
|
|
|
# Phase 6 Plan 1: Category Icon Data Layer Summary
|
|
|
|
**Migrated categories from emoji to Lucide icon names with curated 119-icon data set and LucideIcon render component**
|
|
|
|
## Performance
|
|
|
|
- **Duration:** 5 min
|
|
- **Started:** 2026-03-15T16:45:02Z
|
|
- **Completed:** 2026-03-15T16:50:15Z
|
|
- **Tasks:** 2
|
|
- **Files modified:** 18
|
|
|
|
## Accomplishments
|
|
- Renamed emoji column to icon across DB schema, Zod schemas, and all 5 services
|
|
- Created Drizzle migration with emoji-to-icon data conversion for existing categories
|
|
- Built iconData.ts with 119 curated gear-relevant Lucide icons across 8 groups
|
|
- Added LucideIcon component with kebab-to-PascalCase conversion and Package fallback
|
|
- All 87 tests pass, build succeeds
|
|
|
|
## Task Commits
|
|
|
|
Each task was committed atomically:
|
|
|
|
1. **Task 1: Migrate schema, Zod schemas, services, test helper, and seed to icon field** - `546dff1` (feat)
|
|
2. **Task 2: Install lucide-react and create icon data file with LucideIcon component** - `fca1eb7` (feat)
|
|
|
|
## Files Created/Modified
|
|
- `src/db/schema.ts` - Categories table now uses icon column with "package" default
|
|
- `src/shared/schemas.ts` - Zod schemas validate icon as string(1-50)
|
|
- `src/server/services/category.service.ts` - Parameter types use icon instead of emoji
|
|
- `src/server/services/item.service.ts` - Returns categoryIcon instead of categoryEmoji
|
|
- `src/server/services/thread.service.ts` - Returns categoryIcon in both list and detail
|
|
- `src/server/services/setup.service.ts` - Returns categoryIcon in setup item list
|
|
- `src/server/services/totals.service.ts` - Returns categoryIcon in category totals
|
|
- `src/db/seed.ts` - Seeds Uncategorized with icon "package"
|
|
- `tests/helpers/db.ts` - Test helper creates icon column, seeds with "package"
|
|
- `src/client/lib/iconData.ts` - Curated icon groups, LucideIcon component, emoji-to-icon map
|
|
- `drizzle/0001_rename_emoji_to_icon.sql` - Migration SQL with data conversion
|
|
- `package.json` - Added lucide-react dependency
|
|
|
|
## Decisions Made
|
|
- Used ALTER TABLE RENAME COLUMN for SQLite migration -- simpler than table recreation, supported in SQLite 3.25+
|
|
- Applied migration directly via Bun SQLite API since drizzle-kit push/generate requires interactive input for column renames
|
|
- Included 119 icons (slightly under the upper bound) for comprehensive gear coverage without bloat
|
|
|
|
## Deviations from Plan
|
|
|
|
### Auto-fixed Issues
|
|
|
|
**1. [Rule 3 - Blocking] Updated all test files referencing emoji/categoryEmoji**
|
|
- **Found during:** Task 1 (schema migration)
|
|
- **Issue:** Test files referenced emoji field and categoryEmoji property which no longer exist after schema rename
|
|
- **Fix:** Updated 6 test files to use icon/categoryIcon
|
|
- **Files modified:** tests/services/category.service.test.ts, tests/routes/categories.test.ts, tests/services/item.service.test.ts, tests/services/totals.test.ts, tests/services/setup.service.test.ts, tests/services/thread.service.test.ts
|
|
- **Verification:** All 87 tests pass
|
|
- **Committed in:** 546dff1 (Task 1 commit)
|
|
|
|
---
|
|
|
|
**Total deviations:** 1 auto-fixed (1 blocking)
|
|
**Impact on plan:** Test updates were necessary for correctness. No scope creep.
|
|
|
|
## Issues Encountered
|
|
- drizzle-kit generate/push commands require interactive input for column renames -- applied migration SQL directly via Bun SQLite API instead
|
|
|
|
## User Setup Required
|
|
None - no external service configuration required.
|
|
|
|
## Next Phase Readiness
|
|
- Icon data infrastructure complete, ready for UI component work (06-02: IconPicker, 06-03: display integration)
|
|
- Client-side still references categoryEmoji -- will be updated in subsequent plans
|
|
|
|
## Self-Check: PASSED
|
|
|
|
All created files verified, all commits found, all key exports confirmed.
|
|
|
|
---
|
|
*Phase: 06-category-icons*
|
|
*Completed: 2026-03-15*
|