Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
30 lines
1.4 KiB
TypeScript
30 lines
1.4 KiB
TypeScript
import type { ReportFactTable } from "./report-fact-table-schema";
|
|
import type { ReportLanguage } from "./report-language";
|
|
|
|
export const FACT_STATUS_LABELS = {
|
|
multi_system_consensus: "多系统共识",
|
|
single_system_inference: "单一系统推断",
|
|
parameter_sensitive: "参数敏感",
|
|
unclosed_divisional_chart: "分盘尚未核验完整",
|
|
user_history_verification_required: "需要过往经历核对",
|
|
blocked: "暂不可用",
|
|
} as const;
|
|
|
|
export const FACT_STATUS_LABELS_EN: Record<keyof typeof FACT_STATUS_LABELS, string> = {
|
|
multi_system_consensus: "Multi-system agreement",
|
|
single_system_inference: "Single-system inference",
|
|
parameter_sensitive: "Setting-sensitive",
|
|
unclosed_divisional_chart: "Divisional chart not fully checked",
|
|
user_history_verification_required: "Needs checking against past events",
|
|
blocked: "Not available",
|
|
};
|
|
|
|
export function factStatusLabel(status: keyof typeof FACT_STATUS_LABELS, language: ReportLanguage = "zh"): string {
|
|
return (language === "en" ? FACT_STATUS_LABELS_EN : FACT_STATUS_LABELS)[status];
|
|
}
|
|
|
|
export function factCellText(cell: ReportFactTable["rows"][number]["cells"][number], language: ReportLanguage = "zh"): string {
|
|
if (language === "en" && typeof cell === "boolean") return cell ? "Yes" : "No";
|
|
return cell === null ? "—" : typeof cell === "boolean" ? (cell ? "是" : "否") : typeof cell === "number" ? String(Number(cell.toFixed(2))) : cell;
|
|
}
|