import type { StreamParticle } from "@/api/types"; import { getParticleData } from "@/api/types"; import { MessageSquare, Video, Mic, ScrollText, BookOpen, FileIcon, FolderIcon, } from "lucide-react"; interface ParticlePreviewProps { particle: StreamParticle; } export function ParticlePreview({ particle }: ParticlePreviewProps) { switch (particle.type) { case "text": { const data = getParticleData(particle, "text"); return (

{data.content}

); } case "media": { const data = getParticleData(particle, "media"); const isVideo = data.mime_type.startsWith("video"); const Icon = isVideo ? Video : Mic; const label = isVideo ? "Video" : "Audio"; const seconds = Math.round(data.duration_ms / 1000); return (
{label} · {seconds}s
); } case "quest": { const data = getParticleData(particle, "quest"); return (
{data.title} {data.status && ` · ${data.status}`}
); } case "paper": { const data = getParticleData(particle, "paper"); return (
{data.title}
); } case "file": { const data = getParticleData(particle, "file"); return (
{data.filename}
); } case "folder": { const data = getParticleData(particle, "folder"); return (
{data.name}
); } default: return null; } }