import React, { useState } from 'react'; import { Button } from './ui/button'; import { Input } from './ui/input'; import { Label } from './ui/label'; import { Card } from './ui/card'; import { Separator } from './ui/separator'; import { Textarea } from './ui/textarea'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './ui/select'; import { LogIn, LogOut, Download, ClipboardList, FileText, Sparkles, ChevronUp, ChevronDown, PanelRightClose, MessageSquare } from 'lucide-react'; import type { User } from '../App'; import { toast } from 'sonner@2.0.3'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, DialogFooter, } from './ui/dialog'; interface RightPanelProps { user: User | null; onLogin: (user: User) => void; onLogout: () => void; isLoggedIn: boolean; onClose?: () => void; exportResult: string; setExportResult: (result: string) => void; resultType: 'export' | 'quiz' | 'summary' | null; setResultType: (type: 'export' | 'quiz' | 'summary' | null) => void; } export function RightPanel({ user, onLogin, onLogout, isLoggedIn, onClose, exportResult, setExportResult, resultType, setResultType }: RightPanelProps) { const [showLoginForm, setShowLoginForm] = useState(false); const [name, setName] = useState(''); const [email, setEmail] = useState(''); const [isExpanded, setIsExpanded] = useState(true); const [feedbackDialogOpen, setFeedbackDialogOpen] = useState(false); const [feedbackText, setFeedbackText] = useState(''); const [feedbackCategory, setFeedbackCategory] = useState<'general' | 'bug' | 'feature'>('general'); const handleLogin = () => { if (!name.trim() || !email.trim()) { toast.error('Please fill in all fields'); return; } onLogin({ name: name.trim(), email: email.trim() }); setShowLoginForm(false); setName(''); setEmail(''); toast.success(`Welcome, ${name}!`); }; const handleLogout = () => { onLogout(); setShowLoginForm(false); toast.success('Logged out successfully'); }; const handleExport = () => { const result = `# Conversation Export Date: ${new Date().toLocaleDateString()} Student: ${user?.name} ## Summary This conversation covered key concepts in Module 10 – Responsible AI, including ethical considerations, fairness, transparency, and accountability in AI systems. ## Key Takeaways 1. Understanding the principles of Responsible AI 2. Real-world applications and implications 3. Best practices for ethical AI development Exported successfully! ✓`; setExportResult(result); setResultType('export'); toast.success('Conversation exported!'); }; const handleQuiz = () => { const quiz = `# Micro-Quiz: Responsible AI **Question 1:** Which of the following is a key principle of Responsible AI? a) Profit maximization b) Transparency c) Rapid deployment d) Cost reduction **Question 2:** What is algorithmic fairness? (Short answer expected) **Question 3:** True or False: AI systems should always prioritize accuracy over fairness. Generate quiz based on your conversation!`; setExportResult(quiz); setResultType('quiz'); toast.success('Quiz generated!'); }; const handleSummary = () => { const summary = `# Learning Summary ## Today's Session **Duration:** 25 minutes **Topics Covered:** 3 **Messages Exchanged:** 12 ## Key Concepts Discussed • Principles of Responsible AI • Ethical considerations in AI development • Fairness and transparency in algorithms ## Recommended Next Steps 1. Review Module 10, Section 2.3 2. Complete practice quiz on algorithmic fairness 3. Read additional resources on AI ethics ## Progress Update You've covered 65% of Module 10 content. Keep up the great work! 🎉`; setExportResult(summary); setResultType('summary'); toast.success('Summary generated!'); }; const handleFeedbackSubmit = () => { if (!feedbackText.trim()) { toast.error('Please provide feedback text'); return; } // Here you can add logic to send feedback to your server or handle it as needed console.log('Feedback submitted:', feedbackText, feedbackCategory); setFeedbackDialogOpen(false); setFeedbackText(''); toast.success('Feedback submitted!'); }; return (
{isExpanded && ( <> {/* Login Section */} {!isLoggedIn ? (
Student studying

Welcome to Clare!

Log in to start your personalized learning journey

{!showLoginForm ? ( ) : (
setName(e.target.value)} placeholder="Enter your name" />
setEmail(e.target.value)} placeholder="Enter your email or ID" />
)}
) : (
{user.name.charAt(0).toUpperCase()}

{user.name}

{user.email}

)}
{/* Actions section removed - functionality available via floating buttons */} {/*

Actions

{!isLoggedIn && (

Log in to unlock all features

)}
*/} {/* Results Section */}

{resultType === 'export' && 'Exported Conversation'} {resultType === 'quiz' && 'Micro-Quiz'} {resultType === 'summary' && 'Summarization'} {!resultType && 'Results'}

{exportResult ? (
{exportResult}
) : (
Results (export / summary / quiz) will appear here after using the actions above
)}
{/* Feedback Section */}

Feedback

{/* Feedback Dialog */} Provide Feedback Help us improve Clare by sharing your thoughts and suggestions.