diff --git a/src/components/game/tabs/CraftingTab.tsx b/src/components/game/tabs/CraftingTab.tsx index 180e78b..b3f2fb8 100755 --- a/src/components/game/tabs/CraftingTab.tsx +++ b/src/components/game/tabs/CraftingTab.tsx @@ -1,12 +1,10 @@ 'use client'; import { useState } from 'react'; -import { Button } from '@/components/ui/button'; import { Progress } from '@/components/ui/progress'; import { GameCard } from '@/components/ui/game-card'; import { SectionHeader } from '@/components/ui/section-header'; import { ActionButton } from '@/components/ui/action-button'; -import { Stepper } from '@/components/ui/stepper'; import { Scroll, Hammer, Sparkles, Anvil } from 'lucide-react'; import type { EquipmentInstance, EnchantmentDesign, DesignEffect, AppliedEnchantment, LootInventory, EquipmentCraftingProgress } from '@/lib/game/types'; import { fmt, type GameStore } from '@/lib/game/store'; @@ -22,9 +20,6 @@ export interface CraftingTabProps { store: GameStore; } -// Crafting phases for the stepper -const CRAFTING_PHASES = ['Design', 'Prepare', 'Apply', 'Craft']; - export function CraftingTab({ store }: CraftingTabProps) { const showToast = useGameToast(); const currentAction = store.currentAction; @@ -35,18 +30,8 @@ export function CraftingTab({ store }: CraftingTabProps) { const pauseApplication = store.pauseApplication; const resumeApplication = store.resumeApplication; - const [craftingStage, setCraftingStage] = useState<'design' | 'prepare' | 'apply' | 'craft'>('craft'); - - // Map crafting stage to stepper index - const getStepperIndex = (stage: string): number => { - switch (stage) { - case 'design': return 0; - case 'prepare': return 1; - case 'apply': return 2; - case 'craft': return 3; - default: return 0; - } - }; + const [activeTab, setActiveTab] = useState<'fabricate' | 'enchant'>('fabricate'); + const [enchantStage, setEnchantStage] = useState<'design' | 'prepare' | 'apply'>('design'); // Safe toFixed helper const safeToFixed = (value: number | undefined, decimals: number = 0): string => { @@ -72,96 +57,105 @@ export function CraftingTab({ store }: CraftingTabProps) { return (
- {/* Visual Stepper - Requirement: show Design, Prepare, Apply phases as visual stepper */} + {/* Top Sub-Tabs: Fabricate / Enchant */} - - - - {/* Stage Content - Without unlabeled Tabs, using conditional rendering instead */} -
- {craftingStage === 'craft' && ( - - )} - {craftingStage === 'design' && ( - {}} - selectedEffects={[]} - setSelectedEffects={() => {}} - designName={''} - setDesignName={() => {}} - selectedDesign={null} - setSelectedDesign={() => {}} - /> - )} - {craftingStage === 'prepare' && ( - {}} - /> - )} - {craftingStage === 'apply' && ( - {}} - selectedDesign={null} - setSelectedDesign={() => {}} - onEnchantmentApplied={handleEnchantmentApplied} - onCapacityExceeded={handleCapacityExceeded} - /> - )} -
- - {/* Stage Navigation Buttons */} - -
+
setCraftingStage('craft')} - className={craftingStage === 'craft' ? 'ring-2 ring-[var(--interactive-primary)]' : ''} + variant={activeTab === 'fabricate' ? 'primary' : 'secondary'} + onClick={() => setActiveTab('fabricate')} + className={activeTab === 'fabricate' ? 'ring-2 ring-[var(--interactive-primary)]' : ''} > - Craft + Fabricate setCraftingStage('design')} - className={craftingStage === 'design' ? 'ring-2 ring-[var(--interactive-primary)]' : ''} - > - - Design - - setCraftingStage('prepare')} - className={craftingStage === 'prepare' ? 'ring-2 ring-[var(--interactive-primary)]' : ''} - > - - Prepare - - setCraftingStage('apply')} - className={craftingStage === 'apply' ? 'ring-2 ring-[var(--interactive-primary)]' : ''} + variant={activeTab === 'enchant' ? 'primary' : 'secondary'} + onClick={() => setActiveTab('enchant')} + className={activeTab === 'enchant' ? 'ring-2 ring-[var(--interactive-primary)]' : ''} > - Apply + Enchant
- {/* Current Activity Indicator */} + {/* Fabricate Content: EquipmentCrafter */} + {activeTab === 'fabricate' && ( + + )} + + {/* Enchant Content: Design → Prepare → Apply workflow */} + {activeTab === 'enchant' && ( +
+ {/* Enchant Sub-Navigation (no numbered stepper) */} + +
+ setEnchantStage('design')} + className={enchantStage === 'design' ? 'ring-2 ring-[var(--interactive-primary)]' : ''} + > + + Design + + setEnchantStage('prepare')} + className={enchantStage === 'prepare' ? 'ring-2 ring-[var(--interactive-primary)]' : ''} + > + + Prepare + + setEnchantStage('apply')} + className={enchantStage === 'apply' ? 'ring-2 ring-[var(--interactive-primary)]' : ''} + > + + Apply + +
+
+ + {/* Enchant Stage Content */} + {enchantStage === 'design' && ( + {}} + selectedEffects={[]} + setSelectedEffects={() => {}} + designName={''} + setDesignName={() => {}} + selectedDesign={null} + setSelectedDesign={() => {}} + /> + )} + {enchantStage === 'prepare' && ( + {}} + /> + )} + {enchantStage === 'apply' && ( + {}} + selectedDesign={null} + setSelectedDesign={() => {}} + onEnchantmentApplied={handleEnchantmentApplied} + onCapacityExceeded={handleCapacityExceeded} + /> + )} +
+ )} + + {/* Current Activity Indicator: Crafting */} {currentAction === 'craft' && equipmentCraftingProgress && ( )} + {/* Current Activity Indicator: Designing */} {currentAction === 'design' && designProgress && ( )} + {/* Current Activity Indicator: Preparing */} {currentAction === 'prepare' && preparationProgress && ( )} + {/* Current Activity Indicator: Enchanting */} {currentAction === 'enchant' && applicationProgress && ( Resume ) : ( <> - Pause + Pause { store.cancelApplication(); showToast('warning', 'Enchantment Cancelled', 'The enchantment application was cancelled.');