feat(tour): post-login product tour foundation + M0/M0.5/M1#244
Open
artlut-eng wants to merge 1 commit into
Open
feat(tour): post-login product tour foundation + M0/M0.5/M1#244artlut-eng wants to merge 1 commit into
artlut-eng wants to merge 1 commit into
Conversation
First slice of the post-login tour spec from
design_handoff_tour_pos_login. Ships the foundation (state, components,
i18n) plus the first three modules end-to-end:
Foundation (`app/lib/tour/`)
- `constants.ts` module ids in order, 12 curated initial templates,
3 silent-seed fallbacks, sub map for the picker.
- `store.ts` zustand + AsyncStorage, keyed per character_id so
per-user state doesn't bleed between accounts.
Holds per-module status + in-memory stepIndex
shared across multiple `<TourModule>` mounts.
Also `useActiveTourStep()` for layout consumers
that need to reserve space behind the tooltip.
- `eventBus.ts` counter-based emit/listen bus. Steps with
`awaitEvent` advance on emission; baseline-at-mount
pattern means only NEW emits count.
- `m1Steps.ts` config for M1.
Components (`app/components/tour/`)
- `FullScreenStep` reusable Perceva-branded hero panel (used by M0).
- `TourStep` non-blocking tooltip overlay — `pointerEvents:
'box-none'`, no dim, only the card catches touches.
Floats above the BottomNavBar via `useBottomNavClearance`.
- `TourModule` generic runner: respects per-screen filtering via
`screen` prop, drives advance via Next / awaitEvent
/ autoAdvanceMs, calls optional `onExitScreen`
after navigation away.
Modules
- M0 `/tour/m0` — welcome card with name + Começar/Pular.
- M0.5 `/tour/m0-5` — grid of 12 selectable cards; "Continuar"
enables at exactly 3. Skipping silently seeds 3 defaults
(dexterity/stretch, learn/read, circle/message) — but only
when the user has fewer than 3 tasks already, and never
duplicates templates they already own.
- M1 5 interactive spotlights on Home + task-form:
1. tap a task (awaitEvent task:tapped)
2. detail screen (Next-to-advance, lives on /task-form)
3. long-press (awaitEvent task:long-pressed)
4. mark as done (awaitEvent task:completed)
5. expand drawer (awaitEvent drawer:expanded)
Closing /task-form via the screen's own X / save / back
auto-advances to step 3 via `useFocusEffect` so the user is
never stranded.
Wiring
- AuthGate (in `_layout.tsx`) routes new authenticated users to
/tour/m0 when M0 status is `pending` and onboarding slides are done.
- Settings "Refazer onboarding" now also resets every tour module
(temporary catch-all until per-module replay lands).
- Home (`(tabs)/index.tsx`) emits task:tapped / task:long-pressed /
task:completed / drawer:expanded; bumps scroll paddingBottom by
160px while a bottom tooltip is visible so the relevant content
settles just above the card.
- task-form emits step 2 + auto-advances on blur.
- CompletedBucket gains an optional `onToggle(open)` callback.
- useNotificationsSetup early-returns on web (notifications module
has no web shim — was crashing the login flow there).
DB
- `supabase/migrations/20260602000002_start_task_from_template_fix.sql`
fixes a latent bug in the May-24 RPC that still referenced legacy
`task_template.sub_id` + difficulty/metric columns (dropped in the
multi-sub migration). Was undetected until M0.5 became the first
caller exercising the adoption path. Already applied to cloud.
i18n
- `tour.common.*` + `tour.m0.*` + `tour.m0_5.*` + `tour.m1.step{1..6}.*`
in PT and EN.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumo
Primeiro checkpoint estável do tour pós-login (
tour-pos-login.md). Entrega a fundação modular + os três primeiros módulos (M0 Boas-vindas, M0.5 Escolher 3 tarefas, M1 Tour interativo de Tasks). M2–M6 e Wrap-up virão em PRs separadas.Foundation
lib/tour/store.ts) — Zustand + AsyncStorage porcharacter_id(rpgtasks.tour.v1.{id}). Persistemodules(status por módulo), mantémstepIndicesem memória pra módulos multi-tela compartilharem progresso.resetAll()pro botão de Settings.lib/tour/eventBus.ts) — Contador por evento. Cada<TourModule>guarda baseline no mount do step e só avança em emissões NOVAS.useActiveTourStepStorepropaga{module, position}pra Home reservar scroll bump abaixo do tooltip.Componentes
TourStep— Tooltip não-bloqueante (pointerEvents: 'box-none'), sem dim band, card com sombra forte. Bottom padding viauseBottomNavClearance.FullScreenStep— Painel cheio Perceva-branded pra M0 e Wrap-up futuro.TourModule— Runner genérico: filtro porscreen, avanço por Próximo / evento / timer, callbacksonExitScreen(pra fechar detalhes ao avançar) eonComplete.Módulos
app/tour/m0.tsx) — Full-screen Perceva. Skip semeia 3 templates default só se o user tem<3tarefas.app/tour/m0-5.tsx) — Grid de 12 cards curados (1 por sub-atributo). Cards já adotados ficam dimmed com badge. Skip respeita o mesmo guard de M0.task-form; X / Próximo fecham detail viaonExitScreen.useFocusEffectem task-form garante avanço mesmo quando o user fecha por hardware back.Wiring
/tour/m0quandom0Status === 'pending'e onboarding já visto.tourBottomBumpbaseado nopositiondo step ativo.onToggle?(open)pra emitir DRAWER_EXPANDED.useOnboardingStore+useTourStore(catch-all temporário; per-module replay vem depois).i18n
tour.common.*,tour.m0.*,tour.m0_5.*,tour.m1.step{1..5}.*em pt-BR e en-US.Bugfixes que entraram junto
useNotificationsSetupagora guardaPlatform.OS !== 'web'— expo-notifications não tem shim web e crashava o bundle no Metro local.circle_message: record 'v_template' has no field 'sub_id'— Já mergeado na main via feat(learning): summary — Deep Work (Cal Newport) #242, mas o arquivo está aqui também (resolvido pelo rebase pra ficar igual main).Test plan
/tour/m0Follow-ups