SPB Git forge

spb/uqo-chat

Public
14commits 1branches 0releases
1.4 MBsize
maindefault branch
17 days agolast push
Python 64.6% TypeScript 33.7% CSS 0.8%
1.3 KB · 27 lines tsx
Raw Blame History
1import type { ToolCallView } from '@/lib/types';2import { fmtNum } from '@/lib/format';34const LABELS: Record<string, string> = {5  value: 'Valeur', factor: 'Facteur', depreciation: 'Dépréciation ($)', depreciation_ratio: 'Taux de dépréciation',6  depreciated_cost: 'Coût déprécié ($)', remaining_life: 'Durée de vie restante (ans)', cost_new: 'Coût neuf ($)',7  area: 'Superficie', area_other_unit: 'Superficie (autre unité)', ratio: 'Ratio', annual_rate: 'Taux annuel', unit: 'Unité', note: 'Note',8};910export function FinancialCalcCard({ call }: { call: ToolCallView }) {11  const p = call.payload as { function?: string; params?: Record<string, unknown>; result?: Record<string, unknown> };12  const r = p.result || {};13  return (14    <div className="text-sm">15      {r.formula ? <div className="font-mono text-xs text-uqo-blue mb-2">{String(r.formula)}</div> : null}16      <dl className="grid grid-cols-2 gap-x-4 gap-y-1">17        {Object.entries(r).filter(([k]) => k !== 'formula').map(([k, v]) => (18          <div key={k} className="contents">19            <dt className="text-neutral-muted">{LABELS[k] || k}</dt>20            <dd className="font-medium text-right tabular-nums">{typeof v === 'number' ? fmtNum(v, Math.abs(v) < 10 ? 6 : 2) : String(v ?? '—')}</dd>21          </div>22        ))}23      </dl>24    </div>25  );26}27