'use client'; import { useState, useEffect } from 'react'; interface Account { id: string; name: string; type: 'checking' | 'savings' | 'credit_card' | 'mortgage' | 'investment' | 'loan'; balance: number; color: string; isActive: boolean; } interface Envelope { id: string; name: string; allocated: number; spent: number; color: string; accountId: string; isRecurring?: boolean; recurringFrequency?: 'weekly' | 'monthly' | 'yearly'; lastRecurringDate?: string; } interface DemoWizardProps { onApplyDemo: (accounts: Account[], envelopes: Envelope[]) => void; onSkip: () => void; accountId?: string; } const DEMO_DATA = { accounts: [ { id: crypto.randomUUID(), name: 'Main Checking', type: 'checking' as const, balance: 5000, color: 'bg-blue-500', isActive: true, }, { id: crypto.randomUUID(), name: 'Emergency Fund', type: 'savings' as const, balance: 10000, color: 'bg-green-500', isActive: true, }, ], envelopes: [ { name: 'Rent', allocated: 1500, color: 'bg-red-500', isRecurring: true, recurringFrequency: 'monthly' as const }, { name: 'Groceries', allocated: 400, color: 'bg-green-500', isRecurring: true, recurringFrequency: 'monthly' as const }, { name: 'Utilities', allocated: 150, color: 'bg-yellow-500', isRecurring: true, recurringFrequency: 'monthly' as const }, { name: 'Entertainment', allocated: 200, color: 'bg-purple-500', isRecurring: false }, { name: 'Dining Out', allocated: 250, color: 'bg-pink-500', isRecurring: false }, { name: 'Car Payment', allocated: 350, color: 'bg-indigo-500', isRecurring: true, recurringFrequency: 'monthly' as const }, ], }; export default function DemoWizard({ onApplyDemo, onSkip, accountId }: DemoWizardProps) { const [showDemo, setShowDemo] = useState(false); const handleApplyDemo = () => { // Use first account as default, or create new ones const firstAccountId = accountId || DEMO_DATA.accounts[0].id; const envelopes = DEMO_DATA.envelopes.map((env) => ({ id: crypto.randomUUID(), ...env, accountId: firstAccountId, spent: 0, })); onApplyDemo(DEMO_DATA.accounts, envelopes); }; if (!showDemo) { return (
We can populate your budget with sample accounts and envelopes to help you get started and explore the app's features.
Here's what we'll create for you:
💡 Tip: You can always edit or delete these envelopes and accounts later. This is just a starting point!