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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
import React, { useState, useEffect } from 'react';
import './DeploymentMap.css';

// Mock data for demonstration purposes
const mockDeploymentData = {
  phases: [
    {
      id: 1,
      name: "Phase 1",
      timeline: "Q3 2025 - Q1 2026",
      status: "planning",
      locations: [
        { id: 101, name: "Springfield Downtown", lat: 39.801, lng: -89.644, status: "planned", type: "urban", capacity: 12 },
        { id: 102, name: "Champaign-Urbana Hub", lat: 40.116, lng: -88.243, status: "planned", type: "urban", capacity: 8 },
        { id: 103, name: "Bloomington-Normal", lat: 40.484, lng: -88.993, status: "planned", type: "urban", capacity: 8 },
        { id: 104, name: "Peoria Central", lat: 40.694, lng: -89.589, status: "planned", type: "urban", capacity: 8 }
      ]
    },
    {
      id: 2,
      name: "Phase 2",
      timeline: "Q2 2026 - Q4 2026",
      status: "future",
      locations: [
        { id: 201, name: "Rockford Hub", lat: 42.271, lng: -89.093, status: "future", type: "urban", capacity: 8 },
        { id: 202, name: "Quad Cities", lat: 41.512, lng: -90.578, status: "future", type: "urban", capacity: 8 },
        { id: 203, name: "Carbondale", lat: 37.727, lng: -89.216, status: "future", type: "urban", capacity: 6 },
        { id: 204, name: "Quincy", lat: 39.936, lng: -91.410, status: "future", type: "urban", capacity: 6 },
        { id: 205, name: "I-55 Corridor North", lat: 41.097, lng: -88.841, status: "future", type: "corridor", capacity: 4 },
        { id: 206, name: "I-55 Corridor South", lat: 39.144, lng: -89.479, status: "future", type: "corridor", capacity: 4 }
      ]
    },
    {
      id: 3,
      name: "Phase 3",
      timeline: "Q1 2027 - Q3 2027",
      status: "future",
      locations: [
        { id: 301, name: "Decatur", lat: 39.840, lng: -88.954, status: "future", type: "urban", capacity: 6 },
        { id: 302, name: "Danville", lat: 40.124, lng: -87.630, status: "future", type: "urban", capacity: 6 },
        { id: 303, name: "Galesburg", lat: 40.947, lng: -90.371, status: "future", type: "urban", capacity: 4 },
        { id: 304, name: "Mt. Vernon", lat: 38.317, lng: -88.903, status: "future", type: "urban", capacity: 4 },
        { id: 305, name: "I-57 Corridor North", lat: 41.201, lng: -87.866, status: "future", type: "corridor", capacity: 4 },
        { id: 306, name: "I-57 Corridor South", lat: 38.729, lng: -88.978, status: "future", type: "corridor", capacity: 4 },
        { id: 307, name: "I-70 Corridor", lat: 39.123, lng: -88.542, status: "future", type: "corridor", capacity: 4 },
        { id: 308, name: "I-74 Corridor", lat: 40.681, lng: -89.893, status: "future", type: "corridor", capacity: 4 }
      ]
    }
  ],
  demographics: {
    population: [
      { county: "Cook", population: 5150233, evAdoption: 2.8, chargingStations: 487 },
      { county: "DuPage", population: 922921, evAdoption: 3.2, chargingStations: 112 },
      { county: "Lake", population: 696535, evAdoption: 2.9, chargingStations: 78 },
      { county: "Will", population: 677560, evAdoption: 2.1, chargingStations: 54 },
      { county: "Kane", population: 532403, evAdoption: 2.3, chargingStations: 42 },
      { county: "McHenry", population: 307774, evAdoption: 1.9, chargingStations: 28 },
      { county: "Winnebago", population: 285350, evAdoption: 1.2, chargingStations: 18 },
      { county: "Madison", population: 264461, evAdoption: 0.9, chargingStations: 14 },
      { county: "St. Clair", population: 259686, evAdoption: 0.7, chargingStations: 12 },
      { county: "Champaign", population: 205865, evAdoption: 1.8, chargingStations: 22 }
    ],
    evProjections: [
      { year: 2025, percentage: 3.5 },
      { year: 2026, percentage: 5.2 },
      { year: 2027, percentage: 7.8 },
      { year: 2028, percentage: 11.5 },
      { year: 2029, percentage: 16.3 },
      { year: 2030, percentage: 22.0 }
    ]
  },
  impactMetrics: {
    economic: {
      jobsCreated: 450,
      localBusinessImpact: 28,
      taxRevenue: 3.2
    },
    environmental: {
      co2Reduction: 12500,
      gasDisplaced: 1.4,
      renewableIntegration: 65
    },
    social: {
      underservedCommunities: 14,
      accessibilityScore: 72,
      publicTransportIntegration: 8
    }
  }
};

