const SECTIONS = [ { id: "readme", Comp: ReadmeSection }, { id: "about", Comp: AboutSection }, { id: "experience", Comp: ExperienceSection }, { id: "skills", Comp: SkillsSection }, { id: "projects", Comp: ProjectsSection }, { id: "education", Comp: EducationSection }, { id: "contact", Comp: ContactSection }, ]; const BOOT_LINES = [ { txt: "[boot] zohaib-os v5.0.1 — kernel 24.04 LTS", c: "var(--fg-2)" }, { txt: "[ok] mounting filesystem... [DONE]", c: "var(--accent)" }, { txt: "[ok] loading shell, completions, $PATH... [DONE]", c: "var(--accent)" }, { txt: "[ok] initialising React 18.3, TS 5.5... [DONE]", c: "var(--accent)" }, { txt: "[ok] warming up the typewriter... [DONE]", c: "var(--accent)" }, { txt: "", c: "var(--fg-2)" }, { txt: "type 'help' in the terminal below to explore the portfolio.", c: "var(--fn)" }, { txt: "", c: "var(--fg-2)" }, ]; function App() { const [tweaks, setTweak] = useTweaks(window.TWEAK_DEFAULTS); const [activeFile, setActiveFile] = React.useState("readme"); const [openTabs, setOpenTabs] = React.useState(FILES.map((f) => f.id)); const [activeActivity, setActiveActivity] = React.useState("explorer"); const editorRef = React.useRef(null); const termCmdRef = React.useRef(null); const openTabIds = React.useMemo( () => openTabs.map((s) => { const f = FILES.find((x) => x.id === s || x.name === s); return f ? f.id : s; }).filter((id, i, a) => a.indexOf(id) === i), [openTabs] ); // Theme application React.useEffect(() => { document.documentElement.setAttribute("data-theme", tweaks.theme || "deep"); }, [tweaks.theme]); // Accent hue override React.useEffect(() => { if (typeof tweaks.accentHue !== "number") return; document.documentElement.style.setProperty("--accent", `oklch(0.80 0.14 ${tweaks.accentHue})`); }, [tweaks.accentHue]); // Font override React.useEffect(() => { if (!tweaks.primaryFont) return; document.documentElement.style.setProperty("--mono", `"${tweaks.primaryFont}", ui-monospace, monospace`); }, [tweaks.primaryFont]); // Boot screen const [bootVisible, setBootVisible] = React.useState(!!tweaks.boot); const [bootStep, setBootStep] = React.useState(0); React.useEffect(() => { if (!bootVisible) return; if (bootStep < BOOT_LINES.length) { const t = setTimeout(() => setBootStep((s) => s + 1), bootStep === 0 ? 120 : 240); return () => clearTimeout(t); } else { const t = setTimeout(() => setBootVisible(false), 600); return () => clearTimeout(t); } }, [bootVisible, bootStep]); // Terminal lines const [termLines, setTermLines] = React.useState([ { kind: "out", text: "welcome to zohaib's portfolio shell." }, { kind: "out", text: "type 'help' for commands. try: whoami · projects · theme paper · social · ls" }, ]); const focusSection = (id) => { setActiveFile(id); setOpenTabs((prev) => prev.includes(id) ? prev : [...prev, id]); setTimeout(() => { const el = document.getElementById("sec-" + id); if (!el) return; const mq = window.matchMedia("(max-width: 760px)").matches; if (mq) { const mainEl = document.querySelector(".main"); if (mainEl) { const mainRect = mainEl.getBoundingClientRect(); const elRect = el.getBoundingClientRect(); mainEl.scrollBy({ top: elRect.top - mainRect.top - 8, behavior: "smooth" }); } } else if (editorRef.current) { editorRef.current.scrollTo({ top: el.offsetTop - 8, behavior: "smooth" }); } }, 30); }; // Scroll spy React.useEffect(() => { const getContainer = () => isMobile ? document.querySelector(".main") : editorRef.current; const onScroll = () => { const container = getContainer(); if (!container) return; const containerRect = container.getBoundingClientRect(); let current = SECTIONS[0].id; for (const sec of SECTIONS) { const el = document.getElementById("sec-" + sec.id); if (el) { const elTop = el.getBoundingClientRect().top - containerRect.top; if (elTop <= 80) current = sec.id; } } setActiveFile((prev) => prev === current ? prev : current); }; const container = getContainer(); if (!container) return; container.addEventListener("scroll", onScroll, { passive: true }); return () => container.removeEventListener("scroll", onScroll); }, [isMobile]); // Keyboard: Cmd/Ctrl-K focuses terminal React.useEffect(() => { const onKey = (e) => { if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") { e.preventDefault(); const inp = document.querySelector(".term-input"); if (inp) inp.focus(); } }; window.addEventListener("keydown", onKey); return () => window.removeEventListener("keydown", onKey); }, []); // Dynamic line numbers const [lineCount, setLineCount] = React.useState(420); React.useEffect(() => { const ed = editorRef.current; if (!ed) return; const lh = parseFloat(getComputedStyle(ed).fontSize) * 1.65; setLineCount(Math.ceil(ed.scrollHeight / lh)); }); const sidebarOpen = tweaks.sidebar !== false; const terminalOpen = tweaks.terminal !== false; // Mobile detection + sheet const [isMobile, setIsMobile] = React.useState(() => typeof window !== "undefined" && window.matchMedia("(max-width: 760px)").matches); React.useEffect(() => { const mq = window.matchMedia("(max-width: 760px)"); const onChange = (e) => setIsMobile(e.matches); mq.addEventListener ? mq.addEventListener("change", onChange) : mq.addListener(onChange); return () => { mq.removeEventListener ? mq.removeEventListener("change", onChange) : mq.removeListener(onChange); }; }, []); const [sheetOpen, setSheetOpen] = React.useState(false); return ( {bootVisible && (
{BOOT_LINES.slice(0, bootStep).map((l, i) => (
{l.txt || " "}
))} {bootStep === BOOT_LINES.length && (
$ launching editor
)}
)}
{/* TITLE BAR */}
~ / zohaib-arshad / portfolio / {(FILES.find((f) => f.id === activeFile) || {}).name || "README.md"}
⌘K command ● live
{/* ACTIVITY BAR */}
{[ { id: "explorer", title: "Explorer", svg: }, { id: "search", title: "Search", svg: }, { id: "git", title: "Source Control", svg: }, { id: "ext", title: "Extensions", svg: }, { id: "debug", title: "Run & Debug", svg: }, ].map((b) => ( ))}
{/* SIDEBAR */}

