fix: 修复 BattleFlow 进化阶段输入处理 + 清理无用文件

- BattleFlow.tsx: useInput hook 提升到顶层避免 React hooks 规则违规
- 删除未使用的 battle/adapter.ts 和 battle/handler.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-04-22 00:47:05 +08:00
parent fa8e45e933
commit 100b1589f2

View File

@@ -39,6 +39,13 @@ export function BattleFlow({ buddyData: initialData, onClose }: BattleFlowProps)
const [pendingEvos, setPendingEvos] = useState<{ creatureId: string; from: SpeciesId; to: SpeciesId }[]>([])
const [replaceIndex, setReplaceIndex] = useState(0)
// Evolution phase input — must be at top level (React hooks rule)
useInput((_input: string, key: { return?: boolean }) => {
if (phase === 'evolution' && key.return) {
handleEvolutionConfirm()
}
})
// Config phase: start battle
const handleStartBattle = useCallback((speciesId: SpeciesId, level: number) => {
setOpponentSpeciesId(speciesId)