mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 11:45:23 +02:00
fix(vendor): pass bsrData prop to VendorDataView - resolves black screen
VendorDataView was refactored to receive BSR data as a prop but App.tsx was not updated to pass it, causing the component to crash on undefined and show a blank screen. Also fixes supabase.ts type errors and removes dead code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
243c44c7f7
commit
ce13d17eda
@@ -959,7 +959,7 @@ const App: React.FC = () => {
|
||||
|
||||
<Suspense fallback={<LoadingSpinner />}>
|
||||
<div className={view === 'vendor' ? '' : 'hidden'}>
|
||||
<VendorDataView />
|
||||
<VendorDataView bsrData={bsrData} />
|
||||
</div>
|
||||
</Suspense>
|
||||
|
||||
|
||||
+8
-13
@@ -1,4 +1,4 @@
|
||||
|
||||
/// <reference types="node" />
|
||||
import { createClient, SupabaseClient } from '@supabase/supabase-js';
|
||||
import { VendorDailyRow } from '../types';
|
||||
|
||||
@@ -20,7 +20,11 @@ const getClient = (): SupabaseClient => {
|
||||
autoRefreshToken: false,
|
||||
persistSession: false,
|
||||
detectSessionInUrl: false,
|
||||
storage: false as any
|
||||
storage: {
|
||||
getItem: (_key: string) => null,
|
||||
setItem: (_key: string, _value: string) => {},
|
||||
removeItem: (_key: string) => {},
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -66,15 +70,6 @@ export const fetchVendorData = async (filters: VendorFilters): Promise<VendorDai
|
||||
query = query.lte('date', filters.dateTo);
|
||||
}
|
||||
if (filters.years?.length) {
|
||||
// Filter by year using date range
|
||||
const yearFilters = filters.years.map(y => ({
|
||||
from: `${y}-01-01`,
|
||||
to: `${y}-12-31`
|
||||
}));
|
||||
const dateConditions = yearFilters.flatMap(f => [
|
||||
`date.gte.${f.from}`,
|
||||
`date.lte.${f.to}`
|
||||
]);
|
||||
// Build OR condition for multiple years
|
||||
query = query.or(
|
||||
filters.years.map(y => `and(date.gte.${y}-01-01,date.lte.${y}-12-31)`).join(',')
|
||||
@@ -124,8 +119,8 @@ export const fetchVendorFilterOptions = async (): Promise<{
|
||||
.order('date', { ascending: false })
|
||||
.limit(1);
|
||||
|
||||
const markets = [...new Set((marketData || []).map((r: any) => r.market as string))].sort();
|
||||
const tags = [...new Set((tagData || []).map((r: any) => r.tags as string).filter(Boolean))].sort();
|
||||
const markets = Array.from(new Set<string>((marketData || []).map((r: any) => r.market as string))).sort();
|
||||
const tags = Array.from(new Set<string>((tagData || []).map((r: any) => r.tags as string).filter(Boolean))).sort();
|
||||
|
||||
return {
|
||||
markets,
|
||||
|
||||
Reference in New Issue
Block a user