import React, { useState } from 'react'; import { Headphones, Video, Network, FileText, Component, HelpCircle, Package, Columns, Projector, Activity, Loader2, X, BookOpen } from 'lucide-react'; import { generateSourceContent } from '../api'; // Tool definitions const TOOLS = [ { id: 'audio', label: 'Audio Overview', icon: Headphones, color: 'text-purple-600', bg: 'bg-purple-50' }, { id: 'video', label: 'Video Overview', icon: Video, color: 'text-red-600', bg: 'bg-red-50' }, { id: 'mind_map', label: 'Mind Map', icon: Network, color: 'text-blue-600', bg: 'bg-blue-50' }, { id: 'reports', label: 'Reports', icon: FileText, color: 'text-emerald-600', bg: 'bg-emerald-50' }, { id: 'flashcards', label: 'Flashcards', icon: Component, color: 'text-amber-600', bg: 'bg-amber-50' }, { id: 'quiz', label: 'Quiz', icon: HelpCircle, color: 'text-cyan-600', bg: 'bg-cyan-50' }, { id: 'artifact', label: 'Create Artifact', icon: Package, color: 'text-indigo-600', bg: 'bg-indigo-50' }, { id: 'infographic', label: 'Infographic', icon: Columns, color: 'text-pink-600', bg: 'bg-pink-50' }, { id: 'slides', label: 'Slide Deck', icon: Projector, color: 'text-orange-600', bg: 'bg-orange-50' }, { id: 'data_table', label: 'Data Table', icon: Activity, color: 'text-teal-600', bg: 'bg-teal-50' }, ]; const SourceGuide = ({ onGenerate, activeCitation, onCloseCitation, notebookId }) => { const [generating, setGenerating] = useState(null); const handleToolClick = async (toolId) => { if (generating) return; setGenerating(toolId); try { const result = await generateSourceContent(toolId, notebookId); // Callback to Notebook to insert the result onGenerate(toolId, result.answer); } catch (error) { console.error(error); alert("Failed to generate content: " + (error.response?.data?.detail || error.message)); } finally { setGenerating(null); } }; // If a citation is active, show the Citation View (mini-panel) if (activeCitation) { return (

Source Guide

Selected Source

{activeCitation.paper_id}

"{activeCitation.text_snippet}"

); } return (

Source Guide

Transform your sources into...

{TOOLS.map((tool) => { const Icon = tool.icon; const isProcessing = generating === tool.id; return ( ); })}
); }; export default SourceGuide;