import { For, onCleanup, onMount } from 'solid-js'; import { A } from '@solidjs/router'; import { Users, Building2, TrendingUp, CreditCard, Download, Eye, Pencil, Trash2 } from 'lucide-solid'; import AdminShell from '~/components/AdminShell'; type StatDef = { id: string; label: string; icon: any; value: string; delta: string; deltaPositive?: boolean; subtext: string; }; const STAT_DEFS: StatDef[] = [ { id: 'total-users', label: 'Total Users', icon: Users, value: '12,458', delta: '+12.5%', deltaPositive: true, subtext: '+1,245 from last month', }, { id: 'active-companies', label: 'Active Companies', icon: Building2, value: '1,234', delta: '+8.2%', deltaPositive: true, subtext: '+94 from last month', }, { id: 'open-leads', label: 'Open Leads', icon: TrendingUp, value: '847', delta: '-3.1%', deltaPositive: false, subtext: '-27 from last month', }, { id: 'credits-purchased', label: 'Credits Purchased', icon: CreditCard, value: '$45,890', delta: '+18.7%', deltaPositive: true, subtext: '+$7,234 from last month', }, ]; type RecentLead = { title: string; customer: string; category: string; budget: string; status: 'Active' | 'Pending' | 'Negotiating'; }; const RECENT_LEADS: RecentLead[] = [ { title: 'Website Redesign Project', customer: 'TechCorp Inc.', category: 'Developers', budget: '$15,000', status: 'Active' }, { title: 'Corporate Event Photography', customer: 'EventMasters LLC', category: 'Photographer', budget: '$3,500', status: 'Pending' }, { title: 'Marketing Campaign Design', customer: 'BrandHub Co.', category: 'Graphics Designer', budget: '$8,200', status: 'Active' }, { title: 'Social Media Management', customer: 'GrowthStart', category: 'Social Media Manager', budget: '$5,000', status: 'Negotiating' }, ]; function classForStatus(status: RecentLead['status']) { if (status === 'Active') return 'bg-[rgba(250,80,20,0.1)] border-[rgba(250,80,20,0.2)] text-[#fa5014]'; if (status === 'Pending') return 'bg-[rgba(0,0,50,0.1)] border-[rgba(0,0,50,0.2)] text-[#000032]'; return 'bg-[#f9fafb] border-[#e5e7eb] text-[rgba(0,0,50,0.6)]'; } function MiniChart(props: { type: 'line' | 'bar' }) { let el!: HTMLDivElement; let chart: any = null; onCleanup(() => { chart?.destroy(); chart = null; }); onMount(async () => { const { default: ApexCharts } = await import('apexcharts'); if (!el) return; const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']; const isLine = props.type === 'line'; chart = new ApexCharts(el, { chart: { type: props.type, height: 240, toolbar: { show: false }, fontFamily: 'Exo 2, sans-serif', }, grid: { borderColor: '#e5e7eb', strokeDashArray: 4, xaxis: { lines: { show: false } }, }, xaxis: { categories: months, labels: { style: { colors: '#000032', fontSize: '11px', fontWeight: 700 } }, }, yaxis: { labels: { style: { colors: '#000032', fontSize: '11px', fontWeight: 700 } }, }, tooltip: { theme: 'light' }, legend: { show: false }, dataLabels: { enabled: false }, ...(isLine ? { series: [{ name: 'Total Leads', data: [65, 75, 90, 80, 95, 110] }], stroke: { width: 3, curve: 'smooth', colors: ['#000032'] }, fill: { type: 'gradient', gradient: { shadeIntensity: 1, opacityFrom: 0.2, opacityTo: 0.01, colorStops: [{ offset: 0, color: '#000032', opacity: 0.16 }, { offset: 100, color: '#000032', opacity: 0.01 }], }, }, markers: { size: 0 }, colors: ['#000032'], yaxis: { min: 0, max: 120, tickAmount: 4, labels: { style: { colors: '#000032', fontSize: '11px', fontWeight: 700 } } }, } : { series: [{ name: 'Revenue', data: [42000, 48000, 55000, 51000, 62000, 69000] }], plotOptions: { bar: { columnWidth: '38%', borderRadius: 4 } }, colors: ['#000032'], yaxis: { min: 0, max: 80000, tickAmount: 4, labels: { formatter: (v: number) => `${v}` } }, }), }); await chart.render(); }); return
; } function StatCard(props: { def: StatDef }) { const Icon = props.def.icon; return (
{props.def.deltaPositive ? '↗' : '↘'} {props.def.delta}

{props.def.label}

{props.def.value}

{props.def.subtext}

); } export default function AdminDashboard() { const handleExport = () => window.print(); return (

Dashboard Overview

Welcome back! Here's what's happening with your platform today.

{(def) => }

Leads Trend

Monthly leads performance overview

Revenue Overview

Monthly revenue vs expenses comparison

Recent Leads

Latest customer inquiries and opportunities

View All Leads
{(lead) => ( )}
Lead Title Customer Category Budget Status Actions
{lead.title} {lead.customer} {lead.category} {lead.budget} {lead.status}
); }