import React, { memo } from 'react'; import { Target, TrendingUp, Trash2, Calendar, Plus, CheckCircle } from 'lucide-react'; const SavingsGoalsWidget = memo(({ goals, currencySymbol, onAddGoal, onDeleteGoal, onUpdateGoal }) => { // Net balance is the same for all goals, we can take it from the first one if available const availableBalance = goals.length > 0 ? goals[0].current_amount : 0; return (

Financial Goals

Available Balance: {currencySymbol}{availableBalance.toLocaleString()}
{goals.length === 0 ? (
🎯

No goals active

Start by setting a target for your savings!

) : ( goals.map((goal) => { const remaining = goal.target_amount - goal.current_amount; const isAchieved = goal.current_amount >= goal.target_amount; return (
{/* Achievement Glow */} {isAchieved && (
)}
{isAchieved ? '✨' : }

{goal.name}

Target: {goal.target_date || 'Ongoing'}
Progress {goal.progress_percentage.toFixed(0)}%
Current: {currencySymbol}{goal.current_amount.toLocaleString()} Goal: {currencySymbol}{goal.target_amount.toLocaleString()}
{/* Personalized Feedback */}
{isAchieved ? (
🎉 Congratulations! Goal Achieved!

You've successfully saved enough for this milestone.

) : (
🚀 Keep going!

Save {currencySymbol}{remaining.toLocaleString()} more to reach your goal.

)}
); }) )}