ca86b6268c
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 55s
- Fix broken barrel exports in components/game/index.ts - Remove skill system from stores (gameStore, gameActions, gameLoopActions, gameHooks, craftingStore, combat) - Remove skill system from components (page.tsx, LeftPanel, StatsTab, SpellsTab, EnchantmentDesigner, EnchantmentPreparer, GameContext/Provider) - Delete dead code: stats/ directory, attunements/ directory, layout/ Header+TabBar, shared/ StudyProgress+UpgradeDialog duplicates, effects.ts.fix, study-slice.ts, navigation-slice.ts - Delete legacy store/ and store-modules/ directories, redirect remaining callers - Merge root formatting.ts into utils/formatting.ts - Move effects files (dynamic-compute, upgrade-effects, special-effects, upgrade-effects.types) into effects/ directory - Move debug-context.tsx into components/game/debug/ - Create tabs/index.ts barrel for tab components - Fix page.tsx lazy imports to use tabs barrel - Fix all broken import paths across codebase - Remove SKILLS_DEF and skill-evolution references - Trim store.ts to under 400 lines by removing dead skill actions
116 lines
3.9 KiB
TypeScript
Executable File
116 lines
3.9 KiB
TypeScript
Executable File
'use client';
|
|
|
|
import type { SkillUpgradeChoice } from '@/lib/game/types';
|
|
import { Button } from '@/components/ui/button';
|
|
import { Badge } from '@/components/ui/badge';
|
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '@/components/ui/dialog';
|
|
|
|
export interface UpgradeDialogProps {
|
|
open: boolean;
|
|
skillId: string | null;
|
|
milestone: 5 | 10;
|
|
pendingSelections: string[];
|
|
available: SkillUpgradeChoice[];
|
|
alreadySelected: string[];
|
|
onToggle: (upgradeId: string) => void;
|
|
onConfirm: () => void;
|
|
onCancel: () => void;
|
|
onOpenChange: (open: boolean) => void;
|
|
}
|
|
|
|
export function UpgradeDialog({
|
|
open,
|
|
skillId,
|
|
milestone,
|
|
pendingSelections,
|
|
available,
|
|
alreadySelected,
|
|
onToggle,
|
|
onConfirm,
|
|
onCancel,
|
|
onOpenChange,
|
|
}: UpgradeDialogProps) {
|
|
if (!skillId) return null;
|
|
|
|
const currentSelections = pendingSelections.length > 0 ? pendingSelections : alreadySelected;
|
|
|
|
return (
|
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
<DialogContent className="bg-gray-900 border-gray-700 max-w-lg">
|
|
<DialogHeader>
|
|
<DialogTitle className="text-amber-400">
|
|
Choose Upgrade - {skillId}
|
|
</DialogTitle>
|
|
<DialogDescription className="text-gray-400">
|
|
Level {milestone} Milestone - Select 2 upgrades ({currentSelections.length}/2 chosen)
|
|
</DialogDescription>
|
|
</DialogHeader>
|
|
|
|
<div className="space-y-2 mt-4">
|
|
{available.map((upgrade) => {
|
|
const isSelected = currentSelections.includes(upgrade.id);
|
|
const canToggle = currentSelections.length < 2 || isSelected;
|
|
|
|
return (
|
|
<div
|
|
key={upgrade.id}
|
|
className={`p-3 rounded border cursor-pointer transition-all ${
|
|
isSelected
|
|
? 'border-amber-500 bg-amber-900/30'
|
|
: canToggle
|
|
? 'border-gray-600 bg-gray-800/50 hover:border-amber-500/50 hover:bg-gray-800'
|
|
: 'border-gray-700 bg-gray-800/30 opacity-50 cursor-not-allowed'
|
|
}`}
|
|
onClick={() => {
|
|
if (canToggle) {
|
|
onToggle(upgrade.id);
|
|
}
|
|
}}
|
|
>
|
|
<div className="flex items-center justify-between">
|
|
<div className="font-semibold text-sm text-amber-300">{upgrade.name}</div>
|
|
{isSelected && <Badge className="bg-amber-600 text-amber-100">Selected</Badge>}
|
|
</div>
|
|
<div className="text-xs text-gray-400 mt-1">{upgrade.desc}</div>
|
|
{upgrade.effect.type === 'multiplier' && (
|
|
<div className="text-xs text-green-400 mt-1">
|
|
+{Math.round((upgrade.effect.value! - 1) * 100)}% {upgrade.effect.stat}
|
|
</div>
|
|
)}
|
|
{upgrade.effect.type === 'bonus' && (
|
|
<div className="text-xs text-blue-400 mt-1">
|
|
+{upgrade.effect.value} {upgrade.effect.stat}
|
|
</div>
|
|
)}
|
|
{upgrade.effect.type === 'special' && (
|
|
<div className="text-xs text-cyan-400 mt-1">
|
|
⚡ {upgrade.effect.specialDesc || 'Special effect'}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
})}
|
|
</div>
|
|
|
|
<div className="flex justify-end gap-2 mt-4">
|
|
<Button
|
|
variant="outline"
|
|
onClick={onCancel}
|
|
>
|
|
Cancel
|
|
</Button>
|
|
<Button
|
|
variant="default"
|
|
onClick={onConfirm}
|
|
disabled={currentSelections.length !== 2}
|
|
>
|
|
{currentSelections.length < 2 ? `Select ${2 - currentSelections.length} more` : 'Confirm'}
|
|
</Button>
|
|
</div>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
}
|
|
|
|
UpgradeDialog.displayName = "UpgradeDialog";
|