function StudentProfile({ onNavigate }) { const [tab, setTab] = React.useState('Bookmarks'); const tabs = ['Bookmarks', 'Notes', 'Offline Downloads', 'Settings']; const [profile, setProfile] = React.useState({ name: 'Rahul Kumar', trade: 'Fitter', sem: 'Semester 3', roll: 'FTR-24-018', iti: 'Govt ITI Cuttack' }); const [editing, setEditing] = React.useState(false); const [draft, setDraft] = React.useState(profile); const initials = profile.name.trim().split(/\s+/).map(w => w[0]).slice(0, 2).join('').toUpperCase() || 'ST'; const openEdit = () => { setDraft(profile); setEditing(true); }; const saveProfile = () => { if (!draft.name.trim()) { window.toast('Name cannot be empty'); return; } setProfile(draft); setEditing(false); window.toast('Profile updated'); }; const bookmarks = [ { t: 'Star-Delta Winding Termination', trade: 'Electrician', type: '3D Lesson', nav: 'lesson' }, { t: 'MIG Welding — Butt Joint', trade: 'Welder', type: 'Virtual Lab', nav: 'lab' }, { t: 'Fits & Tolerances', trade: 'Fitter', type: 'Concept', nav: 'lesson' }, { t: 'Centre Lathe SOP', trade: 'Fitter', type: 'Manual', nav: 'manual' }, ]; const notes = [ { t: 'Vernier caliper least count', body: 'LC = 1 MSD − 1 VSD = 0.02 mm for standard metric caliper. Remember zero error correction.', date: '14 Jul', lesson: 'Measuring Instruments' }, { t: 'Synchronous speed formula', body: 'Ns = 120f / P. For 50 Hz, 4-pole: Ns = 1500 rpm. Slip s = (Ns − N)/Ns.', date: '12 Jul', lesson: 'Three-Phase Motor' }, { t: 'Welding travel speed', body: 'Aim ~250 mm/min for 6mm MS plate. Too fast = poor penetration, too slow = burn-through.', date: '09 Jul', lesson: 'MIG Welding' }, ]; const downloads = [ { t: 'Semester 3 · Electrical Machines', size: '184 MB', prog: 100 }, { t: 'Fitter Workshop Manual (PDF)', size: '22 MB', prog: 100 }, { t: 'Virtual Lab: MIG Welding pack', size: '310 MB', prog: 64 }, ]; return (
{/* Profile header */}
{initials}

{profile.name}

Active
{profile.trade} · {profile.sem} · Roll {profile.roll} · {profile.iti}
{[ { k: '68%', v: 'Completion' }, { k: '12', v: 'Day streak' }, { k: '4.2', v: 'Avg. score' }, { k: '11/14', v: 'Practicals' }, { k: 'B2', v: 'Readiness' }, ].map((s, i) => (
{s.k}
{s.v}
))}
{/* Tabs */}
{tabs.map(t => ( ))}
{tab === 'Bookmarks' && (
{bookmarks.map(b => (
onNavigate(b.nav)}>
{b.t}
{b.trade} {b.type}
))}
)} {tab === 'Notes' && (
{notes.map(n => (
{n.t}

{n.body}

{n.lesson} {n.date}
))}
)} {tab === 'Offline Downloads' && (
Downloaded for offline use
516 MB / 2 GB
{downloads.map(d => (
{d.prog === 100 ? : }
{d.t}
{d.prog === 100 ? d.size : `${d.prog}%`}
))}
)} {tab === 'Settings' && } setEditing(false)} width={520} footer={<> } > setDraft(d => ({ ...d, name: e.target.value }))} placeholder="Your name" style={window.fieldInputStyle} />
setDraft(d => ({ ...d, trade: e.target.value }))} style={window.fieldInputStyle} /> setDraft(d => ({ ...d, sem: e.target.value }))} style={window.fieldInputStyle} /> setDraft(d => ({ ...d, roll: e.target.value }))} style={window.fieldInputStyle} /> setDraft(d => ({ ...d, iti: e.target.value }))} style={window.fieldInputStyle} />
); } function ProfileSettings() { const [toggles, setToggles] = React.useState({ Subtitles: true, 'Auto-download over Wi-Fi': true, 'High-contrast mode': false }); const rows = [ { l: 'Interface language', v: 'English', opts: true }, { l: 'Voice-over language', v: 'हिंदी', opts: true }, { l: 'Subtitles', toggle: true }, { l: 'Auto-download over Wi-Fi', toggle: true }, { l: 'Daily reminder', v: '7:00 PM', opts: true }, { l: 'High-contrast mode', toggle: true }, ]; const flip = l => setToggles(t => ({ ...t, [l]: !t[l] })); return (
Preferences
{rows.map(s => (
{s.l} {s.opts ? ( ) : (
flip(s.l)} role="switch" aria-checked={!!toggles[s.l]} style={{ width: 42, height: 24, borderRadius: 999, background: toggles[s.l] ? 'var(--green-600)' : 'var(--ink-300)', position: 'relative', cursor: 'pointer', transition: 'background 0.15s' }}>
)}
))}
); } window.StudentProfile = StudentProfile;