From c7a986aebc2fb39f4c6d7a9a6b82fc27ebe191ba Mon Sep 17 00:00:00 2001 From: nico Date: Fri, 27 Mar 2026 14:50:34 +0800 Subject: [PATCH] fix: remove hardcoded trend percentages and add debug logging Chart Surat: - Added console.log debugging to track API response and data mapping - Helps identify if data is being received but not rendered Stat Cards: - Removed hardcoded trend='0%' and trendValue={0} props - Cards now display clean without misleading 0% trends - Trend feature can be re-added later with proper API support Files changed: - dashboard/chart-surat.tsx: Added debug logging - dashboard-content.tsx: Removed hardcoded trend props Co-authored-by: Qwen-Coder --- src/components/dashboard-content.tsx | 4 ---- src/components/dashboard/chart-surat.tsx | 15 +++++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/components/dashboard-content.tsx b/src/components/dashboard-content.tsx index 9fcefe8..5665640 100644 --- a/src/components/dashboard-content.tsx +++ b/src/components/dashboard-content.tsx @@ -76,8 +76,6 @@ export function DashboardContent() { title="Surat Minggu Ini" value={stats.weeklyService} detail="Total surat diajukan" - trend="0%" - trendValue={0} icon={} /> @@ -94,8 +92,6 @@ export function DashboardContent() { title="Layanan Selesai" value={stats.complaints.selesai} detail="Total diselesaikan" - trend="+0%" - trendValue={0} icon={} /> diff --git a/src/components/dashboard/chart-surat.tsx b/src/components/dashboard/chart-surat.tsx index a16ece8..18b1535 100644 --- a/src/components/dashboard/chart-surat.tsx +++ b/src/components/dashboard/chart-surat.tsx @@ -36,13 +36,16 @@ export function ChartSurat() { async function fetchTrends() { try { const res = await apiClient.GET("/api/complaint/service-trends"); + console.log("Service trends response:", res); if (res.data?.data) { - setData( - (res.data.data as { month: string; count: number }[]).map((d) => ({ - month: d.month, - value: Number(d.count), - })), - ); + const chartData = (res.data.data as { month: string; count: number }[]).map((d) => ({ + month: d.month, + value: Number(d.count), + })); + console.log("Mapped chart data:", chartData); + setData(chartData); + } else { + console.log("No data in response"); } } catch (error) { console.error("Failed to fetch service trends", error);