'use client'; import { useState, useEffect } from 'react'; export default function MetroLine() { const [currentStation, setCurrentStation] = useState(0); // Metro başlangıçtan Tuzluçayır'a (index 2) kadar ilerler ve durur useEffect(() => { const interval = setInterval(() => { setCurrentStation((prev) => { if (prev < 2) return prev + 1; // Sadece 2'ye kadar ilerle return 2; // Tuzluçayır'da dur }); }, 3000); // Her 3 saniyede bir ilerle return () => clearInterval(interval); }, []); const stations = [ { name: 'ABİDİN PAŞA', status: 'completed' }, { name: 'AŞIK VEYSEL', status: 'completed' }, { name: 'TUZLUÇAYIR', status: 'construction' }, { name: 'GENERAL ZEKİ DOĞAN', status: 'planned' }, { name: 'FAHRİ KORUTÜRK', status: 'planned' }, { name: 'CENGİZHAN', status: 'planned' }, { name: 'AKŞEMSETTİN', status: 'planned' }, { name: 'NATOYOLU', status: 'planned' }, ]; const getStationStyle = (index: number, status: string) => { if (index === currentStation) { return 'w-16 h-16 bg-[#F59E0B] border-4 border-white shadow-2xl scale-110'; } if (status === 'completed') { return 'w-14 h-14 bg-green-500 border-4 border-white shadow-lg'; } return 'w-12 h-12 bg-gray-300 border-4 border-dashed border-gray-400 shadow-lg opacity-60'; }; const getTextStyle = (index: number, status: string) => { if (index === currentStation) { return 'text-[#F59E0B] font-bold'; } if (status === 'completed') { return 'text-green-600 font-bold'; } return 'text-gray-500 font-semibold'; }; // Her durak arası mesafe için progress hesaplama const totalStations = stations.length; const progressPercentage = (currentStation / (totalStations - 1)) * 100; return (
Abidin Paşa - Natoyolu
İnşaat Durumu
{Math.round(progressPercentage)}%