From 32a7de8aea14983de94ccb7f1c5441d7a1fc792d Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Tue, 3 Mar 2026 11:19:05 +0100 Subject: [PATCH] feat: remove vendor CSV upload button from data modal All vendor files are linked via Dropbox, making manual upload unnecessary. Removes the Upload Vendor CSV button, handleVendorUpload handler, and processVendorCSV import. Co-Authored-By: Claude Sonnet 4.6 --- App.tsx | 43 +------------------------------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/App.tsx b/App.tsx index 22d4b75..093239c 100644 --- a/App.tsx +++ b/App.tsx @@ -5,7 +5,7 @@ import Dashboard from './components/Dashboard'; import FilterBar from './components/FilterBar'; import AIChat from './components/AIChat'; import CrazeLogo from './components/CrazeLogo'; -import { processCSV, processExcel, filterData, aggregateData, processAdsCSV, processAdsExcel, mergeSalesAndAdsData, processTrafficExcel, processStockExcel, filterAdsData, calculateForecastViewData, processVendorStockExcel, processUKInventoryExcel, calculateVelocityMap, getUniqueValues, processForecastExcel, processBuyBoxExcel, processVendorCSV, processBSRExcel, filterBsrData } from './services/dataProcessor'; +import { processCSV, processExcel, filterData, aggregateData, processAdsCSV, processAdsExcel, mergeSalesAndAdsData, processTrafficExcel, processStockExcel, filterAdsData, calculateForecastViewData, processVendorStockExcel, processUKInventoryExcel, calculateVelocityMap, getUniqueValues, processForecastExcel, processBuyBoxExcel, processBSRExcel, filterBsrData } from './services/dataProcessor'; import { SalesRecord, FilterState, AggregatedData, AdsRecord, TrafficRecord, ForecastRecord, ProductForecastData, ActiveExperiment, BSRRecord } from './types'; import { queryGemini } from './services/geminiService'; import { ChartIcon, TableIcon, UploadIcon, DownloadIcon, CloseIcon, TrendingIcon, MegaphoneIcon } from './components/Icons'; @@ -480,46 +480,6 @@ const App: React.FC = () => { }; // Handle uploaded Vendor CSV (sends to Supabase via API with batching) - const handleVendorUpload = async (file: File) => { - setSyncing(true); - try { - console.log("[App] Parsing Vendor CSV on client..."); - const rows = await processVendorCSV(file); - - if (rows.length === 0) { - alert("No valid rows found in CSV."); - return; - } - - console.log(`[App] Uploading ${rows.length} rows in batches...`); - - const BATCH_SIZE = 500; - let totalUpserted = 0; - - for (let i = 0; i < rows.length; i += BATCH_SIZE) { - const batch = rows.slice(i, i + BATCH_SIZE); - const response = await fetch('/api/upload-vendor-data', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(batch), - }); - - const result = await response.json(); - if (!response.ok) throw new Error(result.error || `Batch ${i / BATCH_SIZE + 1} failed`); - - totalUpserted += result.rowsUpserted; - console.log(`[App] Batch ${Math.floor(i / BATCH_SIZE) + 1} complete. Total: ${totalUpserted}`); - } - - alert(`Vendor data uploaded: ${totalUpserted} rows processed successfully.`); - setIsDataModalOpen(false); - } catch (error: any) { - console.error("Failed to upload vendor data", error); - alert(`Error uploading vendor data: ${error.message}`); - } finally { - setSyncing(false); - } - }; // 2. Schedule Auto-Refresh (Background) useEffect(() => { @@ -1029,7 +989,6 @@ const App: React.FC = () => { onSalesUpload={handleSalesUpload} onAdsUpload={handleAdsUpload} onTrafficUpload={handleTrafficUpload} - onVendorUpload={handleVendorUpload} onUrlSubmit={handleDataFetch} isLoading={syncing} activeUrl={activeUrl}