@@ -17,16 +17,86 @@ interface UsageData {
1717
1818// Global usage data - in a real app, this would come from analytics APIs
1919const globalUsageData : UsageData [ ] = [
20- { region : "North America" , country : "United States" , users : 1250 , growth : 23 , coordinates : { x : 25 , y : 35 } , color : "primary" } ,
21- { region : "North America" , country : "Canada" , users : 380 , growth : 18 , coordinates : { x : 23 , y : 25 } , color : "primary" } ,
22- { region : "Europe" , country : "United Kingdom" , users : 920 , growth : 31 , coordinates : { x : 50 , y : 30 } , color : "secondary" } ,
23- { region : "Europe" , country : "Germany" , users : 850 , growth : 27 , coordinates : { x : 52 , y : 32 } , color : "secondary" } ,
24- { region : "Europe" , country : "France" , users : 640 , growth : 19 , coordinates : { x : 51 , y : 35 } , color : "secondary" } ,
25- { region : "Asia" , country : "India" , users : 1850 , growth : 45 , coordinates : { x : 72 , y : 50 } , color : "accent" } ,
26- { region : "Asia" , country : "Japan" , users : 720 , growth : 15 , coordinates : { x : 85 , y : 42 } , color : "accent" } ,
27- { region : "Asia" , country : "Singapore" , users : 290 , growth : 38 , coordinates : { x : 78 , y : 60 } , color : "accent" } ,
28- { region : "Oceania" , country : "Australia" , users : 420 , growth : 22 , coordinates : { x : 82 , y : 75 } , color : "primary" } ,
29- { region : "South America" , country : "Brazil" , users : 580 , growth : 35 , coordinates : { x : 35 , y : 70 } , color : "secondary" } ,
20+ {
21+ region : "North America" ,
22+ country : "United States" ,
23+ users : 1250 ,
24+ growth : 23 ,
25+ coordinates : { x : 25 , y : 35 } ,
26+ color : "primary" ,
27+ } ,
28+ {
29+ region : "North America" ,
30+ country : "Canada" ,
31+ users : 380 ,
32+ growth : 18 ,
33+ coordinates : { x : 23 , y : 25 } ,
34+ color : "primary" ,
35+ } ,
36+ {
37+ region : "Europe" ,
38+ country : "United Kingdom" ,
39+ users : 920 ,
40+ growth : 31 ,
41+ coordinates : { x : 50 , y : 30 } ,
42+ color : "secondary" ,
43+ } ,
44+ {
45+ region : "Europe" ,
46+ country : "Germany" ,
47+ users : 850 ,
48+ growth : 27 ,
49+ coordinates : { x : 52 , y : 32 } ,
50+ color : "secondary" ,
51+ } ,
52+ {
53+ region : "Europe" ,
54+ country : "France" ,
55+ users : 640 ,
56+ growth : 19 ,
57+ coordinates : { x : 51 , y : 35 } ,
58+ color : "secondary" ,
59+ } ,
60+ {
61+ region : "Asia" ,
62+ country : "India" ,
63+ users : 1850 ,
64+ growth : 45 ,
65+ coordinates : { x : 72 , y : 50 } ,
66+ color : "accent" ,
67+ } ,
68+ {
69+ region : "Asia" ,
70+ country : "Japan" ,
71+ users : 720 ,
72+ growth : 15 ,
73+ coordinates : { x : 85 , y : 42 } ,
74+ color : "accent" ,
75+ } ,
76+ {
77+ region : "Asia" ,
78+ country : "Singapore" ,
79+ users : 290 ,
80+ growth : 38 ,
81+ coordinates : { x : 78 , y : 60 } ,
82+ color : "accent" ,
83+ } ,
84+ {
85+ region : "Oceania" ,
86+ country : "Australia" ,
87+ users : 420 ,
88+ growth : 22 ,
89+ coordinates : { x : 82 , y : 75 } ,
90+ color : "primary" ,
91+ } ,
92+ {
93+ region : "South America" ,
94+ country : "Brazil" ,
95+ users : 580 ,
96+ growth : 35 ,
97+ coordinates : { x : 35 , y : 70 } ,
98+ color : "secondary" ,
99+ } ,
30100] ;
31101
32102/**
@@ -35,7 +105,9 @@ const globalUsageData: UsageData[] = [
35105 */
36106const AdoptionMap : React . FC = ( ) => {
37107 const [ selectedRegion , setSelectedRegion ] = useState < string | null > ( null ) ;
38- const [ animatedUsers , setAnimatedUsers ] = useState < { [ key : string ] : number } > ( { } ) ;
108+ const [ animatedUsers , setAnimatedUsers ] = useState < { [ key : string ] : number } > (
109+ { } ,
110+ ) ;
39111 const { stats } = useRepositoryStats ( ) ;
40112
41113 // Animate user counts on mount
@@ -44,9 +116,9 @@ const AdoptionMap: React.FC = () => {
44116 const animated : { [ key : string ] : number } = { } ;
45117 globalUsageData . forEach ( ( data , index ) => {
46118 setTimeout ( ( ) => {
47- setAnimatedUsers ( prev => ( {
119+ setAnimatedUsers ( ( prev ) => ( {
48120 ...prev ,
49- [ data . country ] : data . users
121+ [ data . country ] : data . users ,
50122 } ) ) ;
51123 } , index * 100 ) ;
52124 } ) ;
@@ -56,19 +128,22 @@ const AdoptionMap: React.FC = () => {
56128 } , [ ] ) ;
57129
58130 const getRegionData = ( region : string ) => {
59- return globalUsageData . filter ( data => data . region === region ) ;
131+ return globalUsageData . filter ( ( data ) => data . region === region ) ;
60132 } ;
61133
62134 const getTotalUsers = ( ) => {
63135 return globalUsageData . reduce ( ( sum , data ) => sum + data . users , 0 ) ;
64136 } ;
65137
66138 const getAverageGrowth = ( ) => {
67- const totalGrowth = globalUsageData . reduce ( ( sum , data ) => sum + data . growth , 0 ) ;
139+ const totalGrowth = globalUsageData . reduce (
140+ ( sum , data ) => sum + data . growth ,
141+ 0 ,
142+ ) ;
68143 return Math . round ( totalGrowth / globalUsageData . length ) ;
69144 } ;
70145
71- const regions = [ ...new Set ( globalUsageData . map ( data => data . region ) ) ] ;
146+ const regions = [ ...new Set ( globalUsageData . map ( ( data ) => data . region ) ) ] ;
72147
73148 const getColorClasses = ( color : string ) => {
74149 switch ( color ) {
@@ -88,7 +163,7 @@ const AdoptionMap: React.FC = () => {
88163 { /* Background Animation */ }
89164 < div className = "absolute inset-0 pointer-events-none" >
90165 < motion . div
91- className = "absolute top-1/4 right-1/4 w-48 h-48 bg-gradient-to-br from-primary/5 to-accent/5 rounded-full blur-3xl"
166+ className = "absolute top-1/4 right-1/4 w-48 h-48 bg-gradient-to-br from-[var(--color- primary)] /5 to-[var(--color- accent)] /5 rounded-full blur-3xl"
92167 animate = { {
93168 x : [ 0 , 50 , - 50 , 0 ] ,
94169 y : [ 0 , - 30 , 30 , 0 ] ,
@@ -114,8 +189,9 @@ const AdoptionMap: React.FC = () => {
114189 Global Adoption
115190 </ h2 >
116191 < p className = "text-xl text-gray-600 max-w-3xl mx-auto" >
117- OptiBlogAi is being used by content creators around the world to revolutionize
118- their blogging and SEO strategies. See where our community is growing.
192+ OptiBlogAi is being used by content creators around the world to
193+ revolutionize their blogging and SEO strategies. See where our
194+ community is growing.
119195 </ p >
120196 </ motion . div >
121197
@@ -220,11 +296,31 @@ const AdoptionMap: React.FC = () => {
220296 < div className = "absolute inset-0 opacity-20" >
221297 < svg viewBox = "0 0 100 60" className = "w-full h-full" >
222298 { /* Simplified continent shapes */ }
223- < path d = "M15 20 L35 15 L40 25 L35 35 L20 40 L15 30 Z" fill = "currentColor" opacity = "0.3" />
224- < path d = "M45 15 L65 10 L70 20 L65 30 L50 35 L45 25 Z" fill = "currentColor" opacity = "0.3" />
225- < path d = "M70 25 L90 20 L95 30 L90 40 L75 45 L70 35 Z" fill = "currentColor" opacity = "0.3" />
226- < path d = "M25 45 L40 40 L45 50 L40 55 L30 55 L25 50 Z" fill = "currentColor" opacity = "0.3" />
227- < path d = "M80 50 L90 45 L95 55 L90 60 L85 60 L80 55 Z" fill = "currentColor" opacity = "0.3" />
299+ < path
300+ d = "M15 20 L35 15 L40 25 L35 35 L20 40 L15 30 Z"
301+ fill = "currentColor"
302+ opacity = "0.3"
303+ />
304+ < path
305+ d = "M45 15 L65 10 L70 20 L65 30 L50 35 L45 25 Z"
306+ fill = "currentColor"
307+ opacity = "0.3"
308+ />
309+ < path
310+ d = "M70 25 L90 20 L95 30 L90 40 L75 45 L70 35 Z"
311+ fill = "currentColor"
312+ opacity = "0.3"
313+ />
314+ < path
315+ d = "M25 45 L40 40 L45 50 L40 55 L30 55 L25 50 Z"
316+ fill = "currentColor"
317+ opacity = "0.3"
318+ />
319+ < path
320+ d = "M80 50 L90 45 L95 55 L90 60 L85 60 L80 55 Z"
321+ fill = "currentColor"
322+ opacity = "0.3"
323+ />
228324 </ svg >
229325 </ div >
230326
@@ -242,15 +338,21 @@ const AdoptionMap: React.FC = () => {
242338 width : `${ Math . max ( 20 , Math . min ( 40 , data . users / 50 ) ) } px` ,
243339 height : `${ Math . max ( 20 , Math . min ( 40 , data . users / 50 ) ) } px` ,
244340 } }
245- onClick = { ( ) => setSelectedRegion ( selectedRegion === data . region ? null : data . region ) }
341+ onClick = { ( ) =>
342+ setSelectedRegion (
343+ selectedRegion === data . region ? null : data . region ,
344+ )
345+ }
246346 >
247347 { Math . round ( data . users / 100 ) }
248-
348+
249349 { /* Tooltip */ }
250350 < div className = "absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-3 py-2 bg-gray-900 text-white text-sm rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-200 whitespace-nowrap pointer-events-none z-10" >
251351 < div className = "font-semibold" > { data . country } </ div >
252352 < div > { data . users . toLocaleString ( ) } users</ div >
253- < div className = "text-green-300" > +{ data . growth } % growth</ div >
353+ < div className = "text-green-300" >
354+ +{ data . growth } % growth
355+ </ div >
254356 < div className = "absolute top-full left-1/2 transform -translate-x-1/2 border-4 border-transparent border-t-gray-900" > </ div >
255357 </ div >
256358 </ motion . div >
@@ -296,9 +398,13 @@ const AdoptionMap: React.FC = () => {
296398 < div className = "space-y-4" >
297399 { regions . map ( ( region , index ) => {
298400 const regionData = getRegionData ( region ) ;
299- const totalUsers = regionData . reduce ( ( sum , data ) => sum + data . users , 0 ) ;
401+ const totalUsers = regionData . reduce (
402+ ( sum , data ) => sum + data . users ,
403+ 0 ,
404+ ) ;
300405 const avgGrowth = Math . round (
301- regionData . reduce ( ( sum , data ) => sum + data . growth , 0 ) / regionData . length
406+ regionData . reduce ( ( sum , data ) => sum + data . growth , 0 ) /
407+ regionData . length ,
302408 ) ;
303409 const isSelected = selectedRegion === region ;
304410
@@ -309,22 +415,28 @@ const AdoptionMap: React.FC = () => {
309415 animate = { { opacity : 1 , y : 0 } }
310416 transition = { { duration : 0.5 , delay : index * 0.1 } }
311417 className = { `p-4 rounded-lg border-2 cursor-pointer transition-all duration-200 ${
312- isSelected
313- ? "border-primary bg-primary/5"
418+ isSelected
419+ ? "border-primary bg-primary/5"
314420 : "border-gray-200 hover:border-gray-300"
315421 } `}
316- onClick = { ( ) => setSelectedRegion ( isSelected ? null : region ) }
422+ onClick = { ( ) =>
423+ setSelectedRegion ( isSelected ? null : region )
424+ }
317425 >
318426 < div className = "flex justify-between items-start mb-2" >
319- < h4 className = "font-semibold text-gray-900" > { region } </ h4 >
427+ < h4 className = "font-semibold text-gray-900" >
428+ { region }
429+ </ h4 >
320430 < div className = "text-right" >
321431 < div className = "text-lg font-bold text-primary" >
322432 { totalUsers . toLocaleString ( ) }
323433 </ div >
324- < div className = "text-sm text-green-600" > +{ avgGrowth } %</ div >
434+ < div className = "text-sm text-green-600" >
435+ +{ avgGrowth } %
436+ </ div >
325437 </ div >
326438 </ div >
327-
439+
328440 { isSelected && (
329441 < motion . div
330442 initial = { { opacity : 0 , height : 0 } }
@@ -333,9 +445,16 @@ const AdoptionMap: React.FC = () => {
333445 className = "mt-3 pt-3 border-t border-gray-200 space-y-2"
334446 >
335447 { regionData . map ( ( country ) => (
336- < div key = { country . country } className = "flex justify-between text-sm" >
337- < span className = "text-gray-700" > { country . country } </ span >
338- < span className = "font-medium" > { country . users . toLocaleString ( ) } </ span >
448+ < div
449+ key = { country . country }
450+ className = "flex justify-between text-sm"
451+ >
452+ < span className = "text-gray-700" >
453+ { country . country }
454+ </ span >
455+ < span className = "font-medium" >
456+ { country . users . toLocaleString ( ) }
457+ </ span >
339458 </ div >
340459 ) ) }
341460 </ motion . div >
@@ -353,4 +472,4 @@ const AdoptionMap: React.FC = () => {
353472 ) ;
354473} ;
355474
356- export default AdoptionMap ;
475+ export default AdoptionMap ;
0 commit comments