import { supabase } from '../lib/supabaseClient'; export interface DashboardStats { info: { label: string; value: number }[]; alerts: { id: string; title: string; desc: string; severity: 'critical' | 'warning' }[]; waste: { name: string; value: number }[]; } // Mock data const MOCK_STATS: DashboardStats = { info: [ { label: 'Mon', value: 30 }, { label: 'Tue', value: 45 }, { label: 'Wed', value: 15 }, { label: 'Thu', value: 25 }, { label: 'Fri', value: 10 }, { label: 'Sat', value: 35 }, { label: 'Sun', value: 20 }, ], alerts: [ { id: '1', title: 'Critical temperature alert', desc: 'Freezer #3 exceeded limit', severity: 'critical' }, { id: '2', title: 'Stock level warning', desc: 'Ingredient A low inventory', severity: 'warning' }, ], waste: [ { name: 'Expired', value: 30 }, { name: 'Preparation', value: 45 }, { name: 'Packaging', value: 25 }, ] }; export async function getDashboardStats(): Promise { if (!supabase) return MOCK_STATS; try { // Example: Fetching alerts from Supabase // const { data: alerts } = await supabase.from('alerts').select('*').limit(5); // if (alerts) { ... } // For now, return mock data even if supabase is connected, until tables are created return MOCK_STATS; } catch (error) { console.error('Error fetching dashboard stats:', error); return MOCK_STATS; } }