"use client"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { MapPinIcon, ZapIcon, ClockIcon, NavigationIcon } from "@/components/ui/phosphor-icons"; import { BRAND_COLORS } from "@/lib/map-data"; import type { UserMarker } from "@/components/leaflet-map"; interface GasStationInspectorProps { selectedStation: UserMarker | null; } const BRAND_PRICES = { Pertamina: { ron92: 13200, ron95: 14400, diesel: 14900 }, Shell: { ron92: 13850, ron95: 14600, diesel: 15100 }, BP: { ron92: 13400, ron95: 14500, diesel: 14800 }, Vivo: { ron92: 13400, ron95: 14500, diesel: 14800 } }; export function GasStationInspector({ selectedStation }: GasStationInspectorProps) { if (!selectedStation) { return ( Pilih stasiun dari direktori atau peta untuk melihat detail. ); } const isGasPump = selectedStation.type === "gas-pump"; const isEvCharger = selectedStation.type === "charging-station"; const isWrench = selectedStation.type === "wrench"; const brandName = isGasPump ? selectedStation.meta?.poi_type : null; const brandColor = BRAND_COLORS[brandName as keyof typeof BRAND_COLORS] || { bg: "#6b7280", text: "#ffffff" }; // Get price index for gas stations const prices = isGasPump ? (BRAND_PRICES[brandName as keyof typeof BRAND_PRICES] || BRAND_PRICES.Pertamina) : null; // Extract clean values from meta const cleanNotes = selectedStation.meta?.notes ?? ""; const cleanPoiType = selectedStation.meta?.poi_type ?? ""; return ( Detail Stasiun Metrik stasiun langsung & detail dari database. {selectedStation.name} {isGasPump ? `Jaringan ${brandName}` : isEvCharger ? "Pengisi Daya EV" : "Bengkel (Repair Shop)"} {/* Gas Pump: Pricing Cards */} {isGasPump && prices && ( Harga RON 92 Rp {prices.ron92.toLocaleString()} / L Harga RON 95 Rp {prices.ron95.toLocaleString()} / L Harga Diesel Rp {prices.diesel.toLocaleString()} / L )} {/* Gas Pump: Fuel Types */} {isGasPump && selectedStation.meta?.gas_types && selectedStation.meta.gas_types.length > 0 && ( Tipe Bahan Bakar {selectedStation.meta.gas_types.map((gt) => ( {gt} ))} )} {/* EV Charger Details */} {isEvCharger && ( Tipe Charger {cleanPoiType} Status Operasional {cleanNotes.replace("Status: ", "")} )} {/* Repair Shop Details */} {isWrench && ( Spesialisasi {cleanPoiType} Status / Jam Buka {cleanNotes} )} {/* General: Operating Hours HUD style */} {isGasPump && ( Jam Operasional Buka Layanan {cleanNotes.replace("Jam: ", "") || "24 Jam"} )} {/* Coordinates & Route Buttons */} Lat: {selectedStation.lat.toFixed(5)}, Lng: {selectedStation.lng.toFixed(5)} Dapatkan Arah Rute ); }
Pilih stasiun dari direktori atau peta untuk melihat detail.
Buka Layanan
{cleanNotes.replace("Jam: ", "") || "24 Jam"}
Lat: {selectedStation.lat.toFixed(5)}, Lng: {selectedStation.lng.toFixed(5)}