/** * BoostMedia AI Content Generator Admin - Dashboard Page * * @package BoostMedia_AI * @license GPL-2.0-or-later */ import { useState, useCallback } from 'react' import { FileText, Sparkles, Clock, AlertTriangle } from 'lucide-react' import { useNavigate } from 'react-router-dom' import { Header } from '../components/layout/Header' import { StatsCard, QuickActions, RecentActivity, PostTypesOverview, OnboardingBanner } from '../components/dashboard' import { useStats } from '../hooks' import { useOnboarding } from '../hooks/useOnboarding' import { t } from '../lib/i18n' function OnboardingBannerFallback() { const { isSetupComplete } = useOnboarding() if (!isSetupComplete) return null return } function SetupProgress() { const { state, setupStepsRemaining, isSetupComplete } = useOnboarding() const navigate = useNavigate() if (isSetupComplete) return null const steps = [ { key: 'usageSeen' as const, label: t('Usage & Costs'), path: '/usage', icon: '\u{1F4B0}', done: state.usageSeen }, { key: 'contentTypesSeen' as const, label: t('Content Types'), path: '/post-types', icon: '\u{1F4CB}', done: state.contentTypesSeen }, { key: 'linksSeen' as const, label: t('Links'), path: '/links', icon: '\u{1F517}', done: state.linksSeen }, { key: 'reportersSeen' as const, label: t('Reporters'), path: '/reporters', icon: '\u{270D}\uFE0F', done: state.reportersSeen }, ] const nextStep = steps.find(s => !s.done) return (

{'\u{1F389}'} {t('Welcome to BoostMedia AI Content Generator!')}

{t('You received 60 free BoostCoins to get started. Let\'s set up the plugin in 4 simple steps:')}

{steps.map((step) => ( ))}
{nextStep && ( )}
) } export default function Dashboard() { const { stats, loading, error, refetch } = useStats() const [isRefreshing, setIsRefreshing] = useState(false) const handleRefresh = useCallback(async () => { setIsRefreshing(true) await refetch() setIsRefreshing(false) }, [refetch]) return (
{/* Header */}
{/* Content */}
{/* Setup Progress (shown during onboarding) */} {/* Original onboarding banner (shown after setup when no content generated yet) */} {/* Error Banner */} {error && (
{t('Failed to load dashboard data. Please try refreshing.')}
)} {/* Stats Grid */}
} color="primary" subtitle={t('Custom post types')} helpText={t('Number of custom post types detected on your site, including posts, pages, and custom types from JetEngine or ACF.')} /> } color="accent" subtitle={t('Total AI-generated posts')} helpText={t('Total posts created by BoostMedia AI Content Generator so far.')} /> } color="warning" subtitle={t('Awaiting approval')} helpText={t('Posts that were created but not yet published. They are waiting for your review and approval.')} /> } color={stats?.total_errors && stats.total_errors > 0 ? 'error' : 'success'} subtitle={ stats?.total_errors && stats.total_errors > 0 ? t('Needs attention') : t('All good') } helpText={t('Errors that occurred during content creation or publishing. Check Logs for details.')} />
{/* Main Grid */}
{/* Left Column */}
{/* Right Column */}
{/* Welcome Card */}

{t('Welcome! 🎉')}

{t('BoostMedia AI Content Generator lets you create quality content in your site\'s style using AI. Start by scanning your site to identify content types.')}

{t('✨ AI Content Creation')} {t('📊 Style Analysis')} {t('⏰ Scheduled Publishing')}
{/* Footer Info */}

BoostMedia AI Content Generator v{window.bmaiSettings?.version || '?'} • Boost Media LTD • Made with ❤️ in Israel

) }