mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 02:05:22 -04:00
Make task status pills interactive
This commit is contained in:
+15
-4
@@ -627,13 +627,15 @@ function _renderList() {
|
||||
// status dot (right). Click to expand.
|
||||
const titleRow = document.createElement('div');
|
||||
titleRow.style.cssText = 'display:flex;align-items:center;gap:6px;cursor:pointer;';
|
||||
const pausedBadge = task.status === 'paused'
|
||||
? `<span class="task-paused-badge" title="Paused" style="position:relative;top:4px;"><svg width="11" height="11" viewBox="0 0 24 24" fill="currentColor"><rect x="6" y="5" width="4" height="14" rx="1"/><rect x="14" y="5" width="4" height="14" rx="1"/></svg> paused</span>`
|
||||
: '';
|
||||
const statusBadge = task.status === 'paused'
|
||||
? `<span class="task-status-badge task-paused-badge" data-task-status-action="resume" title="Click to resume" style="position:relative;top:4px;"><svg width="11" height="11" viewBox="0 0 24 24" fill="currentColor"><rect x="6" y="5" width="4" height="14" rx="1"/><rect x="14" y="5" width="4" height="14" rx="1"/></svg> paused</span>`
|
||||
: task.status === 'active'
|
||||
? `<span class="task-status-badge task-active-badge" data-task-status-action="pause" title="Click to pause" style="position:relative;top:4px;"><svg width="11" height="11" viewBox="0 0 24 24" fill="currentColor"><polygon points="7 4 19 12 7 20 7 4"/></svg> active</span>`
|
||||
: '';
|
||||
const builtinBadge = task.is_builtin
|
||||
? `<span class="task-builtin-badge${task.is_modified ? ' modified' : ''}" title="${task.is_modified ? 'Built-in task — edited from its default' : 'Built-in task'}">built-in${task.is_modified ? ' · edited' : ''}</span>`
|
||||
: '';
|
||||
titleRow.innerHTML = `${_taskIcon(task)}<span class="memory-item-title">${_esc(task.name)}</span>${builtinBadge}<span style="flex:1;"></span>${pausedBadge}${_statusDot(task.status)}`;
|
||||
titleRow.innerHTML = `${_taskIcon(task)}<span class="memory-item-title">${_esc(task.name)}</span>${builtinBadge}<span style="flex:1;"></span>${statusBadge}${_statusDot(task.status)}`;
|
||||
|
||||
// ... menu button (hover to show)
|
||||
const actionsWrap = document.createElement('div');
|
||||
@@ -690,6 +692,15 @@ function _renderList() {
|
||||
meta.textContent = metaParts.join(' · ');
|
||||
content.appendChild(meta);
|
||||
|
||||
const statusPill = titleRow.querySelector('[data-task-status-action]');
|
||||
if (statusPill) {
|
||||
statusPill.addEventListener('click', async (e) => {
|
||||
e.stopPropagation();
|
||||
if (statusPill.dataset.taskStatusAction === 'pause') await _doPause(task.id);
|
||||
else await _doResume(task.id);
|
||||
});
|
||||
}
|
||||
|
||||
// Expandable detail (revealed on click) — like the library doc/chat cards:
|
||||
// extra meta + last-run result + description.
|
||||
const detail = document.createElement('div');
|
||||
|
||||
Reference in New Issue
Block a user