"use client"; import { useEffect, useState } from "react"; import Link from "next/link"; interface Slide { id: string; slug: string; title: string; excerpt: string; image: string | null; category: string; author: string; author_initials: string; author_beat: string | null; date: string; read_min: number; ago_min: number; neural_summary: NeuralSummary | null; } interface NeuralSummary { bullets?: string[]; confidence?: number; entities?: string[]; } export default function FeaturedCarousel({ slides }: { slides: Slide[] }) { const [i, setI] = useState(0); const [paused, setPaused] = useState(false); useEffect(() => { if (slides.length < 2 || paused) return; const t = setInterval(() => setI((v) => (v + 1) % slides.length), 4000); return () => clearInterval(t); }, [slides.length, paused]); if (slides.length === 0) return null; const s = slides[i]; return (
setPaused(true)} onMouseLeave={() => setPaused(false)} className="max-w-container mx-auto px-4 my-8" aria-label="Featured editorial" >

Featured · staff editorial

auto · 4s
{s.image ? ( {s.title} ) : (
no image
)}
[ID {s.id.slice(0, 4).toUpperCase()}] [{s.category.replace(/\s+/g, "-")}]
{s.category} · {s.ago_min}min ago · {s.read_min}min read

{s.title}

{s.excerpt}

{s.neural_summary && Array.isArray(s.neural_summary.bullets) && s.neural_summary.bullets.length > 0 && (
Neural summary {typeof s.neural_summary.confidence === "number" && ( conf {(s.neural_summary.confidence * 100).toFixed(0)}% )}
    {s.neural_summary.bullets.slice(0, 3).map((b, idx) => (
  • · {b}
  • ))}
{s.neural_summary.entities && s.neural_summary.entities.length > 0 && (
{s.neural_summary.entities.slice(0, 5).map((e) => ( {e} ))}
)}
)}
{s.author_initials}
{s.author}
{s.author_beat && (
{s.author_beat}
)}
{slides.map((_, n) => (
{String(i + 1).padStart(2, "0")} / {String(slides.length).padStart(2, "0")}
); }