From fd8c11be671bb8f87afe3b272ebd98d56696e820 Mon Sep 17 00:00:00 2001 From: Zeeshan Adil Date: Wed, 18 Nov 2026 19:45:42 +0500 Subject: [PATCH 1/8] Let a host page hear when a visual lab run finishes HldBoard takes an optional onRunDone callback with the passed and total checks of each finished run, and the package exports HldBoard so a page can open one lab full screen. The landing page uses this to unlock its next step when a visitor passes the lab. --- packages/learning-ui/package.json | 1 + packages/learning-ui/src/labs/HldBoard.tsx | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/learning-ui/package.json b/packages/learning-ui/package.json index c8fe2f97..685c2db9 100644 --- a/packages/learning-ui/package.json +++ b/packages/learning-ui/package.json @@ -23,6 +23,7 @@ "./components/learn/chapter-link-context": "./src/components/learn/chapter-link-context.tsx", "./components/learn/chapter-refs": "./src/components/learn/chapter-refs.tsx", "./labs/Lab": "./src/labs/Lab.tsx", + "./labs/HldBoard": "./src/labs/HldBoard.tsx", "./labs/catalog": "./src/labs/catalog.ts", "./labs/types": "./src/labs/types.ts", "./labs/registry": "./src/labs/registry.ts", diff --git a/packages/learning-ui/src/labs/HldBoard.tsx b/packages/learning-ui/src/labs/HldBoard.tsx index aeeff434..c932bb91 100644 --- a/packages/learning-ui/src/labs/HldBoard.tsx +++ b/packages/learning-ui/src/labs/HldBoard.tsx @@ -248,6 +248,13 @@ function NamesToggle() { ); } +/** The outcome of one finished run, for hosts that react to it (the Edorax landing page). */ +export interface RunScore { + passed: number; + total: number; + allPass: boolean; +} + interface EditorProps { spec: HldLabSpec; onReset: () => void; @@ -255,6 +262,8 @@ interface EditorProps { solutionMode?: boolean; /** Called when the learner presses Run. */ onRun?: () => void; + /** Called when a run finishes, with how many checks passed. */ + onRunDone?: (score: RunScore) => void; /** Reports the learner's design as it changes, for the comparison. */ onSnapshot?: (board: Board, load: number) => void; canOpenSolution?: boolean; @@ -268,7 +277,7 @@ interface EditorProps { onToggleFullscreen?: () => void; } -function Editor({ spec, onReset, solutionMode = false, onRun, onSnapshot, canOpenSolution = false, onOpenSolution, onBack, onCopy, onCompare, compare, onHideCompare, isFullscreen = false, onToggleFullscreen }: EditorProps) { +function Editor({ spec, onReset, solutionMode = false, onRun, onRunDone, onSnapshot, canOpenSolution = false, onOpenSolution, onBack, onCopy, onCompare, compare, onHideCompare, isFullscreen = false, onToggleFullscreen }: EditorProps) { const readOnly = solutionMode; const [confirm, setConfirm] = useState<"solution" | "copy" | null>(null); const start: Board = spec.startingBoard ?? { nodes: [], edges: [] }; @@ -328,8 +337,13 @@ function Editor({ spec, onReset, solutionMode = false, onRun, onSnapshot, canOpe const previousRunState = useRef("idle"); useEffect(() => { - if (runState === "done" && previousRunState.current !== "done") setResultsOpen(true); + if (runState === "done" && previousRunState.current !== "done") { + setResultsOpen(true); + onRunDone?.({ passed: report.passed, total: report.total, allPass: report.allPass }); + } previousRunState.current = runState; + // Only a change of run state should report; the report is read at that moment. + // eslint-disable-next-line react-hooks/exhaustive-deps }, [runState]); useEffect(() => { onSnapshot?.(board, load); }, [board, load, onSnapshot]); @@ -1063,6 +1077,7 @@ export function HldBoard({ fullscreenActive, hideWhenInline = false, onExitFullscreen, + onRunDone, }: { spec: HldLabSpec; initialFullscreen?: boolean; @@ -1072,6 +1087,8 @@ export function HldBoard({ hideWhenInline?: boolean; /** Course launchers close the workspace when the learner exits full screen. */ onExitFullscreen?: () => void; + /** Called when a run of the learner's own board finishes. */ + onRunDone?: (score: RunScore) => void; }) { const [generation, setGeneration] = useState(0); const [mode, setMode] = useState<"mine" | "solution">("mine"); @@ -1155,6 +1172,7 @@ export function HldBoard({ spec={mineSpec} onReset={() => { setSeed(null); setGeneration((g) => g + 1); }} onRun={() => setEverRan(true)} + onRunDone={onRunDone} onSnapshot={onSnapshot} canOpenSolution={everRan} onOpenSolution={() => { setCompare(null); setMode("solution"); }} From 4b0cab12d11147ff0856baddda5e39f16a01b5d4 Mon Sep 17 00:00:00 2001 From: Zeeshan Adil Date: Wed, 18 Nov 2026 19:45:52 +0500 Subject: [PATCH 2/8] Add the landing page try-it panel and rotating headline A short run through every kind of learning: a course question, a drag to order step, a quick Linux lab in a practice terminal behind Launch lab, and the real visual lab opened full screen. Each step opens the next one only on a right answer. Puzzles and voice tutors are listed as coming soon slots in the step list. Only the first step ships with the page. The other steps, the terminal and the visual lab board load when a visitor reaches or launches them. Order and visual steps work with a mouse, touch and the keyboard, focus moves to each new step, and motion stops under reduced motion. --- .../marketing/edorax/try-it/brand.ts | 14 + .../marketing/edorax/try-it/fake-shell.ts | 198 +++++++++ .../marketing/edorax/try-it/linux-step.tsx | 87 ++++ .../marketing/edorax/try-it/linux-tasks.ts | 14 + .../edorax/try-it/linux-terminal.tsx | 164 ++++++++ .../marketing/edorax/try-it/order-step.tsx | 173 ++++++++ .../marketing/edorax/try-it/question-step.tsx | 66 +++ .../edorax/try-it/real-visual-lab.tsx | 17 + .../edorax/try-it/rotating-headline.tsx | 47 +++ .../marketing/edorax/try-it/step-frame.tsx | 24 ++ .../marketing/edorax/try-it/steps.ts | 32 ++ .../marketing/edorax/try-it/try-it.module.css | 387 ++++++++++++++++++ .../marketing/edorax/try-it/try-it.tsx | 149 +++++++ .../marketing/edorax/try-it/visual-step.tsx | 87 ++++ 14 files changed, 1459 insertions(+) create mode 100644 frontend/src/components/marketing/edorax/try-it/brand.ts create mode 100644 frontend/src/components/marketing/edorax/try-it/fake-shell.ts create mode 100644 frontend/src/components/marketing/edorax/try-it/linux-step.tsx create mode 100644 frontend/src/components/marketing/edorax/try-it/linux-tasks.ts create mode 100644 frontend/src/components/marketing/edorax/try-it/linux-terminal.tsx create mode 100644 frontend/src/components/marketing/edorax/try-it/order-step.tsx create mode 100644 frontend/src/components/marketing/edorax/try-it/question-step.tsx create mode 100644 frontend/src/components/marketing/edorax/try-it/real-visual-lab.tsx create mode 100644 frontend/src/components/marketing/edorax/try-it/rotating-headline.tsx create mode 100644 frontend/src/components/marketing/edorax/try-it/step-frame.tsx create mode 100644 frontend/src/components/marketing/edorax/try-it/steps.ts create mode 100644 frontend/src/components/marketing/edorax/try-it/try-it.module.css create mode 100644 frontend/src/components/marketing/edorax/try-it/try-it.tsx create mode 100644 frontend/src/components/marketing/edorax/try-it/visual-step.tsx diff --git a/frontend/src/components/marketing/edorax/try-it/brand.ts b/frontend/src/components/marketing/edorax/try-it/brand.ts new file mode 100644 index 00000000..49f98293 --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/brand.ts @@ -0,0 +1,14 @@ +// Brand values for the try-it panel. The landing page is light only, matching the +// approved design, so these are plain values rather than theme tokens. + +export const INK = "#0A0F2C"; +export const MUTED = "#46507A"; +export const COBALT = "#2434E0"; +export const YELLOW = "#FFC933"; +export const TINT = "#E8EBFF"; +export const LINE = "#DCE0F2"; +export const PAPER = "#F6F7FB"; +export const GREEN = "#16794C"; +export const RED = "#B42318"; +export const HEADING = "var(--font-unbounded), sans-serif"; +export const MONO = "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"; diff --git a/frontend/src/components/marketing/edorax/try-it/fake-shell.ts b/frontend/src/components/marketing/edorax/try-it/fake-shell.ts new file mode 100644 index 00000000..d7c27aa4 --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/fake-shell.ts @@ -0,0 +1,198 @@ +// A tiny pretend Linux shell for the landing page's practice terminal. It keeps a small +// file tree in memory and knows a handful of everyday commands. It is not a real +// machine: the real shell labs run on one, in the Edorax desktop app. + +type FileNode = { type: "file"; text: string }; +type DirNode = { type: "dir"; children: Record }; +type Node = FileNode | DirNode; + +export const HOME = "/home/learner"; + +function dir(children: Record = {}): DirNode { + return { type: "dir", children }; +} +function file(text: string): FileNode { + return { type: "file", text }; +} + +export function createFileTree(): DirNode { + return dir({ + bin: dir(), + etc: dir({ hostname: file("edorax-lab") }), + tmp: dir(), + home: dir({ + learner: dir({ + "welcome.txt": file("Welcome to your first Edorax lab.\nIn the real shell labs, a test checks the machine after every task."), + notes: dir({ "todo.txt": file("1. Learn pwd, ls and cat\n2. Run a real lab in the desktop app") }), + }), + }), + }); +} + +export const COMMANDS = ["cat", "cd", "clear", "date", "echo", "help", "history", "hostname", "ls", "mkdir", "pwd", "touch", "uname", "whoami"] as const; + +export interface ShellState { + root: DirNode; + cwd: string; + history: string[]; +} + +export interface RunResult { + out: string[]; + error?: boolean; + clear?: boolean; + /** What the command did, so a task checker can look at the effect, not the exact text. */ + effect?: { kind: "pwd" } | { kind: "ls"; path: string } | { kind: "cat"; path: string }; +} + +export function resolvePath(cwd: string, input: string): string { + const raw = input === "~" || input.startsWith("~/") ? HOME + input.slice(1) : input; + const start = raw.startsWith("/") ? [] : cwd.split("/").filter(Boolean); + for (const part of raw.split("/")) { + if (!part || part === ".") continue; + if (part === "..") start.pop(); + else start.push(part); + } + return "/" + start.join("/"); +} + +function lookup(root: DirNode, path: string): Node | null { + let node: Node = root; + for (const part of path.split("/").filter(Boolean)) { + if (node.type !== "dir") return null; + const next: Node | undefined = node.children[part]; + if (!next) return null; + node = next; + } + return node; +} + +function parent(path: string): { dirPath: string; name: string } { + const parts = path.split("/").filter(Boolean); + const name = parts.pop() ?? ""; + return { dirPath: "/" + parts.join("/"), name }; +} + +export function displayPath(path: string): string { + if (path === HOME) return "~"; + return path.startsWith(HOME + "/") ? "~" + path.slice(HOME.length) : path; +} + +function listDir(node: DirNode, all: boolean, long: boolean): string[] { + const names = Object.keys(node.children).sort(); + const shown = all ? [".", "..", ...names] : names.filter((n) => !n.startsWith(".")); + if (!long) return shown.length ? [shown.map((n) => (node.children[n]?.type === "dir" ? `${n}/` : n)).join(" ")] : []; + return shown.map((n) => { + const child = node.children[n]; + const isDir = !child || child.type === "dir"; + const size = child && child.type === "file" ? child.text.length : 4096; + return `${isDir ? "drwxr-xr-x" : "-rw-r--r--"} 1 learner learner ${String(size).padStart(5)} Nov 18 09:00 ${n}`; + }); +} + +export function run(state: ShellState, line: string): RunResult { + const words = line.trim().split(/\s+/).filter(Boolean); + if (words.length === 0) return { out: [] }; + const [cmd, ...args] = words; + const flags = args.filter((a) => a.startsWith("-")).join(""); + const paths = args.filter((a) => !a.startsWith("-")); + + switch (cmd) { + case "help": + return { out: ["Commands in this practice terminal:", COMMANDS.join(" "), "Tab completes names. The up arrow brings back earlier commands."] }; + case "pwd": + return { out: [state.cwd], effect: { kind: "pwd" } }; + case "whoami": + return { out: ["learner"] }; + case "hostname": + return { out: ["edorax-lab"] }; + case "date": + return { out: [new Date().toUTCString()] }; + case "uname": + return { out: [flags.includes("a") ? "Linux edorax-lab 6.8.0 x86_64 GNU/Linux" : "Linux"] }; + case "clear": + return { out: [], clear: true }; + case "history": + return { out: state.history.map((h, i) => `${String(i + 1).padStart(4)} ${h}`) }; + case "echo": + return { out: [args.join(" ")] }; + case "ls": { + const targets = paths.length ? paths : ["."]; + const out: string[] = []; + let effect: RunResult["effect"]; + for (const t of targets) { + const path = resolvePath(state.cwd, t); + const node = lookup(state.root, path); + if (!node) return { out: [`ls: cannot access '${t}': No such file or directory`], error: true }; + if (targets.length > 1) out.push(`${t}:`); + out.push(...(node.type === "dir" ? listDir(node, flags.includes("a"), flags.includes("l")) : [t])); + effect = { kind: "ls", path }; + } + return { out, effect }; + } + case "cd": { + const path = resolvePath(state.cwd, paths[0] ?? "~"); + const node = lookup(state.root, path); + if (!node) return { out: [`cd: ${paths[0]}: No such file or directory`], error: true }; + if (node.type !== "dir") return { out: [`cd: ${paths[0]}: Not a directory`], error: true }; + state.cwd = path; + return { out: [] }; + } + case "cat": { + if (!paths.length) return { out: ["cat: give it a file name, for example: cat welcome.txt"], error: true }; + const out: string[] = []; + let effect: RunResult["effect"]; + for (const t of paths) { + const path = resolvePath(state.cwd, t); + const node = lookup(state.root, path); + if (!node) return { out: [...out, `cat: ${t}: No such file or directory`], error: true }; + if (node.type === "dir") return { out: [...out, `cat: ${t}: Is a directory`], error: true }; + out.push(...node.text.split("\n")); + effect = { kind: "cat", path }; + } + return { out, effect }; + } + case "mkdir": + case "touch": { + if (!paths.length) return { out: [`${cmd}: missing name`], error: true }; + for (const t of paths) { + const { dirPath, name } = parent(resolvePath(state.cwd, t)); + const at = lookup(state.root, dirPath); + if (!at || at.type !== "dir" || !name) return { out: [`${cmd}: cannot create '${t}': No such file or directory`], error: true }; + if (at.children[name]) { + if (cmd === "mkdir") return { out: [`mkdir: cannot create directory '${t}': File exists`], error: true }; + continue; + } + at.children[name] = cmd === "mkdir" ? dir() : file(""); + } + return { out: [] }; + } + case "sudo": + return { out: ["learner is not in the sudoers file. Nice try, though."], error: true }; + case "rm": + return { out: ["rm is switched off in this practice terminal. In the real labs you can break things and reset."], error: true }; + default: + return { out: [`${cmd}: command not found. Type help to see what works here.`], error: true }; + } +} + +/** Completes the last word of the line: a command name first, then file names. */ +export function complete(state: ShellState, line: string): string { + const words = line.split(" "); + const last = words[words.length - 1]; + if (words.length === 1) { + const hits = COMMANDS.filter((c) => c.startsWith(last)); + return hits.length === 1 ? `${hits[0]} ` : line; + } + const slash = last.lastIndexOf("/"); + const base = slash >= 0 ? last.slice(0, slash + 1) : ""; + const stem = last.slice(slash + 1); + const node = lookup(state.root, resolvePath(state.cwd, base || ".")); + if (!node || node.type !== "dir") return line; + const hits = Object.keys(node.children).filter((n) => n.startsWith(stem) && !n.startsWith(".")); + if (hits.length !== 1) return line; + const hit = hits[0]; + const suffix = node.children[hit].type === "dir" ? "/" : " "; + words[words.length - 1] = base + hit + suffix; + return words.join(" "); +} diff --git a/frontend/src/components/marketing/edorax/try-it/linux-step.tsx b/frontend/src/components/marketing/edorax/try-it/linux-step.tsx new file mode 100644 index 00000000..a4fd0af6 --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/linux-step.tsx @@ -0,0 +1,87 @@ +"use client"; + +import dynamic from "next/dynamic"; +import Link from "next/link"; +import { useState } from "react"; +import { COBALT, GREEN, INK, LINE, MONO, MUTED, TINT } from "./brand"; +import { LINUX_TASKS } from "./linux-tasks"; +import { StepHeading, type StepProps } from "./step-frame"; +import s from "./try-it.module.css"; + +const LinuxTerminal = dynamic(() => import("./linux-terminal"), { + ssr: false, + loading: () =>
, +}); + +/** + * Step 3: a quick Linux lab. Nothing starts until the visitor presses Launch lab. The + * terminal is a practice one that runs in the page; the real shell labs run on a real + * machine in the desktop app, and the step says so. + */ +export function LinuxStep({ onSolved, headingRef }: StepProps) { + const [launched, setLaunched] = useState(false); + const [done, setDone] = useState(0); + const finished = done >= LINUX_TASKS.length; + + function onProgress(count: number) { + setDone(count); + if (count >= LINUX_TASKS.length) onSolved(); + } + + return ( +
+ + Your first three Linux commands. + +
    + {LINUX_TASKS.map((task, i) => { + const ok = i < done; + return ( +
  1. + + + {task.text} + {ok ? ", done" : ""} + + {task.command} +
  2. + ); + })} +
+ {launched ? ( + + ) : ( +
+ + Starts a practice terminal right here. Nothing to install. +
+ )} +

+ {finished ? ( + <> + Well done. The real shell labs run on a real Linux machine in the{" "} + + Edorax desktop app + + . + + ) : launched ? ( + "A practice terminal in your browser. It knows a few commands; type help to see them." + ) : ( + "" + )} +

+
+ ); +} diff --git a/frontend/src/components/marketing/edorax/try-it/linux-tasks.ts b/frontend/src/components/marketing/edorax/try-it/linux-tasks.ts new file mode 100644 index 00000000..16e2923c --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/linux-tasks.ts @@ -0,0 +1,14 @@ +import { HOME, type RunResult } from "./fake-shell"; + +export interface LinuxTask { + text: string; + command: string; + /** Looks at what the command did, so `ls ~` or `cat ./welcome.txt` count too. */ + done: (effect: RunResult["effect"]) => boolean; +} + +export const LINUX_TASKS: readonly LinuxTask[] = [ + { text: "Print the folder you are in", command: "pwd", done: (e) => e?.kind === "pwd" }, + { text: "List what is in your home folder", command: "ls", done: (e) => e?.kind === "ls" && e.path === HOME }, + { text: "Read the welcome note", command: "cat welcome.txt", done: (e) => e?.kind === "cat" && e.path === `${HOME}/welcome.txt` }, +]; diff --git a/frontend/src/components/marketing/edorax/try-it/linux-terminal.tsx b/frontend/src/components/marketing/edorax/try-it/linux-terminal.tsx new file mode 100644 index 00000000..bc2adfce --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/linux-terminal.tsx @@ -0,0 +1,164 @@ +"use client"; + +import { useEffect, useRef, useState } from "react"; +import { complete, createFileTree, displayPath, HOME, run, type ShellState } from "./fake-shell"; +import { LINUX_TASKS } from "./linux-tasks"; +import { MONO } from "./brand"; +import s from "./try-it.module.css"; + +type Line = { id: number; kind: "in" | "out" | "err" | "ok" | "sys"; text: string }; + +const COLORS: Record = { + in: "#F6F7FB", + out: "#C9CFF0", + err: "#FF9C8F", + ok: "#FFC933", + sys: "#7A8BFF", +}; + +function prefersReducedMotion() { + return typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches; +} + +/** + * The practice terminal behind "Launch lab". Loaded only when a visitor presses the + * button, so it adds nothing to the first page load. + */ +export default function LinuxTerminal({ onProgress }: { onProgress: (doneCount: number) => void }) { + const shell = useRef({ root: createFileTree(), cwd: HOME, history: [] }); + const nextId = useRef(0); + const [lines, setLines] = useState([]); + const [ready, setReady] = useState(false); + const [value, setValue] = useState(""); + const [cwd, setCwd] = useState(HOME); + const [done, setDone] = useState(0); + const [misses, setMisses] = useState(0); + const historyAt = useRef(null); + const inputRef = useRef(null); + const screenRef = useRef(null); + + function push(kind: Line["kind"], text: string | string[]) { + const texts = Array.isArray(text) ? text : [text]; + setLines((prev) => [...prev, ...texts.map((t) => ({ id: nextId.current++, kind, text: t }))]); + } + + // A short start-up so it feels like a machine coming up; instant with reduced motion. + useEffect(() => { + const boot = ["Starting a practice machine...", "edorax-lab is ready. Type help to see the commands it knows."]; + if (prefersReducedMotion()) { + setLines(boot.map((t) => ({ id: nextId.current++, kind: "sys" as const, text: t }))); + setReady(true); + return; + } + const timers = boot.map((t, i) => window.setTimeout(() => push("sys", t), 250 + i * 450)); + timers.push(window.setTimeout(() => setReady(true), 250 + boot.length * 450)); + return () => timers.forEach((t) => window.clearTimeout(t)); + }, []); + + useEffect(() => { + if (ready) inputRef.current?.focus({ preventScroll: true }); + }, [ready]); + + useEffect(() => { + const el = screenRef.current; + if (el) el.scrollTop = el.scrollHeight; + }, [lines]); + + function submit() { + const line = value; + const state = shell.current; + push("in", `learner@edorax-lab:${displayPath(state.cwd)}$ ${line}`); + setValue(""); + historyAt.current = null; + if (!line.trim()) return; + state.history.push(line.trim()); + const result = run(state, line); + setCwd(state.cwd); + if (result.clear) setLines([]); + else if (result.out.length) push(result.error ? "err" : "out", result.out); + + if (done >= LINUX_TASKS.length) return; + const task = LINUX_TASKS[done]; + if (task.done(result.effect)) { + const count = done + 1; + setDone(count); + setMisses(0); + onProgress(count); + push("ok", count === LINUX_TASKS.length ? "All three done. Well done." : `Task ${count} done.`); + } else { + setMisses((m) => m + 1); + if (misses + 1 >= 2) push("sys", `Hint: try ${task.command}`); + } + } + + function onKeyDown(e: React.KeyboardEvent) { + const history = shell.current.history; + if (e.key === "Enter") { + e.preventDefault(); + submit(); + } else if (e.key === "Tab") { + // Only take Tab while there is something to complete, so keyboard users can still leave. + if (!value.trim()) return; + e.preventDefault(); + setValue(complete(shell.current, value)); + } else if (e.key === "ArrowUp" && history.length) { + e.preventDefault(); + const at = historyAt.current === null ? history.length - 1 : Math.max(0, historyAt.current - 1); + historyAt.current = at; + setValue(history[at]); + } else if (e.key === "ArrowDown" && historyAt.current !== null) { + e.preventDefault(); + const at = historyAt.current + 1; + historyAt.current = at < history.length ? at : null; + setValue(at < history.length ? history[at] : ""); + } else if (e.key === "l" && e.ctrlKey) { + e.preventDefault(); + setLines([]); + } + } + + return ( +
inputRef.current?.focus({ preventScroll: true })}> + +
+ {lines.map((l) => ( +
+ {l.text} +
+ ))} + {ready ? ( +
{ + e.preventDefault(); + submit(); + }} + style={{ display: "flex", gap: "8px", alignItems: "baseline" }} + > + + setValue(e.target.value)} + onKeyDown={onKeyDown} + aria-label="Type a command, then press Enter" + autoCapitalize="off" + autoComplete="off" + autoCorrect="off" + spellCheck={false} + enterKeyHint="send" + className={s.terminalInput} + style={{ fontFamily: MONO }} + /> +
+ ) : null} +
+
+ ); +} diff --git a/frontend/src/components/marketing/edorax/try-it/order-step.tsx b/frontend/src/components/marketing/edorax/try-it/order-step.tsx new file mode 100644 index 00000000..5b13bcf6 --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/order-step.tsx @@ -0,0 +1,173 @@ +"use client"; + +import { useRef, useState } from "react"; +import { COBALT, INK, LINE, MUTED, TINT, YELLOW } from "./brand"; +import { StepHeading, type StepProps } from "./step-frame"; +import s from "./try-it.module.css"; + +const RIGHT_ORDER = ["dns", "connect", "request", "reply"] as const; +type BlockId = (typeof RIGHT_ORDER)[number]; + +const LABELS: Record = { + dns: "Ask DNS for the address", + connect: "Connect to the server", + request: "Send the request", + reply: "Get the page back", +}; + +const START: BlockId[] = ["request", "dns", "reply", "connect"]; + +function move(list: T[], from: number, to: number): T[] { + const next = list.slice(); + const [item] = next.splice(from, 1); + next.splice(to, 0, item); + return next; +} + +/** + * Step 2: put the four steps of loading a page in order. Drag a block with a mouse or + * finger, or with the keyboard: Space picks a block up, the arrow keys move it, Space + * or Escape puts it down. + */ +export function OrderStep({ onSolved, headingRef }: StepProps) { + const [order, setOrder] = useState(START); + const [lifted, setLifted] = useState(null); + const [dragging, setDragging] = useState(null); + const [message, setMessage] = useState(""); + const [solved, setSolved] = useState(false); + const listRef = useRef(null); + + function setAndClear(next: BlockId[]) { + setOrder(next); + if (message && !solved) setMessage(""); + } + + function indexAtY(clientY: number): number { + const items = Array.from(listRef.current?.children ?? []) as HTMLElement[]; + for (let i = 0; i < items.length; i++) { + const box = items[i].getBoundingClientRect(); + if (clientY < box.top + box.height / 2) return i; + } + return items.length - 1; + } + + function onPointerDown(e: React.PointerEvent, id: BlockId) { + if (solved || e.button !== 0) return; + // Capture can fail for a pointer the browser no longer tracks; dragging still works without it. + try { + e.currentTarget.setPointerCapture(e.pointerId); + } catch {} + setDragging(id); + } + + function onPointerMove(e: React.PointerEvent, id: BlockId) { + if (dragging !== id) return; + const from = order.indexOf(id); + const to = indexAtY(e.clientY); + if (from !== to) setAndClear(move(order, from, to)); + } + + function onKeyDown(e: React.KeyboardEvent, id: BlockId) { + if (solved) return; + const at = order.indexOf(id); + if (e.key === " " || e.key === "Enter") { + e.preventDefault(); + if (lifted === id) { + setLifted(null); + setMessage(`${LABELS[id]} placed at position ${at + 1}.`); + } else { + setLifted(id); + setMessage(`${LABELS[id]} picked up. Use the up and down arrows, then Space to place it.`); + } + } else if (e.key === "Escape" && lifted === id) { + setLifted(null); + setMessage(`${LABELS[id]} placed at position ${at + 1}.`); + } else if ((e.key === "ArrowUp" || e.key === "ArrowDown") && lifted === id) { + e.preventDefault(); + const to = e.key === "ArrowUp" ? Math.max(0, at - 1) : Math.min(order.length - 1, at + 1); + if (to !== at) { + setOrder(move(order, at, to)); + setMessage(`Position ${to + 1} of ${order.length}.`); + } + } + } + + function check() { + setLifted(null); + if (order.every((id, i) => id === RIGHT_ORDER[i])) { + setSolved(true); + setMessage("That is the whole trip: name, address, connection, request, reply."); + onSolved(); + return; + } + const firstWrong = order.findIndex((id, i) => id !== RIGHT_ORDER[i]); + setMessage( + firstWrong === 0 + ? "Not yet. What does your phone need before it can connect to anything?" + : `Close. The first ${firstWrong} ${firstWrong === 1 ? "is" : "are"} right. What has to happen next?`, + ); + } + + return ( +
+ + Put the trip in order, from Go to the page on your screen. + +

+ Drag the blocks. On a keyboard, press Space on a block, then the arrow keys. +

+
    + {order.map((id, i) => { + const active = lifted === id || dragging === id; + return ( +
  1. + +
  2. + ); + })} +
+
+ {!solved ? ( + + ) : null} +

+ {message} +

+
+
+ ); +} diff --git a/frontend/src/components/marketing/edorax/try-it/question-step.tsx b/frontend/src/components/marketing/edorax/try-it/question-step.tsx new file mode 100644 index 00000000..3ed52405 --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/question-step.tsx @@ -0,0 +1,66 @@ +"use client"; + +import { useState } from "react"; +import { COBALT, INK, LINE, MUTED, PAPER, TINT } from "./brand"; +import { StepHeading, type StepProps } from "./step-frame"; +import s from "./try-it.module.css"; + +type Answer = { key: "A" | "B" | "C"; label: string; feedback: string }; + +const ANSWERS: Answer[] = [ + { key: "A", label: "Asks a name server where edorax.com lives", feedback: "Right. Your phone asks DNS for the address first." }, + { key: "B", label: "Connects straight to the website", feedback: "Not quite. To connect, your phone first needs an address, and it only knows the name." }, + { key: "C", label: "Downloads the page from Google", feedback: "Not quite. Google is not involved here. Your phone first needs the address for the name." }, +]; + +// Step 1, a taste of a course chapter: one question from the networking course. +export function QuestionStep({ onSolved, headingRef }: StepProps) { + const [picked, setPicked] = useState(null); + const answer = ANSWERS.find((a) => a.key === picked); + const right = picked === "A"; + + function pick(key: Answer["key"]) { + setPicked(key); + if (key === "A") onSolved(); + } + + return ( +
+ + You type edorax.com and press Go. What does your phone do first? + +
+ {ANSWERS.map((a) => { + const chosen = a.key === picked; + return ( + + ); + })} +
+

+ {answer?.feedback ?? ""} +

+
+ ); +} diff --git a/frontend/src/components/marketing/edorax/try-it/real-visual-lab.tsx b/frontend/src/components/marketing/edorax/try-it/real-visual-lab.tsx new file mode 100644 index 00000000..7b8960a8 --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/real-visual-lab.tsx @@ -0,0 +1,17 @@ +"use client"; + +import { HldBoard, type RunScore } from "@buildment/learning-ui/labs/HldBoard"; +import { getLabSpec } from "@buildment/learning-ui/labs/registry"; + +export const LANDING_LAB_SLUG = "hld-m4-three-tiers"; + +/** + * The real visual lab, opened full screen from the landing page. This module pulls in + * the board and its drawing library, so it is only ever loaded when a visitor presses + * Launch visual lab. + */ +export default function RealVisualLab({ onClose, onRunDone }: { onClose: () => void; onRunDone: (score: RunScore) => void }) { + const spec = getLabSpec(LANDING_LAB_SLUG); + if (!spec || spec.family !== "hld") return null; + return ; +} diff --git a/frontend/src/components/marketing/edorax/try-it/rotating-headline.tsx b/frontend/src/components/marketing/edorax/try-it/rotating-headline.tsx new file mode 100644 index 00000000..2490c5ac --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/rotating-headline.tsx @@ -0,0 +1,47 @@ +"use client"; + +import { useEffect, useState } from "react"; +import s from "./try-it.module.css"; + +const WORDS = ["hands-on labs", "interactive labs", "learning", "practice"] as const; +const INTERVAL_MS = 2600; +// Two full cycles, then it rests on the first word, so the headline never moves forever. +const MAX_TICKS = WORDS.length * 2; + +/** + * "The number one platform for ..." with the last words cycling. Screen readers get + * the whole sentence once; the moving words are hidden from them. It pauses while the + * pointer or focus is on it, and with reduced motion the words swap without moving. + */ +export function RotatingHeadline({ className, style }: { className?: string; style?: React.CSSProperties }) { + const [tick, setTick] = useState(0); + const [paused, setPaused] = useState(false); + + useEffect(() => { + if (paused || tick >= MAX_TICKS) return; + const id = window.setTimeout(() => setTick((t) => t + 1), INTERVAL_MS); + return () => window.clearTimeout(id); + }, [paused, tick]); + + const word = WORDS[tick % WORDS.length]; + + return ( +

