claude-code-best/packages/pokemon/src/ui/ItemPanel.tsx
claude-code-best f5a97011e8 feat: Phase 3 — 战斗 UI 终端交互组件
- BattleConfigPanel: 战斗前配置(队伍展示 + 对手选择)
- BattleView: 战斗主界面(双方 HP + 招式选择 + 事件日志)
- SwitchPanel: 换人选择面板
- ItemPanel: 道具使用面板
- BattleResultPanel: 战斗结算展示
- MoveLearnPanel: 新招式学习面板
- HP 条颜色分级(绿/黄/红)
- 事件日志中文格式化

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

33 lines
868 B
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'
const CYAN = 'ansi:cyan'
const GRAY = 'ansi:white'
interface ItemPanelProps {
items: { id: string; name: string; count: number; description?: string }[]
onSelect: (itemId: string) => void
onCancel: () => void
}
export function ItemPanel({ items, onSelect, onCancel }: ItemPanelProps) {
return (
<Box flexDirection="column" borderStyle="round" paddingX={1}>
<Text bold color={CYAN}> </Text>
{items.length === 0 ? (
<Text color={GRAY}> </Text>
) : (
items.map((item, i) => (
<Box key={item.id}>
<Text> [{i + 1}] {item.name} ×{item.count}</Text>
{item.description && <Text color={GRAY}> {item.description}</Text>}
</Box>
))
)}
<Box marginTop={1}>
<Text color={GRAY}> [ESC] </Text>
</Box>
</Box>
)
}