fix(admin): nav issues and blank screens fix

This commit is contained in:
2026-02-26 16:20:59 -05:00
parent 10cb37c866
commit 34a73f0f94
8 changed files with 57 additions and 15 deletions

View File

@ -2,7 +2,30 @@
* Reports are now generated directly from Supabase queries in the AdminReports view. */
import { supabase } from '@/supabase';
export interface Report {
id: string;
user_id: string;
user_name?: string;
message: string;
status: 'pending' | 'resolved' | 'archived';
created_at: string;
}
export const reportsService = {
async getReports(): Promise<Report[]> {
const { data, error } = await supabase.from('reports').select('*').order('created_at', { ascending: false })
if (error) {
console.warn('Reports table might not exist or error fetching', error)
return []
}
return data as Report[]
},
async updateReportStatus(id: string, status: string): Promise<void> {
const { error } = await supabase.from('reports').update({ status }).eq('id', id)
if (error) throw new Error(error.message)
},
async getRoutesReport() {
const { data, error } = await supabase.from('routes').select('*')
if (error) throw new Error(error.message)