diff --git a/src/app/(dashboard)/page.tsx b/src/app/(dashboard)/page.tsx index 2905425..77139d0 100644 --- a/src/app/(dashboard)/page.tsx +++ b/src/app/(dashboard)/page.tsx @@ -50,10 +50,18 @@ export default function SummaryPage() { const mapData = useMemo(() => { if (!countries.data) return []; + + // Jika summary menunjukkan tidak ada traffic sama sekali, jangan tampilkan globe + const totalTraffic = (summary.data?.bandwidth_down || 0) + (summary.data?.bandwidth_up || 0); + if (totalTraffic === 0) return []; const origin = getOriginLocation(); return countries.data.reduce((acc: any[], row) => { + // Hanya tampilkan negara yang punya traffic aktual > 0 + const traffic = (row.download || 0) + (row.upload || 0); + if (traffic === 0) return acc; + const dest = getDestinationLocation(row.country_code, row.country_name); if (dest) { acc.push({ @@ -63,7 +71,7 @@ export default function SummaryPage() { endLng: dest.lng, fromLabel: origin.label, toLabel: dest.label, - value: row.download + row.upload, + value: traffic, download: row.download, upload: row.upload, countryCode: row.country_code @@ -71,7 +79,7 @@ export default function SummaryPage() { } return acc; }, []); - }, [countries.data]); + }, [countries.data, summary.data]); useEffect(() => { setMounted(true);