// src/components/PreparingLanding.js import React, { useState, useCallback, useEffect, useContext } from 'react'; import { useNavigate, useLocation } from 'react-router-dom'; import { Button } from './ui/button.js'; import LoanRepaymentDrawer from './LoanRepaymentDrawer.js'; import { ProfileCtx } from '../App.js'; function PreparingLanding() { const navigate = useNavigate(); const location = useLocation(); const { user } = useContext(ProfileCtx); /* ─── Drawer visibility ─────────────────────────────── */ const [showLoan, setShowLoan] = useState(false); /* ─── Stub-school state lives here; Drawer mutates it ─ */ const [schools, setSchools] = useState([]); // [] → quick-fill form const [cipCodes] = useState([]); // you may hold these at page level const [userZip] = useState(''); const [loanResults, setLoanResults] = useState([]); /* Esc -to-close convenience */ const escHandler = useCallback((e) => { if (e.key === 'Escape') setShowLoan(false); }, []); useEffect(() => { if (showLoan) window.addEventListener('keydown', escHandler); return () => window.removeEventListener('keydown', escHandler); }, [showLoan, escHandler]); /* ─── Auto-open drawer when routed from nav ───────── */ useEffect(() => { // support either query ?loan=1 or navigation state { openLoan: true } try { const qs = new URLSearchParams(location.search); const viaQuery = qs.get('loan') === '1'; const viaState = location.state && location.state.openLoan === true; if ((viaQuery || viaState) && !showLoan) { setShowLoan(true); } } catch {} }, [location.search, location.state, showLoan]); return (
{/* ───────────────── TITLE / INTRO ───────────────── */}

Preparing for Your (Next) Career

Build the right skills and plan your education so you can confidently enter—or transition into—your new career.

{/* ──────────────── 1) PATH CHOICE ──────────────── */}

Which Path Fits You?

We can help you identify whether a skills-based program (certifications, bootcamps) or a{' '} formal education route (two- or four-year college) is the best fit. Whichever path you choose, AptivaAI will help you map next steps—from applying to graduating.

{/* Education path card */}

Plan My Education Path

Compare degrees, certificates, and training paths for your target role.

{/* Loan/Cost card */}

Cost of Education & Loan Repayment

Estimate total costs and monthly payments with realistic assumptions.

{/* ──────────────── 2) STILL EXPLORING ──────────────── */}

Still Exploring?

Want to revisit career possibilities? Retake our Interest Inventory to see other matching paths.

{/* ─────────────── DRAWER MOUNT ─────────────── */} {showLoan && ( { setShowLoan(false); // clear nav flag so it doesn’t auto-reopen navigate({ pathname: location.pathname }, { replace: true, state: {} }); }} schools={schools} setSchools={setSchools} results={loanResults} setResults={setLoanResults} isPremium={user?.is_premium || user?.is_pro_premium} cipCodes={cipCodes} userZip={userZip} user={user} /> )}
); } export default PreparingLanding;