'use client'; import colors from '@/con/colors'; import { Box, Button, Card, Divider, Group, Loader, NumberInput, Paper, SimpleGrid, Stack, Text, Title, } from '@mantine/core'; import { IconArrowRight, IconMoodBoy, IconHeartbeat, IconPercentage, IconUser, IconAlertTriangle, } from '@tabler/icons-react'; import { useRouter } from 'next/navigation'; import { useEffect, useCallback } from 'react'; import { useProxy } from 'valtio/utils'; import ringkasanKesehatanState from '../../_state/kesehatan/ringkasan-kesehatan/ringkasanKesehatan'; type StatCardProps = { label: string; value: string | number; icon: React.ReactNode; color?: string; suffix?: string; }; function StatCard({ label, value, icon, color = 'blue', suffix }: StatCardProps) { return ( {icon} {label} {value}{suffix && {suffix}} ); } export default function RingkasanKesehatanPage() { const router = useRouter(); const state = useProxy(ringkasanKesehatanState); const stats = state.findStats.data; const loadStats = useCallback(() => { ringkasanKesehatanState.findStats.load(); }, []); useEffect(() => { loadStats(); }, [loadStats]); const isLoading = state.findStats.loading; return ( Ringkasan Kesehatan Desa {isLoading ? ( ) : ( {/* KPI Utama */} KPI Utama } color="pink" suffix="orang" /> } color="blue" suffix="anak" /> } color="red" suffix="anak" /> {/* Statistik % */} Statistik Kesehatan Balita } color="teal" suffix="%" /> } color="green" suffix="%" /> } color="lime" suffix="%" /> } color="orange" suffix="%" /> {/* Target Stunting Config */} Atur Target Stunting Target penurunan angka stunting adalah nilai kebijakan yang ditentukan oleh admin, bukan turunan dari data. { state.update.form.targetStuntingPct = Number(v) || 0; }} radius="md" style={{ flex: 1 }} /> {/* Kelola Data */} Kelola Data )} ); }