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:
{formatDate()}
{getMotivationalMessage()}