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>
49 lines
1.9 KiB
TypeScript
49 lines
1.9 KiB
TypeScript
import { COUNTRY_CURRENCY, PRO_PRICE_BY_COUNTRY } from '@gruperly/shared'
|
|
import { useTranslation } from 'react-i18next'
|
|
import { useIntlLocale } from '../../i18n'
|
|
import { formatPrice } from '../../lib/format'
|
|
import { MessagePreview } from './MessagePreview'
|
|
import { useOnboarding } from './OnboardingProvider'
|
|
|
|
type PaymentReminderPreviewProps = {
|
|
caption: string
|
|
className?: string
|
|
}
|
|
|
|
/* Día de vencimiento y hora de la muestra: valores típicos, fijos para que la
|
|
vista previa no cambie entre renders. */
|
|
const SAMPLE_DUE_DAY = 10
|
|
const SAMPLE_TIME = new Date(2026, 0, 5, 10, 0)
|
|
|
|
/**
|
|
* El recordatorio de pago semanal, con el mismo texto que arma el backend
|
|
* (`whatsapp/lib/render-message.ts`) y un ejemplo en la moneda del país elegido.
|
|
*/
|
|
export function PaymentReminderPreview({ caption, className }: PaymentReminderPreviewProps) {
|
|
const { t } = useTranslation('onboarding')
|
|
const locale = useIntlLocale()
|
|
const { country } = useOnboarding()
|
|
|
|
const now = new Date()
|
|
const dueDate = new Date(now.getFullYear(), now.getMonth() + (now.getDate() >= SAMPLE_DUE_DAY ? 1 : 0), SAMPLE_DUE_DAY)
|
|
// El precio de ejemplo es el de Pro del país: un monto realista en su moneda.
|
|
const amount = formatPrice(PRO_PRICE_BY_COUNTRY[country], COUNTRY_CURRENCY[country])
|
|
|
|
return (
|
|
<MessagePreview
|
|
caption={caption}
|
|
contactName={t('preview.sampleStudentFull')}
|
|
time={new Intl.DateTimeFormat(locale, { hour: 'numeric', minute: '2-digit' }).format(SAMPLE_TIME)}
|
|
className={className}
|
|
>
|
|
{t('preview.reminder', {
|
|
name: t('preview.sampleStudent'),
|
|
group: t('preview.sampleGroup'),
|
|
amount,
|
|
date: new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'long' }).format(dueDate),
|
|
})}{' '}
|
|
<span className="font-medium text-accent underline underline-offset-2">{t('preview.sampleLink')}</span>
|
|
</MessagePreview>
|
|
)
|
|
}
|