import React from 'react'; import { ExternalLink, Youtube } from 'lucide-react'; export default function SourceCard({ sources }) { if (!sources || sources.length === 0) return null; const getSourceUrl = (source) => { if (source?.url) return source.url; if (source?.video_id) return `https://www.youtube.com/watch?v=${source.video_id}`; return '#'; }; return (

Sources ({sources.length})

{sources.map((source, i) => { const isVideoSource = source?.source_type === 'video'; const sourceUrl = getSourceUrl(source); const previewText = source?.snippet || source?.transcript || source?.video_transcript || ''; return (

{source?.title || 'Untitled'}

{isVideoSource ? ( Video Transcript ) : ( {source?.source_name || sourceUrl} )}
{source?.is_trusted && ( TRUSTED )}
{previewText && (

{previewText}

)} {source?.retrieval_tier && (
{source.retrieval_tier} {source?.channel && {source.channel}}
)}
); })}
); }