feat(ui): project card Tasks + Linked references sections; GET /api/projects/:id/links

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
root
2026-06-05 00:28:17 +10:00
parent dbf84559de
commit 922b289cae
3 changed files with 44 additions and 0 deletions

View File

@@ -68,6 +68,29 @@ export function projectCard(p, o) {
det.appendChild(dl);
panel.appendChild(det);
// ---- Tasks (sub-work of this project) ----
panel.appendChild(el('div', { class: 'proj-section-h' }, 'Tasks'));
const tasksList = el('div', { class: 'proj-sub-list' }, el('div', { class: 'muted', style: { fontSize: '12px' } }, 'Loading…'));
panel.appendChild(tasksList);
api.get('/api/projects/' + p.id + '/tasks').then(ts => {
tasksList.replaceChildren();
if (!ts.length) { tasksList.appendChild(el('div', { class: 'muted', style: { fontSize: '12px' } }, 'No tasks.')); return; }
for (const t of ts) tasksList.appendChild(el('div', { class: 'proj-sub-row' },
el('span', { class: 'status' + (t.status === 'done' ? ' ok' : t.status === 'blocked' ? ' bad' : '') }, t.status || 'todo'),
' ', el('span', {}, t.title)));
}).catch(() => tasksList.replaceChildren(el('div', { class: 'muted', style: { fontSize: '12px' } }, '—')));
// ---- Linked references ----
panel.appendChild(el('div', { class: 'proj-section-h' }, 'Linked references'));
const refsList = el('div', { class: 'proj-sub-list' }, el('div', { class: 'muted', style: { fontSize: '12px' } }, 'Loading…'));
panel.appendChild(refsList);
api.get('/api/projects/' + p.id + '/links').then(ls => {
refsList.replaceChildren();
if (!ls.length) { refsList.appendChild(el('div', { class: 'muted', style: { fontSize: '12px' } }, 'None linked.')); return; }
for (const l of ls) refsList.appendChild(el('div', { class: 'proj-sub-row' },
el('a', { href: (l.to_type === 'page' ? '#/page/' : '#/ref/') + l.to_id }, l.title)));
}).catch(() => refsList.replaceChildren(el('div', { class: 'muted', style: { fontSize: '12px' } }, '—')));
// ---- Eithan research ----
panel.appendChild(el('div', { class: 'proj-section-h' }, 'Eithan research' + (p.last_researched_at ? ` · ${ago(p.last_researched_at)}` : '')));
if (busy) panel.appendChild(el('div', { class: 'muted' }, "Queued for Eithan — he'll fill this in once the agent ships."));

View File

@@ -297,6 +297,8 @@ button.ghost:hover { color: var(--text); border-color: var(--accent-dim); }
.proj-dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 0; font-size: 12px; }
.proj-dl dt { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 10px; align-self: center; }
.proj-dl dd { margin: 0; color: var(--text); }
.proj-sub-list { display: flex; flex-direction: column; gap: 3px; margin-bottom: 4px; }
.proj-sub-row { font-size: 13px; color: var(--text); padding: 2px 0; }
.proj-panel .research-notes, .proj-panel .md-preview { font-size: 13px; }
@media (max-width: 620px) {
.proj-head { flex-wrap: wrap; }