'use client'; import { useEffect, useState } from 'react'; interface LiveProp { player: string; stat: string; line: number; direction: string; grade: string; sport: string; } const SPORT_COLOR: Record = { NBA: '#E94B3C', MLB: '#1E90FF', WNBA: '#FFB347', }; function gradeColor(grade: string): string { const g = (grade || '').trim().toUpperCase().charAt(0); if (g === 'A') return 'var(--grade-a)'; if (g === 'B') return 'var(--grade-b)'; if (g === 'C') return 'var(--grade-c)'; return 'var(--grade-d)'; } export default function LivePropsStrip() { const [props, setProps] = useState(null); const [error, setError] = useState(false); useEffect(() => { let cancelled = false; async function load() { try { const res = await fetch('/api/props/live'); if (!res.ok) { if (!cancelled) setError(true); return; } const data = await res.json(); if (cancelled) return; if (Array.isArray(data) && data.length > 0) { setProps(data.slice(0, 12)); setError(false); } else { setProps([]); } } catch { if (!cancelled) setError(true); } } load(); const id = setInterval(load, 60_000); return () => { cancelled = true; clearInterval(id); }; }, []); // Loading / fallback state if (props === null) return null; if (error || props.length === 0) { return (

LIVE GRADES APPEAR HERE AS BOOKS POST LINES

); } // Duplicate for seamless ticker scroll const ticker = [...props, ...props]; return (
{ticker.map((p, i) => (
{p.sport} {p.player} {p.direction} {p.line} {p.stat} {p.grade}
))}
); }