import React, { useState } from 'react'; import { GraduationCap, Laptop, ArrowRight } from 'lucide-react'; import './SearchPathGate.css'; export const SEARCH_PATH_OPTIONS = [ { value: 'High school / traditional', title: 'High school / traditional', description: 'I am (or am supporting) a high school student choosing a first college — campus-focused, Common App style timelines.', icon: GraduationCap, }, { value: 'Returning adult / online', title: 'Returning adult / online', description: 'I am going back to school as an adult — online, hybrid, or flexible campus options with work and life constraints.', icon: Laptop, }, ]; /** * First-run gate: traditional HS path vs returning adult / online steers advisors. */ const SearchPathGate = ({ authToken, onComplete }) => { const [selected, setSelected] = useState(null); const [saving, setSaving] = useState(false); const [error, setError] = useState(''); const handleContinue = async () => { if (!selected) { setError('Pick a path to continue.'); return; } setSaving(true); setError(''); try { const resp = await fetch(`${process.env.REACT_APP_API_URL}/api/users/me/profile`, { method: 'PUT', headers: { Authorization: `Bearer ${authToken}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ cyber_role: selected }), }); if (!resp.ok) { const data = await resp.json().catch(() => ({})); throw new Error(data.detail || 'Could not save your choice'); } const profile = await resp.json(); localStorage.setItem('universityFinderSearchPath', selected); onComplete?.(profile, selected); } catch (e) { setError(e.message || 'Could not save your choice'); } finally { setSaving(false); } }; return (

Where are you in your college journey?

This steers every advisor — fit matching, aid strategy, accommodations, and application timelines.

{SEARCH_PATH_OPTIONS.map((opt) => { const Icon = opt.icon; const active = selected === opt.value; return ( ); })}
{error &&
{error}
}
); }; export function needsSearchPath(profile) { const role = profile?.cyber_role; if (!role) return true; const normalized = String(role).toLowerCase(); return !( normalized.includes('high school') || normalized.includes('traditional') || normalized.includes('returning') || normalized.includes('adult') || normalized.includes('online') || normalized.includes('both') ); } export default SearchPathGate;