/* global React, IOSDevice, PrimaryButton */
// Yomee — Start Screen
// Entry-point. Onboarding carousel with 3 slides, primary CTA → SignUp,
// secondary "Iniciar sesión" → SignIn. Router/App live in App.jsx.
const { useState: useStateSS, useEffect: useEffectSS, useRef: useRefSS } = React;
// ────────────────────────────────────────────────
// Coin badge — mint circle with $ sign
// ────────────────────────────────────────────────
function CoinBadge({ size = 38, style }) {
return (
$
);
}
// ────────────────────────────────────────────────
// Pagination — 3 dashes; active is a longer mint pill
// ────────────────────────────────────────────────
function Pagination({ index, total = 3, onChange }) {
return (
{Array.from({ length: total }).map((_, i) => {
const active = i === index;
return (
onChange?.(i)}
aria-label={`Ir al slide ${i + 1}`}
style={{
width: active ? 22 : 14,
height: 4,
borderRadius: 2,
border: "none",
background: active ? "var(--yo-mint-700)" : "#C9CDD2",
padding: 0,
cursor: "pointer",
transition: "all 280ms cubic-bezier(.2,.7,.2,1)",
}}
/>
);
})}
);
}
const SLIDES = [
{
mascot: "assets/pocopin-3.png",
mascotStyle: { width: 220, left: 100, top: -170, transform: "scaleX(1)" },
coins: [
{ left: 18, top: -22, size: 40 },
{ left: 62, top: 6, size: 36 },
],
body: (
<>
¿Sabías que el mexicano promedio paga $15,000 al año en intereses?
>
),
},
{
mascot: "assets/pocopin-3.png",
mascotStyle: { width: 218, left: 102, top: -168, transform: "scaleX(-1)" },
coins: [
{ left: 16, top: -16, size: 38 },
{ left: 60, top: 12, size: 40 },
],
body: (
<>
Hay tarjetas y créditos con la mitad del costo esperándote.
>
),
},
{
mascot: "assets/pocopin-6.png",
mascotStyle: { width: 220, left: 100, top: -174, transform: "scaleX(1)" },
coins: [
{ left: 16, top: -14, size: 38 },
{ left: 60, top: 14, size: 38 },
],
body: (
<>
¿Y tú? ¿Cuánto dinero le estás regalando al banco hoy?
>
),
},
];
const CARD_W = 326;
const CARD_H = 252;
function CardFrame({ index, total, onDot, slides }) {
return (
{slides.map((s, i) => (
{s.body}
))}
{slides.map((s, i) => (
{s.coins.map((c, ci) => (
))}
))}
{slides.map((s, i) => (
))}
);
}
function StartScreen({ onPrimary, onSignIn }) {
const [index, setIndex] = useStateSS(0);
const touchStart = useRefSS(null);
const [auto, setAuto] = useStateSS(true);
useEffectSS(() => {
if (!auto) return;
const t = setTimeout(() => setIndex((i) => (i + 1) % SLIDES.length), 4200);
return () => clearTimeout(t);
}, [index, auto]);
function go(i) {
setAuto(false);
setIndex(((i % SLIDES.length) + SLIDES.length) % SLIDES.length);
}
function onTouchStart(e) {
touchStart.current = e.touches[0].clientX;
}
function onTouchEnd(e) {
if (touchStart.current == null) return;
const dx = e.changedTouches[0].clientX - touchStart.current;
if (Math.abs(dx) > 40) go(dx < 0 ? index + 1 : index - 1);
touchStart.current = null;
}
const dragStart = useRefSS(null);
function onMouseDown(e) { dragStart.current = e.clientX; }
function onMouseUp(e) {
if (dragStart.current == null) return;
const dx = e.clientX - dragStart.current;
if (Math.abs(dx) > 40) go(dx < 0 ? index + 1 : index - 1);
dragStart.current = null;
}
return (
Haz tu diagnóstico gratis en 2 minutos
y ahorra dinero de inmediato
{/* Primary CTA */}
onPrimary?.()} trailingArrow>
Ver cuanto estoy pagando
¿Ya tienes cuenta?{" "}
onSignIn?.()}
style={{
background: "transparent",
border: "none",
padding: 0,
cursor: "pointer",
fontFamily: "var(--font-body)",
fontSize: 14,
fontWeight: 700,
color: "var(--yo-ink)",
textDecoration: "underline",
textUnderlineOffset: 3,
textDecorationThickness: 1.5,
letterSpacing: "0.01em",
whiteSpace: "nowrap",
}}
>
Iniciar sesión
);
}
window.StartScreen = StartScreen;
window.CoinBadge = CoinBadge;
window.Pagination = Pagination;
window.CardFrame = CardFrame;