1- import { Card , CardContent , CardDescription , CardHeader , CardTitle } from "@/components/ui/card" ;
1+ import { Card , CardContent , CardDescription , CardHeader , CardTitle , CardFooter } from "@/components/ui/card" ;
22import { Globe } from "lucide-react" ;
33import { Stats } from "@/hooks/useWebSocket" ;
44import { ComposableMap , Geographies , Geography , ZoomableGroup } from "react-simple-maps" ;
@@ -98,7 +98,7 @@ export function GeoMap({ stats }: GeoMapProps) {
9898 }
9999 </ CardDescription >
100100 </ CardHeader >
101- < CardContent >
101+ < CardContent className = "pb-2" >
102102 < div className = "w-full h-[400px]" >
103103 { ! stats ? (
104104 < div className = "h-full flex items-center justify-center text-muted-foreground" >
@@ -130,7 +130,6 @@ export function GeoMap({ stats }: GeoMapProps) {
130130 const geoName = geo . properties . name || geo . properties . NAME ;
131131 const geoCode = geo . properties . ISO_A2 || geo . properties . ISO_A3 ;
132132
133- // Try to find country data by name, mapped name, or code
134133 const data = countryData [ geoName ] ||
135134 countryData [ geoCode ] ||
136135 { count : 0 , code : '' } ;
@@ -168,43 +167,44 @@ export function GeoMap({ stats }: GeoMapProps) {
168167 </ ZoomableGroup >
169168 </ ComposableMap >
170169 < ReactTooltip id = "country-tooltip" />
171-
172- { /* Legend */ }
173- < div className = "mt-4 flex items-center justify-center gap-4 text-sm" >
174- < span className = "text-muted-foreground" > Requests:</ span >
175- < div className = "flex items-center gap-2" >
176- < div className = "w-4 h-4 bg-[#dbeafe]" />
177- < span > Low</ span >
178- </ div >
179- < div className = "flex items-center gap-2" >
180- < div className = "w-4 h-4 bg-[#3b82f6]" />
181- < span > Medium</ span >
182- </ div >
183- < div className = "flex items-center gap-2" >
184- < div className = "w-4 h-4 bg-[#1e40af]" />
185- < span > High</ span >
186- </ div >
187- </ div >
188-
189- { /* Top Countries List */ }
190- { stats . topCountries . length > 0 && (
191- < div className = "mt-4 grid grid-cols-2 md:grid-cols-3 gap-2 text-sm" >
192- { stats . topCountries . slice ( 0 , 6 ) . map ( ( country , idx ) => (
193- < div key = { idx } className = "flex items-center justify-between p-2 rounded bg-muted/50" >
194- < span className = "flex items-center gap-1" >
195- < span className = "font-mono text-xs" > { country . countryCode ?? '' } </ span >
196- < span className = "text-muted-foreground" > -</ span >
197- < span className = "truncate" > { country . country } </ span >
198- </ span >
199- < span className = "font-semibold" > { country . count . toLocaleString ( ) } </ span >
200- </ div >
201- ) ) }
202- </ div >
203- ) }
204170 </ >
205171 ) }
206172 </ div >
207173 </ CardContent >
174+ { hasCountryData && (
175+ < CardFooter className = "flex-col items-start gap-y-4" >
176+ { /* Legend */ }
177+ < div className = "flex w-full items-center justify-center gap-4 text-sm" >
178+ < span className = "text-muted-foreground" > Requests:</ span >
179+ < div className = "flex items-center gap-2" >
180+ < div className = "w-4 h-4 bg-[#dbeafe]" />
181+ < span > Low</ span >
182+ </ div >
183+ < div className = "flex items-center gap-2" >
184+ < div className = "w-4 h-4 bg-[#3b82f6]" />
185+ < span > Medium</ span >
186+ </ div >
187+ < div className = "flex items-center gap-2" >
188+ < div className = "w-4 h-4 bg-[#1e40af]" />
189+ < span > High</ span >
190+ </ div >
191+ </ div >
192+
193+ { /* Top Countries List */ }
194+ < div className = "w-full grid grid-cols-2 md:grid-cols-3 gap-2 text-sm pt-4 border-t" >
195+ { stats . topCountries . slice ( 0 , 6 ) . map ( ( country , idx ) => (
196+ < div key = { idx } className = "flex items-center justify-between p-2 rounded bg-muted/50" >
197+ < span className = "flex items-center gap-1" >
198+ < span className = "font-mono text-xs" > { country . countryCode ?? '' } </ span >
199+ < span className = "text-muted-foreground" > -</ span >
200+ < span className = "truncate" > { country . country } </ span >
201+ </ span >
202+ < span className = "font-semibold" > { country . count . toLocaleString ( ) } </ span >
203+ </ div >
204+ ) ) }
205+ </ div >
206+ </ CardFooter >
207+ ) }
208208 </ Card >
209209 ) ;
210210}
0 commit comments