diff --git a/src/components/settings/DataExportTab.tsx b/src/components/settings/DataExportTab.tsx index e2455487..810babe5 100644 --- a/src/components/settings/DataExportTab.tsx +++ b/src/components/settings/DataExportTab.tsx @@ -8,30 +8,23 @@ import { useToast } from '@/hooks/use-toast'; import { useAuth } from '@/hooks/useAuth'; import { supabase } from '@/integrations/supabase/client'; import { Download, BarChart3, Upload, FileText, History } from 'lucide-react'; - export function DataExportTab() { - const { user, profile } = useAuth(); - const { toast } = useToast(); + const { + user, + profile + } = useAuth(); + const { + toast + } = useToast(); const [exportLoading, setExportLoading] = useState(false); const [exportProgress, setExportProgress] = useState(0); - const handleDataExport = async () => { if (!user) return; - setExportLoading(true); setExportProgress(0); - try { // Simulate export progress - const steps = [ - 'Collecting profile data...', - 'Gathering reviews...', - 'Collecting ride credits...', - 'Gathering top lists...', - 'Packaging data...', - 'Preparing download...' - ]; - + const steps = ['Collecting profile data...', 'Gathering reviews...', 'Collecting ride credits...', 'Gathering top lists...', 'Packaging data...', 'Preparing download...']; for (let i = 0; i < steps.length; i++) { await new Promise(resolve => setTimeout(resolve, 500)); setExportProgress((i + 1) / steps.length * 100); @@ -41,17 +34,15 @@ export function DataExportTab() { // 1. Fetch all user data from various tables // 2. Package it into a structured format (JSON/CSV) // 3. Create a downloadable file - + const exportData = { profile: profile, export_date: new Date().toISOString(), data_types: ['profile', 'reviews', 'ride_credits', 'top_lists'] }; - const blob = new Blob([JSON.stringify(exportData, null, 2)], { type: 'application/json' }); - const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; @@ -60,7 +51,6 @@ export function DataExportTab() { a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); - toast({ title: 'Export complete', description: 'Your data has been exported and downloaded successfully.' @@ -76,16 +66,13 @@ export function DataExportTab() { setExportProgress(0); } }; - const handleImportData = () => { toast({ title: 'Coming soon', - description: 'Data import functionality will be available in a future update.', + description: 'Data import functionality will be available in a future update.' }); }; - - return ( -
Coaster Count
-- Import your ride credits from coaster-count.com -
-Captain Coaster
-- Import your coaster credits from captaincoaster.com -
-CSV File
-- Upload a CSV file with your ride credits -
-