diff --git a/src/components/PopoutPanel.css b/src/components/PopoutPanel.css
index 7753cd1..637c98e 100644
--- a/src/components/PopoutPanel.css
+++ b/src/components/PopoutPanel.css
@@ -100,6 +100,42 @@
color: #666;
}
+/* 🔹 Filter Section Styling */
+.filter-section {
+ background: #f8f8f8;
+ padding: 10px;
+ border-radius: 5px;
+ margin-bottom: 15px;
+}
+
+.filter-section h3 {
+ margin-bottom: 10px;
+ font-size: 16px;
+}
+
+.filter-section label {
+ display: block;
+ font-size: 14px;
+ margin-bottom: 5px;
+ font-weight: bold;
+}
+
+.filter-section input {
+ width: 100%;
+ padding: 5px;
+ margin-bottom: 10px;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+}
+
+.filter-section select {
+ width: 100%;
+ padding: 5px;
+ margin-bottom: 10px;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+}
+
/* Schools section: Grid layout with clear separation */
.schools-offering {
display: grid;
diff --git a/src/components/PopoutPanel.js b/src/components/PopoutPanel.js
index cb3c95a..2bfe168 100644
--- a/src/components/PopoutPanel.js
+++ b/src/components/PopoutPanel.js
@@ -15,18 +15,40 @@ function PopoutPanel({
const [isCalculated, setIsCalculated] = useState(false);
const [results, setResults] = useState([]); // Store loan repayment calculation results
const [loadingCalculation, setLoadingCalculation] = useState(false);
+ const [persistedROI, setPersistedROI] = useState({});
+
+const {
+ jobDescription = null,
+ tasks = null,
+ title = 'Career Details',
+ economicProjections = {},
+ salaryData = [],
+ schools = [],
+} = data || {};
+
-// ✅ Reset `results` when a new career is selected
useEffect(() => {
- console.log(`Career changed to: ${data?.title}, clearing previous loan results.`);
- setResults([]); // ✅ Clears results when a new career is selected
- setIsCalculated(false); // ✅ Reset calculation state
-}, [data]); // Runs whenever `data` changes (i.e., new career is selected)
+ setResults([]);
+ setIsCalculated(false);
+}, [schools]);
-if (!isVisible) return null; // ✅ Prevents rendering instead of hiding the whole dashboard
+
+if (!isVisible) return null;
+
+if (loading || loadingCalculation) {
+ return (
+
+
+
Loading Career Details...
+
+
+ );
+}
+
+ if (!isVisible) return null;
// Handle loading state
- if (loading) {
+ if (loading || loadingCalculation) {
return (
@@ -35,17 +57,7 @@ if (!isVisible) return null; // ✅ Prevents rendering instead of hiding the who
);
}
-
- // Safely access nested data with fallbacks
- const {
- jobDescription = null, // Default to null if not provided
- tasks = null, // Default to null if not provided
- title = 'Career Details',
- economicProjections = {},
- salaryData = [],
- schools = [],
- } = data;
-
+
// Get program length for calculating tuition
const getProgramLength = (degreeType) => {
if (degreeType?.includes("Associate")) return 2;
@@ -61,7 +73,6 @@ if (!isVisible) return null; // ✅ Prevents rendering instead of hiding the who
setIsCalculated(false); // Reset calculation state
closePanel(); // Maintain existing close behavior
}
-
return (
@@ -87,29 +98,8 @@ if (!isVisible) return null; // ✅ Prevents rendering instead of hiding the who
)}
- {/* Schools Offering Programs Section */}
- Schools Offering Programs
-
- {Array.isArray(schools) && schools.length > 0 ? (
- schools.map((school, index) => (
-
-
{school['INSTNM']}
-
Degree Type: {school['CREDDESC'] || 'Degree type information is not available for this program'}
-
In-State Tuition: ${school['In_state cost'] || 'Tuition information is not available for this school'}
-
Out-of-State Tuition: ${school['Out_state cost'] || 'Tuition information is not available for this school'}
-
Distance: {school['distance'] || 'Distance to school not available'}
-
-
- ))
- ) : (
-
No schools of higher education are available in your state for this career path.
- )}
-
-
- {/* Economic Projections */}
-
+{/* Economic Projections */}
+
Economic Projections for {userState}
{economicProjections && typeof economicProjections === 'object' ? (
@@ -147,23 +137,40 @@ if (!isVisible) return null; // ✅ Prevents rendering instead of hiding the who
)}
+ {/* Schools Offering Programs Section */}
+
Schools Offering Programs
+
+ {schools.length > 0 ? (
+ schools.map((school, index) => (
+
+
{school['INSTNM']}
+
Degree Type: {school['CREDDESC'] || 'Degree type information is not available for this program'}
+
In-State Tuition: ${school['In_state cost'] || 'Tuition information is not available for this school'}
+
Out-of-State Tuition: ${school['Out_state cost'] || 'Tuition information is not available for this school'}
+
Distance: {school['distance'] || 'Distance to school not available'}
+
+
+ ))
+ ) : (
+
No schools of higher education are available in your state for this career path.
+ )}
+
+
{/* Loan Repayment Analysis */}
Loan Repayment Analysis
-
- {/* Loan Repayment Calculation Results */}
{
- const years = getProgramLength(school['CREDDESC']);
- return {
- schoolName: school['INSTNM'],
- inState: parseFloat(school['In_state cost'] * years) || 0,
- outOfState: parseFloat(school['Out_state cost'] * years) || 0,
- degreeType: school['CREDDESC'],
- };
- })}
+ schools={schools.map(school => ({
+ schoolName: school['INSTNM'],
+ inState: parseFloat(school['In_state cost']) || 0,
+ outOfState: parseFloat(school['Out_state cost']) || 0,
+ degreeType: school['CREDDESC'],
+ }))}
salaryData={salaryData}
setResults={setResults}
setLoading={setLoadingCalculation}
+ setPersistedROI={setPersistedROI} // ✅ Store ROI after calculation
/>
{/* Results Display */}