From 17f18d255e7ecc1f55927dd5f48d619c883a9ee5 Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 14 May 2025 18:22:45 +0000 Subject: [PATCH] Fixed Confirm button on CareerSearch in Explorer --- src/components/CareerExplorer.js | 19 ++++++++----------- src/components/CareerModal.js | 14 ++++++++++---- user_profile.db | Bin 110592 -> 114688 bytes 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/components/CareerExplorer.js b/src/components/CareerExplorer.js index 9977509..0aa854e 100644 --- a/src/components/CareerExplorer.js +++ b/src/components/CareerExplorer.js @@ -61,7 +61,6 @@ const STATES = [ { name: 'Wyoming', code: 'WY' }, ]; -// 2) Helper to convert state code => full name function getFullStateName(code) { const found = STATES.find((s) => s.code === code?.toUpperCase()); return found ? found.name : ''; @@ -142,7 +141,7 @@ function CareerExplorer({ }) { } else { // No inventory => no suggestions (or do something else here) setCareerSuggestions([]); - } + } // 4) Check if all priorities are answered const priorities = profileData.career_priorities @@ -168,8 +167,7 @@ function CareerExplorer({ }) { fetchUserProfile(); }, [apiUrl]); - - // Load suggestions from Interest Inventory if provided (optional) + useEffect(() => { if (location.state?.careerSuggestions) { setCareerSuggestions(location.state.careerSuggestions); @@ -207,13 +205,10 @@ function CareerExplorer({ }) { console.log('[handleCareerClick] career =>', career); const socCode = career.code; setSelectedCareer(career); - setLoading(true); setError(null); setCareerDetails({}); setSalaryData([]); setEconomicProjections({}); - setError(null); - setLoading(true); // We can set selectedCareer immediately so that our Modal condition is met. setSelectedCareer(career); @@ -221,7 +216,6 @@ function CareerExplorer({ }) { if (!socCode) { console.error('SOC Code is missing'); setError('SOC Code is missing'); - setLoading(false); return; } @@ -382,7 +376,6 @@ function CareerExplorer({ }) { } }; - const addCareerToList = (career) => { const masterRatings = getCareerRatingsBySocCode(career.code); @@ -528,8 +521,12 @@ function CareerExplorer({ }) {

Explore Careers

handleCareerClick(careerObj)} - /> + onCareerSelected={(careerObj) => { + console.log('[Dashboard] onCareerSelected =>', careerObj); + // Set the "pendingCareerForModal" so our useEffect fires + setPendingCareerForModal(careerObj); + }} + />

Career Comparison Matrix

diff --git a/src/components/CareerModal.js b/src/components/CareerModal.js index cb08ec2..2e4e420 100644 --- a/src/components/CareerModal.js +++ b/src/components/CareerModal.js @@ -3,15 +3,21 @@ import axios from 'axios'; const apiUrl = process.env.REACT_APP_API_URL; -function CareerModal({ career, careerDetails, userState, areaTitle, userZipcode, closeModal, addCareerToList }) { +function CareerModal({ career, careerDetails, closeModal, addCareerToList }) { const [error, setError] = useState(null); - console.log('CareerModal props:', { career, careerDetails, userState, areaTitle, userZipcode }); + console.log('CareerModal props:', { career, careerDetails}); if (!careerDetails?.salaryData) { - return
Loading career details...
; - } + return ( +
+
+

Loading career details...

+
+
+ ); +} if (error) return
{error}
; const calculateStabilityRating = (salaryData) => { diff --git a/user_profile.db b/user_profile.db index fbd2469ad9f58264e7aa7b45fae57046c740c651..71f385799c3f1b2e2184aae4d65553185cd28f85 100644 GIT binary patch delta 1062 zcmZ`&y>HV%6i=#@Dgx0$K?!XVT`k(73a#VB`RD+G0G;?AQ6*02vwf;#o4a$<3Powf zKR|Vi9l9{EAfXOyEJ$puY)A~`6zV!B%C%)!#y8Y#T<->j@TiVu9 zX0Lqtb6!mqJJ+q&wVG*J3#PefR1KF&W68Khg@k}a4u$Bb19FndKqv2F;j<`IuZy!e z7Y9P!yf~x26)$A#>PK;L7(~)%p@(qjAWR4qBI1mS1=QsfONt=!Scn7UP{F)VKmuV0 z#}c`}iILXCCp_6OBg{QkpL?eh(rO{5X7fFDyk5MLh^*@rYh=zZO*{4+=zAc_+%T1 z)8`4}fD5JeJT&gC;~on^3islGA`kPlhN3VZ7vYG%u7o>cCbCzMBPR?D(9Xsp&W+qOAS z_onB^mTAO2h7~SNW!q|4y876%OgL^IhaOyV1O5+Z>K>-xHCR;xhhc()2QdxxWf@Bv z6cLid>DAoFz2ncIURoZp8ftfXj#zffJjUPF!9N1^Q~B$<^M4BHcKT2#7sg