"use client"; import React from "react"; interface PredictionData { time: string; predictedLevel: number | null; currentLevel: number; status: string; currentStatus: string; risk: string; color: string; } interface PredictionTableProps { data: PredictionData[]; } export default function TabelPrediksi({ data }: PredictionTableProps) { if (data.length === 0) return null; const item = data[0]; const hasPrediction = item.predictedLevel !== null; const trendValue = hasPrediction ? item.predictedLevel! - item.currentLevel : null; return (

Prediksi Elevasi Air (5 Menit Ke Depan)

Lokasi Status Saat Ini Elevasi Saat Ini Prediksi Elevasi Tren Status Prediksi Tingkat Risiko
Sungai Tegal Bal Karangrejo {item.currentStatus.charAt(0).toUpperCase() + item.currentStatus.slice(1).toLowerCase()} {item.currentLevel} cm {hasPrediction ? `${item.predictedLevel} cm` : "-"}
{hasPrediction && trendValue !== null ? ( = 0 ? "text-red-500" : "text-green-500"}`} fill="none" stroke="currentColor" viewBox="0 0 24 24"> = 0 ? "M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" : "M13 17h8m0 0v-8m0 8l-8-8-4 4-6-6"} /> ) : ( - )}
{!hasPrediction ? "Menunggu" : item.status.charAt(0).toUpperCase() + item.status.slice(1).toLowerCase()} {!hasPrediction ? "-" : item.risk}
); }