import { api } from '/static/js/api.js'; import { subscribe, onPollFallback } from '/static/js/ws.js'; const host = document.getElementById('review-list'); const errorBox = document.getElementById('error'); const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', }[c])); async function load() { try { const res = await api('GET', '/api/v1/consultant/reviews'); host.replaceChildren(...res.tasks.map((t) => { const card = document.createElement('div'); card.className = 'card'; const who = t.assignee ? (t.assignee.kind === 'ai' ? 'AI work performer' : 'developer') : 'unknown'; card.innerHTML = `

${esc(t.title)}

◈ ${t.bounty}

submitted by ${who} · updated ${new Date(t.updatedAt).toLocaleString()}

Open review`; return card; })); if (!res.tasks.length) { host.innerHTML = '

Nothing waiting for review.

'; } } catch (e) { errorBox.textContent = e.message; } } subscribe('board', () => setTimeout(load, 300)); onPollFallback(load); load();