claude-code-best/packages/pokemon/src/ui/BattleResultPanel.tsx
claude-code-best f22caf0e97 feat: 集成 Battle tab 到 BuddyPanel,重命名 data/ 为 dex/ 规避 gitignore
- BuddyPanel 新增 Battle tab,BattleFlow 加 isActive 控制
- BattleFlow configSelect 阶段支持 ↑↓ 选择物种
- packages/pokemon/src/data/ → dex/,解决根 .gitignore 匹配问题
- 全量 Tab→2空格 缩进转换

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 08:35:19 +08:00

49 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react'
import { Box, Text } from '@anthropic/ink'
import type { BattleResult, BattlePokemon } from '../battle/types'
const GREEN = 'ansi:green'
const RED = 'ansi:red'
const YELLOW = 'ansi:yellow'
const CYAN = 'ansi:cyan'
const WHITE = 'ansi:whiteBright'
interface BattleResultPanelProps {
result: BattleResult
playerPokemon: BattlePokemon
onContinue: () => void
}
export function BattleResultPanel({ result, playerPokemon, onContinue }: BattleResultPanelProps) {
const isWin = result.winner === 'player'
return (
<Box flexDirection="column" borderStyle="round" paddingX={1}>
<Box>
<Text bold color={isWin ? GREEN : RED}>
{' '}{isWin ? '胜利!' : '失败...'}
</Text>
</Box>
{isWin && (
<Box flexDirection="column">
<Text> {playerPokemon.name} {result.xpGained} </Text>
{Object.keys(result.evGained).length > 0 && (
<Box>
<Text> : </Text>
{Object.entries(result.evGained).map(([stat, value]) => (
<Text key={stat}> {stat.toUpperCase()}+{value} </Text>
))}
</Box>
)}
</Box>
)}
<Box marginTop={1}>
<Text color={CYAN}> [Enter] </Text>
</Box>
</Box>
)
}