mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-23 16:55:51 +00:00
refactor: 提取共享 getStatColor、移除 deprecated EVOLUTION_CHAINS
- 新增 ui/shared.ts 统一 getStatColor 函数 - CompanionCard/SpeciesDetail 改用共享函数,消除重复 - 移除 data/evolution.ts 中已废弃的 EVOLUTION_CHAINS 常量 - 清理 index.ts 导出 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import { calculateStats, getCreatureName, getTotalEV } from '../core/creature'
|
||||
import { getXpProgress } from '../core/experience'
|
||||
import { getEVSummary } from '../core/effort'
|
||||
import { getGenderSymbol } from '../core/gender'
|
||||
import { getStatColor } from './shared'
|
||||
import { getNextEvolution } from '../data/evolution'
|
||||
import { StatBar } from './StatBar'
|
||||
|
||||
@@ -156,15 +157,3 @@ export function CompanionCard({ creature, buddyData, spriteLines }: CompanionCar
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
function getStatColor(stat: string): Color {
|
||||
const colors: Record<string, Color> = {
|
||||
hp: 'ansi:green',
|
||||
attack: 'ansi:red',
|
||||
defense: 'ansi:yellow',
|
||||
spAtk: 'ansi:blue',
|
||||
spDef: 'ansi:magenta',
|
||||
speed: 'ansi:cyan',
|
||||
}
|
||||
return colors[stat] ?? 'ansi:white'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user