import { useQuery } from '@tanstack/react-query'; import { Link } from 'react-router-dom'; import { api } from '../lib/api-client'; import { AppShell, PageBody, PageHeader } from '../layout/AppShell'; import { Card, CardContent, CardHeader, CardTitle, Badge, Skeleton } from '../components/ui/primitives'; import { ArrowRight, Rss, Package, ListChecks, Shield } from 'lucide-react'; interface MeResponse { user: { email: string; role: string }; jobs: { pending: number; running: number; completed: number; failed: number; cancelled: number; total: number }; recentActivity: { created_at: string; action: string; entity_type: string }[]; serverTime: string; } interface DashboardStats { feeds: { enabled: number; total: number; errored: number }; products: { total: number; sneakers: number }; today: { clicks: number; conversions: number; revenue: number }; } export function DashboardPage() { const me = useQuery({ queryKey: ['me'], queryFn: () => api.get('/me') }); const stats = useQuery({ queryKey: ['dashboard-stats'], queryFn: () => api.get('/dashboard/stats') }); return (
} to="/cms/feeds" /> } to="/cms/products" /> } to="/cms/jobs" /> } to="/cms/jobs" />
Recente activiteit {me.isLoading ? (
) : me.data?.recentActivity.length ? (
    {me.data.recentActivity.map((row, i) => (
  • {row.action} {row.entity_type} {relTime(row.created_at)}
  • ))}
) : (

Geen recente acties.

)} Audit log bekijken
Welkom

Hallo {me.data?.user.email ?? 'admin'},

Dit is je nieuwe CMS. Gebruik Ctrl+K om snel te navigeren of acties uit te voeren.

Beheer feeds → Producten → Homepage →
); } function StatCard({ title, value, hint, icon, to, }: { title: string; value: string; hint?: string; icon: React.ReactNode; to: string; }) { return (
{title} {icon}
{value}
{hint &&
{hint}
}
); } function fmt(n: number) { return new Intl.NumberFormat('nl-NL').format(n); } function relTime(iso: string) { const d = new Date(iso); const diff = Date.now() - d.getTime(); const mins = Math.floor(diff / 60000); if (mins < 1) return 'zojuist'; if (mins < 60) return `${mins}m geleden`; const hrs = Math.floor(mins / 60); if (hrs < 24) return `${hrs}u geleden`; const days = Math.floor(hrs / 24); return `${days}d geleden`; }