import type { EntitySnapshot } from "../types"; import { roleMeta } from "./characterUtils"; type NpcLabelButtonProps = { entity: EntitySnapshot; onSelect: () => void; }; export function NpcLabelButton({ entity, onSelect }: NpcLabelButtonProps) { const meta = roleMeta(entity.role); const isAlive = entity.state.is_alive; const health = Math.max(0, entity.state.health); const maxHealth = Math.max(1, entity.state.max_health); const healthRatio = Math.min(1, health / maxHealth); const age = entity.state.age; const maxAge = entity.state.max_age; const ageRatio = age !== undefined && maxAge !== undefined && maxAge > 0 ? Math.min(1, age / maxAge) : null; const countryBadge = (entity.country_id ?? "?").slice(0, 1).toUpperCase(); const statusLabel = entity.special_status ?? meta.label; return ( ); }