import React from 'react'; import type { ChickenWeight } from '../../types/api.ts'; import { formatDateId, formatNumber } from '../../utils/format.ts'; import { formatWeight, getTargetWeightForAge } from '../../utils/weight.ts'; interface DailyDetailPanelProps { row: ChickenWeight | null; docWeight: number; } const DetailCard: React.FC<{ label: string; value: string; icon: React.ReactNode; highlight?: boolean; }> = ({ label, value, icon, highlight = false }) => (
{icon}

{label}

{value}

); const DailyDetailPanel: React.FC = ({ row, docWeight }) => { if (!row) { return (

Belum ada data untuk tanggal ini

Pilih tanggal lain untuk melihat rincian harian

); } const target = getTargetWeightForAge(row.age, docWeight); const deviation = target != null && row.average_weight > 0 ? row.average_weight - target : null; return (
} /> } /> } /> } highlight /> } /> } /> } /> {deviation != null && ( = 0 ? '+' : ''}${formatWeight(Math.abs(deviation), { stripTrailingZeros: true, })}`} icon={} /> )}
); }; export default DailyDetailPanel;