refactor: pre-cleanup.

This commit is contained in:
sam committed 2026-08-06 01:40:15 +10:00
1 parent 0ceab9d897
commit e10cbbc92c
53 files changed
+3596 -648

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
export function taskRowA11y(task, expanded) {
const title = task.title || "untitled task";
return {
"aria-expanded": String(expanded),
"aria-controls": `task-timeline-${task.id}`,
"aria-label": `${expanded ? "Collapse" : "Expand"} timeline for ${title}`,
};
}
+20
View File
@@ -36,6 +36,26 @@
cursor: pointer;
}
.task-expand {
width: 1.5rem;
height: 1.5rem;
margin-right: var(--sp-2);
padding: 0;
color: var(--fg-muted);
background: transparent;
border: 1px solid var(--border);
border-radius: 50%;
font: inherit;
line-height: 1;
cursor: pointer;
}
.task-expand:hover,
.task-expand:focus-visible {
color: var(--fg);
border-color: var(--accent);
}
.activity-row {
cursor: pointer;
}
+28 -5
View File
@@ -2,6 +2,7 @@ import "./tasks.css";
import { api } from "../base/api.js";
import { ago, el, empty, mount, pill, statusKind } from "../base/dom.js";
import { statTile } from "../base/statTile.js";
import { taskRowA11y } from "./task-row.js";
/**
* Plain-language status labels. One place, so "waiting_human" only ever
@@ -199,16 +200,37 @@ export function tasksPage(params = new URLSearchParams()) {
}
function taskRow(t) {
const expanded = expandedId === t.id;
const timelineID = `task-timeline-${t.id}`;
const toggle = (event) => {
event?.stopPropagation();
expandedId = expandedId === t.id ? null : t.id;
renderRows();
if (expandedId === t.id) loadTimeline(t.id);
};
return el(
"tr.task-row",
{
onclick: () => {
expandedId = expandedId === t.id ? null : t.id;
renderRows();
if (expandedId === t.id) loadTimeline(t.id);
...taskRowA11y(t, expanded),
tabindex: "0",
onkeydown: (event) => {
if (event.key !== "Enter" && event.key !== " ") return;
event.preventDefault();
toggle(event);
},
onclick: toggle,
},
el("td.mono", repoLink(t) ?? `${t.owner}/${t.repo}`),
el(
"td.mono",
el("button.task-expand", {
type: "button",
"aria-expanded": String(expanded),
"aria-controls": timelineID,
"aria-label": `${expanded ? "Collapse" : "Expand"} timeline for ${t.title || "untitled task"}`,
onclick: toggle,
}, expanded ? "−" : "+"),
repoLink(t) ?? `${t.owner}/${t.repo}`,
),
el("td.mono", issueLink(t) ?? `#${t.issue_number}`),
el("td.strong", t.title || "(untitled)"),
el("td", pill(statusLabel(t.status), statusKind(t.status))),
@@ -322,6 +344,7 @@ export function tasksPage(params = new URLSearchParams()) {
const cached = eventCache.get(t.id);
return el(
"tr.task-timeline-row",
{ id: `task-timeline-${t.id}` },
el(
"td",
{ colspan: 8 },