diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx index b79bf188..07112b43 100755 --- a/frontend/src/pages/Dashboard.tsx +++ b/frontend/src/pages/Dashboard.tsx @@ -6,8 +6,7 @@ import { Package, Target, Image as ImageIcon, - MousePointer, - Shield, + Tag, TrendingUp, TrendingDown, RefreshCw, @@ -62,12 +61,42 @@ export function Dashboard() { const loadData = async () => { try { - const [statsData, activityData] = await Promise.all([ - api.getDashboardStats(), - api.getDashboardActivity() - ]); - setStats(statsData); - setActivity(activityData); + // Fetch AZ dashboard data (primary data source) + const azDashboard = await api.getDutchieAZDashboard(); + + // Map AZ dashboard data to the expected stats format + setStats({ + products: { + total: azDashboard.productCount, + in_stock: azDashboard.productCount, // All AZ products are in stock by default + with_images: 0 // Not tracked in AZ pipeline + }, + stores: { + total: azDashboard.dispensaryCount, + active: azDashboard.dispensaryCount // All are active in AZ + }, + brands: { + total: azDashboard.brandCount + }, + campaigns: { + active: 0, + total: 0 + }, + clicks: { + clicks_24h: azDashboard.snapshotCount24h // Use snapshots as activity metric + }, + failedJobs: azDashboard.failedJobCount, + lastCrawlTime: azDashboard.lastCrawlTime + }); + + // Try to fetch activity data (may fail if not authenticated) + try { + const activityData = await api.getDashboardActivity(); + setActivity(activityData); + } catch { + // Activity data requires auth, just skip it + setActivity(null); + } } catch (error) { console.error('Failed to load dashboard:', error); } finally { @@ -196,9 +225,9 @@ export function Dashboard() {
Active Stores
-{stats?.stores?.active || 0}
-{stats?.stores?.total || 0} total stores
+Total Dispensaries
+{stats?.stores?.total || 0}
+{stats?.stores?.active || 0} active (crawlable)
Clicks (24h)
+Snapshots (24h)
{stats?.clicks?.clicks_24h?.toLocaleString() || 0}
-Last 24 hours
+Product snapshots created
Active Proxies
-{stats?.proxies?.active || 0}
-{stats?.proxies?.total || 0} total proxies
+Brands
+{stats?.brands?.total || stats?.products?.unique_brands || 0}
+Unique brands tracked