feat(web): redesign onboarding and home after design critique
Onboarding: - Keep the current step in ?step= so the device back gesture moves one step back; effectiveStep guards skipping the plan and re-opening the group form after the group exists. Show Back on mobile. - Format prices with the chosen country's currency (form prefix and confirmation). - Welcome describes the real flow and previews the WhatsApp payment reminder; the last step shares the group's invite link instead of listing settings chores. - Accessibility: named stepper steps with aria-current, focus moves to the new step heading, alerts on errors, reduced-motion and direction-aware step animation, 48px primary actions. - Group form split into "classes" and "billing", due day hidden for per-class billing; Stripe skips the empty Pro confirmation; Free features read "in Pro" instead of struck through. Home: - Payments section follows the plan: Free gets a locked preview with an upgrade link and is never asked to link Mercado Pago. - Secondary text meets 4.5:1 contrast; accent-fg for links in dark. - Class times use a 24h clock in Spanish and Portuguese. - Drop the summary tiles; one hero for the current or next class, the rest of the day as compact rows; two columns on desktop. - "Para atender" reads the shared ['attention'] query, so resolved alerts match "Requiere atención", with WhatsApp shortcuts and a link to the full list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { useNavigate } from '@tanstack/react-router'
|
||||
import { Loader2 } from 'lucide-react'
|
||||
import { useEffect } from 'react'
|
||||
import { useEffect, useLayoutEffect, useRef } from 'react'
|
||||
import { Logo, LogoIcon } from '../../components/brand'
|
||||
import { Button } from '../../components/ui'
|
||||
import { cn } from '../../lib/utils'
|
||||
import { useAuth } from '../../context/AuthProvider'
|
||||
import { ConfirmationStep } from './ConfirmationStep'
|
||||
import { CountryStep } from './CountryStep'
|
||||
@@ -32,6 +33,32 @@ export function OnboardingView() {
|
||||
statusQuery,
|
||||
} = useOnboarding()
|
||||
|
||||
/* Al cambiar de paso: se sabe hacia dónde se movió (para la animación) y el
|
||||
foco pasa al título del paso nuevo, así el lector de pantalla lo anuncia y
|
||||
el teclado sigue desde ahí. Si el paso ya enfocó su primer campo
|
||||
(`autoFocus`), se respeta. */
|
||||
const stepIndex = steps.indexOf(step)
|
||||
const previousIndex = useRef(stepIndex)
|
||||
const direction = stepIndex < previousIndex.current ? 'back' : 'forward'
|
||||
const stepContainer = useRef<HTMLDivElement>(null)
|
||||
const isFirstStep = useRef(true)
|
||||
useLayoutEffect(() => {
|
||||
previousIndex.current = stepIndex
|
||||
}, [stepIndex])
|
||||
useEffect(() => {
|
||||
if (isFirstStep.current) {
|
||||
isFirstStep.current = false
|
||||
return
|
||||
}
|
||||
window.scrollTo({ top: 0 })
|
||||
const container = stepContainer.current
|
||||
if (!container || container.contains(document.activeElement)) return
|
||||
const heading = container.querySelector<HTMLElement>('h1, h2')
|
||||
if (!heading) return
|
||||
heading.tabIndex = -1
|
||||
heading.focus({ preventScroll: true })
|
||||
}, [step])
|
||||
|
||||
useEffect(() => {
|
||||
if (statusQuery.data?.completed) {
|
||||
void navigate({ to: '/' })
|
||||
@@ -53,7 +80,7 @@ export function OnboardingView() {
|
||||
<span className="mx-auto flex size-14 items-center justify-center rounded-2xl bg-accent-soft">
|
||||
<LogoIcon className="size-8" />
|
||||
</span>
|
||||
<h1 className="text-2xl font-bold text-primary">{t('signedOut.title')}</h1>
|
||||
<h1 className="text-2xl font-bold text-primary text-balance">{t('signedOut.title')}</h1>
|
||||
<p className="text-sm text-foreground/60">
|
||||
{t('signedOut.description')}
|
||||
</p>
|
||||
@@ -80,7 +107,7 @@ export function OnboardingView() {
|
||||
const firstName = user.name?.trim().split(/\s+/)[0] ?? t('fallbackName')
|
||||
|
||||
return (
|
||||
<main className="mx-auto flex min-h-dvh w-full max-w-md flex-col px-4 pb-12 pt-8 sm:pt-12">
|
||||
<main className="mx-auto flex min-h-dvh w-full max-w-md flex-col px-4 pt-8 pb-[calc(3rem+env(safe-area-inset-bottom))] sm:pt-12">
|
||||
<header className="mb-6 flex items-center justify-center">
|
||||
<Logo className="h-6" />
|
||||
</header>
|
||||
@@ -89,10 +116,17 @@ export function OnboardingView() {
|
||||
los pasos que se van a recorrer. */}
|
||||
<Stepper
|
||||
steps={steps.map((id) => ({ label: t(`steps.${id}`) }))}
|
||||
current={steps.indexOf(step)}
|
||||
current={stepIndex}
|
||||
/>
|
||||
|
||||
<div key={step} className="mt-8 animate-step-enter">
|
||||
<div
|
||||
key={step}
|
||||
ref={stepContainer}
|
||||
className={cn(
|
||||
'mt-8 motion-reduce:animate-none [&_h1]:outline-none [&_h2]:outline-none',
|
||||
direction === 'back' ? 'animate-step-enter-back' : 'animate-step-enter',
|
||||
)}
|
||||
>
|
||||
{step === 'welcome' ? <WelcomeStep name={firstName} onNext={goNext} /> : null}
|
||||
{step === 'country' ? <CountryStep onNext={goNext} onBack={goBack} /> : null}
|
||||
{step === 'plan' ? <PlanStep /> : null}
|
||||
@@ -107,7 +141,9 @@ export function OnboardingView() {
|
||||
onBack={goBack}
|
||||
onCompleted={(group) => {
|
||||
setCreatedGroup(group)
|
||||
goTo('done')
|
||||
// Reemplaza: el formulario ya no tiene que quedar en el historial
|
||||
// (volver a él crearía otro grupo).
|
||||
goTo('done', { replace: true })
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
Reference in New Issue
Block a user