// fichaje.eu — Screen: Tareas (kanban) const COLS = [ { key: 'backlog', label: 'Backlog', tone: 'slate' }, { key: 'todo', label: 'Por hacer', tone: 'brand' }, { key: 'doing', label: 'En curso', tone: 'warning' }, { key: 'review', label: 'En revisión', tone: 'violet' }, { key: 'done', label: 'Hecho', tone: 'success' }, ]; const colIdx = (k) => COLS.findIndex(c => c.key === k); async function refresh() { if (!window.api) return; await window.api.reloadBootstrap(); window.location.reload(); } async function quickCreateTask(colKey) { const title = window.prompt('Título de la nueva tarea'); if (!title || !window.api) return; await window.api.createTask({ title, board_col: colKey, priority: 'media' }); await refresh(); } async function moveCol(t, delta) { if (!window.api) return; const cur = colIdx(t.board_col || 'todo'); const next = COLS[Math.max(0, Math.min(COLS.length - 1, cur + delta))]; if (!next || next.key === (t.board_col || 'todo')) return; await window.api.moveTask(t.id, next.key); await refresh(); } async function deleteTask(t) { if (!window.api) return; if (!window.confirm(`¿Eliminar tarea "${t.title}"?`)) return; await window.api.deleteTask(t.id); await refresh(); } const ScreenTareas = () => { const cols = COLS; const totalTasks = Object.values(TASKS).reduce((a, c) => a + c.length, 0); return (
{/* Toolbar */}
Plataforma — Sprint 14
{totalTasks} tareas · 5 personas · cierra el 24 may
{TEAM.slice(0, 5).map(p => )}
}>Filtrar }>Vista } onClick={() => quickCreateTask('todo')}>Nueva tarea
{/* Kanban */}
{cols.map(col => { const items = TASKS[col.key]; return (
{col.label} {items.length}
{items.map(t => )}
); })}
); }; const TaskCard = ({ t, colKey }) => { const priorityColors = { alta: { bg: 'var(--danger-100)', fg: 'var(--danger-600)' }, media: { bg: 'var(--warning-100)', fg: 'var(--warning-600)' }, baja: { bg: 'var(--slate-200)', fg: 'var(--slate-600)' }, }; const tagColors = { cliente: 'brand', investigación: 'violet', comercial: 'success', infra: 'slate', marketing: 'pink', plataforma: 'teal', interno: 'warning', }; const tWithCol = { ...t, board_col: colKey }; const ci = colIdx(colKey); const canPrev = ci > 0; const canNext = ci < COLS.length - 1; const btnArrow = { width: 22, height: 22, borderRadius: 6, border: '1px solid var(--slate-200)', background: 'var(--white)', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', fontSize: 13, lineHeight: 1, color: 'var(--slate-600)', cursor: 'pointer', }; return (
{t.tag} {t.priority === 'alta' && '↑ '}{t.priority === 'baja' && '↓ '}{t.priority}
{t.title}
{t.progress && (
{t.progress}% completado
)}
{colKey === 'done' ? ( {t.done} ) : t.due !== '—' ? ( {t.due} ) : null}
); }; Object.assign(window, { ScreenTareas });