diff --git a/app/sites/[id]/cdn/page.tsx b/app/sites/[id]/cdn/page.tsx
index dbfa207..d44f9ab 100644
--- a/app/sites/[id]/cdn/page.tsx
+++ b/app/sites/[id]/cdn/page.tsx
@@ -24,6 +24,15 @@ import { SkeletonLine, StatCardSkeleton, useMinimumLoading, useSkeletonFade } fr
// ─── Helpers ────────────────────────────────────────────────────
+function getCountryName(code: string): string {
+ try {
+ const regionNames = new Intl.DisplayNames(['en'], { type: 'region' })
+ return regionNames.of(code) || code
+ } catch {
+ return code
+ }
+}
+
function formatBytes(bytes: number): string {
if (bytes === 0) return '0 B'
const units = ['B', 'KB', 'MB', 'GB', 'TB']
@@ -152,7 +161,7 @@ export default function CDNPage() {
const daily = dailyStats?.daily_stats ?? []
const countries = topCountries?.countries ?? []
- const maxCountryBandwidth = countries.length > 0 ? countries[0].bandwidth : 1
+ const totalBandwidth = countries.reduce((sum, row) => sum + row.bandwidth, 0)
return (
@@ -409,56 +418,52 @@ export default function CDNPage() {
- {/* Traffic Distribution Map */}
-
+ {/* Traffic Distribution */}
+
Traffic Distribution
{countries.length > 0 ? (
-
- ({
- country: row.country_code,
- pageviews: row.bandwidth,
- }))}
- />
-
+ <>
+
+ ({
+ country: row.country_code,
+ pageviews: row.bandwidth,
+ }))}
+ />
+
+
+ {countries.map((row) => {
+ const pct = totalBandwidth > 0 ? (row.bandwidth / totalBandwidth) * 100 : 0
+ return (
+
+
+
+ {getCountryName(row.country_code)}
+
+
+ {formatBytes(row.bandwidth)}
+
+
+
+
+ {pct.toFixed(1)}% of total traffic
+
+
+ )
+ })}
+
+ >
) : (
No geographic data for this period.
)}
-
- {/* Bandwidth by Country */}
-
-
Bandwidth by Country
- {countries.length > 0 ? (
-
- {countries.map((row) => (
-
-
- {row.country_code}
-
-
-
- {formatBytes(row.bandwidth)}
-
-
- {formatNumber(row.requests)} req
-
-
- ))}
-
- ) : (
-
- No geographic data for this period.
-
- )}
-
)
}
diff --git a/app/sites/[id]/settings/page.tsx b/app/sites/[id]/settings/page.tsx
index f45423c..7c3fb16 100644
--- a/app/sites/[id]/settings/page.tsx
+++ b/app/sites/[id]/settings/page.tsx
@@ -1616,11 +1616,25 @@ export default function SiteSettingsPage() {
-
@@ -1733,11 +1747,25 @@ export default function SiteSettingsPage() {
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+