e-asthenoforo.gr
import { useState, useEffect } from "react"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { FaAmbulance, FaMapMarkerAlt } from "react-icons/fa"; export default function EmergencyWidgets() { const [location, setLocation] = useState(null); const [loading, setLoading] = useState(false); useEffect(() => { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition( (position) => { setLocation({ lat: position.coords.latitude, lon: position.coords.longitude, }); }, (error) => console.error("Location error: ", error), { enableHighAccuracy: true } ); } }, []); const handleEmergencyRequest = () => { setLoading(true); setTimeout(() => { alert("🚑 Ambulance request sent! Location: " + JSON.stringify(location)); setLoading(false); }, 2000); }; return (
{/* One-Tap Emergency Request */}

One-Tap Emergency Request

Request an ambulance instantly with your location.

{/* Automatic Location Sharing */}

Automatic Location Sharing

Your exact location is shared with emergency services.

{location ? ( <>📍 {location.lat}, {location.lon} ) : ( "Fetching location..." )}

); }