Files
claude-code/packages/pokemon/src/ui/SwitchPanel.tsx
claude-code-best 661cc764fe refactor: 清理 SwitchPanel 未使用变量和导入
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 00:51:51 +08:00

39 lines
1.0 KiB
TypeScript

import React from 'react'
import { Box, Text } from '@anthropic/ink'
import type { Creature } from '../types'
import { getCreatureName } from '../core/creature'
const CYAN = 'ansi:cyan'
const GRAY = 'ansi:white'
const WHITE = 'ansi:whiteBright'
interface SwitchPanelProps {
party: Creature[]
activeId: string
onSelect: (creatureId: string) => void
onCancel: () => void
}
export function SwitchPanel({ party, activeId, onSelect, onCancel }: SwitchPanelProps) {
return (
<Box flexDirection="column" borderStyle="round" paddingX={1}>
<Text bold color={CYAN}> </Text>
{party.map((creature, i) => {
const isActive = creature.id === activeId
return (
<Box key={creature.id}>
<Text>{isActive ? ' ▶ ' : ' '}</Text>
<Text color={isActive ? GRAY : WHITE}>
[{i + 1}] {getCreatureName(creature)} (Lv.{creature.level}){' '}
</Text>
{isActive && <Text color={GRAY}> </Text>}
</Box>
)
})}
<Box marginTop={1}>
<Text color={GRAY}> [ESC] </Text>
</Box>
</Box>
)
}