// vita-care2.jsx — Full Care screen: today timeline, medication adherence, therapies, controls function CareScreen({ t, persona, profile, tasks, done, streaks, onToggle, postCita, onOpenPostCita, controles, terapias, onBack, onTalk, onOpenHome, onOpenHistory, onOpenProfile, onOpenServices }) { const accent = persona.accent; const completed = tasks.filter(x => done[x.id]).length; const pct = tasks.length ? Math.round(completed / tasks.length * 100) : 0; return ( {Icon.mic({ s: 18, c: accent })}} />
{/* day progress hero */}
{pct}%
Hoy llevas {completed} de {tasks.length}
{pct === 100 ? '¡Día perfecto de autocuidado! 💚' : 'Cada paso cuenta. Yo te recuerdo el resto.'}
{/* post-cita check-in */} {postCita && {}} />} {/* today's timeline by block */} {BLOQUES.map(b => { const bt = tasks.filter(x => x.bloque === b.k); if (!bt.length) return null; return (
{Icon[b.icon]({ s: 15, c: accent })} {b.label}
{bt.map(task => onToggle(task.id)} />)}
); })} {/* medication adherence */} {streaks && streaks.length > 0 && (
Tu constancia
{streaks.map((s, i) => (
{Icon.pill({ s: 20, c: accent })}
{s.nombre}
{s.pauta}
{/* week dots */}
{s.semana.map((on, j) => )}
{Icon.flame({ s: 20, c: '#E6A93C', fill: hexA('#E6A93C', 0.25) })} {s.racha} días
))}
)} {/* therapies follow-up */} {terapias && terapias.length > 0 && (
Tus terapias en curso
{terapias.map((ter, i) => (
{Icon[ter.icon]({ s: 20, c: ter.color })}
{ter.nombre}
{ter.profesional}
{ter.hechas}/{ter.total}
{/* progress bar */}
{Icon.calendar({ s: 14, c: t.muted })} Próxima: {ter.proxima}
))}
)} {/* upcoming controls */} {controles && controles.length > 0 && (
Próximos controles
{controles.map((c, i) => (
{c.dia} {c.mes}
{c.titulo}
{c.detalle}
{Icon.bell({ s: 13, c: t.green })} Te recuerdo
))}
)}
); } // Build demo adherence/therapy/control data from patient state function buildCareDetails({ profile, seguimiento }) { const meds = Array.isArray(profile.medicamentos) ? profile.medicamentos : (profile.medicamentos ? [profile.medicamentos] : []); const streaks = meds.slice(0, 2).map((m, i) => ({ nombre: m, pauta: i === 0 ? '1 vez al día · mañana' : '1 vez al día', racha: i === 0 ? 12 : 6, semana: [true, true, true, true, true, i === 0, false], })); const terapias = []; // psychology in treatment → therapy follow-up terapias.push({ nombre: 'Terapia psicológica', profesional: 'Dr. Suárez', icon: 'brain', color: '#A98CD9', hechas: 3, total: 8, proxima: 'Jueves 4:00 p.m.' }); // if cardiac risk → cardiac rehab walking const cardio = (Array.isArray(profile.condiciones) ? profile.condiciones : [profile.condiciones]).some(c => /hipert|coraz|cardi/i.test(c || '')); if (cardio) terapias.push({ nombre: 'Acondicionamiento cardiaco', profesional: 'Fisioterapia · VITA', icon: 'walk', color: '#73C58E', hechas: 5, total: 12, proxima: 'Lunes 9:00 a.m.' }); const controles = [ { dia: '18', mes: 'Jun', titulo: 'Control de presión arterial', detalle: 'Con medicina general · virtual' }, { dia: '02', mes: 'Jul', titulo: 'Control nutricional', detalle: 'Dra. Marcela Ruiz' }, ]; return { streaks, terapias, controles }; } Object.assign(window, { CareScreen, buildCareDetails });