setPaused(true)} + onPointerLeave={() => setPaused(false)} + > + The number one platform for hands-on labs, interactive labs, learning and practice. + +

+ ); +} diff --git a/frontend/src/components/marketing/edorax/try-it/step-frame.tsx b/frontend/src/components/marketing/edorax/try-it/step-frame.tsx new file mode 100644 index 00000000..bf66db8c --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/step-frame.tsx @@ -0,0 +1,24 @@ +import type { ReactNode, Ref } from "react"; +import { HEADING, MUTED } from "./brand"; + +export interface StepProps { + /** Call once the visitor gets the step right; the panel then offers the next step. */ + onSolved: () => void; + /** The step's heading, focused when the step opens so keyboard users land on it. */ + headingRef: Ref; +} + +export function StepHeading({ eyebrow, children, headingRef }: { eyebrow: string; children: ReactNode; headingRef: Ref }) { + return ( +
+
{eyebrow}
+

+ {children} +

+
+ ); +} diff --git a/frontend/src/components/marketing/edorax/try-it/steps.ts b/frontend/src/components/marketing/edorax/try-it/steps.ts new file mode 100644 index 00000000..6972d01d --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/steps.ts @@ -0,0 +1,32 @@ +import type { DotMood } from "@buildment/learning-ui/brand-dot"; + +// The try-it sequence on the landing page. Each live step unlocks the next one on a +// right answer. "soon" steps are slots for areas that are not built yet (puzzles, +// voice tutors): they show in the progress list and get a component when they ship. + +export type TryStepId = "question" | "order" | "linux" | "visual" | "puzzle" | "voice"; + +export interface TryStep { + id: TryStepId; + /** Short label for the progress list. */ + label: string; + /** Which part of Edorax this step is a taste of. */ + area: string; + status: "live" | "soon"; + /** What Dot says while the step is open. */ + dotLine: string; + dotMood: DotMood; + /** Text of the button that opens this step from the one before. */ + nextLabel: string; +} + +export const TRY_STEPS: readonly TryStep[] = [ + { id: "question", label: "Question", area: "Courses", status: "live", dotLine: "Take a guess. No account needed.", dotMood: "think", nextLabel: "" }, + { id: "order", label: "Order", area: "Courses", status: "live", dotLine: "Now the whole trip. Drag them into order.", dotMood: "determined", nextLabel: "Next: put it in order" }, + { id: "linux", label: "Linux lab", area: "Shell labs", status: "live", dotLine: "Three commands. You can do this.", dotMood: "determined", nextLabel: "Next: a quick Linux lab" }, + { id: "visual", label: "Visual lab", area: "Visual labs", status: "live", dotLine: "Build it, then press Run.", dotMood: "think", nextLabel: "Next: build a system" }, + { id: "puzzle", label: "Puzzle", area: "Puzzles", status: "soon", dotLine: "", dotMood: "happy", nextLabel: "" }, + { id: "voice", label: "Voice tutor", area: "Voice tutors", status: "soon", dotLine: "", dotMood: "happy", nextLabel: "" }, +]; + +export const LIVE_STEPS = TRY_STEPS.filter((step) => step.status === "live"); diff --git a/frontend/src/components/marketing/edorax/try-it/try-it.module.css b/frontend/src/components/marketing/edorax/try-it/try-it.module.css new file mode 100644 index 00000000..34fe9596 --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/try-it.module.css @@ -0,0 +1,387 @@ +/* The landing page's rotating headline and try-it panel. Light only, like the rest of + the landing page. Motion is switched off under prefers-reduced-motion at the end. */ + +.srOnly { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; +} + +/* Headline: the last words sit on their own line so the line above never reflows. */ +.rotor { + display: block; + overflow: hidden; + color: #2434e0; + padding-bottom: 0.08em; +} + +.rotorWord { + display: inline-block; + animation: rotorIn 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both; +} + +@keyframes rotorIn { + from { + transform: translateY(70%); + opacity: 0; + } + to { + transform: none; + opacity: 1; + } +} + +/* Panel */ +.tryIt { + flex: 1 1 460px; + min-width: 0; + display: flex; + flex-direction: column; + align-items: center; + scroll-margin-top: 24px; +} + +.dotRow { + width: 100%; + max-width: 560px; + display: flex; + align-items: flex-end; + gap: 4px; + padding-left: 12px; + box-sizing: border-box; +} + +.bubble { + margin-bottom: 22px; + background: #ffffff; + border: 1px solid #dce0f2; + padding: 10px 14px; + font-size: 15px; + line-height: 1.4; + max-width: 280px; +} + +.panel { + width: 100%; + max-width: 560px; + background: #ffffff; + border: 1px solid #dce0f2; + box-sizing: border-box; + padding: 22px 24px 24px; + display: flex; + flex-direction: column; + gap: 18px; +} + +.progress { + margin: 0; + padding: 0 0 14px; + list-style: none; + display: flex; + flex-wrap: wrap; + gap: 6px; + border-bottom: 1px solid #dce0f2; +} + +.chip { + display: inline-flex; + align-items: center; + gap: 5px; + min-height: 30px; + padding: 4px 10px; + box-sizing: border-box; + font-size: 13px; + font-weight: 700; + color: #46507a; + background: #f6f7fb; + border: 1px solid #dce0f2; +} + +button.chip { + cursor: pointer; +} + +button.chip:hover { + border-color: #2434e0; +} + +.chipCurrent { + background: #0a0f2c; + border-color: #0a0f2c; + color: #f6f7fb; +} + +.chipDone { + background: #e8ebff; + border-color: #e8ebff; + color: #2434e0; +} + +.chipSoon { + background: transparent; + border-style: dashed; + border-color: #9aa2c7; + font-weight: 400; +} + +.stepEnter { + animation: stepIn 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both; +} + +@keyframes stepIn { + from { + transform: translateY(10px); + opacity: 0; + } + to { + transform: none; + opacity: 1; + } +} + +.stepBody { + display: flex; + flex-direction: column; + gap: 16px; +} + +.answer:hover { + border-color: #2434e0 !important; +} + +.primary, +.next { + display: inline-flex; + align-items: center; + gap: 10px; + min-height: 48px; + padding: 12px 22px; + border: 0; + font-size: 16px; + font-weight: 700; + background: #2434e0; + color: #f6f7fb; +} + +.nextRow { + display: flex; + justify-content: flex-end; + border-top: 1px solid #dce0f2; + padding-top: 16px; +} + +.next { + background: #ffc933; + color: #0a0f2c; + animation: stepIn 300ms ease-out both; +} + +.textButton { + background: none; + border: 0; + padding: 0; + font-size: inherit; + font-weight: 700; + color: #2434e0; + text-decoration: underline; + text-underline-offset: 3px; +} + +.finishLinks { + display: flex; + flex-wrap: wrap; + gap: 10px; +} + +.finishLinks a { + display: inline-block; + text-decoration: none; + font-weight: 700; + padding: 12px 20px; +} + +/* Order step */ +.orderList { + margin: 0; + padding: 0; + list-style: none; + display: flex; + flex-direction: column; + gap: 8px; +} + +.orderBlock { + width: 100%; + min-height: 50px; + padding: 10px 14px; + display: flex; + align-items: center; + gap: 12px; + text-align: left; + font-size: 16px; + touch-action: none; + user-select: none; + transition: box-shadow 120ms ease; +} + +.orderBlock:disabled { + opacity: 1; +} + +/* Linux step */ +.taskList { + margin: 0; + padding: 0; + list-style: none; + display: flex; + flex-direction: column; + gap: 6px; +} + +.taskList li { + display: flex; + align-items: center; + gap: 12px; + padding: 8px 12px; + border: 1px solid; + font-size: 15px; +} + +.taskMark { + flex: none; + width: 18px; + height: 18px; + border: 2px solid; + display: grid; + place-items: center; + box-sizing: border-box; +} + +.launchBox { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 12px 16px; + padding: 18px; + background: #0a0f2c; +} + +.launchBox span { + color: #c9cff0 !important; +} + +.launchBox .primary { + background: #ffc933; + color: #0a0f2c; +} + +.terminal { + background: #0a0f2c; + color: #f6f7fb; + font-size: 14px; + line-height: 1.55; + cursor: text; +} + +.terminalBar { + display: flex; + align-items: center; + gap: 6px; + padding: 8px 12px; + border-bottom: 1px solid #252c55; +} + +.terminalBar span { + width: 9px; + height: 9px; + border-radius: 50%; + background: #3a4270; +} + +.terminalBar em { + margin-left: 8px; + font-style: normal; + font-size: 12px; + color: #9aa2c7; +} + +.terminalScreen { + height: 210px; + overflow-y: auto; + padding: 10px 12px 12px; +} + +.terminalInput { + flex: 1; + min-width: 0; + background: transparent; + border: 0; + outline: none; + color: #f6f7fb; + font-size: 16px; + caret-color: #ffc933; + padding: 2px 0; +} + +.terminal:focus-within { + outline: 3px solid #ffc933; + outline-offset: 2px; +} + +/* Visual step: a preview card, then the real lab full screen. */ +.labPreview { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 16px 20px; + padding: 16px; + background: #e8ebff; +} + +.labPoints { + margin: 0; + padding: 0 0 0 18px; + flex: 1 1 200px; + font-size: 15px; + line-height: 1.6; +} + +.labLoading { + position: fixed; + inset: 0; + z-index: 100; + display: grid; + place-items: center; + background: rgba(10, 15, 44, 0.92); + color: #f6f7fb; + font-weight: 700; +} + +@media (max-width: 520px) { + .panel { + padding: 18px 16px 20px; + } + + + .terminalScreen { + height: 190px; + } +} + +@media (prefers-reduced-motion: reduce) { + .rotorWord, + .stepEnter, + .next { + animation: none; + } + + .orderBlock { + transition: none; + } +} diff --git a/frontend/src/components/marketing/edorax/try-it/try-it.tsx b/frontend/src/components/marketing/edorax/try-it/try-it.tsx new file mode 100644 index 00000000..b916fafe --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/try-it.tsx @@ -0,0 +1,149 @@ +"use client"; + +import dynamic from "next/dynamic"; +import Link from "next/link"; +import { useCallback, useRef, useState, type ComponentType } from "react"; +import { Dot } from "@/components/brand/dot"; +import { COBALT, HEADING, INK, LINE, MUTED, PAPER } from "./brand"; +import { QuestionStep } from "./question-step"; +import type { StepProps } from "./step-frame"; +import { LIVE_STEPS, TRY_STEPS, type TryStepId } from "./steps"; +import s from "./try-it.module.css"; + +// Only the first step ships with the page. The others load when they are needed, and +// the next one is fetched as soon as the current one is solved, so it opens at once. +const loaders = { + order: () => import("./order-step").then((m) => m.OrderStep), + linux: () => import("./linux-step").then((m) => m.LinuxStep), + visual: () => import("./visual-step").then((m) => m.VisualStep), +}; +const placeholder = () =>
; +const STEP_COMPONENTS: Partial>> = { + question: QuestionStep, + order: dynamic(loaders.order, { loading: placeholder }), + linux: dynamic(loaders.linux, { loading: placeholder }), + visual: dynamic(loaders.visual, { loading: placeholder }), +}; + +const DONE_LINE = "Four for four. You have tried it all."; + +/** + * The landing page's try-it panel: a short run through every kind of learning on + * Edorax. Each step opens the next one only when it is answered right. Steps marked + * "soon" in TRY_STEPS (puzzles, voice tutors) show as slots until they are built. + */ +export function TryIt() { + const [current, setCurrent] = useState(0); + const [solved, setSolved] = useState>(new Set()); + const moved = useRef(false); + // Keyboard and screen reader users land on the new step's heading, not on the page top. + // A callback ref, because later steps load on demand and mount after the step changes. + const headingRef = useCallback((node: HTMLHeadingElement | null) => { + if (node && moved.current) node.focus({ preventScroll: true }); + }, []); + const finished = current >= LIVE_STEPS.length; + const step = finished ? null : LIVE_STEPS[current]; + const stepSolved = step ? solved.has(step.id) : false; + const next = LIVE_STEPS[current + 1]; + + function markSolved() { + if (!step) return; + setSolved((prev) => new Set(prev).add(step.id)); + if (next && next.id in loaders) void loaders[next.id as keyof typeof loaders](); + } + + function go(index: number) { + moved.current = true; + setCurrent(index); + } + + const Step = step ? STEP_COMPONENTS[step.id] : undefined; + const dotMood = finished ? "cheer" : stepSolved ? "wink" : (step?.dotMood ?? "think"); + const dotLine = finished ? DONE_LINE : stepSolved ? "You got it." : (step?.dotLine ?? ""); + + return ( +
+
+ +
{dotLine}
+
+
+
    + {TRY_STEPS.map((t) => { + const live = LIVE_STEPS.findIndex((l) => l.id === t.id); + const isCurrent = live === current; + const done = solved.has(t.id); + const reachable = live >= 0 && (done || isCurrent || (live > 0 && solved.has(LIVE_STEPS[live - 1].id))); + const label = t.status === "soon" ? `${t.label}, soon` : t.label; + const cls = `${s.chip} ${isCurrent ? s.chipCurrent : ""} ${done ? s.chipDone : ""} ${t.status === "soon" ? s.chipSoon : ""}`; + return ( +
  1. + {reachable && !isCurrent ? ( + + ) : ( + + {label} + {isCurrent ? ", current step" : t.status === "live" ? ", opens after the step before it" : ""} + + )} +
  2. + ); + })} +
+
+ {Step && step ? ( + + ) : ( + { setSolved(new Set()); go(0); }} /> + )} +
+ {stepSolved && !finished ? ( +
+ +
+ ) : null} +
+
+ ); +} + +function Finished({ headingRef, onRestart }: { headingRef: React.Ref; onRestart: () => void }) { + const tried = LIVE_STEPS.map((t) => t.area).filter((a, i, all) => all.indexOf(a) === i); + const soon = TRY_STEPS.filter((t) => t.status === "soon").map((t) => t.area.toLowerCase()); + return ( +
+
+
You tried {tried.slice(0, -1).join(", ")} and {tried[tried.length - 1]}
+

+ That was Edorax in two minutes. The real thing goes much deeper. +

+
+
+ + Browse courses + + + Open the labs + + + Get the desktop app + +
+

+ Coming to this panel soon: {soon.join(" and ")}.{" "} + +

+
+ ); +} diff --git a/frontend/src/components/marketing/edorax/try-it/visual-step.tsx b/frontend/src/components/marketing/edorax/try-it/visual-step.tsx new file mode 100644 index 00000000..a8eb764f --- /dev/null +++ b/frontend/src/components/marketing/edorax/try-it/visual-step.tsx @@ -0,0 +1,87 @@ +"use client"; + +import dynamic from "next/dynamic"; +import Link from "next/link"; +import { useState } from "react"; +import type { RunScore } from "@buildment/learning-ui/labs/HldBoard"; +import { COBALT, INK, MUTED, PAPER, TINT } from "./brand"; +import { StepHeading, type StepProps } from "./step-frame"; +import s from "./try-it.module.css"; + +// The real board and its drawing library load only after Launch visual lab is pressed. +const RealVisualLab = dynamic(() => import("./real-visual-lab"), { + ssr: false, + loading: () => ( +
+ Opening the lab... +
+ ), +}); + +/** + * Step 4: the real Edorax visual lab, full screen. The visitor sizes a three-tier + * system for exam week, presses Run tests and reads every check. The step is solved + * when a run passes every check; the board's own hints and Solution button help. + */ +export function VisualStep({ onSolved, headingRef }: StepProps) { + const [open, setOpen] = useState(false); + const [best, setBest] = useState(null); + const passed = best?.allPass === true; + + function onRunDone(score: RunScore) { + setBest((prev) => (!prev || score.passed > prev.passed ? score : prev)); + if (score.allPass) onSolved(); + } + + return ( +
+ + Exam week: 10,000 students at once. Make the system hold. + +
+ + + + Users + + Balancer + + App + + Database + + Zone down + +
    +
  • Size each part and spread it over two zones
  • +
  • Press Run tests and watch the traffic
  • +
  • Pass every check: speed, uptime and budget
  • +
+
+
+ + Opens full screen. Press Esc to come back. +
+

+ {passed && best ? ( + <> + All {best.total} checks passed, on the same board the system design course uses.{" "} + + See all visual labs + + + ) : best ? ( + `Best run so far: ${best.passed} of ${best.total} checks. Stuck? The board has hints, and a Solution button after your first run.` + ) : ( + "" + )} +

+ {open ? setOpen(false)} onRunDone={onRunDone} /> : null} +
+ ); +} From 1e2cf9d4e997ff0114ab183ed3c365bffda044e0 Mon Sep 17 00:00:00 2001 From: Zeeshan Adil Date: Wed, 18 Nov 2026 19:45:52 +0500 Subject: [PATCH 3/8] Put the try-it panel in the landing hero and add labs and desktop app sections The hero now reads "The number one platform for" with the last words cycling, and the try-it panel replaces the single question. New sections after the courses story cover the three kinds of lab and the desktop app that runs the shell labs, with links to download it. --- frontend/src/app/(marketing)/page.tsx | 2 +- .../edorax/edorax-landing.module.css | 5 + .../marketing/edorax/edorax-landing.tsx | 27 ++- .../marketing/edorax/labs-and-desktop.tsx | 174 ++++++++++++++++++ 4 files changed, 197 insertions(+), 11 deletions(-) create mode 100644 frontend/src/components/marketing/edorax/labs-and-desktop.tsx diff --git a/frontend/src/app/(marketing)/page.tsx b/frontend/src/app/(marketing)/page.tsx index 897b40a2..4611c4a6 100644 --- a/frontend/src/app/(marketing)/page.tsx +++ b/frontend/src/app/(marketing)/page.tsx @@ -6,7 +6,7 @@ import { homeRouteForRole } from "@/server/auth/access-rules"; export const metadata: Metadata = { title: { absolute: "Edorax: every lesson starts with a question" }, - description: "Short lessons you can read, play with, listen to and prove. Built for phones, slow connections and second-language learners.", + description: "Courses you read, play, hear and prove, plus visual, guided and shell labs. Try every kind from the home page, no account needed.", alternates: { canonical: "/" }, openGraph: { title: "Edorax: every lesson starts with a question", url: "/", images: [SITE_SHARE_IMAGE] }, }; diff --git a/frontend/src/components/marketing/edorax/edorax-landing.module.css b/frontend/src/components/marketing/edorax/edorax-landing.module.css index 2d280c0d..0d33c7b6 100644 --- a/frontend/src/components/marketing/edorax/edorax-landing.module.css +++ b/frontend/src/components/marketing/edorax/edorax-landing.module.css @@ -34,6 +34,11 @@ /* Inline styles carry the desktop design; these reshape it for phones. */ @media (max-width: 640px) { + /* The drawn desktop app stacks its task panel over its terminal. */ + .appBody { + grid-template-columns: minmax(0, 1fr) !important; + } + .h1 { font-size: 32px !important; } diff --git a/frontend/src/components/marketing/edorax/edorax-landing.tsx b/frontend/src/components/marketing/edorax/edorax-landing.tsx index 83e0d568..25de2b9e 100644 --- a/frontend/src/components/marketing/edorax/edorax-landing.tsx +++ b/frontend/src/components/marketing/edorax/edorax-landing.tsx @@ -1,14 +1,16 @@ import Link from "next/link"; import { ChoiceGroup } from "./choice-group"; import { Dot } from "@/components/brand/dot"; -import { HeroQuestion } from "./hero-question"; +import { RotatingHeadline } from "./try-it/rotating-headline"; +import { TryIt } from "./try-it/try-it"; +import { DesktopApp, HandsOnLabs } from "./labs-and-desktop"; import { AreaShowcase } from "./area-showcase"; import { Wordmark } from "@/components/brand/wordmark"; import s from "./edorax-landing.module.css"; // The Edorax home page. Static markup with inline brand values so it matches the -// approved design one to one; only the hero question and the leaderboard choice -// are interactive. Font variables (--font-unbounded, --font-dm-sans) are defined +// approved design one to one; only the hero's try-it panel and the leaderboard +// choice are interactive. Font variables (--font-unbounded, --font-dm-sans) are defined // globally in layout.tsx. function AccountLink({ dashboardHref }: { dashboardHref: string | null }) { @@ -39,26 +41,27 @@ export function EdoraxLanding({ dashboardHref = null }: { dashboardHref?: string
-

Every lesson starts with a question you already wonder about.

-

Then you play with it, listen to it and prove it. Short chapters that work on a phone, on a slow connection, in your second language.

+ +

Courses you read, play, hear and prove. Labs you build and break. Try each kind right here in two minutes, no account needed.

- +
@@ -134,6 +137,8 @@ export function EdoraxLanding({ dashboardHref = null }: { dashboardHref?: string
+ +
@@ -312,7 +317,7 @@ export function EdoraxLanding({ dashboardHref = null }: { dashboardHref?: string

Answer one question. See where it takes you.

Make an account only when you want to keep your progress.

@@ -329,6 +334,8 @@ export function EdoraxLanding({ dashboardHref = null }: { dashboardHref?: string