"use client"; import { useState } from "react"; import type { Prediction } from "../../types/passport"; import { formatMatchDate } from "../../utils/passportMetrics"; import MetricCard from "../shared/MetricCard"; import ProgressBar from "../shared/ProgressBar"; import StatusPill from "../shared/StatusPill"; interface PredictionCenterScreenProps { predictions: Prediction[]; onChoosePrediction: (predictionId: string, optionId: string) => void; } export default function PredictionCenterScreen({ predictions, onChoosePrediction, }: PredictionCenterScreenProps) { const [confidenceByPrediction, setConfidenceByPrediction] = useState>( () => Object.fromEntries( predictions.map((prediction) => [prediction.id, prediction.confidence]), ), ); const submittedCount = predictions.filter((prediction) => Boolean(prediction.userPickOptionId)).length; const openCount = predictions.filter((prediction) => prediction.status === "open").length; const potentialPoints = predictions.reduce((total, prediction) => total + prediction.points, 0); return (

Prediction center

Back your football instincts.

Prediction cards add stakes to every matchday: safe picks, underdog multipliers, locked tournament futures, and resolved-state rewards.

{predictions.map((prediction) => { const confidence = confidenceByPrediction[prediction.id] ?? prediction.confidence; const isLocked = prediction.status !== "open"; return (
{prediction.status === "resolved" ? prediction.result === "won" ? "Won" : "Resolved" : prediction.status} {prediction.featured ? ( Featured ) : null}
{prediction.points} pts

{prediction.title}

{prediction.description}

Closes {formatMatchDate(prediction.closesAt, "long")}

{prediction.options.map((option) => ( ))}
setConfidenceByPrediction((current) => ({ ...current, [prediction.id]: Number(event.target.value), })) } type="range" value={confidence} />
); })}
); }