Skip to content

feat: Peanut Welcome Club onboarding quiz (static HTML in public/)#2471

Merged
abalinda merged 3 commits into
devfrom
feat/onboarding-quiz
Jul 23, 2026
Merged

feat: Peanut Welcome Club onboarding quiz (static HTML in public/)#2471
abalinda merged 3 commits into
devfrom
feat/onboarding-quiz

Conversation

@0xkkonrad

@0xkkonrad 0xkkonrad commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

The Welcome-@anon handbook's real pitfalls — comms rules (zero follow-ups, @silent, SHIFT+reply), thread hygiene, task ownership, Definition of Done, sick/weekend policy, security, invoicing, referral tree — as a 23-question quiz so new joiners actually retain them. Questions curated + approved by Konrad from the Notion onboarding pages.

Follows the quiz paved path (same engine as the dev-quiz PR #2465, reskinned "ironically kawaii"): ONE self-contained static HTML file in public/onboarding-quiz/ — zero deps, zero build-graph impact, served ungated at peanut.me/onboarding-quiz/index.html after prod release.

  • public/onboarding-quiz/index.html — the quiz (23 Qs: 7 easy / 8 mid / 8 hard, levels, points, streaks, clown option, retry-missed, 1080×1080 share card)
  • /dev index — new entry with static: true → plain <a> (public/ files aren't app routes). Mechanism is line-identical to feat(dev): funnel-definitions quiz — 1337 squ1rr3l squ4d (single static HTML) #2465's so both merge cleanly.
  • .prettierignorepublic/onboarding-quiz/ (hand-tuned inline CSS/JS)

Risks / breaking changes

None. Static file copied at deploy; no bundle/build-graph impact. Only app-code change is the /dev tools list. Content is internal-handbook material, intentionally world-readable (no secrets, no sensitive numbers).

QA

Headless playwright against the static file, 375px + 1280px:

  • 23 questions render; clown option is always last on every question; zero page errors
  • full logical run: correct/wrong/clown paths, scoring (21/23 → CERTIFIED BESTIE, 5400 pts), retry-missed loop re-runs exactly the missed set
  • screenshots eyeballed: start, question, correct, wrong, clown, final rank

Local gate: prettier ✅ · typecheck ✅ (0 errors in changed files; pre-existing @capacitor TS2307s are the known stale-worktree-env artifact) · jest: 3 pre-existing failing suites untouched by this diff (countryCurrencyMapping, GeneralRecipientInput, request-states) — CI is the arbiter.

Summary by CodeRabbit

  • New Features

    • Added the Peanut Welcome Club onboarding quiz with multiple difficulty levels, scoring, streak bonuses, explanations, and rank results.
    • Added replay and “retry missed questions” options.
    • Added shareable result cards with clipboard copying or download support.
    • Added the quiz to the development tools page.
  • Chores

    • Excluded the hand-crafted quiz page from automatic formatting.

Design notes / accepted trade-offs

  • Engine is a deliberate clone of the dev-quiz template (quiz-creator paved path) — intra-file duplication stays aligned with the template rather than being refactored here.
  • Review hardening landed post-open: Safari clipboard activation (ClipboardItem wraps the Promise synchronously), null-blob guard, deferred revokeObjectURL, document.hidden guard on the rain canvas, question count derived from QUESTIONS.length, fallback feedback routed to the clicked button.
  • Known low-impact skip: Serwist defaultCache can serve a briefly-stale copy of the static HTML right after a deploy (template-wide, short window given skipWaiting+clientsClaim).
  • Follow-up (not this PR): upstream the shareCard fixes to the dev-quiz template in PR feat(dev): funnel-definitions quiz — 1337 squ1rr3l squ4d (single static HTML) #2465.

The Welcome-@anon handbook's real pitfalls (comms rules, urgency
hierarchy, task ownership, DoD, sick/weekend policy, security,
invoicing) as a 23-question quiz, so new joiners actually retain them.
Single self-contained file in public/ per the quiz paved path: zero
deps, zero build-graph impact. Linked from /dev with a plain <a>
(public/ files aren't app routes). Prettier-ignored like dev-quiz:
hand-tuned inline CSS/JS.
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
peanut-wallet Ready Ready Preview, Comment Jul 22, 2026 1:59pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3d58ee0c-fc72-4823-850d-b0ade0a55798

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a standalone “PEANUT WELCOME CLUB” onboarding quiz with scoring, animations, results, and share-card generation. The Dev Tools page links to it using standard navigation for the public static file, and Prettier ignores the quiz directory.

Changes

Onboarding quiz

Layer / File(s) Summary
Quiz page structure and content
.prettierignore, public/onboarding-quiz/index.html
Defines the standalone page, embedded styling, quiz sections, question data, scoring constants, and rank thresholds.
Quiz runtime and share interactions
public/onboarding-quiz/index.html
Adds quiz state management, answer scoring, streaks, completion results, animations, boot behavior, and canvas-based share cards.
Dev Tools static-page integration
src/app/(mobile-ui)/dev/page.tsx
Adds the Peanut Welcome Club tool and uses plain anchors for static public pages while preserving Next.js links for app routes.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels: enhancement

Suggested reviewers: hugo0

Sequence Diagram(s)

sequenceDiagram
  participant DevToolsPage
  participant Browser
  participant QuizRuntime
  participant ShareCanvas
  participant Clipboard
  DevToolsPage->>Browser: Open Peanut Welcome Club link
  Browser->>QuizRuntime: Load static quiz page
  QuizRuntime->>Browser: Render questions and update score
  Browser->>QuizRuntime: Submit answers and finish run
  QuizRuntime->>ShareCanvas: Render result card
  ShareCanvas->>Clipboard: Copy generated PNG when supported
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: a new Peanut Welcome Club onboarding quiz delivered as a static HTML page in public/.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/onboarding-quiz

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Code-analysis diff

Painscore total: 6233.83 → 6233.08 (-0.75)
Findings: 0 net (+2 new, -2 resolved)

🆕 New findings (2)

  • medium high-mdd — src/app/(mobile-ui)/dev/page.tsx:8 — DevToolsPage: MDD 27.0 (uses across many lines from declarations)
  • medium complexity — src/app/(mobile-ui)/dev/page.tsx — CC 4, MI 59.69, SLOC 37

✅ Resolved (2)

  • src/app/(mobile-ui)/dev/page.tsx:8 — DevToolsPage: MDD 54.0 (uses across many lines from declarations)
  • src/app/(mobile-ui)/dev/page.tsx — CC 3, MI 62.19, SLOC 31

📈 Painscore deltas (top movers)

File Before After Δ
src/app/(mobile-ui)/dev/page.tsx 8.5 7.8 -0.8

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

🧪 UI test report — ✅ all green

Suites

  • unit: 2012 ran, 0 failed, 0 skipped, 36.3s

📊 Coverage (unit)

metric %
statements 59.8%
branches 43.4%
functions 48.7%
lines 60.1%
⏱ 10 slowest test cases
time test
4.1s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › never places two stickers in heavy overlap (broad seed sweep)
1.2s src/utils/__tests__/demo-api.test.ts › isDemoMode() is false when not running under Capacitor
0.6s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › every sticker stays within canvas at any count
0.3s src/app/actions/__tests__/api-headers.test.ts › should include Content-Type in validateInviteCode
0.3s src/app/(mobile-ui)/withdraw/__tests__/withdraw-states.test.tsx › Bank withdrawal keeps the $1 minimum for sub-$1 amounts
0.3s src/app/actions/__tests__/api-headers-extended.test.ts › should not include apiKey in validateInviteCode body
0.3s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › keeps stickers off the username pill (final pass respects the keep-out)
0.2s src/utils/__tests__/demo-balance.test.ts › resetDemoBalance refills and restarts the TTL window
0.2s src/utils/__tests__/demo-balance.test.ts › debits and floors at zero
0.2s src/utils/__tests__/demo-balance.test.ts › keeps a spent-down balance across a cold start within the TTL
📍 Inline annotations are in the **Unit test report** check above. Coverage artifact: `coverage-unit`. Generated by `.github/workflows/tests.yml`.

@0xkkonrad

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@public/onboarding-quiz/index.html`:
- Around line 538-587: Update the fallback branch in shareCard so feedback
targets the button corresponding to mode: when mode is 'copy', update btnCopy
after the fallback download; otherwise retain btnDl for download mode. Preserve
the existing download behavior and reset the same button’s label after the
timeout.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 457d12bb-e448-4cc3-a7ce-bc2c90a6d032

📥 Commits

Reviewing files that changed from the base of the PR and between 74f02f5 and c9aa2f5.

📒 Files selected for processing (3)
  • .prettierignore
  • public/onboarding-quiz/index.html
  • src/app/(mobile-ui)/dev/page.tsx

Comment thread public/onboarding-quiz/index.html
Safari drops transient user activation across the awaited toBlob, so
clipboard.write always rejected and COPY silently became a download —
construct the ClipboardItem synchronously around the Promise<Blob>.
Guard the null-blob path (createObjectURL(null) threw uncaught and
killed both buttons), defer revokeObjectURL past the download fetch,
skip petal-rain repaints while the tab is hidden, and derive the boot
banner count from QUESTIONS.length.
@0xkkonrad
0xkkonrad marked this pull request as ready for review July 22, 2026 13:59
@0xkkonrad
0xkkonrad requested a review from Hugo0 July 22, 2026 13:59
@abalinda
abalinda merged commit f2c427f into dev Jul 23, 2026
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants