// fichaje.eu — Screen: Inicio (employee dashboard) const ScreenInicio = ({ onNav }) => { const [now, setNow] = React.useState(new Date()); React.useEffect(() => { const id = setInterval(() => setNow(new Date()), 1000); return () => clearInterval(id); }, []); // Pretend "today" started 09:02, with 12+45 = 57 min of breaks // For display, show 04:43 worked, with a live counter const workedH = 4, workedM = 43; const greet = now.getHours() < 13 ? 'Buenos días' : now.getHours() < 20 ? 'Buenas tardes' : 'Buenas noches'; const todayStr = now.toLocaleDateString('es-ES', { weekday: 'long', day: 'numeric', month: 'long' }); return (
{/* Hero row: greeting + fichaje widget */}
{todayStr}
{greet}, {ME.name.split(' ')[0]}
Hoy tienes una demo con BBVA Insurance a las 10:00 y una solicitud de vacaciones de Aitor pendiente de aprobar.
Trabajado hoy
{String(workedH).padStart(2,'0')}:{String(workedM).padStart(2,'0')} / 08:00
Entrada
09:02
Pausas
57 min
{/* Side cards: vacation + this week */}
Vacaciones
{ME.vacationDays.total - ME.vacationDays.used} / {ME.vacationDays.total} días
} onClick={() => onNav('ausencias')}>Solicitar
{ME.vacationDays.used} usados Próxima: 11 ago — 22 ago
Esta semana
+1h 14m de superávit
{[ { d: 'L', v: 8.05, ok: true }, { d: 'M', v: 7.83, ok: true }, { d: 'X', v: 4.72, today: true }, { d: 'J', v: 0, future: true }, { d: 'V', v: 0, future: true }, { d: 'S', v: 0, future: true, weekend: true }, { d: 'D', v: 0, future: true, weekend: true }, ].map((b, i) => { const h = Math.max(b.v / 9 * 100, b.future ? 4 : 8); const color = b.weekend ? 'var(--slate-150)' : b.future ? 'var(--slate-200)' : b.today ? 'var(--brand-500)' : 'var(--brand-200)'; return (
{b.today && (
)}
{b.d}
); })}
{/* Middle row: tablón + cumpleaños */}
Ver todos →} />
{[ { tag: 'Importante', tone: 'danger', title: 'Cambios en el horario de verano', body: 'Del 1 de julio al 31 de agosto, jornada intensiva 8:00–15:00. La pausa de comida queda suspendida durante el periodo estival.', author: 'Núria Castells', time: 'hace 1 día', pinned: true }, { tag: 'RRHH', tone: 'brand', title: 'Política de teletrabajo 2026 — firma requerida', body: 'Pendiente de tu firma en Mis documentos. Plazo hasta el 25 de mayo.', author: 'Helena Prats', time: 'hace 2 días' }, { tag: 'Equipo', tone: 'success', title: '¡Damos la bienvenida a Mireia Solé!', body: 'Se incorpora al equipo de Implementación como Customer Success. Su onboarding empieza esta semana.', author: 'People Ops', time: '08 may' }, ].map((post, i) => (
{post.tag} {post.pinned && 📌 Fijado}
{post.time}
{post.title}
{post.body}
{post.author}
))}
{/* Right column */}
{[ { name: 'Sofía Marín', when: 'Mañana · 14 may', detail: 'Cumple 32', type: 'birthday' }, { name: 'Laia Boixader', when: '19 may', detail: 'Cumple 29', type: 'birthday' }, { name: 'Pere Aguiló', when: '26 may', detail: 'Cumple 41', type: 'birthday' }, { name: 'Iván Romero', when: '02 jun', detail: '2 años en la empresa', type: 'anniversary' }, ].map((p, i) => (
{p.name}
{p.detail}
{p.type === 'birthday' ? : } {p.when}
))}
t.status === 'fichado').length} fichados · ${TEAM.filter(t => t.status === 'vacaciones').length} ausentes`}/>
{TEAM.slice(0, 9).map(p => (
))}
+{TEAM.length - 9}
{/* Bottom row: shortcuts */}
{[ { icon: , label: 'Solicitar ausencia', tone: 'brand', nav: 'ausencias' }, { icon: , label: 'Firmar documentos', tone: 'violet', nav: 'misdocs', badge: 1 }, { icon: , label: 'Mis tareas', tone: 'success', nav: 'tareas' }, { icon: , label: 'Directorio', tone: 'warning', nav: 'organizacion' }, ].map((s, i) => ( onNav(s.nav)} style={{ padding: 16 }}>
{s.icon}
{s.label}
{s.badge && {s.badge}}
))}
); }; Object.assign(window, { ScreenInicio });