"use client"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Button } from "@/components/ui/button"; import { SearchIcon, ZapIcon } from "@/components/ui/phosphor-icons"; import { BRAND_COLORS } from "@/lib/map-data"; import type { UserMarker } from "@/components/leaflet-map"; import { ContinuousTabs } from "@/components/ui/continuous-tabs"; interface GasStationDirectoryProps { searchQuery: string; setSearchQuery: (query: string) => void; brandFilter: string; setBrandFilter: (brand: string) => void; evOnlyFilter: boolean; setEvOnlyFilter: (evOnly: boolean) => void; filteredStations: UserMarker[]; selectedStationId: string; onSelectStation: (station: UserMarker) => void; } export function GasStationDirectory({ searchQuery, setSearchQuery, brandFilter, setBrandFilter, evOnlyFilter, setEvOnlyFilter, filteredStations, selectedStationId, onSelectStation, }: GasStationDirectoryProps) { return ( Direktori Stasiun Aktif Menyaring {filteredStations.length} target stasiun regional aktif dari database. {/* Filters */}
setSearchQuery(e.target.value)} />
{/* Grid List */} {filteredStations.length === 0 ? (
Tidak ada lokasi yang cocok. Tambah lokasi baru melalui peta stasiun.
) : (
{filteredStations.map((station) => { const isSelected = selectedStationId === station.id; const brandName = station.type === "gas-pump" ? station.meta?.poi_type : null; const brandColor = BRAND_COLORS[brandName as keyof typeof BRAND_COLORS] || { bg: "#6b7280", text: "#ffffff" }; return (
onSelectStation(station)} className={`p-4 border rounded-lg cursor-pointer flex flex-col gap-1.5 transition-all ${ isSelected ? "border-primary bg-primary/5 font-semibold" : "border-border/60 hover:bg-muted" }`} >
{station.name} {station.type === "gas-pump" && brandName ? ( {brandName} ) : ( {station.type === "charging-station" ? "EV Charger" : "Bengkel"} )}

Koordinat: {station.lat.toFixed(5)}, {station.lng.toFixed(5)}

{station.type === "gas-pump" && station.meta?.gas_types && station.meta.gas_types.length > 0 && (
{station.meta.gas_types.map((gt) => ( {gt} ))}
)}
{station.type === "gas-pump" ? ( Operasional: {station.meta?.notes?.replace("Jam: ", "") || "24 Jam"} ) : station.type === "charging-station" ? ( Tipe: {station.meta?.poi_type} · {station.meta?.notes} ) : ( Spesialisasi: {station.meta?.poi_type} · {station.meta?.notes} )}
); })}
)}
); }