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:
41
apps/web/src/features/home/day.ts
Normal file
41
apps/web/src/features/home/day.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import type { ClassTodayDto } from '@gruperly/shared'
|
||||
|
||||
/* El día del profe, como funciones puras: qué clase va en el hero y en qué
|
||||
estado está cada una. `HomeView` las usa y `test/home-day.test.ts` las cubre. */
|
||||
|
||||
/** Cuánto después del inicio una clase sin asistencia sigue siendo "la de
|
||||
* ahora". Pasado eso, deja el hero a la próxima y queda en la lista del día
|
||||
* como pendiente. */
|
||||
export const CLASS_ACTIVE_WINDOW_MS = 2 * 60 * 60 * 1000
|
||||
|
||||
export type ClassState =
|
||||
/** La asistencia ya está tomada. */
|
||||
| 'taken'
|
||||
/** Empezó hace menos de `CLASS_ACTIVE_WINDOW_MS` y falta la asistencia. */
|
||||
| 'live'
|
||||
/** Todavía no empezó. */
|
||||
| 'upcoming'
|
||||
/** Ya pasó y nadie tomó asistencia: un olvido, se ofrece tomarla igual. */
|
||||
| 'missed'
|
||||
|
||||
export function classState(item: ClassTodayDto, now: Date): ClassState {
|
||||
if (item.hasAttendance) return 'taken'
|
||||
const startsAt = new Date(item.startsAt).getTime()
|
||||
if (startsAt > now.getTime()) return 'upcoming'
|
||||
return now.getTime() - startsAt <= CLASS_ACTIVE_WINDOW_MS ? 'live' : 'missed'
|
||||
}
|
||||
|
||||
/**
|
||||
* El hero es la clase en curso o la próxima de hoy que todavía no tiene
|
||||
* asistencia. El resto del día va en filas compactas, en orden. Sin hero, el
|
||||
* Inicio muestra la próxima clase (que puede ser de otro día).
|
||||
*/
|
||||
export function planDay(classes: readonly ClassTodayDto[], now: Date) {
|
||||
const sorted = [...classes].sort((a, b) => a.startsAt.localeCompare(b.startsAt))
|
||||
const hero =
|
||||
sorted.find((item) => {
|
||||
const state = classState(item, now)
|
||||
return state === 'live' || state === 'upcoming'
|
||||
}) ?? null
|
||||
return { hero, rest: sorted.filter((item) => item !== hero) }
|
||||
}
|
||||
Reference in New Issue
Block a user