// vita-home.jsx — ASIS generation reveal + friendly patient home/dashboard
const DIM_ICON = { heart: 'heart', sueno: 'moon', actividad: 'pulse', alimentacion: 'food', animo: 'animo' };
const AMBER = '#E6A93C';
const estadoColor = (t, e) => e === 'bien' ? t.green : e === 'atencion' ? t.coral : AMBER;
const estadoLabel = (e) => e === 'bien' ? 'Bien' : e === 'atencion' ? 'Atención' : 'Cuidar';
const semColor = (t, e) => e === 'verde' ? t.green : e === 'rojo' ? t.coral : AMBER;
// ── ASIS generating / reveal ────────────────────────────────────
function AsisGenerating({ t, persona, waveStyle }) {
const [step, setStep] = React.useState(0);
const steps = ['Organizando lo que me contaste…', 'Revisando tus documentos…', 'Preparando tu análisis de salud…'];
React.useEffect(() => {
const iv = setInterval(() => setStep(s => Math.min(steps.length - 1, s + 1)), 1100);
return () => clearInterval(iv);
}, []);
return (
Tu ASIS
Análisis de Situación de Salud
{steps.map((s, i) => (
= step ? `2px solid ${t.stroke}` : 'none' }}>
{i < step ? Icon.check({ s: 13, c: '#fff', w: 3 }) : i === step ? : null}
{s}
))}
);
}
// ── Home / dashboard ────────────────────────────────────────────
function HomeScreen({ t, persona, profile, asis, docs, seguimiento, pic, picReady, picGenerating, changelog, careTasks, careDone, onToggleCare, onOpenCare, postCita, onOpenPostCita, onDismissPostCita, notifCount, onOpenNotifs, onTalk, onAddInfo, onOpenSeg, onActivatePic, onOpenPic, onDismissChangelog, onShowHistory, onOpenHistory, onOpenProfile, onOpenServices, onShowSecurity, onToggleTheme }) {
const name = (profile.nombre || 'persona').split(' ')[0];
const sem = semColor(t, asis.estadoGeneral);
const fechaRaw = new Date().toLocaleDateString('es-CO', { weekday: 'long', day: 'numeric', month: 'long' });
const fecha = fechaRaw.charAt(0).toUpperCase() + fechaRaw.slice(1);
const plan = profile.prepagada && profile.prepagada !== 'Ninguna' ? profile.prepagada : profile.eps;
const scrollRef = React.useRef(null);
// when Vita updates the ASIS, bring the changelog into view
React.useEffect(() => {
if (changelog && scrollRef.current) scrollRef.current.scrollTop = 0;
}, [changelog && changelog.version]);
return (
Hola, {name}
{/* changelog after a live update */}
{/* health status hero (semáforo) */}
{Icon.heart({ s: 32, c: sem, fill: sem })}
Tu salud hoy
{asis.estadoTexto}
{/* ASIS summary */}
{Icon.sparkle({ s: 16, c: persona.accent })}
Tu análisis de salud
{changelog && changelog.version > 1 &&
v{changelog.version} }
{asis.resumen}
{Icon.plus({ s: 18, c: persona.accent })} Alimentar mi historia
{/* post-cita proactive check-in */}
{postCita &&
}
{/* Tu cuidado de hoy — proactive daily care */}
{careTasks && careTasks.length > 0 &&
}
{/* PIC: activate gate OR plan section */}
{pic
?
: picReady &&
}
{/* Seguimiento — Vita manages pending items */}
{/* dimensiones */}
¿Cómo estás por dentro?
{(asis.dimensiones || []).map((d, i) => {
const col = estadoColor(t, d.estado);
const ic = Icon[DIM_ICON[d.icono] || d.icono] || Icon.heart;
return (
{d.nombre}
{estadoLabel(d.estado)}
{d.nota}
);
})}
{/* prioridades */}
Lo que vamos a cuidar
{(asis.prioridades || []).map((p, i) => (
{i + 1}
{p}
))}
{/* seguro + documentos */}
Tu seguro y documentos
{plan && (
{Icon.card({ s: 21, c: persona.accent })}
Tu cobertura
{[profile.eps, profile.prepagada && profile.prepagada !== 'Ninguna' ? profile.prepagada : null].filter(Boolean).join(' · ') || plan}
)}
{Icon.plus({ s: 22, c: persona.accent })}
Agregar
{(docs && docs.length ? docs : ['Sin documentos aún']).map((d, i) => (
docs && docs.length ? (
{Icon.doc({ s: 22, c: persona.accent })}
{d}
) : (
{d}
)
))}
{/* bottom nav */}
);
}
function SectionTitle({ t, children }) {
return
{children}
;
}
// La navegación la provee ahora AppShell (vita-shell.jsx): sidebar en
// escritorio, barra inferior en móvil. Este componente se mantiene como
// no-op para no tocar las 6 pantallas que aún lo invocan; desaparecerá
// cuando todas migren al shell.
function BottomNav() {
return null;
}
Object.assign(window, { AsisGenerating, HomeScreen });