/* * AIToolsDialog.tsx * Purpose: Shows the focused text-editing dialog for refine/change/expand/regenerate AI actions. * Used by: GoogleSlidesEditor when a text element is edited with AI. * Depends on: AI edit route and editor apply callbacks. */ import React, { useState } from 'react'; import { X, Sparkles, RefreshCw, FileText, Maximize2 } from 'lucide-react'; interface AIToolsDialogProps { isOpen: boolean; onClose: () => void; selectedText: string; onApply: (newText: string) => void; onAIEdit: (action: 'refine' | 'change' | 'expand') => Promise; } export default function AIToolsDialog({ isOpen, onClose, selectedText, onApply, onAIEdit }: AIToolsDialogProps) { const [currentText, setCurrentText] = useState(selectedText); const [isProcessing, setIsProcessing] = useState(false); const [selectedAction, setSelectedAction] = useState<'refine' | 'change' | 'expand' | null>(null); if (!isOpen) return null; const handleAction = async (action: 'refine' | 'change' | 'expand') => { setIsProcessing(true); setSelectedAction(action); try { const newText = await onAIEdit(action); setCurrentText(newText); } catch (error) { console.error('AI edit error:', error); } finally { setIsProcessing(false); setSelectedAction(null); } }; const handleApply = () => { onApply(currentText); onClose(); }; const handleCancel = () => { setCurrentText(selectedText); onClose(); }; return (
{/* Header */}

AI Text Tools

{/* Content */}
{/* Action buttons */}
{/* Text preview */}