mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 14:25:51 +00:00
39 lines
1.0 KiB
TypeScript
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>
|
|
)
|
|
}
|