Skip to content

Offer new users the targets wizard once - #5

Merged
Oliver-Johnson merged 7 commits into
masterfrom
claude/onboarding-wizard
Oct 7, 2026
Merged

Oliver-Johnson merged 7 commits into
masterfrom
claude/onboarding-wizard

Conversation

@Oliver-Johnson

Copy link
Copy Markdown
Owner

Checks

  • I have not edited index.html or sw.js without understanding the PWA cache implications
  • The version string in index.html has been bumped (format: Version YYYY-MM-DD.N), now 2026-10-06.3 in both files
  • manifest.json is still valid JSON (unchanged)
  • The app works offline after the change (no change to sw.js other than the version)
  • CI passes (version consistency, .nojekyll, symlinks, conflict markers)

What this changes

Before: the targets wizard never opened by itself, so every new user started on the default 2,500 kcal. recordTodayTargets() saves the defaults for today on every launch, and checkOnboarding() ran after it and found them. It has been like this since the first commit.

After: a new user is offered the wizard once, after the tour or after Skip Tutorial. Returning users never see it. A returning user is anyone with saved settings, targets from an earlier day, or logged data. It never opens while the tour's demo data is active.

How: checkOnboarding() uses the checks above instead of "any targets exist", and sets mt_onboarding_offered once it has offered the wizard. tourSkip() calls it too. Also bumps the version to 2026-10-06.3 and updates What's New and the changelog.

Testing done

  • 44/44 smoke tests pass locally on the 4 Chromium devices. The tour and import tests now close the wizard, and a new test checks it opens once for a new user and not again after a reload.
  • Checked an existing user's data (settings, older targets, a food log) never triggers it.
  • Checked by screenshot that it shows as a centred dialog at 1440 wide in the beta styles and fits at 390 wide.
  • Ran CI's checks locally. All pass.

Notes for reviewer

This builds on #4, #2 and #1. Merge those first; this PR's own changes are commits c4ab1e7 and 41b0f70.

🤖 Generated with Claude Code

https://claude.ai/code/session_019C67htt6KV7fmxsGCf5FR7


Generated by Claude Code

claude added 6 commits October 6, 2026 10:04
…6-10-06.1)

seedCustomFoods() ran on every launch and added 11 foods to each user's
custom foods list, re-adding any the user had deleted. The list is now
only used as a fibre lookup. Existing users keep whatever is already in
their list.

Also removes plans/training_plan_2026.md, which held personal health
data, and corrects the v2026-09-02.2 changelog date.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019C67htt6KV7fmxsGCf5FR7
…(v2026-10-06.2)

- Trends and Macro History: dates under the charts were cut off; the
  Trends kg/kcal labels overlapped the top axis values and the end bars
  covered the axis numbers.
- History calendar: an inline padding override put "Jump to Today"
  behind the bottom nav, so tapping it opened Settings.
- Additional Nutrients in Manual and Quick Add never collapsed because
  no .hidden rule existed. It now collapses on tap and stays open by
  default, as users see it today.
- Macro breakdown popup: escape food names before inserting them.
- First-run tour: steps whose target is hidden show the tip centred.
- Ko-fi card on tablets sits above the bottom nav.
- Docs: What's New cards now reveal in Chrome; the observer watched a
  card clipped to nothing, which never intersects.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019C67htt6KV7fmxsGCf5FR7
Adds tests/smoke.spec.js and tests/playwright.config.js, run in CI by
.github/workflows/test.yml on Chromium (Galaxy S8, Pixel 7, 320x568,
Desktop 1440x900) and WebKit (iPhone SE, iPhone 15 Pro Max, iPad Mini).

Each test blocks all non-localhost requests and the service worker, and
fails on any uncaught page error. Coverage:
- fresh load: welcome screen shown, no horizontal overflow, nav on screen
- tour demo data is removed afterwards and never replaces real data
- every nav tab opens its view without overflow
- Quick Add shows on Today, updates the calorie total, survives reload
- sheet primary buttons are not covered by the bottom nav
- export JSON, wipe storage, import JSON restores the log

The History calendar test is marked test.fail(): its "Jump to Today"
button sits behind the bottom nav on every device (the date-modal has an
inline padding-bottom that overrides the 7 Sep fix).

MT_BROWSERS picks engines (default chromium,webkit). No app code changed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019C67htt6KV7fmxsGCf5FR7
checkOnboarding() looked for any daily targets, but recordTodayTargets()
saves the defaults for today on every launch before it runs, so the
wizard never opened and new users started on 2500 kcal. It now treats
saved settings, targets from an earlier day or logged data as a
returning user, offers the wizard once (also after Skip Tutorial), and
remembers that it did.

Smoke tests: the tour and import tests expect the wizard and close it,
and a new test checks it opens once.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019C67htt6KV7fmxsGCf5FR7
The bug was fixed in v2026-10-06.2, so the test passes. knownBug now
takes a description for any scenario marked as failing later.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019C67htt6KV7fmxsGCf5FR7
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019C67htt6KV7fmxsGCf5FR7
checkOnboarding() runs synchronously in the init block, but
openTDEEWizard() assigns obActivityMult, obGoalAdj and obDietType, which
are let-declared further down the script. When the wizard is offered at
launch (tour finished or skipped earlier the same day on an older
version, nothing logged, no settings saved) this threw a ReferenceError
that stopped the rest of the script: the wizard never opened but was
marked as offered, and Trends, Recalculate targets, the tour and its
demo-data cleanup listeners were broken for that session.

The launch-time check now runs after the script has finished. A smoke
test covers the launch path.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CRtr2mPSPusKdCyJWSbct5
@Oliver-Johnson
Oliver-Johnson merged commit 913742b into master Oct 7, 2026
2 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