import React, { useState, useEffect } from 'react'; import { motion, AnimatePresence } from 'motion/react'; import { Terminal, CheckCircle2, CircleDashed, Cpu, Play, Zap, BookOpen, ChevronRight } from 'lucide-react'; // ── 1. Hero Code Editor ──────────────────────────────────────────────────────── const TYPING_LINES = [ { text: 'function twoSum(nums, target) {', color: '#c084fc' }, { text: ' const map = new Map();', color: '#93c5fd' }, { text: ' for (let i = 0; i < nums.length; i++) {', color: '#93c5fd' }, { text: ' const diff = target - nums[i];', color: '#93c5fd' }, { text: ' if (map.has(diff)) {', color: '#c084fc' }, { text: ' return [map.get(diff), i];', color: '#f87171' }, { text: ' }', color: '#93c5fd' }, { text: ' map.set(nums[i], i);', color: '#fbbf24' }, { text: ' }', color: '#93c5fd' }, { text: ' return [];', color: '#f87171' }, { text: '}', color: '#c084fc' }, ]; export function HeroCodeEditor() { const [currentLine, setCurrentLine] = useState(0); const [currentChar, setCurrentChar] = useState(0); const [showToast, setShowToast] = useState(false); useEffect(() => { let interval: ReturnType; const start = setTimeout(() => { interval = setInterval(() => { setCurrentChar(prev => { if (currentLine >= TYPING_LINES.length) { clearInterval(interval); setTimeout(() => setShowToast(true), 600); return prev; } const len = TYPING_LINES[currentLine].text.length; if (prev < len) return prev + 1; setCurrentLine(l => l + 1); return 0; }); }, 28); }, 800); return () => { clearTimeout(start); clearInterval(interval); }; }, [currentLine]); return (
{/* Title bar */}
JS twoSum.js
{/* Editor body */}
{TYPING_LINES.map((_, i) =>
{i + 1}
)}
{TYPING_LINES.map((line, idx) => { if (idx > currentLine) return null; const isActive = idx === currentLine; const text = isActive ? line.text.slice(0, currentChar) : line.text; return (
{text} {isActive && ( )}
); })}
{/* Toast */} {showToast && ( Accepted! 48ms )}
); } // ── 2. Feature Glow Card ─────────────────────────────────────────────────────── export function FeatureGlowCard({ icon: Icon, title, desc, color, accent, image }: { icon: React.ElementType; title: string; desc: string; color: string; accent: string; image: string | null; }) { return (
{image ? ( {title} ) : (
)}

{title}

{desc}

); } // ── 3. Animated Terminal ─────────────────────────────────────────────────────── export function AnimatedTerminal() { const [step, setStep] = useState(0); useEffect(() => { const seq = async () => { setStep(1); await new Promise(r => setTimeout(r, 600)); setStep(2); await new Promise(r => setTimeout(r, 1200)); setStep(3); await new Promise(r => setTimeout(r, 1500)); setStep(4); }; const interval = setInterval(() => { setStep(0); setTimeout(seq, 500); }, 7000); seq(); return () => clearInterval(interval); }, []); return (
Test Results
= 2 ? 'bg-slate-800/50 text-slate-400 border border-white/5' : 'bg-emerald-500/20 text-emerald-400 border border-emerald-500/30'}`}> {step >= 2 ? : } {step >= 2 ? 'Evaluating...' : 'Submit Code'}
{step === 0 && ( Waiting for submission... )} {step >= 2 && ( {['Testcase 1', 'Testcase 2', 'Testcase 3'].map((tc, i) => (
{tc} {step >= 3 ? Passed : {i === 0 ? <> Running : 'Pending'} }
))}
)}
{step >= 4 && (
Accepted
RUNTIME: 48MS
Beats 98.4% of users with JavaScript
)}
); } // ── 4. Animated Notes Preview ────────────────────────────────────────────────── export function AnimatedNotesPreview() { const [step, setStep] = useState(0); useEffect(() => { const seq = async () => { setStep(1); await new Promise(r => setTimeout(r, 800)); setStep(2); await new Promise(r => setTimeout(r, 600)); setStep(3); await new Promise(r => setTimeout(r, 1200)); setStep(4); await new Promise(r => setTimeout(r, 1000)); setStep(5); }; const interval = setInterval(() => { setStep(0); setTimeout(seq, 500); }, 8000); seq(); return () => clearInterval(interval); }, []); return (
OS_Notes.md
{/* Sidebar */}
Chapters
{['Virtual Memory', 'Scheduling', 'Deadlocks'].map((ch, i) => (
= 1 && i === 0 ? 'bg-amber-500/10 text-amber-400 border border-amber-500/20' : 'text-slate-500'}`}> {ch}
))}
{/* Content */}
{step === 0 && ( Loading... )} {step >= 2 && ( Virtual Memory )} {step >= 3 && (

A technique that provides an idealized abstraction of storage.

Creates the illusion of a very large memory. {step >= 4 && ( )}
)}
{step >= 5 && (
Logical
Memory
Page
Table
Physical
RAM
)}
); } // ── 5. Animated Study Orb ────────────────────────────────────────────────────── const ORB_TOPICS = [ { label: 'DSA', color: '#3b82f6', glow: '#3b82f640', angle: 0 }, { label: 'OS', color: '#a78bfa', glow: '#a78bfa40', angle: 72 }, { label: 'DBMS', color: '#f59e0b', glow: '#f59e0b40', angle: 144 }, { label: 'CN', color: '#34d399', glow: '#34d39940', angle: 216 }, { label: 'Aptitude', color: '#f87171', glow: '#f8717140', angle: 288 }, ]; const INNER_TOPICS = [ { label: 'DP', color: '#60a5fa', angle: 36 }, { label: 'Trees', color: '#c084fc', angle: 108 }, { label: 'Heap', color: '#fbbf24', angle: 180 }, { label: 'Graph', color: '#4ade80', angle: 252 }, { label: 'Tries', color: '#fb7185', angle: 324 }, ]; export function AnimatedStudyOrb() { const cx = 200; const cy = 200; const outerR = 140; const innerR = 82; return (
📖 {ORB_TOPICS.map((t, i) => { const rad = (t.angle * Math.PI) / 180; const nx = cx + outerR * Math.cos(rad); const ny = cy + outerR * Math.sin(rad); return ( 3 ? '7' : '9'} fontWeight="700" fill={t.color} fontFamily="monospace"> {t.label} ); })} {INNER_TOPICS.map((t, i) => { const rad = (t.angle * Math.PI) / 180; const nx = cx + innerR * Math.cos(rad); const ny = cy + innerR * Math.sin(rad); return ( {t.label} ); })} 500+ problems FAANG mapped AI guided
); }