11"use client" ;
22
3- import { AlertCircle , Globe , HelpCircle , MapPin } from "lucide- react" ;
3+ import { GlobeIcon , MapPinIcon , QuestionIcon } from "@phosphor-icons/ react" ;
44import dynamic from "next/dynamic" ;
55import { useParams } from "next/navigation" ;
66import { Suspense , useState } from "react" ;
@@ -11,6 +11,7 @@ import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
1111import { useMapLocationData } from "@/hooks/use-dynamic-query" ;
1212import { cn } from "@/lib/utils" ;
1313import { WebsitePageHeader } from "../_components/website-page-header" ;
14+ import { CountryFlag } from "@/components/analytics/icons/CountryFlag" ;
1415
1516interface CountryData {
1617 country : string ;
@@ -50,24 +51,24 @@ function WebsiteMapPage() {
5051 const { id } = useParams < { id : string } > ( ) ;
5152 const [ mode , setMode ] = useState < "total" | "perCapita" > ( "total" ) ;
5253
53- if ( ! id ) {
54- return < div > No website ID</ div > ;
55- }
56-
57- const { results, isLoading, getDataForQuery } = useMapLocationData ( id , {
54+ const { isLoading, getDataForQuery } = useMapLocationData ( id , {
5855 start_date : new Date ( Date . now ( ) - 30 * 24 * 60 * 60 * 1000 ) . toISOString ( ) . split ( 'T' ) [ 0 ] ,
5956 end_date : new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] ,
6057 granularity : 'daily'
6158 } ) ;
6259
60+ if ( ! id ) {
61+ return < div > No website ID</ div > ;
62+ }
63+
6364 const locationData : LocationData = {
64- countries : ( getDataForQuery ( "map-countries" , "countries " ) || [ ] ) . map ( ( item : { name : string ; visitors : number ; pageviews : number ; country_code ?: string ; country_name ?: string } ) => ( {
65+ countries : ( getDataForQuery ( "map-countries" , "country " ) || [ ] ) . map ( ( item : { name : string ; visitors : number ; pageviews : number ; country_code ?: string ; country_name ?: string } ) => ( {
6566 country : item . country_name || item . name ,
6667 country_code : item . country_code || item . name ,
6768 visitors : item . visitors ,
6869 pageviews : item . pageviews ,
6970 } ) ) ,
70- regions : ( getDataForQuery ( "map-regions" , "regions " ) || [ ] ) . map ( ( item : { name : string ; visitors : number ; pageviews : number } ) => ( {
71+ regions : ( getDataForQuery ( "map-regions" , "region " ) || [ ] ) . map ( ( item : { name : string ; visitors : number ; pageviews : number } ) => ( {
7172 country : item . name ,
7273 visitors : item . visitors ,
7374 pageviews : item . pageviews ,
@@ -86,7 +87,7 @@ function WebsiteMapPage() {
8687 < div className = "flex flex-col gap-4 md:flex-row md:items-center md:justify-between" >
8788 < WebsitePageHeader
8889 title = "Geographic Data"
89- icon = { < Globe className = "h-5 w-5 text-primary" /> }
90+ icon = { < GlobeIcon className = "h-5 w-5 text-primary" weight = "duotone" aria-label = "Globe " /> }
9091 websiteId = { id }
9192 variant = "minimal"
9293 subtitle = { ! isLoading && totalVisitors > 0 ? `${ totalVisitors . toLocaleString ( ) } visitors across ${ topCountries . length } countries` : undefined }
@@ -124,7 +125,7 @@ function WebsiteMapPage() {
124125 < CardHeader className = "flex-shrink-0 pb-3" >
125126 < CardTitle className = "flex items-center justify-between" >
126127 < span className = "flex items-center gap-2" >
127- < MapPin className = "h-4 w-4" />
128+ < MapPinIcon className = "h-4 w-4" weight = "duotone" aria-label = "World Map " />
128129 World Map
129130 </ span >
130131 < Badge className = "text-xs" variant = "secondary" >
@@ -145,7 +146,7 @@ function WebsiteMapPage() {
145146 < Card className = "flex min-h-0 flex-1 flex-col overflow-hidden rounded md:w-72 md:flex-none" >
146147 < CardHeader className = "flex-shrink-0 pb-3" >
147148 < CardTitle className = "flex items-center gap-2" >
148- < Globe className = "h-4 w-4" />
149+ < GlobeIcon className = "h-4 w-4" weight = "duotone" aria-label = "Top Countries " />
149150 Top Countries
150151 </ CardTitle >
151152 </ CardHeader >
@@ -220,7 +221,7 @@ function WebsiteMapPage() {
220221 < div className = "flex items-center justify-between p-3" >
221222 < div className = "flex min-w-0 flex-1 items-center gap-3" >
222223 < div className = "flex h-4 w-6 flex-shrink-0 items-center justify-center rounded bg-muted" >
223- < HelpCircle className = "h-3 w-3 text-muted-foreground" />
224+ < QuestionIcon className = "h-3 w-3 text-muted-foreground" weight = "duotone" aria-label = "Unknown " />
224225 </ div >
225226 < div className = "min-w-0 flex-1" >
226227 < div className = "font-medium text-sm" > Unknown</ div >
@@ -244,7 +245,7 @@ function WebsiteMapPage() {
244245 < div className = "flex flex-col items-center justify-center py-16 text-center" >
245246 < div className = "mb-4" >
246247 < div className = "mx-auto mb-3 flex h-16 w-16 items-center justify-center rounded-2xl bg-muted/20" >
247- < Globe className = "h-7 w-7 text-muted-foreground/50" />
248+ < GlobeIcon className = "h-7 w-7 text-muted-foreground/50" weight = "duotone" aria-label = "No Data " />
248249 </ div >
249250 </ div >
250251 < h4 className = "mb-2 font-medium text-base text-foreground" >
0 commit comments