From 9404135915d949b0cf97823dae3a6db1a03bb618 Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 1 May 2025 16:01:56 +0000 Subject: [PATCH] milestone tracker UI improvements - untested due to navigation issues --- src/components/MilestoneTracker.js | 42 +++++++++++++++++------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/components/MilestoneTracker.js b/src/components/MilestoneTracker.js index 218416a..dd4b10e 100644 --- a/src/components/MilestoneTracker.js +++ b/src/components/MilestoneTracker.js @@ -1,5 +1,4 @@ // src/components/MilestoneTracker.js - import React, { useState, useEffect } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; import { v4 as uuidv4 } from 'uuid'; @@ -22,8 +21,8 @@ import CareerSearch from './CareerSearch.js'; import MilestoneTimeline from './MilestoneTimeline.js'; import AISuggestedMilestones from './AISuggestedMilestones.js'; import ScenarioEditModal from './ScenarioEditModal.js'; -import './MilestoneTracker.css'; -import './MilestoneTimeline.css'; +import './MilestoneTracker.css'; // keeps your local styles +import './MilestoneTimeline.css'; // keeps your local styles import { simulateFinancialProjection } from '../utils/FinancialProjectionService.js'; ChartJS.register( @@ -53,7 +52,7 @@ const MilestoneTracker = ({ selectedCareer: initialCareer }) => { // Real user snapshot const [financialProfile, setFinancialProfile] = useState(null); - // Scenario row (with planned_* overrides) from GET /api/premium/career-profile/:careerPathId + // Scenario row (with planned_* overrides) const [scenarioRow, setScenarioRow] = useState(null); // scenario's collegeProfile row @@ -151,8 +150,7 @@ const MilestoneTracker = ({ selectedCareer: initialCareer }) => { }, [careerPathId, apiURL]); // -------------------------------------------------- - // 3) Once we have (financialProfile, scenarioRow, collegeProfile), - // run initial simulation with the scenario's milestones + impacts + // 3) Once we have (financialProfile, scenarioRow, collegeProfile), run initial simulation // -------------------------------------------------- useEffect(() => { if (!financialProfile || !scenarioRow || !collegeProfile) return; @@ -168,7 +166,7 @@ const MilestoneTracker = ({ selectedCareer: initialCareer }) => { const milestonesData = await milRes.json(); const allMilestones = milestonesData.milestones || []; - // 2) fetch impacts for each + // 2) fetch impacts for each milestone const impactPromises = allMilestones.map(m => authFetch(`${apiURL}/premium/milestone-impacts?milestone_id=${m.id}`) .then(r => r.ok ? r.json() : null) @@ -185,7 +183,7 @@ const MilestoneTracker = ({ selectedCareer: initialCareer }) => { })); const allImpacts = milestonesWithImpacts.flatMap(m => m.impacts); - // 3) Build the merged profile w/ scenario overrides + // 3) Build the merged profile const mergedProfile = buildMergedProfile( financialProfile, scenarioRow, @@ -377,7 +375,8 @@ const MilestoneTracker = ({ selectedCareer: initialCareer }) => { ); return ( -
+
+ {/* Career Select */} { authFetch={authFetch} /> + {/* Milestone Timeline */} { onMilestoneUpdated={reSimulate} /> + {/* AI-Suggested Milestones */} { projectionData={projectionData} /> + {/* Chart Section */} {projectionData.length > 0 && ( -
-

Financial Projection

+
+

Financial Projection

p.month), @@ -485,22 +487,26 @@ const MilestoneTracker = ({ selectedCareer: initialCareer }) => {
)} -
- + {/* Simulation Length Input */} +
+
+ {/* Career Search */} { setPendingCareerForModal(careerObj.title); }} /> + {/* Modal */} setShowEditModal(false)} @@ -512,19 +518,19 @@ const MilestoneTracker = ({ selectedCareer: initialCareer }) => { authFetch={authFetch} /> -{pendingCareerForModal && ( + {/* Confirm new career scenario */} + {pendingCareerForModal && ( - )} + )}
); };