diff --git a/components/dashboard/Countries.tsx b/components/dashboard/Countries.tsx
index f57e5ce..d54b505 100644
--- a/components/dashboard/Countries.tsx
+++ b/components/dashboard/Countries.tsx
@@ -1,6 +1,7 @@
'use client'
import { formatNumber } from '@/lib/utils/format'
+import * as Flags from 'country-flag-icons/react/3x2'
interface CountriesProps {
countries: Array<{ country: string; pageviews: number }>
@@ -18,6 +19,14 @@ export default function Countries({ countries }: CountriesProps) {
)
}
+ const getFlagComponent = (countryCode: string) => {
+ if (!countryCode || countryCode === 'Unknown') return null
+ // * The API returns 2-letter country codes (e.g. US, DE)
+ // * We cast it to the flag component name
+ const FlagComponent = (Flags as any)[countryCode]
+ return FlagComponent ?