diff --git a/src/components/MilestoneTimeline.js b/src/components/MilestoneTimeline.js
index 0daa254..66f677c 100644
--- a/src/components/MilestoneTimeline.js
+++ b/src/components/MilestoneTimeline.js
@@ -1,8 +1,8 @@
+// src/components/MilestoneTimeline.js
+
import React, { useEffect, useState, useCallback } from 'react';
import { Button } from './ui/button.js';
-const today = new Date();
-
export default function MilestoneTimeline({
careerPathId,
authFetch,
@@ -12,6 +12,7 @@ export default function MilestoneTimeline({
}) {
const [milestones, setMilestones] = useState({ Career: [], Financial: [] });
+ // We'll keep your existing milestone form state, tasks, copy wizard, etc.
const [newMilestone, setNewMilestone] = useState({
title: '',
description: '',
@@ -25,16 +26,14 @@ export default function MilestoneTimeline({
const [showForm, setShowForm] = useState(false);
const [editingMilestone, setEditingMilestone] = useState(null);
- // For tasks
const [showTaskForm, setShowTaskForm] = useState(null);
const [newTask, setNewTask] = useState({ title: '', description: '', due_date: '' });
- // The copy wizard
const [scenarios, setScenarios] = useState([]);
const [copyWizardMilestone, setCopyWizardMilestone] = useState(null);
// ------------------------------------------------------------------
- // 1) HELPER: Add or remove an impact from newMilestone
+ // 1) Financial Impacts sub-form helpers (no change)
// ------------------------------------------------------------------
function addNewImpact() {
setNewMilestone((prev) => ({
@@ -67,7 +66,7 @@ export default function MilestoneTimeline({
}
// ------------------------------------------------------------------
- // 2) fetchMilestones => local state
+ // 2) Fetch milestones => store in "milestones[Career]" / "milestones[Financial]"
// ------------------------------------------------------------------
const fetchMilestones = useCallback(async () => {
if (!careerPathId) return;
@@ -101,7 +100,7 @@ export default function MilestoneTimeline({
}, [fetchMilestones]);
// ------------------------------------------------------------------
- // 3) Load Scenarios for copy wizard
+ // 3) Load all scenarios for the copy wizard
// ------------------------------------------------------------------
useEffect(() => {
async function loadScenarios() {
@@ -254,7 +253,7 @@ export default function MilestoneTimeline({
}
}
- // Re-fetch or update local
+ // Re-fetch
await fetchMilestones();
// reset form
@@ -306,7 +305,7 @@ export default function MilestoneTimeline({
const createdTask = await res.json();
console.log('Task created:', createdTask);
- // Re-fetch so the timeline shows the new task
+ // Re-fetch so the list shows the new task
await fetchMilestones();
setNewTask({ title: '', description: '', due_date: '' });
@@ -317,7 +316,7 @@ export default function MilestoneTimeline({
}
// ------------------------------------------------------------------
- // 7) Copy Wizard => now with brute force refresh
+ // 7) Copy Wizard
// ------------------------------------------------------------------
function CopyMilestoneWizard({ milestone, scenarios, onClose, authFetch }) {
const [selectedScenarios, setSelectedScenarios] = useState([]);
@@ -342,7 +341,6 @@ export default function MilestoneTimeline({
});
if (!res.ok) throw new Error('Failed to copy milestone');
- // Brute force page refresh
window.location.reload();
onClose();
} catch (err) {
@@ -357,7 +355,6 @@ export default function MilestoneTimeline({
Milestone: {milestone.title}
-
{scenarios.map((s) => (
))}
-