+ {/* Header */}
+
+
+
Savings Goals
+
Track your savings progress and achieve your financial milestones
+
+
+
+
+ {error && (
+
+ {error}
+
+ )}
+
+ {/* Overview Stats */}
+
+
+
+
+
+ Total Goals
+
+
+
+ {goals.length}
+ Active savings goals
+
+
+
+
+
+
+
+ Total Saved
+
+
+
+ ${totalSaved.toFixed(2)}
+
+ of ${totalTarget.toFixed(2)} target
+
+
+
+
+
+
+
+
+ Overall Progress
+
+
+
+ {overallProgress.toFixed(1)}%
+
+
+
+
+
+ {/* Goals List */}
+ {goals.length === 0 ? (
+
+
+
+ No savings goals yet
+
+ Create your first savings goal to start tracking your financial progress
+
+
+
+
+ ) : (
+
+ {goals.map((goal) => {
+ const progress = calculateProgress(goal);
+ const daysLeft = getDaysLeft(goal.deadline);
+ const goalMilestones = milestones[goal.id] || [];
+
+ return (
+
+
+
+
+
+
+ {goal.name}
+
+ {goal.description && (
+ {goal.description}
+ )}
+
+ {getStatusBadge(goal)}
+
+
+
+
+ {/* Progress Bar */}
+
+
+ ${goal.current_amount.toFixed(2)}
+ ${goal.target_amount.toFixed(2)}
+
+
+
+ {progress.toFixed(1)}% Complete
+
+
+
+ {/* Deadline */}
+ {goal.deadline && (
+
+
+
+ {daysLeft !== null && daysLeft >= 0
+ ? `${daysLeft} days left`
+ : daysLeft !== null && daysLeft < 0
+ ? `${Math.abs(daysLeft)} days overdue`
+ : new Date(goal.deadline).toLocaleDateString()}
+
+
+ )}
+
+ {/* Milestones */}
+ {goalMilestones.length > 0 && (
+
+
+
+ Milestones
+
+
+ {goalMilestones.map((milestone) => {
+ const isAchieved = progress >= milestone.target_percentage;
+ return (
+
+ {milestone.name}
+ {milestone.target_percentage}%
+
+ );
+ })}
+
+
+ )}
+
+
+
+
+
+
+
+
+
+ );
+ })}
+
+ )}
+
+ {/* Create Modal (simplified placeholder) */}
+ {showCreateModal && (
+
+
+
Create Savings Goal
+
+
+
+ )}
+
+ );
+}