import { memo, useState, useEffect } from 'react'; import { ShoppingCart, TrendingUp, Target, FileText } from 'lucide-react'; const WelcomeBanner = memo(({ user, summary, currencySymbol, onNavigate }) => { const [currentTime, setCurrentTime] = useState(new Date()); useEffect(() => { const timer = setInterval(() => setCurrentTime(new Date()), 60000); return () => clearInterval(timer); }, []); const getGreeting = () => { const hour = currentTime.getHours(); if (hour < 12) return 'Good Morning'; if (hour < 17) return 'Good Afternoon'; if (hour < 21) return 'Good Evening'; return 'Good Night'; }; const getMotivationalMessage = () => { const savingsRate = summary?.total_income > 0 ? ((summary.total_income - summary.total_expense) / summary.total_income * 100) : 0; if (savingsRate >= 20) return "You're doing great with your savings! 🎉"; if (savingsRate >= 0) return "Keep up the good work! 💪"; return "Let's work on improving your finances! 🚀"; }; const formatDate = () => { return currentTime.toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }); }; const quickActions = [ { icon: , label: 'Add Expense', action: () => onNavigate('/transactions'), color: '#ef4444' }, { icon: , label: 'Add Income', action: () => onNavigate('/transactions'), color: '#10b981' }, { icon: , label: 'Set Budget', action: () => onNavigate('/budget'), color: '#6366f1' }, { icon: , label: 'Web Report', action: () => onNavigate('/report'), color: '#f59e0b' } ]; return (
{/* Animated Background Gradient */}
{/* Left Section - Greeting */}
{user?.username?.charAt(0).toUpperCase() || 'U'}

{getGreeting()}, {user?.username ? user.username.toUpperCase() : 'User'}!

{formatDate()}

{getMotivationalMessage()}

{/* Right Section - Quick Stats */}
Total Balance
{currencySymbol}{((summary?.total_income || 0) - (summary?.total_expense || 0)).toLocaleString()}
This Month
{summary?.monthly_txn_count || 0} txns
{/* Quick Actions */}
{quickActions.map((action, idx) => ( ))}
); }); export default WelcomeBanner;