function DeploymentMap() {
  const [activeTab, setActiveTab] = useState('map');
  const [loading, setLoading] = useState(true);
  const [selectedPhase, setSelectedPhase] = useState(1);
  const [mapView, setMapView] = useState('phases');
  const [selectedLocation, setSelectedLocation] = useState(null);
  const [mapZoom, setMapZoom] = useState(1);

  useEffect(() => {
    // Simulate loading
    const timer = setTimeout(() => {
      setLoading(false);
    }, 1500);
    
    return () => clearTimeout(timer);
  }, []);

  const handlePhaseChange = (phaseId) => {
    setSelectedPhase(phaseId);
    setSelectedLocation(null);
  };

  const handleMapViewChange = (view) => {
    setMapView(view);
    setSelectedLocation(null);
  };

  const handleLocationSelect = (location) => {
    setSelectedLocation(location);
    setMapZoom(2);
  };

  const handleZoomChange = (zoom) => {
    setMapZoom(zoom);
    if (zoom === 1) {
      setSelectedLocation(null);
    }
  };

  // Helper function to render the Illinois map with deployment locations
  const renderMap = () => {
    const currentPhase = mockDeploymentData.phases.find(phase => phase.id === selectedPhase);
    const allLocations = mockDeploymentData.phases.flatMap(phase => phase.locations);
    const displayLocations = mapView === 'phases' ? currentPhase.locations : allLocations;
    
    return (
      <div className="map-container">
        <div className="illinois-map">
          <img src="/images/illinois_map.png" alt="Illinois Map" className="map-image" />
          
          {displayLocations.map(location => (
            <div 
              key={location.id}
              className={`map-marker ${location.status} ${location.type} ${selectedLocation && selectedLocation.id === location.id ? 'selected' : ''}`}
              style={{ 
                top: `${(1 - (location.lat - 37) / 6) * 100}%`, 
                left: `${((location.lng + 91.5) / 4) * 100}%` 
              }}
              onClick={() => handleLocationSelect(location)}
            >
              <div className="marker-pulse"></div>
              {mapZoom > 1 && (
                <div className="marker-label">{location.name}</div>
              )}
            </div>
          ))}
          
          {selectedLocation && (
            <div 
              className="location-detail-popup"
              style={{ 
                top: `${(1 - (selectedLocation.lat - 37) / 6) * 100}%`, 
                left: `${((selectedLocation.lng + 91.5) / 4) * 100}%` 
              }}
            >
              <h4>{selectedLocation.name}</h4>
              <div className="detail-item">
                <span className="detail-label">Status:</span>
                <span className={`detail-value ${selectedLocation.status}`}>
                  {selectedLocation.status.charAt(0).toUpperCase() + selectedLocation.status.slice(1)}
                </span>
              </div>
              <div className="detail-item">
                <span className="detail-label">Type:</span>
                <span className="detail-value">
                  {selectedLocation.type === 'urban' ? 'Urban Hub' : 'Corridor Station'}
                </span>
              </div>
              <div className="detail-item">
                <span className="detail-label">Capacity:</span>
                <span className="detail-value">{selectedLocation.capacity} Chargers</span>
              </div>
              <div className="detail-item">
                <span className="detail-label">Phase:</span>
                <span className="detail-value">
                  {mockDeploymentData.phases.find(phase => 
                    phase.locations.some(loc => loc.id === selectedLocation.id)
                  ).name}
                </span>
              </div>
              <button className="close-popup" onClick={() => setSelectedLocation(null)}>Γ—</button>
            </div>
          )}
        </div>
        
        <div className="map-controls">
          <div className="zoom-controls">
            <button 
              className={`zoom-button ${mapZoom === 1 ? 'active' : ''}`}
              onClick={() => handleZoomChange(1)}
            >
              State View
            </button>
            <button 
              className={`zoom-button ${mapZoom === 2 ? 'active' : ''}`}
              onClick={() => handleZoomChange(2)}
            >
              Detailed View
            </button>
          </div>
          
          <div className="view-controls">
            <button 
              className={`view-button ${mapView === 'phases' ? 'active' : ''}`}
              onClick={() => handleMapViewChange('phases')}
            >
              Phase View
            </button>
            <button 
              className={`view-button ${mapView === 'all' ? 'active' : ''}`}
              onClick={() => handleMapViewChange('all')}
            >
              All Locations
            </button>
          </div>
        </div>
        
        <div className="map-legend">
          <h4>Map Legend</h4>
          <div className="legend-items">
            <div className="legend-item">
              <div className="legend-marker planned"></div>
              <span>Planned (Phase 1)</span>
            </div>
            <div className="legend-item">
              <div className="legend-marker future"></div>
              <span>Future Phases</span>
            </div>
            <div className="legend-item">
              <div className="legend-marker urban"></div>
              <span>Urban Hub</span>
            </div>
            <div className="legend-item">
              <div className="legend-marker corridor"></div>
              <span>Corridor Station</span>
            </div>
          </div>
        </div>
      </div>
    );
  };

  // Helper function to render the deployment phases
  const renderPhases = () => {
    return (
      <div className="deployment-phases">
        <div className="phase-tabs">
          {mockDeploymentData.phases.map(phase => (
            <button 
              key={phase.id}
              className={`phase-tab ${selectedPhase === phase.id ? 'active' : ''} ${phase.status}`}
              onClick={() => handlePhaseChange(phase.id)}
            >
              {phase.name}
            </button>
          ))}
        </div>
        
        {mockDeploymentData.phases.map(phase => (
          phase.id === selectedPhase && (
            <div key={phase.id} className="phase-details">
              <div className="phase-header">
                <h3>{phase.name}</h3>
                <div className="phase-timeline">{phase.timeline}</div>
                <div className={`phase-status ${phase.status}`}>
                  {phase.status.charAt(0).toUpperCase() + phase.status.slice(1)}
                </div>
              </div>
              
              <div className="phase-metrics">
                <div className="metric-card">
                  <div className="metric-value">{phase.locations.length}</div>
                  <div className="metric-label">Charging Locations</div>
                </div>
                <div className="metric-card">
                  <div className="metric-value">
                    {phase.locations.reduce((sum, location) => sum + location.capacity, 0)}
                  </div>
                  <div className="metric-label">Total Chargers</div>
                </div>
                <div className="metric-card">
                  <div className="metric-value">
                    {phase.locations.filter(location => location.type === 'urban').length}
                  </div>
                  <div className="metric-label">Urban Hubs</div>
                </div>
                <div className="metric-card">
                  <div className="metric-value">
                    {phase.locations.filter(location => location.type === 'corridor').length}
                  </div>
                  <div className="metric-label">Corridor Stations</div>
                </div>
              </div>
              
              <div className="location-list">
                <h4>Deployment Locations</h4>
                <div className="location-grid">
                  {phase.locations.map(location => (
                    <div 
                      key={location.id} 
                      className={`location-card ${selectedLocation && selectedLocation.id === location.id ? 'selected' : ''}`}
                      onClick={() => handleLocationSelect(location)}
                    >
                      <div className="location-name">{location.name}</div>
                      <div className="location-type">
                        {location.type === 'urban' ? 'Urban Hub' : 'Corridor Station'}
                      </div>
                      <div className="location-capacity">{location.capacity} Chargers</div>
                    </div>
                  ))}
                </div>
              </div>
            </div>
          )
        ))}
      </div>
    );
  };

  // Helper function to render the demographics tab
  const renderDemographics = () => {
    return (
      <div className="demographics-tab">
        <div className="demographics-section">
          <h3>Population & EV Adoption by County</h3>
          <div className="county-chart">
            <div className="chart-header">
              <div className="chart-column county">County</div>
              <div className="chart-column population">Population</div>
              <div className="chart-column adoption">EV Adoption %</div>
              <div className="chart-column stations">Charging Stations</div>
            </div>
            {mockDeploymentData.demographics.population.map((county, index) => (
              <div key={index} className="chart-row">
                <div className="chart-column county">{county.county}</div>
                <div className="chart-column population">{county.population.toLocaleString()}</div>
                <div className="chart-column adoption">
                  <div className="adoption-bar-container">
                    <div 
                      className="adoption-bar"
                      style={{ width: `${county.evAdoption * 10}%` }}
                    ></div>
                    <span className="adoption-value">{county.evAdoption}%</span>
                  </div>
                </div>
                <div className="chart-column stations">{county.chargingStations}</div>
              </div>
            ))}
          </div>
        </div>
        
        <div className="demographics-section">
          <h3>EV Adoption Projections</h3>
          <div className="projection-chart">
            <div className="projection-bars">
              {mockDeploymentData.demographics.evProjections.map((projection, index) => (
                <div key={index} className="projection-bar-container">
                  <div className="projection-year">{projection.year}</div>
                  <div className="projection-bar-wrapper">
                    <div 
                      className="projection-bar"
                      style={{ height: `${projection.percentage * 3}%` }}
                    ></div>
                  </div>
                  <div className="projection-value">{projection.percentage}%</div>
                </div>
              ))}
            </div>
            <div className="projection-axis">
              <div className="axis-label">Projected EV Adoption Rate (%)</div>
            </div>
          </div>
          
          <div className="projection-notes">
            <p>Projections based on current adoption trends, state incentives, and manufacturer production forecasts.</p>
            <p>The Link deployment strategy is designed to stay ahead of projected adoption curves to ensure adequate charging infrastructure.</p>
          </div>
        </div>
      </div>
    );
  };

  // Helper function to render the impact metrics tab
  const renderImpactMetrics = () => {
    const { economic, environmental, social } = mockDeploymentData.impactMetrics;
    
    return (
      <div className="impact-metrics-tab">
        <div className="impact-section economic">
          <h3>Economic Impact</h3>
          <div className="impact-metrics">
            <div className="impact-metric">
              <div className="impact-icon">πŸ’Ό</div>
              <div className="impact-value">{economic.jobsCreated}</div>
              <div className="impact-label">Jobs Created</div>
              <div className="impact-description">
                Direct and indirect employment opportunities across all deployment phases
              </div>
            </div>
            <div className="impact-metric">
              <div className="impact-icon">πŸͺ</div>
              <div className="impact-value">{economic.localBusinessImpact}%</div>
              <div className="impact-label">Local Business Growth</div>
              <div className="impact-description">
                Projected increase in revenue for businesses near charging hubs
              </div>
            </div>
            <div className="impact-metric">
              <div className="impact-icon">πŸ’°</div>
              <div className="impact-value">${economic.taxRevenue}M</div>
              <div className="impact-label">Annual Tax Revenue</div>
              <div className="impact-description">
                Estimated additional tax revenue for state and local governments
              </div>
            </div>
          </div>
        </div>
        
        <div className="impact-section environmental">
          <h3>Environmental Impact</h3>
          <div className="impact-metrics">
            <div className="impact-metric">
              <div className="impact-icon">🌱</div>
              <div className="impact-value">{environmental.co2Reduction}</div>
              <div className="impact-label">Tons COβ‚‚ Reduced</div>
              <div className="impact-description">
                Annual carbon emissions reduction from EV adoption enabled by The Link
              </div>
            </div>
            <div className="impact-metric">
              <div className="impact-icon">β›½</div>
              <div className="impact-value">{environmental.gasDisplaced}M</div>
              <div className="impact-label">Gallons Gas Displaced</div>
              <div className="impact-description">
                Annual reduction in gasoline consumption
              </div>
            </div>
            <div className="impact-metric">
              <div className="impact-icon">β˜€οΈ</div>
              <div className="impact-value">{environmental.renewableIntegration}%</div>
              <div className="impact-label">Renewable Energy</div>
              <div className="impact-description">
                Percentage of charging energy from renewable sources
              </div>
            </div>
          </div>
        </div>
        
        <div className="impact-section social">
          <h3>Social Impact</h3>
          <div className="impact-metrics">
            <div className="impact-metric">
              <div className="impact-icon">🏘️</div>
              <div className="impact-value">{social.underservedCommunities}</div>
              <div className="impact-label">Underserved Communities</div>
              <div className="impact-description">
                Number of underserved communities with improved EV access
              </div>
            </div>
            <div className="impact-metric">
              <div className="impact-icon">β™Ώ</div>
              <div className="impact-value">{social.accessibilityScore}/100</div>
              <div className="impact-label">Accessibility Score</div>
              <div className="impact-description">
                Rating of charging infrastructure accessibility for all users
              </div>
            </div>
            <div className="impact-metric">
              <div className="impact-icon">🚌</div>
              <div className="impact-value">{social.publicTransportIntegration}</div>
              <div className="impact-label">Transit Connections</div>
              <div className="impact-description">
                Number of charging hubs with public transportation connections
              </div>
            </div>
          </div>
        </div>
      </div>
    );
  };

  if (loading) {
    return (
      <div className="deployment-map loading">
        <div className="loading-logo">
          <img src="/images/unity_fleet_logo.png" alt="Unity Fleet" />
          <div className="loading-pulse"></div>
        </div>
        <p>Loading Deployment Map...</p>
      </div>
    );
  }

  return (
    <div className="deployment-map">
      <header className="map-header">
        <div className="map-title">
          <h1>Deployment Map</h1>
          <span className="map-subtitle">The Link Charging Network</span>
        </div>
      </header>
      
      <div className="map-navigation">
        <button 
          className={`nav-button ${activeTab === 'map' ? 'active' : ''}`}
          onClick={() => setActiveTab('map')}
        >
          Interactive Map
        </button>
        <button 
          className={`nav-button ${activeTab === 'phases' ? 'active' : ''}`}
          onClick={() => setActiveTab('phases')}
        >
          Deployment Phases
        </button>
        <button 
          className={`nav-button ${activeTab === 'demographics' ? 'active' : ''}`}
          onClick={() => setActiveTab('demographics')}
        >
          Demographics
        </button>
        <button 
          className={`nav-button ${activeTab === 'impact' ? 'active' : ''}`}
          onClick={() => setActiveTab('impact')}
        >
          Impact Metrics
        </button>
      </div>
      
      <main className="map-content">
        {activeTab === 'map' && renderMap()}
        {activeTab === 'phases' && renderPhases()}
        {activeTab === 'demographics' && renderDemographics()}
        {activeTab === 'impact' && renderImpactMetrics()}
      </main>
      
      <footer className="map-footer">
        <div className="footer-info">
          <span>Unity Fleet Deployment Strategy</span>
          <span>Powered by Atlas Intelligence</span>
        </div>
        <div className="footer-actions">
          <button className="footer-button">Download Map Data</button>
          <button className="footer-button">Share Deployment Plan</button>
        </div>
      </footer>
    </div>
  );
}

export default DeploymentMap;