import React, { useState } from "react"; import { MapContainer, TileLayer, Marker, Popup } from "react-leaflet"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs"; import { LineChart, Line, XAxis, YAxis, Tooltip, ResponsiveContainer } from "recharts"; import { motion } from "framer-motion"; import { PhoneCall, Battery, Zap, MapPin, DollarSign, Shield } from "lucide-react"; // Mock vehicle and grid data const vehicles = [ { id: 1, name: "EV-101", lat: 1.3521, lng: 103.8198, soc: 80, status: "Idle", battery: 60, fleet: false }, { id: 2, name: "EV-202", lat: 1.3621, lng: 103.8298, soc: 45, status: "Discharging", battery: 120, fleet: true }, { id: 3, name: "EV-303", lat: 1.3721, lng: 103.8098, soc: 90, status: "Charging", battery: 75, fleet: false }, ]; const demandCurve = [ { time: "10:00", demand: 120 }, { time: "12:00", demand: 180 }, { time: "14:00", demand: 150 }, { time: "16:00", demand: 200 }, { time: "18:00", demand: 250 }, ]; export default function V2GPlatformUI() { const [selectedEV, setSelectedEV] = useState(null); return (
{/* Left Panel: Map */} {vehicles.map((v) => ( setSelectedEV(v) }}>

{v.name}

Status: {v.status}

SoC: {v.soc}%

Battery: {v.battery} kWh

{v.fleet ? "Fleet Vehicle" : "Private EV"}

))}
{/* Right Panel: Multi-layer controls */} Overview Criteria Benefits {/* Overview Layer */} {selectedEV ? (

{selectedEV.name}

Status: {selectedEV.status}

State of Charge: {selectedEV.soc}%

Battery Capacity: {selectedEV.battery} kWh

) : (

Select a vehicle on the map.

)}
{/* Criteria Layer */}

Criteria for Selecting EVs

  • Availability: plugged in, idle duration
  • SoC beyond user’s next trip
  • User preferences & consent
  • Battery health & rotation to reduce wear
  • Incentives: tariffs, agreements
  • Technical readiness: bidirectional chargers, protocol support
  • Location/grid constraints: congestion hotspots
  • Fleet vs private profile

Location & Distance Impacts

EVs closer to demand centers reduce losses, relieve congestion, support renewables, and optimize voltage/frequency regulation.

Battery Capacity & Health

Larger batteries provide longer dispatch windows and flexibility. Smart scheduling & BMS mitigate ~9–14% extra degradation over 10 years.

{/* Benefits Layer */}

Economic Benefits for EV Owners

  • Direct revenue: $700–$1,250/year (private EVs); $1,000–$16,000/vehicle (fleets)
  • Electricity bill savings: off-peak charging, on-peak discharging
  • Incentives & rebates: e.g., $3,000 charger rebates
  • Offsets ownership costs, lowers TCO
Smart V2G reduces costs and supports the grid
); }