Explorer ⌘B

zohaib-arshad/ main
focusSection("readme")}> README.md
src/
{FILES.filter((f) => f.group === "src").map((f) => (
focusSection(f.id)}> {f.name}
))}
focusSection("contact")}> contact.sh
resume.pdf
· .gitignore
· .zshrc

Outline

{SECTIONS.map((s) => { const f = FILES.find((x) => x.id === s.id); return (
focusSection(s.id)}> # {(f && f.name) || s.id}
); })}

Timeline

10m ago · updated experience.log
1h ago · refactored skills.json
2h ago · merged main
today · published v5.0.1
{/* MAIN editor */}
{openTabIds.map((id) => { const f = FILES.find((x) => x.id === id); if (!f) return null; return (
focusSection(id)}> {f.name} { e.stopPropagation(); setOpenTabs((prev) => prev.filter((p) => { const ff = FILES.find((x) => x.id === p || x.name === p); return ff ? ff.id !== id : true; })); }}>
); })}
{Array.from({ length: lineCount }).map((_, i) =>
{i + 1}
)}
termCmdRef.current && termCmdRef.current(cmd)} />
// EOF — file ends here. press ⌘K to focus terminal.
{/* TERMINAL (desktop bottom panel) */} {!isMobile && (
TERMINAL
PROBLEMS 0
OUTPUT
DEBUG CONSOLE
setTweak("theme", th)} />
)} {/* STATUS BAR */}
⎇ main 0 errors 0 warnings UTF-8 LF TypeScript React
Ln {Math.min(lineCount, 1 + (SECTIONS.findIndex((s) => s.id === activeFile) * 47))}, Col 1 Spaces: 2 ● connected
{/* Mobile terminal sheet + FAB */} {isMobile && (
setSheetOpen(false)} />
terminal · try 'help'
{ focusSection(id); setSheetOpen(false); }} setTheme={(th) => setTweak("theme", th)} />
)} setTweak("theme", v)} options={[ { value: "deep", label: "Deep" }, { value: "paper", label: "Paper" }, { value: "dracula", label: "Dusk" }, ]} /> setTweak("accentHue", v)} /> setTweak("primaryFont", v)} options={["JetBrains Mono", "IBM Plex Mono", "Fira Code"]} /> setTweak("showLineNumbers", v)} /> setTweak("sidebar", v)} /> setTweak("terminal", v)} /> setTweak("boot", v)} /> ); } ReactDOM.createRoot(document.getElementById("root")).render();