No description
  • TypeScript 92.1%
  • CSS 4.3%
  • JavaScript 3.3%
  • HTML 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-12-03 15:48:14 +00:00
e2e apply: implement the change and its tests 2026-12-03 05:54:00 +00:00
openspec Archive answering-the-tree-of-the-day-performs-t-s1b68w 2026-12-03 15:48:14 +00:00
public fix: a new build replaces the saved home page 2026-12-02 15:44:42 -05:00
scripts apply: implement the change and its tests 2026-11-19 01:31:32 +00:00
src apply: implement the change and its tests 2026-12-03 05:54:00 +00:00
.gitignore propose: the change, its specs, its tasks and its estimate 2026-11-18 22:56:48 +00:00
.npmrc propose: the change, its specs, its tasks and its estimate 2026-11-18 22:56:48 +00:00
.nvmrc propose: the change, its specs, its tasks and its estimate 2026-11-18 22:56:48 +00:00
AGENTS.md propose: the change, its specs, its tasks and its estimate 2026-11-18 22:56:48 +00:00
index.html apply: implement the change and its tests 2026-11-19 01:31:32 +00:00
package-lock.json apply: implement the change and its tests 2026-11-19 01:31:32 +00:00
package.json apply: implement the change and its tests 2026-11-19 01:31:32 +00:00
playwright.config.ts apply: implement the change and its tests 2026-11-19 01:31:32 +00:00
README.md apply: implement the change and its tests 2026-12-02 19:07:25 +00:00
tsconfig.json apply: implement the change and its tests 2026-11-19 01:31:32 +00:00
vite.config.ts apply: implement the change and its tests 2026-11-19 01:31:32 +00:00

Flash Leaf

Flash Leaf is a mobile-friendly PWA game: identify North American trees from a leaf photograph, with an optional whole-tree hint, a shared daily puzzle with a historical tidbit, and day-to-day stats. It is a fully static app — no backend, no accounts, no runtime data dependency — and works offline.

Run it

Built and tested with Node 26, the version .nvmrc names; nvm use picks it.

npm install
npm run dev        # dev server at http://127.0.0.1:5173

Or the production build:

npm run build
npm run preview    # serves the build at http://127.0.0.1:4173

Use it

  • Tree of the Day — one shared puzzle per UTC day, playable once per day. The completion screen says whether your answer was right ("Correct!" or "Not this time"), shows the leaf and whole-tree photographs with the common and botanical name, and lists the stats: the points, the time taken from opening the puzzle to answering, the species' rarity tier and whether the hint was used. The species' historical tidbit is revealed underneath. A correct answer is celebrated with a full-screen confetti — 144 pieces, four times the practice burst, each one larger and lasting at least twice as long, in three staggered waves; a wrong answer gets no celebration.
  • Opening a day you already finished — the home button then reads "View today’s tree" and opens the same screen as a review, read back from the stored result: both photographs, both names, your answer, the points, the time taken, the hint use and the tidbit, with "Come back tomorrow for the next tree." in place of a fresh question, and no further points awarded. The review shows the species the record names, so it stays the tree you were actually served. A day completed before daily results were kept shows the photographs, the names and the tidbit of that date's species, and no answer, points, time or hint — those were never recorded, and nothing is invented for them.
  • Practice — an unlimited run of questions dealt from a shuffled bag of the whole catalog, so every species appears exactly once before the bag reshuffles for a fresh pass; stop it any time to see a session summary of the points, correct and wrong answers.

Each question shows a leaf photograph and exactly four options, each labeled with the common and botanical name. Hint reveals the whole-tree photograph. Scoring is by the target species' rarity: a correct answer earns 100 points for a common tree, 150 for an uncommon tree and 200 for a rare tree, half as much when the hint was used (50, 75 or 100), and 0 for a wrong answer — the same table in practice and the tree of the day. Points, correct/wrong counts and the daily streak are stored on the device.

Test it

npm test               # unit tests (Vitest)
npx playwright test    # browser smoke test (Playwright, against the production build)

The app can also be driven by script: the page exposes window.__app, where getState() returns the whole screen as plain data and startPractice(), startTreeOfTheDay(), chooseOption(i), useHint(), next(), finish() and home() are the player's own actions. Three test-only setters pin what is otherwise unpredictable: setSeed(n) the practice shuffle, setDate('YYYY-MM-DD') the UTC day being played, and setDailyElapsedMs(ms) the time taken recorded with the day's puzzle result. getState().stats.dailyResult is that stored result for the day in view — the species served, its correctness, the points, the hint use and elapsedMs — or null when the day has no recorded result, which is also the case for a day completed before results were stored. While the completion or review screen is on display, getState().results also carries outcome ('correct', 'wrong', or null for a day with no stored result), the stats shown on it, and the review species whose photographs and names are drawn.