mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-21 15:55:50 +00:00
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:
@@ -39,6 +39,13 @@ export function BattleFlow({ buddyData: initialData, onClose }: BattleFlowProps)
|
|||||||
const [pendingEvos, setPendingEvos] = useState<{ creatureId: string; from: SpeciesId; to: SpeciesId }[]>([])
|
const [pendingEvos, setPendingEvos] = useState<{ creatureId: string; from: SpeciesId; to: SpeciesId }[]>([])
|
||||||
const [replaceIndex, setReplaceIndex] = useState(0)
|
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
|
// Config phase: start battle
|
||||||
const handleStartBattle = useCallback((speciesId: SpeciesId, level: number) => {
|
const handleStartBattle = useCallback((speciesId: SpeciesId, level: number) => {
|
||||||
setOpponentSpeciesId(speciesId)
|
setOpponentSpeciesId(speciesId)
|
||||||
|
|||||||
Reference in New Issue
Block a user