eerrerer
erdfsfsfsdf
This commit is contained in:
@@ -17,9 +17,7 @@ import {
|
||||
Zap,
|
||||
BarChart3,
|
||||
Users,
|
||||
Bell,
|
||||
Shield,
|
||||
HelpCircle,
|
||||
Loader2,
|
||||
Check,
|
||||
AlertCircle,
|
||||
@@ -65,7 +63,7 @@ interface SortResult {
|
||||
name: string
|
||||
description: string
|
||||
confidence: number
|
||||
action: any
|
||||
action?: { name?: string; email?: string; condition?: string; category?: string }
|
||||
}>
|
||||
}
|
||||
|
||||
@@ -131,7 +129,7 @@ export function Dashboard() {
|
||||
if (referralRes.data) setReferralCode(referralRes.data.referralCode)
|
||||
} catch (err) {
|
||||
console.error('Error loading dashboard data:', err)
|
||||
setError('Failed to load data')
|
||||
setError('Couldn’t load your data. Check your connection and refresh.')
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
@@ -139,7 +137,7 @@ export function Dashboard() {
|
||||
|
||||
const handleSortNow = async () => {
|
||||
if (!user?.$id || accounts.length === 0) {
|
||||
setError('Please connect an email account first to start sorting.')
|
||||
setError('Connect your inbox first, then click Sort Now.')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -178,7 +176,7 @@ export function Dashboard() {
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error sorting emails:', err)
|
||||
setError('Unable to sort emails right now. Please check your connection and try again.')
|
||||
setError('Something went wrong. Check your connection and try again.')
|
||||
} finally {
|
||||
setSorting(false)
|
||||
}
|
||||
@@ -248,13 +246,6 @@ export function Dashboard() {
|
||||
</Link>
|
||||
|
||||
<div className="flex items-center gap-1.5 sm:gap-2 lg:gap-4">
|
||||
<Button variant="ghost" size="icon" className="hidden lg:flex h-9 w-9">
|
||||
<Bell className="w-5 h-5 text-slate-500 dark:text-slate-400" />
|
||||
</Button>
|
||||
<Button variant="ghost" size="icon" className="hidden lg:flex h-9 w-9">
|
||||
<HelpCircle className="w-5 h-5 text-slate-500 dark:text-slate-400" />
|
||||
</Button>
|
||||
<div className="hidden lg:block h-6 w-px bg-slate-200 dark:bg-slate-700" />
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => navigate('/settings')}
|
||||
@@ -304,7 +295,7 @@ export function Dashboard() {
|
||||
<p className="text-sm text-slate-600 dark:text-slate-400">
|
||||
{accounts.length > 0
|
||||
? `${accounts.length} account${accounts.length > 1 ? 's' : ''} connected`
|
||||
: 'Connect an account to get started'}
|
||||
: 'Connect Gmail or Outlook to sort your first emails.'}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 sm:gap-3">
|
||||
@@ -315,7 +306,7 @@ export function Dashboard() {
|
||||
aria-label="Connect email account"
|
||||
>
|
||||
<Plus className="w-4 h-4 mr-2" />
|
||||
Connect Account
|
||||
Connect inbox
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
@@ -359,6 +350,15 @@ export function Dashboard() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* First-time hint: account connected, no sort yet */}
|
||||
{!loading && accounts.length > 0 && !sortResult && !error && (
|
||||
<div className="mb-4 p-4 bg-slate-100 dark:bg-slate-800/60 rounded-xl border border-slate-200 dark:border-slate-700">
|
||||
<p className="text-sm text-slate-700 dark:text-slate-300">
|
||||
Click <strong>Sort Now</strong> to categorize your inbox. Takes about 30 seconds. Nothing is deleted — we only add labels or move mail to folders.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Error message */}
|
||||
{error && (
|
||||
<div className="mb-3 sm:mb-4 p-2.5 sm:p-3 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg flex items-start sm:items-center gap-2 text-red-700 dark:text-red-300">
|
||||
@@ -378,7 +378,8 @@ export function Dashboard() {
|
||||
<div className="flex items-center justify-center py-20">
|
||||
<div className="text-center">
|
||||
<Loader2 className="w-10 h-10 animate-spin text-primary-500 dark:text-primary-400 mx-auto mb-4" />
|
||||
<p className="text-slate-500 dark:text-slate-400">Loading dashboard...</p>
|
||||
<p className="text-slate-500 dark:text-slate-400">Loading your data...</p>
|
||||
<p className="text-slate-400 dark:text-slate-500 text-sm mt-1">One moment.</p>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -394,9 +395,9 @@ export function Dashboard() {
|
||||
<Sparkles className="w-5 h-5 text-white" />
|
||||
</div>
|
||||
<div>
|
||||
<CardTitle className="text-lg">AI-Assistent</CardTitle>
|
||||
<CardTitle className="text-lg">Email sorting</CardTitle>
|
||||
<CardDescription className="text-sm">
|
||||
Automatische E-Mail-Sortierung mit KI
|
||||
Categorize inbox — leads, clients, newsletters
|
||||
</CardDescription>
|
||||
</div>
|
||||
</div>
|
||||
@@ -413,10 +414,10 @@ export function Dashboard() {
|
||||
</div>
|
||||
<div>
|
||||
<p className={`${sortResult.isFirstRun ? 'text-lg' : 'text-sm'} font-bold text-green-800 dark:text-green-200`}>
|
||||
{sortResult.isFirstRun ? '🎉 First sort complete!' : 'Sorting complete!'}
|
||||
{sortResult.isFirstRun ? 'Done. Your inbox is sorted.' : 'Sort complete.'}
|
||||
</p>
|
||||
{sortResult.isFirstRun && (
|
||||
<p className="text-sm text-green-700 dark:text-green-300 mt-0.5">Your inbox is getting organized</p>
|
||||
<p className="text-sm text-green-700 dark:text-green-300 mt-0.5">Newsletters and promos are in folders. Check your inbox — only important mail is left.</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -444,10 +445,10 @@ export function Dashboard() {
|
||||
<div className="bg-white/80 dark:bg-slate-800/80 p-3 rounded-lg">
|
||||
<p className="text-xs text-green-600 dark:text-green-400 mb-1">Top category</p>
|
||||
<p className="text-xl font-bold text-green-800 dark:text-green-200">
|
||||
{Object.entries(sortResult.categories).sort(([_, a], [__, b]) => b - a)[0]?.[1] || 0}
|
||||
{Object.entries(sortResult.categories).sort(([, a], [, b]) => b - a)[0]?.[1] || 0}
|
||||
</p>
|
||||
<p className="text-xs text-green-500 dark:text-green-400 mt-1">
|
||||
{formatCategoryName(Object.entries(sortResult.categories).sort(([_, a], [__, b]) => b - a)[0]?.[0] || '')}
|
||||
{formatCategoryName(Object.entries(sortResult.categories).sort(([, a], [, b]) => b - a)[0]?.[0] || '')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -457,7 +458,7 @@ export function Dashboard() {
|
||||
{sortResult.isFirstRun && sortResult.suggestedRules && sortResult.suggestedRules.length > 0 && (
|
||||
<div className="mt-4 pt-4 border-t border-green-200 dark:border-green-800">
|
||||
<div className="mb-3">
|
||||
<p className="text-sm font-semibold text-green-900 dark:text-green-200">Smart suggestions for you</p>
|
||||
<p className="text-sm font-semibold text-green-900 dark:text-green-200">Suggestions for you</p>
|
||||
<p className="text-xs text-green-600 dark:text-green-400 mt-0.5">Based on your email patterns</p>
|
||||
</div>
|
||||
<div className="space-y-2 mb-3">
|
||||
@@ -479,19 +480,19 @@ export function Dashboard() {
|
||||
setSorting(true)
|
||||
try {
|
||||
const vipSenders = sortResult.suggestedRules
|
||||
.filter(r => r.type === 'vip_sender' && r.action?.email)
|
||||
.map(r => r.action.email)
|
||||
.filter((r): r is typeof r & { action: { email: string } } => r.type === 'vip_sender' && !!r.action?.email)
|
||||
.map(r => ({ email: r.action.email }))
|
||||
|
||||
const companyLabels = sortResult.suggestedRules
|
||||
.filter(r => r.type === 'company_label' && r.action?.name)
|
||||
.filter((r): r is typeof r & { action: { name: string; condition?: string; category?: string } } => r.type === 'company_label' && !!r.action?.name)
|
||||
.map(r => ({
|
||||
name: r.action.name,
|
||||
condition: r.action.condition,
|
||||
condition: r.action.condition ?? '',
|
||||
category: r.action.category || 'promotions',
|
||||
enabled: true,
|
||||
}))
|
||||
|
||||
const updates: any = {}
|
||||
const updates: { vipSenders?: Array<{ email: string; name?: string }>; companyLabels?: Array<{ name: string; condition?: string; category: string; enabled: boolean }> } = {}
|
||||
if (vipSenders.length > 0) {
|
||||
updates.vipSenders = vipSenders
|
||||
}
|
||||
@@ -502,10 +503,10 @@ export function Dashboard() {
|
||||
if (Object.keys(updates).length > 0) {
|
||||
await api.saveUserPreferences(user.$id, updates)
|
||||
trackRulesApplied(user.$id, sortResult.suggestedRules.length)
|
||||
showMessage('success', `Applied ${sortResult.suggestedRules.length} smart rules! Your inbox will stay organized.`)
|
||||
showMessage('success', `${sortResult.suggestedRules.length} rules applied. Your inbox will stay organized.`)
|
||||
setSortResult({ ...sortResult, suggestedRules: [] })
|
||||
}
|
||||
} catch (err) {
|
||||
} catch {
|
||||
showMessage('error', 'Unable to apply rules right now. Please try again.')
|
||||
} finally {
|
||||
setSorting(false)
|
||||
@@ -756,7 +757,7 @@ export function Dashboard() {
|
||||
<CardTitle className="text-base">Control Panel</CardTitle>
|
||||
</div>
|
||||
<CardDescription className="text-xs">
|
||||
KI-Einstellungen und Kategorien verwalten
|
||||
Categories and rules
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
@@ -767,7 +768,7 @@ export function Dashboard() {
|
||||
aria-label="Open Control Panel settings"
|
||||
>
|
||||
<Settings className="w-4 h-4 mr-2" />
|
||||
Control Panel öffnen
|
||||
Open Control Panel
|
||||
<ExternalLink className="w-3 h-3 ml-2" />
|
||||
</Button>
|
||||
</CardContent>
|
||||
@@ -778,10 +779,10 @@ export function Dashboard() {
|
||||
<CardHeader className="pb-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<Settings className="w-5 h-5 text-primary-500 dark:text-primary-400" />
|
||||
<CardTitle className="text-base">Einstellungen</CardTitle>
|
||||
<CardTitle className="text-base">Settings</CardTitle>
|
||||
</div>
|
||||
<CardDescription className="text-xs">
|
||||
Schnellzugriff auf wichtige Einstellungen
|
||||
Quick access
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-2">
|
||||
@@ -810,7 +811,7 @@ export function Dashboard() {
|
||||
aria-label="Open all settings"
|
||||
>
|
||||
<Settings className="w-4 h-4 mr-2" />
|
||||
Alle Einstellungen
|
||||
All settings
|
||||
<ExternalLink className="w-3 h-3 ml-auto" />
|
||||
</Button>
|
||||
</CardContent>
|
||||
@@ -819,9 +820,9 @@ export function Dashboard() {
|
||||
{/* Account/System Karte */}
|
||||
<Card className="border border-slate-200 dark:border-slate-700 shadow-sm">
|
||||
<CardHeader className="pb-3">
|
||||
<CardTitle className="text-base">Account & System</CardTitle>
|
||||
<CardTitle className="text-base">Account</CardTitle>
|
||||
<CardDescription className="text-xs">
|
||||
Subscription und Konten-Status
|
||||
Subscription and accounts
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
@@ -932,7 +933,7 @@ export function Dashboard() {
|
||||
) : (
|
||||
<div className="text-center py-4">
|
||||
<Mail className="w-8 h-8 text-slate-300 dark:text-slate-600 mx-auto mb-2" />
|
||||
<p className="text-xs text-slate-500 dark:text-slate-400 mb-2">No accounts connected</p>
|
||||
<p className="text-xs text-slate-500 dark:text-slate-400 mb-2">No inbox connected yet</p>
|
||||
<Button
|
||||
onClick={() => navigate('/setup')}
|
||||
variant="outline"
|
||||
@@ -941,7 +942,7 @@ export function Dashboard() {
|
||||
aria-label="Connect email account"
|
||||
>
|
||||
<Plus className="w-3 h-3 mr-1.5" />
|
||||
Connect Account
|
||||
Connect inbox
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -21,8 +21,8 @@ export function ForgotPassword() {
|
||||
try {
|
||||
await auth.forgotPassword(email)
|
||||
setSent(true)
|
||||
} catch (err: any) {
|
||||
setError(err.message || 'Fehler beim Senden der E-Mail')
|
||||
} catch (err: unknown) {
|
||||
setError(err instanceof Error ? err.message : 'Fehler beim Senden der E-Mail')
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@ import { Navbar } from '@/components/landing/Navbar'
|
||||
import { Hero } from '@/components/landing/Hero'
|
||||
import { Features } from '@/components/landing/Features'
|
||||
import { HowItWorks } from '@/components/landing/HowItWorks'
|
||||
import { Pricing } from '@/components/landing/Pricing'
|
||||
import { Testimonials } from '@/components/landing/Testimonials'
|
||||
import { TrustSection } from '@/components/landing/TrustSection'
|
||||
import { Pricing } from '@/components/landing/Pricing'
|
||||
import { FAQ } from '@/components/landing/FAQ'
|
||||
import { Footer } from '@/components/landing/Footer'
|
||||
|
||||
@@ -15,6 +16,7 @@ export function Home() {
|
||||
<Features />
|
||||
<HowItWorks />
|
||||
<Testimonials />
|
||||
<TrustSection />
|
||||
<Pricing />
|
||||
<FAQ />
|
||||
<Footer />
|
||||
|
||||
@@ -23,8 +23,8 @@ export function Login() {
|
||||
try {
|
||||
await login(email, password)
|
||||
navigate('/dashboard')
|
||||
} catch (err: any) {
|
||||
setError(err.message || 'Login failed. Please check your credentials.')
|
||||
} catch (err: unknown) {
|
||||
setError(err instanceof Error ? err.message : 'Login failed. Please check your credentials.')
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ export function Register() {
|
||||
try {
|
||||
await register(email, password, name)
|
||||
navigate('/setup')
|
||||
} catch (err: any) {
|
||||
setError(err.message || 'Registration failed. Please try again.')
|
||||
} catch (err: unknown) {
|
||||
setError(err instanceof Error ? err.message : 'Registration failed. Please try again.')
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ export function ResetPassword() {
|
||||
try {
|
||||
await auth.resetPassword(userId, secret, password)
|
||||
setSuccess(true)
|
||||
} catch (err: any) {
|
||||
setError(err.message || 'Fehler beim Zurücksetzen des Passworts')
|
||||
} catch (err: unknown) {
|
||||
setError(err instanceof Error ? err.message : 'Fehler beim Zurücksetzen des Passworts')
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ import {
|
||||
Save,
|
||||
Edit2,
|
||||
} from 'lucide-react'
|
||||
import type { AIControlSettings, CompanyLabel, CategoryInfo, CleanupStatus } from '@/types/settings'
|
||||
import type { AIControlSettings, CompanyLabel, CategoryInfo, CleanupSettings, CleanupStatus, CategoryAdvanced } from '@/types/settings'
|
||||
import { PrivacySecurity } from '@/components/PrivacySecurity'
|
||||
|
||||
type TabType = 'profile' | 'accounts' | 'vip' | 'ai-control' | 'subscription' | 'privacy' | 'referrals'
|
||||
@@ -198,29 +198,31 @@ export function Settings() {
|
||||
if (prefsRes.data?.vipSenders) setVipSenders(prefsRes.data.vipSenders)
|
||||
if (aiControlRes.data) {
|
||||
// Merge cleanup defaults if not present
|
||||
const settings: AIControlSettings = {
|
||||
...aiControlRes.data,
|
||||
cleanup: aiControlRes.data.cleanup || {
|
||||
const raw = aiControlRes.data
|
||||
const defaultCleanup: CleanupSettings = {
|
||||
enabled: false,
|
||||
readItems: {
|
||||
enabled: false,
|
||||
readItems: {
|
||||
enabled: false,
|
||||
action: 'archive_read' as const,
|
||||
gracePeriodDays: 7,
|
||||
},
|
||||
promotions: {
|
||||
enabled: false,
|
||||
matchCategoriesOrLabels: ['promotions', 'newsletters'],
|
||||
action: 'archive_read' as const,
|
||||
deleteAfterDays: 30,
|
||||
},
|
||||
safety: {
|
||||
requireConfirmForDelete: true,
|
||||
dryRun: false,
|
||||
maxDeletesPerRun: 100,
|
||||
},
|
||||
action: 'archive_read',
|
||||
gracePeriodDays: 7,
|
||||
},
|
||||
categoryAdvanced: aiControlRes.data.categoryAdvanced || {},
|
||||
version: aiControlRes.data.version || 1,
|
||||
promotions: {
|
||||
enabled: false,
|
||||
matchCategoriesOrLabels: ['promotions', 'newsletters'],
|
||||
action: 'archive_read',
|
||||
deleteAfterDays: 30,
|
||||
},
|
||||
safety: {
|
||||
requireConfirmForDelete: true,
|
||||
dryRun: false,
|
||||
maxDeletesPerRun: 100,
|
||||
},
|
||||
}
|
||||
const settings: AIControlSettings = {
|
||||
...raw,
|
||||
cleanup: (raw.cleanup as CleanupSettings | undefined) || defaultCleanup,
|
||||
categoryAdvanced: (raw.categoryAdvanced as Record<string, CategoryAdvanced> | undefined) || {},
|
||||
version: raw.version ?? 1,
|
||||
}
|
||||
setAiControlSettings(settings)
|
||||
savedSettingsRef.current = JSON.parse(JSON.stringify(settings)) // Deep copy
|
||||
@@ -312,7 +314,7 @@ export function Settings() {
|
||||
try {
|
||||
const res = await api.getCleanupStatus(user.$id)
|
||||
if (res.data) setCleanupStatus(res.data)
|
||||
} catch (err) {
|
||||
} catch {
|
||||
// Silently fail if endpoint doesn't exist yet
|
||||
console.debug('Cleanup status endpoint not available')
|
||||
}
|
||||
@@ -324,7 +326,7 @@ export function Settings() {
|
||||
try {
|
||||
const res = await api.getCleanupPreview(user.$id)
|
||||
if (res.data?.preview) setCleanupPreview(res.data.preview)
|
||||
} catch (err) {
|
||||
} catch {
|
||||
// Silently fail if endpoint doesn't exist yet
|
||||
console.debug('Cleanup preview endpoint not available')
|
||||
}
|
||||
@@ -1058,7 +1060,7 @@ export function Settings() {
|
||||
</div>
|
||||
<select
|
||||
value={filterEnabled}
|
||||
onChange={(e) => setFilterEnabled(e.target.value as any)}
|
||||
onChange={(e) => setFilterEnabled((e.target.value || 'all') as 'all' | 'enabled' | 'disabled')}
|
||||
className="px-3 py-2 border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100"
|
||||
>
|
||||
<option value="all">All</option>
|
||||
@@ -1070,7 +1072,7 @@ export function Settings() {
|
||||
</Card>
|
||||
|
||||
{/* Tabs */}
|
||||
<Tabs value={controlPanelTab} onValueChange={(v) => setControlPanelTab(v as any)} className="w-full">
|
||||
<Tabs value={controlPanelTab} onValueChange={(v) => setControlPanelTab((v || 'rules') as 'rules' | 'cleanup' | 'labels')} className="w-full">
|
||||
<TabsList className="grid w-full grid-cols-3">
|
||||
<TabsTrigger value="rules" className="text-sm sm:text-base">Rules</TabsTrigger>
|
||||
<TabsTrigger value="cleanup" className="text-sm sm:text-base">Cleanup</TabsTrigger>
|
||||
@@ -1554,7 +1556,7 @@ export function Settings() {
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<select
|
||||
value={labelSort}
|
||||
onChange={(e) => setLabelSort(e.target.value as any)}
|
||||
onChange={(e) => setLabelSort((e.target.value || 'name') as 'name' | 'newest')}
|
||||
className="px-3 py-2 text-sm border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100"
|
||||
>
|
||||
<option value="name">Sort: Name</option>
|
||||
@@ -1834,7 +1836,7 @@ export function Settings() {
|
||||
id="category-action"
|
||||
value={aiControlSettings.categoryActions[selectedCategory.key] || selectedCategory.defaultAction}
|
||||
onChange={(e) => {
|
||||
const newActions = { ...aiControlSettings.categoryActions, [selectedCategory.key]: e.target.value as any }
|
||||
const newActions = { ...aiControlSettings.categoryActions, [selectedCategory.key]: (e.target.value || 'inbox') as 'inbox' | 'archive_read' | 'star' }
|
||||
setAiControlSettings({ ...aiControlSettings, categoryActions: newActions })
|
||||
}}
|
||||
className="w-full px-4 py-3 border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 focus:ring-2 focus:ring-primary-500 focus:border-transparent"
|
||||
@@ -1881,7 +1883,7 @@ export function Settings() {
|
||||
onChange={(e) => {
|
||||
const newAdvanced = { ...aiControlSettings.categoryAdvanced }
|
||||
if (!newAdvanced[selectedCategory.key]) newAdvanced[selectedCategory.key] = {}
|
||||
newAdvanced[selectedCategory.key] = { ...newAdvanced[selectedCategory.key], priority: e.target.value as any }
|
||||
newAdvanced[selectedCategory.key] = { ...newAdvanced[selectedCategory.key], priority: (e.target.value || 'medium') as 'low' | 'medium' | 'high' }
|
||||
setAiControlSettings({ ...aiControlSettings, categoryAdvanced: newAdvanced })
|
||||
}}
|
||||
className="w-full px-3 py-2 border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 mt-1"
|
||||
|
||||
@@ -107,9 +107,7 @@ export function Setup() {
|
||||
|
||||
const steps: { id: Step; title: string; description: string }[] = [
|
||||
{ id: 'connect', title: 'Connect email', description: 'Link your mailbox' },
|
||||
{ id: 'preferences', title: 'Settings', description: 'Sorting preferences' },
|
||||
{ id: 'categories', title: 'Categories', description: 'Choose categories' },
|
||||
{ id: 'complete', title: 'Done', description: 'Get started!' },
|
||||
{ id: 'complete', title: 'Done', description: 'Go to dashboard' },
|
||||
]
|
||||
|
||||
const stepIndex = steps.findIndex(s => s.id === currentStep)
|
||||
@@ -128,13 +126,12 @@ export function Setup() {
|
||||
} else {
|
||||
setConnectedProvider('gmail')
|
||||
setConnectedEmail(user.email)
|
||||
setCurrentStep('preferences')
|
||||
// Track onboarding step
|
||||
await api.updateOnboardingStep(user.$id, 'first_rule', ['connect'])
|
||||
setCurrentStep('complete')
|
||||
await api.updateOnboardingStep(user.$id, 'see_results', ['connect'])
|
||||
trackOnboardingStep(user.$id, 'first_rule')
|
||||
trackProviderConnected(user.$id, 'gmail')
|
||||
}
|
||||
} catch (err) {
|
||||
} catch {
|
||||
setError('Gmail connection failed. Please try again.')
|
||||
} finally {
|
||||
setConnecting(null)
|
||||
@@ -155,11 +152,10 @@ export function Setup() {
|
||||
} else {
|
||||
setConnectedProvider('outlook')
|
||||
setConnectedEmail(user.email)
|
||||
setCurrentStep('preferences')
|
||||
// Track onboarding step
|
||||
await api.updateOnboardingStep(user.$id, 'first_rule', ['connect'])
|
||||
setCurrentStep('complete')
|
||||
await api.updateOnboardingStep(user.$id, 'see_results', ['connect'])
|
||||
}
|
||||
} catch (err) {
|
||||
} catch {
|
||||
setError('Outlook connection failed. Please try again.')
|
||||
} finally {
|
||||
setConnecting(null)
|
||||
@@ -176,13 +172,12 @@ export function Setup() {
|
||||
if (response.data) {
|
||||
setConnectedProvider('demo')
|
||||
setConnectedEmail(response.data.email)
|
||||
setCurrentStep('preferences')
|
||||
// Track onboarding step
|
||||
await api.updateOnboardingStep(user.$id, 'first_rule', ['connect'])
|
||||
setCurrentStep('complete')
|
||||
await api.updateOnboardingStep(user.$id, 'see_results', ['connect'])
|
||||
trackOnboardingStep(user.$id, 'first_rule')
|
||||
trackDemoUsed(user.$id)
|
||||
}
|
||||
} catch (err) {
|
||||
} catch {
|
||||
setError('Demo connection failed. Please try again.')
|
||||
} finally {
|
||||
setConnecting(null)
|
||||
@@ -240,7 +235,7 @@ export function Setup() {
|
||||
})
|
||||
|
||||
// Mark onboarding as completed
|
||||
await api.updateOnboardingStep(user.$id, 'completed', ['connect', 'first_rule', 'see_results', 'auto_schedule'])
|
||||
await api.updateOnboardingStep(user.$id, 'completed', ['connect', 'see_results'])
|
||||
} catch (err) {
|
||||
console.error('Failed to save preferences:', err)
|
||||
} finally {
|
||||
@@ -336,7 +331,7 @@ export function Setup() {
|
||||
<OnboardingProgress
|
||||
currentStep={onboardingState.onboarding_step}
|
||||
completedSteps={onboardingState.completedSteps}
|
||||
totalSteps={4}
|
||||
totalSteps={2}
|
||||
onSkip={handleSkipOnboarding}
|
||||
/>
|
||||
</div>
|
||||
@@ -588,12 +583,15 @@ export function Setup() {
|
||||
|
||||
{currentStep === 'complete' && (
|
||||
<div className="text-center">
|
||||
<div className="w-28 h-28 mx-auto mb-8 rounded-full bg-gradient-to-br from-green-100 to-green-200 flex items-center justify-center shadow-2xl shadow-green-500/20 animate-pulse">
|
||||
<Sparkles className="w-14 h-14 text-green-600" />
|
||||
<div className="w-28 h-28 mx-auto mb-8 rounded-full bg-gradient-to-br from-green-100 to-green-200 dark:from-green-900/40 dark:to-green-800/40 flex items-center justify-center shadow-2xl shadow-green-500/20 animate-pulse">
|
||||
<Sparkles className="w-14 h-14 text-green-600 dark:text-green-400" />
|
||||
</div>
|
||||
<h1 className="text-4xl font-bold text-slate-900 dark:text-slate-100 mb-4">All set! 🎉</h1>
|
||||
<p className="text-xl text-slate-600 dark:text-slate-400 mb-10 max-w-md mx-auto">
|
||||
Your email account is connected. The AI will now start intelligent sorting.
|
||||
<h1 className="text-4xl font-bold text-slate-900 dark:text-slate-100 mb-4">You're in 🎉</h1>
|
||||
<p className="text-xl text-slate-600 dark:text-slate-400 mb-6 max-w-md mx-auto">
|
||||
Click Sort Now on the dashboard to categorize your inbox. Takes about 30 seconds.
|
||||
</p>
|
||||
<p className="text-sm text-slate-500 dark:text-slate-500 mb-10">
|
||||
<Link to="/settings" className="underline hover:text-slate-700 dark:hover:text-slate-300">Tune categories later in Settings</Link>
|
||||
</p>
|
||||
|
||||
<div className="inline-flex items-center gap-4 p-5 bg-gradient-to-r from-slate-50 to-slate-100 dark:from-slate-800 dark:to-slate-700 rounded-2xl mb-10 shadow-lg">
|
||||
|
||||
@@ -29,9 +29,9 @@ export function VerifyEmail() {
|
||||
try {
|
||||
await auth.verifyEmail(userId, secret)
|
||||
setStatus('success')
|
||||
} catch (err: any) {
|
||||
} catch (err: unknown) {
|
||||
setStatus('error')
|
||||
setError(err.message || 'Fehler bei der Verifizierung')
|
||||
setError(err instanceof Error ? err.message : 'Fehler bei der Verifizierung')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ export function VerifyEmail() {
|
||||
await auth.sendVerification()
|
||||
setError('')
|
||||
alert('Neue Verifizierungs-E-Mail wurde gesendet!')
|
||||
} catch (err: any) {
|
||||
setError(err.message || 'Fehler beim Senden')
|
||||
} catch (err: unknown) {
|
||||
setError(err instanceof Error ? err.message : 'Fehler beim Senden')
|
||||
} finally {
|
||||
setStatus('error')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user