import React, { useState } from 'react'; import { ChevronLeft, ChevronRight, Clock, CheckCircle2, XCircle } from 'lucide-react'; import type { Prediction } from '../types'; interface PredictionStreamProps { predictions: Prediction[]; } const ITEMS_PER_PAGE = 10; export function PredictionStream({ predictions }: PredictionStreamProps) { const [currentPage, setCurrentPage] = useState(1); const totalPages = Math.ceil(predictions.length / ITEMS_PER_PAGE); const paginatedPredictions = predictions.slice( (currentPage - 1) * ITEMS_PER_PAGE, currentPage * ITEMS_PER_PAGE ); return (

Live Predictions

Page {currentPage} of {totalPages}
{paginatedPredictions.map((prediction) => (
{new Date(prediction.timestamp).toLocaleString()}
{prediction.latencyMs.toFixed(2)}ms {prediction.groundTruth !== undefined && ( prediction.output === prediction.groundTruth ? ( ) : ( ) )}

Input

                    {JSON.stringify(prediction.input, null, 2)}
                  

Prediction

{typeof prediction.output === 'boolean' ? prediction.output ? 'Will Churn' : 'Will Not Churn' : prediction.output} {prediction.groundTruth !== undefined && ( Ground Truth: {prediction.groundTruth ? 'Churned' : 'Retained'} )}
))}
); }