# Subtask 9 Progress: Update LootInventory.tsx and AchievementsDisplay.tsx with Design System ## Task Completion Status ### ✅ Completed Changes #### 1. LootInventory.tsx - **File Path**: `/home/user/repos/Mana-Loop/src/components/game/LootInventory.tsx` - **Changes Made**: - ✅ Replaced `Card` component with `GameCard` from UI primitives - ✅ Replaced inline hex colors with CSS variables from `globals.css`: - `--bg-surface`, `--bg-sunken` for backgrounds - `--border-default`, `--border-subtle` for borders - `--text-primary`, `--text-secondary`, `--text-muted`, `--text-disabled` for text colors - `--mana-*` variables for element colors - `--color-danger` for delete/danger actions - `--interactive-danger`, `--interactive-danger-hover` for danger button states - `--rarity-*` CSS variables for rarity colors (added to globals.css) - ✅ Used `ElementBadge` component for element display instead of emoji symbols - ✅ Replaced trash emoji with `Trash2` icon from Lucide React - ✅ Used `ActionButton` component instead of raw `Button` from shadcn - ✅ Added proper ARIA labels for accessibility: - Search input has `aria-label="Search inventory"` - Filter buttons have `aria-pressed` and `aria-label` - Sort button has `aria-label` indicating current sort mode - Delete buttons have `aria-label` with item name - Item count badge has `aria-label` with total items - ✅ Empty state has explicit messaging: "No items collected yet. Defeat floors and guardians to find loot!" - ✅ Delete confirmation dialog uses design system colors - ✅ No raw hex colors in className (all use CSS variables) #### 2. AchievementsDisplay.tsx - **File Path**: `/home/user/repos/Mana-Loop/src/components/game/AchievementsDisplay.tsx` - **Changes Made**: - ✅ Replaced `Card` component with `GameCard` from UI primitives - ✅ Replaced inline hex colors with CSS variables: - `--bg-surface` for AlertDialog content background - `--border-default` for borders - `--text-primary`, `--text-secondary`, `--text-muted` for text colors - `--mana-light` for achievement icons and unlocked text - `--rarity-legendary` and `--rarity-legendary-glow` for unlocked achievement styling - `--mana-dark` for title badge - `--color-danger` mapped via `CATEGORY_COLOR_MAP` for category colors - Added category color mapping to CSS variables in `CATEGORY_COLOR_MAP` - ✅ Used `ManaBar` component for progress bars instead of raw `Progress` - ✅ Used `ActionButton` component for category expand/collapse buttons - ✅ Added proper ARIA labels for accessibility: - Achievement count badge has `aria-label` with unlocked/total count - Category buttons have `aria-expanded`, `aria-label` with category progress - Progress bars have `aria-label` with percentage - Locked achievements have `aria-label="Locked achievement - details hidden"` - ✅ Empty states handled (locked achievements show "???" with lock icon) - ✅ No raw hex colors in className (all use CSS variables) #### 3. globals.css Updates - **File Path**: `/home/user/repos/Mana-Loop/src/app/globals.css` - **Changes Made**: - ✅ Added rarity CSS variables in `:root` and `.dark`: - `--rarity-common: #9CA3AF` and `--rarity-common-glow: rgba(156, 163, 175, 0.25)` - `--rarity-uncommon: #22C55E` and `--rarity-uncommon-glow: rgba(34, 197, 94, 0.25)` - `--rarity-rare: #3B82F6` and `--rarity-rare-glow: rgba(59, 130, 246, 0.25)` - `--rarity-epic: #A855F7` and `--rarity-epic-glow: rgba(168, 85, 247, 0.25)` - `--rarity-legendary: #F59E0B` and `--rarity-legendary-glow: rgba(245, 158, 11, 0.375)` - `--rarity-mythic: #E8734A` and `--rarity-mythic-glow: rgba(232, 115, 74, 0.25)` - ✅ Mapped rarity colors from `RARITY_COLORS` in `loot-drops.ts` to CSS variables ### ✅ Requirements Verification | Requirement | LootInventory.tsx | AchievementsDisplay.tsx | |------------|-------------------|----------------------| | Use CSS vars from globals.css | ✅ | ✅ | | Use UI primitives (GameCard, etc.) | ✅ GameCard, ElementBadge, ActionButton | ✅ GameCard, ManaBar, ActionButton | | Remove emoji icons | ✅ Used Trash2 for delete | ✅ Used Trophy, Lock, CheckCircle, ChevronDown/Up | | Use Lucide React icons | ✅ Trash2, Gem, Sparkles, etc. | ✅ Trophy, Lock, CheckCircle, etc. | | Proper ARIA labels | ✅ | ✅ | | No raw hex colors | ✅ Verified with grep - no hex colors found | ✅ Verified with grep - no hex colors found | | Empty state messaging | ✅ "No items collected yet..." | ✅ "???" for locked achievements | | Mobile layout (375px) | ✅ Uses Tailwind classes, ScrollArea for overflow | ✅ Uses Tailwind classes, ScrollArea for overflow | ### ✅ Build Verification - Next.js build completes successfully - No compilation errors in the updated components - All UI primitives (GameCard, ElementBadge, ActionButton, ManaBar) properly integrated - Verified no hardcoded hex colors remain in either file ### 📝 Notes 1. **Rarity Colors**: Mapped the existing `RARITY_COLORS` from `loot-drops.ts` to CSS variables in `globals.css` for consistency with the design system. 2. **ElementBadge Usage**: In LootInventory.tsx, replaced the custom element display (using `elem.sym`) with the `ElementBadge` component that uses Lucide icons. 3. **ManaBar for Progress**: In AchievementsDisplay.tsx, used `ManaBar` component instead of the basic `Progress` component for consistent styling with the game's design system. 4. **Category Colors**: Created a `CATEGORY_COLOR_MAP` that maps achievement categories to appropriate CSS variables (e.g., combat → `--color-danger`, progression → `--rarity-legendary`). 5. **Delete Confirmation**: Both the UI and the confirmation dialog in LootInventory.tsx are now styled with the design system. The actual delete confirmation logic was already in place. 6. **Mobile Layout**: Both components use `ScrollArea` for content that might overflow and proper Tailwind CSS classes that are responsive. No fixed widths that would cause overflow at 375px. ### 🔄 Remaining Work (for other subtasks) - Subtask 10 would handle ensuring delete confirmation works properly (this is partially done in the UI) - Other tabs/components may need similar updates (SkillsTab, SpellsTab, etc.) ## Summary Successfully updated both LootInventory.tsx and AchievementsDisplay.tsx to use the design system with: - CSS variables instead of hardcoded colors - UI primitives (GameCard, ElementBadge, ActionButton, ManaBar) - Lucide React icons instead of emojis - Proper ARIA labels for accessibility - Explicit empty state messaging - Mobile-friendly layout (no overflow at 375px) Both files compile successfully and the Next.js build passes.