/** * BoostMedia AI Content Generator Admin - QuickActions Component * * @package BoostMedia_AI * @license GPL-2.0-or-later */ import { useState } from 'react' import { useNavigate } from 'react-router-dom' import { RefreshCw, Sparkles, FileText, Settings } from 'lucide-react' import { Card, CardHeader, CardTitle, CardContent } from '../common' import { endpoints } from '../../api/client' import { t } from '../../lib/i18n' interface QuickActionsProps { onScanComplete?: () => void } export function QuickActions({ onScanComplete }: QuickActionsProps) { const navigate = useNavigate() const [scanning, setScanning] = useState(false) const [scanMessage, setScanMessage] = useState(null) const [scanSuccess, setScanSuccess] = useState(false) const handleScan = async () => { setScanning(true) setScanMessage(null) try { await endpoints.scanAll() setScanSuccess(true) setScanMessage(t('Scan completed successfully!')) onScanComplete?.() } catch { setScanSuccess(false) setScanMessage(t('Scan error. Try again.')) } finally { setScanning(false) setTimeout(() => setScanMessage(null), 3000) } } const actions = [ { id: 'scan', label: t('Rescan'), description: t('Scan content types and meta fields'), icon: , onClick: handleScan, loading: scanning, variant: 'primary' as const, }, { id: 'generate', label: t('Create new content'), description: t('Create a new article with AI'), icon: , onClick: () => navigate('/generate'), variant: 'accent' as const, }, { id: 'post-types', label: t('View content types'), description: t('View post structure'), icon: , onClick: () => navigate('/post-types'), variant: 'secondary' as const, }, { id: 'settings', label: t('Settings'), description: t('Manage content preferences'), icon: , onClick: () => navigate('/settings'), variant: 'secondary' as const, }, ] return ( {t('Quick Actions')}
{actions.map((action) => ( ))}
{/* Scan Message */} {scanMessage && (
{scanMessage}
)}
) }