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 <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -76,8 +76,6 @@ export function DashboardContent() {
|
||||
title="Surat Minggu Ini"
|
||||
value={stats.weeklyService}
|
||||
detail="Total surat diajukan"
|
||||
trend="0%"
|
||||
trendValue={0}
|
||||
icon={<FileText style={{ width: "70%", height: "70%" }} />}
|
||||
/>
|
||||
</Grid.Col>
|
||||
@@ -94,8 +92,6 @@ export function DashboardContent() {
|
||||
title="Layanan Selesai"
|
||||
value={stats.complaints.selesai}
|
||||
detail="Total diselesaikan"
|
||||
trend="+0%"
|
||||
trendValue={0}
|
||||
icon={<CheckCircle style={{ width: "70%", height: "70%" }} />}
|
||||
/>
|
||||
</Grid.Col>
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user