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:
claude-code-best
2026-04-22 01:58:33 +08:00
parent fae96c3e7f
commit 98284a5908
5 changed files with 19 additions and 30 deletions

View File

@@ -6,6 +6,7 @@ import { getSpeciesData } from '../data/species'
import { SPECIES_PERSONALITY } from '../data/names'
import { getNextEvolution } from '../data/evolution'
import { StatBar } from './StatBar'
import { getStatColor } from './shared'
const CYAN: Color = 'ansi:cyan'
const GRAY: Color = 'ansi:white'
@@ -184,10 +185,3 @@ function isInChain(target: SpeciesId, head: SpeciesId): boolean {
return false
}
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'
}