diff --git a/.github/ISSUE_TEMPLATE/other.yml b/.github/ISSUE_TEMPLATE/other.yml index 3ee77ea..dbd2d13 100644 --- a/.github/ISSUE_TEMPLATE/other.yml +++ b/.github/ISSUE_TEMPLATE/other.yml @@ -1,5 +1,5 @@ name: Something else -description: A bug in the site as a whole, a problem you'd like a page for, or an idea. +description: A bug in the site as a whole, a problem you'd like a page for, something in the AI Engineer course, or an idea. body: - type: textarea id: what diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4627112..e465590 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -9,6 +9,7 @@ - [ ] every badge says what was actually run; every trap output was produced by running it - [ ] `npm run build` succeeds, then `npm run audit -- ` passes - [ ] opens on step 1, and reads well beside another page at the same width +- [ ] **If this changes the AI Engineer course** (`course/`, `src/lib/ai/`, `src/pages/ai-engineer/`): `npm run build` and `npm run audit` pass, and new links open - [ ] **If this changes how every page is built** (`src/lib/`, `src/layouts/`, `lesson.css`, `kit.css`, `scripts/check-lessons.mjs`): I updated `.claude/skills/leetcode-solution-page/` (usually `references/lesson-kit.md`) and `CONTRIBUTING.md` to match, or this change doesn't affect how a page is made. See [CONTRIBUTING.md](../CONTRIBUTING.md) for what each item means. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 57caaeb..7dc6bad 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,13 @@ -# Contributing a solution page +# Contributing + +This repo is the site at [learn.devmtnaing.com](https://learn.devmtnaing.com), +with two sections. Most of this guide is about the first: + +- **LeetCode solution pages** (`src/lessons/`): the rest of this guide. +- **The AI Engineer course** (`course/` and `src/pages/ai-engineer/`): see + [Changing the AI Engineer course](#changing-the-ai-engineer-course) at the end. + +## Contributing a solution page The most useful contribution is a new solution page for a problem on the list that doesn't have one yet: any row on the problem list (`/leetcode`) marked *Solution coming @@ -9,7 +18,7 @@ Before you start, open a page or two to see what one looks like: copy. Every page has the same parts in the same order — the layout comes from the shared kit, so you write content, not markup. -## What a page promises +### What a page promises A reader comes back to these pages to relearn a problem, watch it run, and copy code they can trust. So three rules are firm: @@ -25,14 +34,14 @@ code they can trust. So three rules are firm: carries between steps, in the shape the code holds it: the map, the stack, the call stack. It isn't a cartoon of the idea. -## You will need +### You will need - Node 20+, Python 3.10+, Ruby 3 - Docker, for Go and Rust. The verifier runs them in `golang:1.23-alpine` and `rust:1.98-slim`, and reports them as *skipped*, not passed, when Docker isn't running. -## Building a page, step by step +### Building a page, step by step A page is one folder, `src/lessons//`. The route finds it and the problem list links it automatically, so there is nothing else to register. @@ -46,7 +55,7 @@ verify//spec.py the corpus, the oracle, the five drivers verify//adapter.mjs how the walkthrough reads a corpus line ``` -### 1. Get the problem exactly right +#### 1. Get the problem exactly right Quote the statement, don't paraphrase it: readers will submit against the real one. LeetCode's GraphQL endpoint returns it without a key: @@ -59,13 +68,13 @@ curl -s -X POST https://leetcode.com/graphql/ -H 'Content-Type: application/json `statement.html` holds the prose paragraphs only. Examples and constraints have their own components in `lesson.js` and `page.js`. -### 2. Write the brute force first +#### 2. Write the brute force first It is the reference everything else is checked against, so write it first and confirm it on the examples. Then write the better approach. Most pages show two (the brute force and the one worth learning); some show three. -### 3. Write the listings as files, then generate the code table +#### 3. Write the listings as files, then generate the code table Write each approach in each language as a plain file (`brute.rb`, `brute.py`, `brute.js`, `brute.go`, `brute.rs`, `hash.rb`, …) and mark each @@ -85,7 +94,7 @@ and paste the `CODE` block into `lesson.js`. Don't retype listings: the verifier runs the text in `lesson.js`, and the generator strips the markers so that text is exactly the file you wrote. -### 4. Write `lesson.js` +#### 4. Write `lesson.js` Copy `src/lessons/two-sum/lesson.js` and replace its parts. It ends with one `mountLesson({...})` call. Keep that call last in the file, because it runs the @@ -131,7 +140,7 @@ and calls get `cells(items, { wide: true })` and a board or matrix Give a failed comparison its own frame. The branch that *doesn't* fire is often the one worth seeing. -### 5. Write `page.js` +#### 5. Write `page.js` Every prop is required, and `npm run check` names any that are missing: `title`, `summary`, `eyebrow`, `lede`, `links`, `constraints`, `part1Sub`, @@ -145,7 +154,7 @@ Traps are the places the statement trips people up: each one names what the wrong code returns, and you ran it to find out. Notes are questions a reader would ask ("Why check for the partner *before* storing?"), answered in a paragraph. -### 6. Verify +#### 6. Verify Write `verify//spec.py`: `DRIVERS` (a program per language that reads one case per line and prints one answer per line, with `{SOL}` where the @@ -174,7 +183,7 @@ Things that have bitten before: - Rust's `i32` overflows silently in release builds. - Go's `for range` over a map is randomly ordered. -### 7. Check the page +#### 7. Check the page ```sh npm run check # structure: every key highlighted, every part present @@ -192,7 +201,7 @@ finds and opens a page. What it cannot tell you is whether the page reads well — open it beside another one and look. -## Burmese +### Burmese Pages are bilingual, but **you don't need to write Burmese**. Any string can be plain English, or `t(english, burmese)` from `kit.js`. A missing Burmese side @@ -203,7 +212,7 @@ If you do translate: keep code, identifiers, problem titles and terms of art translate idioms word for word. [docs/translation-review.md](docs/translation-review.md) collects phrasings a native reader should check. Help there is very welcome. -## Pull request checklist +### Pull request checklist - [ ] `npm run check` passes - [ ] `npm run verify -- ` passes, with Go and Rust run (not skipped) @@ -225,9 +234,39 @@ shared page code but neither the skill nor this guide, so a reviewer can ask whether the docs need to follow. A third job runs `npm run audit` over every page. Reading the page beside another one is still yours to do. -## Using Claude Code +### Using Claude Code The repo ships a project skill, `.claude/skills/leetcode-solution-page/`. In Claude Code, `/leetcode-solution-page ` follows this guide end to end, verification included. It holds a contribution to the same standard as a hand-written one: the checklist above still applies. + +## Changing the AI Engineer course + +The course is plain markdown in [`course/`](course/README.md), and the pages +under `/ai-engineer` are built from it at build time +(`src/lib/ai/course.ts`), so a change to the markdown is a change to the site. + +- **Module text** lives in each track's README. A module is a heading + (`## 1.4 …` in Track 1, `### 2.7 …` in Tracks 2 and 3, `## Level 2: …` in + Math) with `**Why:**`, `**Concepts:**`, `**Learn**` (`- *Core:*` and + `- *Optional:*` items), `**Build**` (`- [ ]` items) and `**Checkpoint:**`. + Keep that shape: the parser turns each part into a step of the module. +- **Time estimates** come from the weeks column of each track's module table. + They are weeks at ~13.5 hours a week; the site scales them to the reader's + chosen pace. +- **Quizzes and flashcards** are in `src/lib/ai/quizzes.ts` and + `src/lib/ai/flashcards.ts`, keyed by module id (`t1-1.4`). A question names + its correct option and says why. +- **Papers and projects** are `course/track-3-research-engineer/papers.md` and + `course/projects/README.md`. +- **A new section** (another course next to LeetCode and AI Engineer) is one + entry in `src/data/sections.ts`, which gives it a rail icon and its own menu, + plus its pages. + +Checklist for a course change: + +- [ ] `npm run build` succeeds, and the module still shows all of its steps on its track page +- [ ] `npm run audit` passes: it checks the hub and a sample of AI Engineer + pages for errors, overflow at 320 and 400px, and contrast in both themes +- [ ] links you added open (resources are linked out, so check them) diff --git a/README.md b/README.md index f0b587b..5b00eb5 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,20 @@ -# LeetCode solution pages +# learn -**Live: [learn.devmtnaing.com](https://learn.devmtnaing.com).** Two sections share one site, one design and one progress record: +**Live: [learn.devmtnaing.com](https://learn.devmtnaing.com).** A learning site with two sections that share one design and one progress record: -- **[LeetCode](https://learn.devmtnaing.com/leetcode)**: open any problem and step through its solution. -- **[AI Engineer](https://learn.devmtnaing.com/ai-engineer)**: a self-study path from backend engineer to AI research engineer, built from the markdown course in [`course/`](course/README.md), with quizzes, flashcards, XP and streaks. +- **[LeetCode](https://learn.devmtnaing.com/leetcode)**: interview problems you can step through one state change at a time, with tested code in five languages. +- **[AI Engineer](https://learn.devmtnaing.com/ai-engineer)**: a self-study path from backend engineer to AI research engineer, in three tracks, with quizzes, flashcards and portfolio projects. -[![Lowest Common Ancestor, step 4 of 7: the tree with the call stack beside it and the Ruby line that is running highlighted](docs/screenshots/walkthrough.png)](https://learn.devmtnaing.com/leetcode/lowest-common-ancestor-of-a-binary-tree) +[![The hub: jump back into the last LeetCode problem and the next AI Engineer step, a card for each section, and the week's XP by section](docs/screenshots/home.png)](https://learn.devmtnaing.com) -Interactive solutions to interview problems. Each page quotes the problem, -steps through the algorithm one state change at a time, and ends with complete -solutions in Ruby, Python, JavaScript, Go and Rust. Every one of those -solutions was run against thousands of cases before it was published. +A section rail on the left switches between the sections; each section has its own menu. Progress, XP and streaks are kept per section and add up on the hub. ⌘K searches the section you are in. Light and dark themes; the LeetCode pages are also in မြန်မာ (Burmese). All screenshots here are in the dark theme. -Every page follows the same three parts: +## LeetCode + +Each page quotes the problem, steps through the algorithm one state change at a +time, and ends with complete solutions in Ruby, Python, JavaScript, Go and +Rust. Every one of those solutions was run against thousands of cases before it +was published. Every page has the same three parts: 1. **The question.** LeetCode's statement, quoted word for word, the worked examples, a small widget for the idea the statement hinges on, and the @@ -24,22 +26,47 @@ Every page follows the same three parts: 3. **The whole solution.** Paste-ready code for every approach and language, each with a badge saying exactly how it was checked. -The pages are bilingual, English and မြန်မာ (Burmese), in a light and a dark -theme. The screenshots below are all in the dark one. +[![Lowest Common Ancestor, step 4 of 11: the tree with parents recorded, the stack, and the Ruby line that is running highlighted](docs/screenshots/walkthrough.png)](https://learn.devmtnaing.com/leetcode/lowest-common-ancestor-of-a-binary-tree?step=4) + +The list has 45 interview problems, 15 each of easy, medium and hard, chosen +where three of LeetCode's own study plans agree ([how](docs/problem-list.md)), +plus 2 from outside that list, grouped by pattern. Every one has a solution +page. "Mark as solved" on a page ticks it on the list and earns LeetCode XP. -## Screenshots +[![The problem list: patterns in the section menu, a difficulty filter, solved problems ticked](docs/screenshots/problems.png)](https://learn.devmtnaing.com/leetcode) **The question.** The statement next to a widget for the one idea it turns on. [![The top of the Two Sum page: the statement on the left, a target slider on the right](docs/screenshots/question.png)](https://learn.devmtnaing.com/leetcode/two-sum) -**The problem list.** 47 problems grouped by pattern, with search, a difficulty filter and ⌘K from any page. +**In Burmese.** Trapping Rain Water with two pointers, finished. -[![The home page: patterns down the side, problems with difficulty and acceptance rate](docs/screenshots/home.png)](https://learn.devmtnaing.com/leetcode) +[![Trapping Rain Water with Burmese narration, the answer of 6 units filled in](docs/screenshots/burmese.png)](https://learn.devmtnaing.com/leetcode/trapping-rain-water?approach=pointers) -**In Burmese.** Trapping Rain Water with two pointers, finished. +## AI Engineer + +A curriculum for a backend engineer moving into AI, in the order the jobs come: + +| Track | Goal | At the course's own pace (~13.5 h a week) | +|---|---|---| +| **1 · AI Application Engineer** | Use models well: APIs, RAG, agents, MCP, evals, agent frameworks, durable workflows | ~3.5–4 months | +| **2 · ML / AI Systems Engineer** | Neural nets from scratch, transformers, fine-tuning, GPUs, inference, distributed training, Kubernetes | ~7–9 months | +| **3 · AI Research Engineer** | Learning theory, scaling, RL and post-training, interpretability, reproducing papers | ~8–12 months, then ongoing | +| **Math** | Three levels, each paired with a track | alongside | + +Every module has five steps: **concepts**, the **resources** to work through, +hands-on **builds**, a **quiz** (with hearts and retries), and a **checkpoint** +that earns a crown. You choose a study pace in hours a week, and every time +estimate scales to it. Flashcards come back on a spaced schedule; the reading +list has 57 papers in order; the projects are portfolio capstones with full +specs. + +[![The Track 1 path: modules on a timeline, each with its five steps, the first one crowned](docs/screenshots/ai-path.png)](https://learn.devmtnaing.com/ai-engineer/track-1) + +[![A quiz question on retrieval, answered correctly, with the explanation](docs/screenshots/ai-quiz.png)](https://learn.devmtnaing.com/ai-engineer/track-1/1-4/quiz) -[![Trapping Rain Water with Burmese chrome and narration, the answer of 6 units filled in](docs/screenshots/burmese.png)](https://learn.devmtnaing.com/leetcode/trapping-rain-water?approach=pointers) +The course itself is markdown in [`course/`](course/README.md), readable on its +own. The pages are built from it, so editing a track's README updates the site. ## Run it @@ -47,48 +74,43 @@ theme. The screenshots below are all in the dark one. npm install npm run dev # http://localhost:4321 npm run build # static site in dist/ -npm run check # structural check of every lesson -npm run audit # every built page in a real browser (after npm run build) +npm run check # structural check of every LeetCode lesson +npm run audit # every lesson, the hub and the AI pages in a real browser (after build) +npm run verify -- # rerun a lesson's listings in five languages +npm run screenshots # retake docs/screenshots (after build) npm run refresh-problems # re-read titles, tags and acceptance rates from LeetCode ``` -The problem list has 45 interview problems, 15 each of easy, medium and hard, -chosen where three of LeetCode's own study plans agree -([how](docs/problem-list.md)), plus 2 from outside that list, grouped by -pattern (Arrays & Hashing, Two Pointers, Trees, …). Every one of them has a -solution page. To add a problem or fix a page, see -[CONTRIBUTING.md](CONTRIBUTING.md). +To add a LeetCode page or change the course, see [CONTRIBUTING.md](CONTRIBUTING.md). ## What is in the repo ``` -src/pages/index.astro the hub: both sections -src/pages/leetcode/index.astro the problem list -src/pages/leetcode/[slug].astro renders every lesson folder -src/lessons// one folder per solution page -src/pages/ai-engineer/ the AI Engineer path, module guides and lesson steps -src/pages/profile.astro progress across both sections -course/ the AI Engineer course as markdown (the pages read it at build) -src/lib/ai/ course parser, quizzes, flashcards, progress painter -src/components/ai/ Preact islands: lesson steps, practice, profile, rail -src/lib/progress.ts progress, XP and streak for the whole site (localStorage) -src/lib/ the shared kit: stepper, stage shapes, trees, i18n -src/styles/ tokens (one design, a teal and an indigo accent), app shell, lessons, AI section -scripts/check-lessons.mjs structure and format check -scripts/audit.mjs drives every built page in Chromium -scripts/refresh-problems.mjs refreshes src/data/problems.json from LeetCode -scripts/verify/ runs every listing in five languages -verify// each lesson's test corpus and drivers -docs/ how the problem list was chosen; translation notes; screenshots -wrangler.jsonc Cloudflare: serve dist/ at learn.devmtnaing.com +src/pages/index.astro the hub +src/pages/profile.astro progress, the study plan, export and import +src/pages/leetcode/ the problem list and [slug].astro, which renders every lesson +src/lessons// one folder per LeetCode solution page +src/pages/ai-engineer/ AI Engineer overview, tracks, module guides, lesson steps, practice +course/ the AI Engineer course as markdown (the pages read it at build) +src/lib/ai/ course parser, quizzes, flashcards, the progress painter +src/components/ai/ Preact islands: lesson steps, practice, profile, progress rail +src/components/ the shell: section rail, section menu, search, theme +src/data/sections.ts the sections and each one's menu +src/lib/progress.ts progress for the whole site: XP per section, streaks, pace +src/lib/ the LeetCode kit: stepper, stage shapes, trees, i18n +src/styles/ tokens (one design, a teal and an indigo accent), shell, lessons, AI +scripts/ lesson check, browser audit, verify, screenshots, problem refresh +verify// each lesson's test corpus and drivers +docs/ how the problem list was chosen, translation notes, screenshots +wrangler.jsonc Cloudflare: serve dist/ at learn.devmtnaing.com ``` -The site is fully static: every page is prerendered and served as a file (the -AI Engineer's interactive steps are small Preact islands on those pages), so -there's no backend. A solution page is a folder of data and one step generator -per approach. The kit supplies the transport, code panel, language switching -and layout. Every lesson has a spec in `verify/`, so `npm run verify -- -` reruns exactly what its badges claim. +The site is fully static: every page is prerendered and served as a file, and +the interactive parts of the AI Engineer section are small Preact islands on +those pages. Progress lives in the browser (`localStorage`); export it from the +profile to move it. A LeetCode page is a folder of data and one step generator +per approach, and the kit supplies the rest. Every lesson has a spec in +`verify/`, so `npm run verify -- ` reruns exactly what its badges claim. ## License diff --git a/docs/screenshots/ai-path.png b/docs/screenshots/ai-path.png new file mode 100644 index 0000000..f595827 Binary files /dev/null and b/docs/screenshots/ai-path.png differ diff --git a/docs/screenshots/ai-quiz.png b/docs/screenshots/ai-quiz.png new file mode 100644 index 0000000..21ad25d Binary files /dev/null and b/docs/screenshots/ai-quiz.png differ diff --git a/docs/screenshots/burmese.png b/docs/screenshots/burmese.png index 2635661..4b5f72f 100644 Binary files a/docs/screenshots/burmese.png and b/docs/screenshots/burmese.png differ diff --git a/docs/screenshots/home.png b/docs/screenshots/home.png index 14ae3bc..0f2a2e5 100644 Binary files a/docs/screenshots/home.png and b/docs/screenshots/home.png differ diff --git a/docs/screenshots/problems.png b/docs/screenshots/problems.png new file mode 100644 index 0000000..cbd7f67 Binary files /dev/null and b/docs/screenshots/problems.png differ diff --git a/docs/screenshots/question.png b/docs/screenshots/question.png index 6c5db9b..b01abc6 100644 Binary files a/docs/screenshots/question.png and b/docs/screenshots/question.png differ diff --git a/docs/screenshots/walkthrough.png b/docs/screenshots/walkthrough.png index 0f11d95..d7f1730 100644 Binary files a/docs/screenshots/walkthrough.png and b/docs/screenshots/walkthrough.png differ diff --git a/package-lock.json b/package-lock.json index f647a34..42d8485 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "leetcode-solution-pages", + "name": "learn", "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "leetcode-solution-pages", + "name": "learn", "version": "0.1.0", "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index abfa50f..2622677 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "leetcode-solution-pages", + "name": "learn", "type": "module", "version": "0.1.0", "private": true, @@ -12,7 +12,8 @@ "audit": "node scripts/audit.mjs", "refresh-problems": "node scripts/refresh-problems.mjs", "deploy": "npm run build && wrangler deploy", - "serve": "wrangler dev" + "serve": "wrangler dev", + "screenshots": "node scripts/screenshots.mjs" }, "dependencies": { "@astrojs/preact": "^6.0.6", @@ -20,7 +21,7 @@ "marked": "^18.1.0", "preact": "^10.29.8" }, - "description": "Interactive, verified LeetCode solution pages — step through the algorithm, copy code that was run in five languages.", + "description": "learn.devmtnaing.com: interactive, verified LeetCode walkthroughs and the AI Engineer course, from backend engineer to AI research engineer.", "license": "MIT", "devDependencies": { "axe-core": "^4.13.0", diff --git a/scripts/screenshots.mjs b/scripts/screenshots.mjs new file mode 100644 index 0000000..2897202 --- /dev/null +++ b/scripts/screenshots.mjs @@ -0,0 +1,117 @@ +// Retakes the README screenshots in docs/screenshots/, in the dark theme at 2×. +// Run after `npm run build`; it serves dist/ itself, like the audit. +// +// npm run screenshots +// +// The pages are given a little sample progress (some XP, a solved problem, a +// finished module) so the progress parts aren't empty. It lives only in the +// browser this script starts. +import { createServer } from 'node:http'; +import { existsSync, readFileSync, statSync } from 'node:fs'; +import { resolve, dirname, extname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { chromium } from 'playwright'; + +const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..'); +const DIST = resolve(ROOT, 'dist'); +const OUT = resolve(ROOT, 'docs/screenshots'); +const TYPES = { '.html': 'text/html', '.js': 'text/javascript', '.css': 'text/css', '.svg': 'image/svg+xml', '.json': 'application/json' }; + +if (!existsSync(resolve(DIST, 'index.html'))) { + console.error('no dist/ — run `npm run build` first'); + process.exit(1); +} + +// /x is x.html, else x/index.html, as Cloudflare serves it +const server = createServer((req, res) => { + let file = join(DIST, decodeURIComponent(new URL(req.url, 'http://x').pathname)); + if (existsSync(`${file}.html`) && !(existsSync(file) && statSync(file).isFile())) file = `${file}.html`; + else if (existsSync(file) && statSync(file).isDirectory()) file = join(file, 'index.html'); + if (!existsSync(file)) return res.writeHead(404).end(); + res.writeHead(200, { 'content-type': TYPES[extname(file)] ?? 'application/octet-stream' }); + res.end(readFileSync(file)); +}); +await new Promise((ok) => server.listen(0, '127.0.0.1', ok)); +const BASE = `http://127.0.0.1:${server.address().port}`; + +const day = (n) => { + const d = new Date(); + d.setDate(d.getDate() - n); + return d.toLocaleDateString('en-CA'); +}; +const SAMPLE = { + pace: 'regular', + aiOnboarded: true, + aiTrack: 't1', + xp: { + leetcode: { [day(0)]: 20, [day(1)]: 40, [day(3)]: 20 }, + ai: { [day(0)]: 15, [day(1)]: 35, [day(2)]: 55, [day(4)]: 25 }, + }, + done: { 't1-1.1/concepts': true, 't1-1.1/resources': true, 't1-1.1/build': true, 't1-1.1/quiz': true, 't1-1.1/checkpoint': true, 't1-1.2/concepts': true }, + checked: { 'leetcode:two-sum': true, 'leetcode:valid-anagram': true }, + crowns: { 't1-1.1': true }, + quizBest: {}, + cards: {}, + recent: { + leetcode: { url: '/leetcode/trapping-rain-water', title: 'Trapping Rain Water', sub: 'LeetCode 42 · Hard', at: Date.now() - 3600e3 }, + ai: { url: '/ai-engineer/track-1/1-2/concepts', title: 'Working with model APIs', sub: 'Track 1 · 1.2', at: Date.now() }, + }, +}; + +const browser = await chromium.launch(); +const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 }, deviceScaleFactor: 2, colorScheme: 'dark' }); +await ctx.addInitScript((p) => localStorage.setItem('learn-progress-v1', p), JSON.stringify(SAMPLE)); +const page = await ctx.newPage(); + +// scroll so part 2·2 ("Watch it run") sits under the top bar +const toPlayer = () => page.evaluate(() => { + const n = [...document.querySelectorAll('.subsec-n')].find((e) => e.textContent.includes('2·2')); + const el = n?.closest('section, div') ?? document.querySelector('#lesson'); + window.scrollTo(0, el.getBoundingClientRect().top + window.scrollY - 72); +}); + +async function shot(name, path, { width = 1440, height = 900, ready, before } = {}) { + await page.setViewportSize({ width, height }); + await page.goto(BASE + path); + if (ready) await page.waitForSelector(ready); + if (before) await before(); + await page.evaluate(() => document.fonts.ready); + await page.waitForTimeout(300); + await page.screenshot({ path: resolve(OUT, `${name}.png`) }); + console.log(` ${name}.png ${path}`); +} + +await shot('home', '/', { ready: '.jbi' }); +await shot('problems', '/leetcode', { ready: '.prow' }); +await shot('question', '/leetcode/two-sum', { ready: '#lesson .atab' }); +await shot('walkthrough', '/leetcode/lowest-common-ancestor-of-a-binary-tree?step=4', { + width: 1280, + height: 1000, + ready: '#lesson .atab', + before: toPlayer, +}); +await shot('burmese', '/leetcode/trapping-rain-water?approach=pointers', { + width: 1280, + height: 1000, + ready: '#lesson .atab', + before: async () => { + await page.click('[data-lang-opt="my"]'); + await page.evaluate(() => { + const s = document.querySelector('#lesson [data-scrub]'); + s.value = s.max; + s.dispatchEvent(new Event('input', { bubbles: true })); + }); + await toPlayer(); + }, +}); +await shot('ai-path', '/ai-engineer/track-1', { ready: '.timeline' }); +await shot('ai-quiz', '/ai-engineer/track-1/1-4/quiz', { + ready: '.option', + before: async () => { + await page.click('.option:has-text("Keyword search")'); + await page.click('.footer .btn'); + }, +}); + +await browser.close(); +server.close(); diff --git a/src/components/ai/JumpBackIn.tsx b/src/components/ai/JumpBackIn.tsx index 8aad022..7c15bd3 100644 --- a/src/components/ai/JumpBackIn.tsx +++ b/src/components/ai/JumpBackIn.tsx @@ -26,7 +26,7 @@ export default function JumpBackIn({ units }: { units: UnitRef[] }) { if (next) cards.push({ key: 'ai', - color: next.color, + color: 'indigo', kicker: 'AI Engineer · up next', title: next.moduleTitle, sub: `${next.trackShort} · ${next.moduleLabel} · ${next.label}`, diff --git a/src/components/ai/Rail.tsx b/src/components/ai/Rail.tsx index ea7b734..87ce277 100644 --- a/src/components/ai/Rail.tsx +++ b/src/components/ai/Rail.tsx @@ -103,7 +103,7 @@ export default function Rail({ units, mode = 'ai' }: { units: UnitRef[]; mode?: AI Engineer - {totalXp(p, 'ai')} XP · {streak(p, 'ai')}-day streak · {crownCount(p)} crowns + {totalXp(p, 'ai')} XP · {streak(p, 'ai')}-day streak · {crownCount(p)} {crownCount(p) === 1 ? 'crown' : 'crowns'} diff --git a/src/lib/ai/course.ts b/src/lib/ai/course.ts index c2e5468..53a8eea 100644 --- a/src/lib/ai/course.ts +++ b/src/lib/ai/course.ts @@ -50,7 +50,7 @@ const block = (md: string) => const TRACKS = [ { id: 'setup', slug: 'setup', file: '00-setup/README.md', title: 'Setup', short: 'Setup', subtitle: 'Tools, GPUs and notes. Week 0.', color: 'slate', heading: /^## (?!Checkpoint)(\d+)\. (.+)$/ }, - { id: 't1', slug: 'track-1', file: 'track-1-ai-application-engineer/README.md', title: 'AI Application Engineer', short: 'Track 1', subtitle: 'Use models well: APIs, RAG, agents, MCP, evals.', color: 'teal', heading: /^## (1\.\d+) (.+)$/ }, + { id: 't1', slug: 'track-1', file: 'track-1-ai-application-engineer/README.md', title: 'AI Application Engineer', short: 'Track 1', subtitle: 'Use models well: APIs, RAG, agents, MCP, evals.', color: 'sky', heading: /^## (1\.\d+) (.+)$/ }, { id: 't2', slug: 'track-2', file: 'track-2-ml-systems-engineer/README.md', title: 'ML / AI Systems Engineer', short: 'Track 2', subtitle: 'Train, tune, optimise and serve models.', color: 'indigo', heading: /^### (2\.\d+) (.+)$/ }, { id: 't3', slug: 'track-3', file: 'track-3-research-engineer/README.md', title: 'AI Research Engineer', short: 'Track 3', subtitle: 'Understand and improve models.', color: 'rose', heading: /^### (3\.\d+) (.+)$/ }, { id: 'math', slug: 'math', file: 'math/README.md', title: 'Math Track', short: 'Math', subtitle: 'Runs alongside all three tracks.', color: 'amber', heading: /^## Level (\d): (.+)$/ }, diff --git a/src/styles/ai.css b/src/styles/ai.css index 9395144..f710f18 100644 --- a/src/styles/ai.css +++ b/src/styles/ai.css @@ -20,6 +20,7 @@ } .tc-slate{--c:#5F6B85;--ce:#46506A;--cs:#E9ECF3;--ct:#3D465C} .tc-teal{--c:#0B7077;--ce:#08545A;--cs:#DCF1F0;--ct:#08545A} +.tc-sky{--c:#0369A1;--ce:#075985;--cs:#E0F2FE;--ct:#075985} .tc-indigo{--c:#5141E0;--ce:#3A2DB8;--cs:#ECEBFF;--ct:#3A2DB8} .tc-rose{--c:#C2346A;--ce:#962550;--cs:#FDE8EF;--ct:#962550} .tc-amber{--c:#B4650A;--ce:#8A4C06;--cs:#FDF0DC;--ct:#7F4605} @@ -27,6 +28,7 @@ :root:not([data-theme="light"]){--xp:#F5B03C;--streak:#F2784F;--ok-edge:#2E8F62;--bad-edge:#B0533F} :root:not([data-theme="light"]) .tc-slate{--c:#8792AE;--ce:#5F6B85;--cs:#232838;--ct:#B5BDD2} :root:not([data-theme="light"]) .tc-teal{--c:#4FC0C9;--ce:#2A8F97;--cs:#103539;--ct:#6FD3DA} + :root:not([data-theme="light"]) .tc-sky{--c:#5CC3F2;--ce:#2B8FC0;--cs:#0C2D3F;--ct:#7FD3F7} :root:not([data-theme="light"]) .tc-indigo{--c:#A39AFF;--ce:#6E61E6;--cs:#25204F;--ct:#BDB6FF} :root:not([data-theme="light"]) .tc-rose{--c:#F27AA3;--ce:#C2346A;--cs:#3A1726;--ct:#F7A6C2} :root:not([data-theme="light"]) .tc-amber{--c:#F0A93E;--ce:#B4650A;--cs:#3A2A10;--ct:#F7C46E} @@ -34,6 +36,7 @@ :root[data-theme="dark"]{--xp:#F5B03C;--streak:#F2784F;--ok-edge:#2E8F62;--bad-edge:#B0533F} :root[data-theme="dark"] .tc-slate{--c:#8792AE;--ce:#5F6B85;--cs:#232838;--ct:#B5BDD2} :root[data-theme="dark"] .tc-teal{--c:#4FC0C9;--ce:#2A8F97;--cs:#103539;--ct:#6FD3DA} +:root[data-theme="dark"] .tc-sky{--c:#5CC3F2;--ce:#2B8FC0;--cs:#0C2D3F;--ct:#7FD3F7} :root[data-theme="dark"] .tc-indigo{--c:#A39AFF;--ce:#6E61E6;--cs:#25204F;--ct:#BDB6FF} :root[data-theme="dark"] .tc-rose{--c:#F27AA3;--ce:#C2346A;--cs:#3A1726;--ct:#F7A6C2} :root[data-theme="dark"] .tc-amber{--c:#F0A93E;--ce:#B4650A;--cs:#3A2A10;--ct:#F7C46E} @@ -345,3 +348,7 @@ a.s{text-decoration:none;color:var(--ink)} .plan-title{font-family:var(--display);font-size:18px;margin-top:4px} .plan-main small{color:var(--muted);line-height:1.5} .linkish{background:none;border:0;padding:0;font:inherit;color:var(--accent);font-weight:600;cursor:pointer;text-decoration:underline} + +/* answered options stay readable; only the ones not picked step back a little */ +.option:disabled{color:var(--ink-2)} +.option.right:disabled,.option.wrong:disabled{color:var(--ink)} diff --git a/wrangler.jsonc b/wrangler.jsonc index 80d885c..4bc1a02 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -12,7 +12,7 @@ // own: assets stay at the top level and are uploaded from the branch, and // the production route is not applied to Previews. { - "$schema": "node_modules/wrangler/config-schema.json", + "$schema": "node_modules/wrangler/config-schema.json" "name": "learn", "compatibility_date": "2026-09-25", "assets": {