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:
Jose Selesan
2026-11-06 09:58:08 -03:00
parent 70ef049f34
commit 2d80af082f
48 changed files with 1507 additions and 784 deletions

View File

@@ -0,0 +1,54 @@
import { describe, expect, test } from 'bun:test'
import type { ClassTodayDto } from '@gruperly/shared'
import { classState, planDay } from '../src/features/home/day'
import { formatClockTime } from '../src/lib/format'
function session(id: string, startsAt: string, hasAttendance = false): ClassTodayDto {
return {
sessionId: id,
groupId: `g-${id}`,
groupName: `Grupo ${id}`,
startsAt,
enrolledCount: 5,
capacity: 10,
availableSlots: 5,
hasAttendance,
}
}
const now = new Date('2026-11-05T22:00:00.000Z')
describe('el día del Inicio', () => {
test('estado de cada clase', () => {
expect(classState(session('a', '2026-11-05T23:00:00.000Z'), now)).toBe('upcoming')
expect(classState(session('b', '2026-11-05T21:00:00.000Z'), now)).toBe('live')
expect(classState(session('c', '2026-11-05T18:00:00.000Z'), now)).toBe('missed')
expect(classState(session('d', '2026-11-05T21:00:00.000Z', true), now)).toBe('taken')
})
test('el hero es la clase en curso o la próxima sin asistencia; el resto va en orden', () => {
const morning = session('m', '2026-11-05T12:00:00.000Z', true)
const live = session('l', '2026-11-05T21:30:00.000Z')
const later = session('n', '2026-11-05T23:30:00.000Z')
const { hero, rest } = planDay([later, morning, live], now)
expect(hero?.sessionId).toBe('l')
expect(rest.map((item) => item.sessionId)).toEqual(['m', 'n'])
})
test('terminado el día no hay hero: las clases quedan en la lista', () => {
const missed = session('x', '2026-11-05T18:00:00.000Z')
const taken = session('y', '2026-11-05T19:00:00.000Z', true)
const { hero, rest } = planDay([taken, missed], now)
expect(hero).toBeNull()
expect(rest.map((item) => item.sessionId)).toEqual(['x', 'y'])
})
})
describe('hora de una clase', () => {
test('24 h en español y portugués', () => {
const date = new Date(2026, 10, 5, 19, 0)
expect(formatClockTime(date, 'es-AR')).toBe('19:00')
expect(formatClockTime(date, 'pt-BR')).toBe('19:00')
expect(formatClockTime(new Date(2026, 10, 5, 9, 5), 'es-419')).toBe('09:05')
})
})

View File

@@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
import type { OnboardingStatusDto } from '@gruperly/shared'
import { resumeStep, visibleSteps } from '../src/features/onboarding/steps'
import { effectiveStep, parseStep, resumeStep, visibleSteps } from '../src/features/onboarding/steps'
function status(overrides: Partial<OnboardingStatusDto> = {}): OnboardingStatusDto {
return {
@@ -46,3 +46,30 @@ describe('pasos del onboarding', () => {
).toBe('group')
})
})
describe('paso pedido por la URL', () => {
test('solo acepta ids de pasos conocidos', () => {
expect(parseStep('plan')).toBe('plan')
expect(parseStep('nope')).toBeUndefined()
expect(parseStep(undefined)).toBeUndefined()
expect(parseStep(3)).toBeUndefined()
})
test('sin plan elegido no se pasa del paso Plan', () => {
expect(effectiveStep('group', { plan: null, hasCreatedGroup: false })).toBe('plan')
expect(effectiveStep('payment', { plan: null, hasCreatedGroup: false })).toBe('plan')
expect(effectiveStep('country', { plan: null, hasCreatedGroup: false })).toBe('country')
})
test('con Free no se muestran Cobros ni WhatsApp', () => {
expect(effectiveStep('payment', { plan: 'FREE', hasCreatedGroup: false })).toBe('group')
expect(effectiveStep('whatsapp', { plan: 'FREE', hasCreatedGroup: false })).toBe('group')
expect(effectiveStep('payment', { plan: 'PRO', hasCreatedGroup: false })).toBe('payment')
})
test('"Listo" necesita el grupo creado, y con el grupo creado no se vuelve al formulario', () => {
expect(effectiveStep('done', { plan: 'PRO', hasCreatedGroup: false })).toBe('group')
expect(effectiveStep('group', { plan: 'PRO', hasCreatedGroup: true })).toBe('done')
expect(effectiveStep('plan', { plan: 'FREE', hasCreatedGroup: true })).toBe('done')
})
})