web: put the work first and the audit evidence behind a door
- Turn files (input/memory/output/session) are system artifacts now: they are never tiles in the run or stage galleries. Shared public files are attributed to the visit that first recorded them, so a run counts 3 stage artifacts, not one copy of each per later stage. - Audit & debug opens a dialog with vertical Input / Output / Memory / Session / Definition tabs, for a visit from the stage pane or the run Summary. - Run tabs are Summary / Graph / Timeline; Input and Output are Summary sections with Artifacts, Files changed and Audit. Each stage pane gains Files changed. - Artifacts gain a gallery/list switch (remembered) and full-name wrapping; the copy/share actions are hover-or-focus icon buttons. - Status badge above the run title; no live badges on the run surfaces. The runs list leads with the pipeline name and the stored task title beneath it. - Chat rows: title + coloured status word only, then directory, then model; no operator or closed chips, no dot. The more/star cluster is a hover/focus overlay so the title uses the row's width, and an open menu stacks above rows. Closed chats collapse behind a chevron. Sessions can be starred locally and sort in a Starred group. The chat header no longer repeats status/dir/model. - A visible rail divider separates Search from the destinations; the page has a real favicon/apple-touch icon and the rail brand wears it. - Smoke updated: no live badges, 3 detail tabs, field hits open Summary sections, closed chats expand for checks, the fixture viewer uses shot.png/missing.txt and the audit for markdown.
This commit is contained in:
+289
-46
@@ -3,9 +3,8 @@
|
||||
// the run's artifact gallery. Pure models live in runDetail.js, changes.js,
|
||||
// artifacts.js and actions.js; dialogs are delegated to dialogs.js.
|
||||
|
||||
import { h, kvMono, renderLiveBadge, canCopyLink, canShare, copyArtifactLink, shareArtifact } from "../dom.js";
|
||||
import { h, kvMono, canCopyLink, canShare, copyArtifactLink, shareArtifact } from "../dom.js";
|
||||
import { isExecuting, changeKindTone, describeError } from "../format.js";
|
||||
import { liveBadgeState } from "../connection.js";
|
||||
import { resolveArtifactUrl } from "../serverUrl.js";
|
||||
import { runStateOf } from "../runs.js";
|
||||
import { PIPELINE_GRAPH_EMPTY, RUN_GRAPH_MISSING, mount as mountGraph } from "../graph.js";
|
||||
@@ -27,6 +26,8 @@ import {
|
||||
headlineFields,
|
||||
runStepFields,
|
||||
stageSectionSpecs,
|
||||
stageDefinitionFields,
|
||||
terminalFields,
|
||||
clampVisitIndex,
|
||||
referencedVerdictArtifacts,
|
||||
verdictReasonSegments,
|
||||
@@ -50,8 +51,12 @@ import {
|
||||
presentedArtifacts,
|
||||
resolvedArtifactUrl,
|
||||
sessionExportArtifact,
|
||||
stageArtifacts,
|
||||
systemArtifacts,
|
||||
visitArtifacts,
|
||||
viewerIndexByUrl,
|
||||
} from "../artifacts.js";
|
||||
import { writeArtifactView } from "../artifactViewPrefs.js";
|
||||
import {
|
||||
BINARY_DIFF_MESSAGE,
|
||||
NO_LINE_CHANGES_MESSAGE,
|
||||
@@ -105,6 +110,7 @@ export function createRunDetailView(rt) {
|
||||
const renderConfirmDialog = (...args) => rt.views.dialogs.renderConfirmDialog(...args);
|
||||
const renderActionFailedDialog = (...args) => rt.views.dialogs.renderActionFailedDialog(...args);
|
||||
const openArtifactViewer = (...args) => rt.views.dialogs.openArtifactViewer(...args);
|
||||
const showStageAudit = (...args) => rt.views.dialogs.openStageAudit(...args);
|
||||
const selectPipeline = (...args) => rt.selectPipeline(...args);
|
||||
|
||||
/**
|
||||
@@ -127,6 +133,14 @@ function renderRunDetail(now = Date.now()) {
|
||||
// the Android run detail does, so opening the run is enough — no tab hunt.
|
||||
const decision = pendingDecision(d);
|
||||
if (decision) pane.append(renderDecisionCard(decision));
|
||||
const status = runStateOf(d.status);
|
||||
const kicker = h("div", { class: "run-kicker" });
|
||||
kicker.append(h("span", { class: `chip chip-${status}`, text: d.status || status }));
|
||||
if (String(d.outcome ?? "").trim()) {
|
||||
kicker.append(h("span", { class: "muted", text: `outcome ${d.outcome}` }));
|
||||
}
|
||||
if (d.executing) kicker.append(h("span", { class: "muted", text: "executing" }));
|
||||
pane.append(kicker);
|
||||
pane.append(
|
||||
h("h1", {
|
||||
class: "run-detail-title",
|
||||
@@ -195,17 +209,108 @@ function latestVisitIndex(d, key) {
|
||||
return Math.max(0, visits.length - 1);
|
||||
}
|
||||
|
||||
/** The Summary tab: identity, chip row, key/value rows, diagnostic and gallery. */
|
||||
/** The summary's Audit & debug section: one audit door per visit. */
|
||||
function renderRunAuditSection(d) {
|
||||
return renderCollapsible("summary-audit", "Audit & debug", () => {
|
||||
const timeline = runTimeline(d.steps ?? []);
|
||||
const body = h("div", { class: "audit-list" });
|
||||
if (!timeline.entries.length) {
|
||||
body.append(h("div", { class: "muted", text: EMPTY_TIMELINE_MESSAGE }));
|
||||
return body;
|
||||
}
|
||||
for (const entry of timeline.entries) {
|
||||
const used = systemArtifacts(entry.step).length;
|
||||
const row = h("div", { class: "audit-row" });
|
||||
row.append(
|
||||
h("span", {
|
||||
class: "audit-row-label",
|
||||
text: `${entry.stageKey} · visit ${entry.visitIndex + 1}`,
|
||||
}),
|
||||
h("span", { class: "audit-row-meta muted", text: `${used} system file${used === 1 ? "" : "s"}` }),
|
||||
);
|
||||
const open = h("button", {
|
||||
class: "ghost audit-open",
|
||||
type: "button",
|
||||
text: "Audit",
|
||||
});
|
||||
open.addEventListener("click", () => openAuditFor(d, entry.step, entry.stageKey, entry.visitIndex));
|
||||
row.append(open);
|
||||
body.append(row);
|
||||
}
|
||||
return body;
|
||||
});
|
||||
}
|
||||
|
||||
/** Open the audit dialog for one visit: its turn files, session and definition. */
|
||||
function openAuditFor(d, step, stageKey, visitIndex) {
|
||||
if (!step) return;
|
||||
const graph = d.graph ?? { stages: [] };
|
||||
const stage = (graph.stages ?? []).find((candidate) => candidate.key === stageKey) ?? null;
|
||||
const fields = runStepFields(step);
|
||||
const valueOf = (label) => fields.find((field) => field.label === label)?.value ?? "";
|
||||
showStageAudit({
|
||||
title: `${nodeLabel(stageKey)} audit`,
|
||||
subtitle: `Visit ${visitIndex + 1} · ${runLabelFor(d)}`,
|
||||
tabs: [
|
||||
{ key: "input", label: "Input", body: () => auditDocument(valueOf("Input"), EMPTY_INPUT_MESSAGE) },
|
||||
{ key: "output", label: "Output", body: () => auditDocument(valueOf("Output"), EMPTY_OUTPUT_MESSAGE) },
|
||||
{ key: "memory", label: "Memory", body: () => auditMemory(step) },
|
||||
{ key: "session", label: "Session", body: () => renderSessionExport(step) },
|
||||
{ key: "definition", label: "Definition", body: () => auditDefinition(stage, stageKey, graph) },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
/** One audit tab body: a markdown document, or the honest empty sentence. */
|
||||
function auditDocument(text, emptyMessage) {
|
||||
const value = String(text ?? "").trim();
|
||||
if (value === "") return h("div", { class: "muted", text: emptyMessage });
|
||||
if (looksLikeMarkdown(value)) {
|
||||
return h("div", { class: "audit-doc field-markdown" }, rt.views.chat.renderMarkdown(value));
|
||||
}
|
||||
return h("pre", { class: "field-block" }, h("code", { text: value }));
|
||||
}
|
||||
|
||||
/** The memory.md of this visit, rendered once it loads. */
|
||||
function auditMemory(step) {
|
||||
const artifact = systemArtifacts(step).find((entry) => entry.name === "memory.md");
|
||||
if (!artifact) return h("div", { class: "muted", text: "No memory recorded for this visit." });
|
||||
const resolved = resolvedArtifactUrl(artifact, state.url);
|
||||
if (!resolved) return h("div", { class: "muted", text: ARTIFACT_SERVER_HINT });
|
||||
const body = h("div", { class: "audit-doc" }, h("div", { class: "muted", text: "Loading memory…" }));
|
||||
fetch(resolved)
|
||||
.then((response) => {
|
||||
if (!response.ok) throw new Error(`The server answered ${response.status}.`);
|
||||
return response.text();
|
||||
})
|
||||
.then((text) => {
|
||||
if (text.trim() === "") {
|
||||
body.replaceChildren(h("div", { class: "muted", text: "No completed turns were recorded before this visit." }));
|
||||
return;
|
||||
}
|
||||
const article = h("div", { class: "field-markdown" });
|
||||
article.append(rt.views.chat.renderMarkdown(text));
|
||||
body.replaceChildren(article);
|
||||
})
|
||||
.catch((error) => {
|
||||
body.replaceChildren(h("div", { class: "muted", text: describeError(error) }));
|
||||
});
|
||||
return body;
|
||||
}
|
||||
|
||||
/** The stage's own definition (prompt, tools, configs, edges) in the audit. */
|
||||
function auditDefinition(stage, stageKey, graph) {
|
||||
const fields = stage ? stageDefinitionFields(stage) : terminalFields(graph, stageKey);
|
||||
if (!fields.length) return h("div", { class: "muted", text: NO_STAGE_DETAILS_MESSAGE });
|
||||
const body = h("div", { class: "audit-definition" });
|
||||
for (const field of fields) body.append(renderStageField(field));
|
||||
return body;
|
||||
}
|
||||
|
||||
/** The Summary tab: identity, key/value rows, diagnostic and the sections. */
|
||||
function renderRunSummaryTab(d, now) {
|
||||
const wrap = h("div", { class: "run-tab-body" });
|
||||
wrap.append(renderRunTitleRow(d));
|
||||
const status = runStateOf(d.status);
|
||||
const chips = h("div", { class: "run-chip-row" });
|
||||
chips.append(h("span", { class: `chip chip-${status}`, text: d.status || status }));
|
||||
if (String(d.outcome ?? "").trim()) chips.append(h("span", { class: "muted", text: `outcome ${d.outcome}` }));
|
||||
if (d.executing) chips.append(h("span", { class: "muted", text: "executing" }));
|
||||
chips.append(renderLiveBadge(liveBadgeState(state.runStream)));
|
||||
wrap.append(chips);
|
||||
wrap.append(h("div", { class: "run-identity muted", text: runIdentityLine(d) }));
|
||||
|
||||
const rows = h("div", { class: "kv" });
|
||||
@@ -218,24 +323,41 @@ function renderRunSummaryTab(d, now) {
|
||||
}
|
||||
wrap.append(rows);
|
||||
|
||||
// The run-level artifacts gallery (parity R8), collapsed by default like the
|
||||
// Android summary. Its header alone says what was captured until expanded.
|
||||
// Stage-produced artifacts first: the turn's own input/memory/output/session
|
||||
// files are audit evidence and live behind Audit & debug instead.
|
||||
wrap.append(
|
||||
renderCollapsible("summary-artifacts", artifactsHeader(d.steps ?? [], isExecuting(d)), () =>
|
||||
renderArtifactGallery(d.steps ?? []),
|
||||
renderCollapsible(
|
||||
"summary-artifacts",
|
||||
artifactsHeader(d.steps ?? [], isExecuting(d)),
|
||||
() => renderArtifactGallery(d.steps ?? []),
|
||||
{ actions: artifactViewToggle() },
|
||||
),
|
||||
);
|
||||
|
||||
// The run-level Changes (parity R4), collapsed by default like the Android
|
||||
// summary: the observed final-state workspace diff. Only a succeeded run has a
|
||||
// settled final state to present; a failed run keeps its evidence in each
|
||||
// visit's own capture (a deliberate divergence from Android, see PARITY R4).
|
||||
// The run-level Changes (parity R4): the observed final-state workspace diff.
|
||||
// Only a succeeded run has a settled final state to present; a failed run keeps
|
||||
// its evidence in each visit's own capture.
|
||||
if (showRunChangesSummary(d.status)) {
|
||||
const changes = runChanges(d.steps ?? []);
|
||||
wrap.append(
|
||||
renderCollapsible("summary-changes", runChangesHeader(changes), () => renderChangesBody(changes)),
|
||||
);
|
||||
}
|
||||
|
||||
// Input and Output are sections of the summary now, not tabs.
|
||||
wrap.append(
|
||||
renderCollapsible("summary-input", "Input", () =>
|
||||
renderRunFieldBody(d.input, "input", EMPTY_INPUT_MESSAGE),
|
||||
),
|
||||
);
|
||||
wrap.append(
|
||||
renderCollapsible("summary-output", "Output", () =>
|
||||
renderRunFieldBody(d.output, "output", EMPTY_OUTPUT_MESSAGE),
|
||||
),
|
||||
);
|
||||
|
||||
// Everything the system wrote for each visit, behind one explicit door.
|
||||
wrap.append(renderRunAuditSection(d));
|
||||
return wrap;
|
||||
}
|
||||
|
||||
@@ -337,7 +459,12 @@ function renderStageField(field) {
|
||||
|
||||
/** One collapsible input/output field section (expanded body is a code block). */
|
||||
function renderRunFieldTab(map, keyPrefix, emptyMessage) {
|
||||
const wrap = h("div", { class: "run-tab-body" });
|
||||
return h("div", { class: "run-tab-body" }, renderRunFieldBody(map, keyPrefix, emptyMessage));
|
||||
}
|
||||
|
||||
/** The input/output body itself, shared by the old tab and the summary sections. */
|
||||
function renderRunFieldBody(map, keyPrefix, emptyMessage) {
|
||||
const wrap = h("div", { class: "run-field-body" });
|
||||
const sections = fieldSections(map, keyPrefix);
|
||||
if (!sections.length) {
|
||||
wrap.append(h("div", { class: "run-empty muted", text: emptyMessage }));
|
||||
@@ -363,10 +490,11 @@ function renderRunFieldTab(map, keyPrefix, emptyMessage) {
|
||||
* One collapsible section of the run detail's field/summary body. Expanded state
|
||||
* is keyed in `state.runSections`, so the operator's choices survive a re-render.
|
||||
*/
|
||||
function renderCollapsible(key, title, bodyFn) {
|
||||
function renderCollapsible(key, title, bodyFn, { actions = null } = {}) {
|
||||
const expanded = state.runSections.has(key);
|
||||
const wrap = h("div", { class: "collapsible" });
|
||||
wrap.append(
|
||||
const head = h("div", { class: "section-row" });
|
||||
head.append(
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
@@ -384,6 +512,8 @@ function renderCollapsible(key, title, bodyFn) {
|
||||
h("span", { class: "section-title", text: title }),
|
||||
),
|
||||
);
|
||||
if (actions) head.append(actions);
|
||||
wrap.append(head);
|
||||
if (expanded) wrap.append(h("div", { class: "section-body" }, bodyFn()));
|
||||
return wrap;
|
||||
}
|
||||
@@ -520,7 +650,7 @@ function renderStagePane(d) {
|
||||
const visitIndex = clampVisitIndex(state.runStagePane.visitIndex, runSteps.length);
|
||||
const step = runSteps[visitIndex] ?? null;
|
||||
const graph = d.graph ?? { stages: [] };
|
||||
const specs = stageSectionSpecs(stageKey, graph, runSteps, visitIndex, true);
|
||||
const specs = stageSectionSpecs(stageKey, graph, runSteps, visitIndex, true, d.steps ?? []);
|
||||
const fields = step ? runStepFields(step) : [];
|
||||
const headline = headlineFields(fields);
|
||||
|
||||
@@ -560,7 +690,22 @@ function renderStagePane(d) {
|
||||
if (headline.length === 0 && specs.length === 0) {
|
||||
body.append(h("div", { class: "run-empty muted", text: NO_STAGE_DETAILS_MESSAGE }));
|
||||
}
|
||||
for (const spec of specs) body.append(renderStageSection(spec, step));
|
||||
for (const spec of specs) body.append(renderStageSection(spec, step, d.steps ?? []));
|
||||
if (step) {
|
||||
body.append(
|
||||
h(
|
||||
"div",
|
||||
{ class: "stage-pane-audit" },
|
||||
h("button", {
|
||||
class: "ghost audit-open",
|
||||
type: "button",
|
||||
text: "Audit & debug",
|
||||
title: "Input, output, memory, session and definition",
|
||||
onclick: () => openAuditFor(d, step, stageKey, visitIndex),
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
overlay.append(h("div", { class: "stage-pane-sheet" }, bar, body));
|
||||
modal.stage("stage-pane", overlay, {
|
||||
onClose: () => closeStagePane(),
|
||||
@@ -583,7 +728,7 @@ function renderStagePane(d) {
|
||||
}
|
||||
|
||||
/** One stage-pane section, using the pane's own expansion state. */
|
||||
function renderStageSection(spec, step) {
|
||||
function renderStageSection(spec, step, allSteps = null) {
|
||||
const expanded = state.runStageSections.has(spec.key);
|
||||
const wrap = h("div", { class: "collapsible stage-section" });
|
||||
wrap.append(
|
||||
@@ -606,9 +751,9 @@ function renderStageSection(spec, step) {
|
||||
);
|
||||
if (!expanded) return wrap;
|
||||
const body = h("div", { class: "section-body" });
|
||||
if (spec.artifacts && step) body.append(renderVisitArtifacts(step));
|
||||
else if (spec.session && step) body.append(renderSessionExport(step));
|
||||
else for (const field of spec.fields) body.append(renderStageField(field));
|
||||
if (spec.artifacts && step) body.append(renderVisitArtifacts(step, allSteps));
|
||||
else if (spec.changes && step) body.append(renderChangesBody(runChanges([step])));
|
||||
else for (const field of spec.fields ?? []) body.append(renderStageField(field));
|
||||
wrap.append(body);
|
||||
return wrap;
|
||||
}
|
||||
@@ -857,13 +1002,48 @@ function artifactsResolvable() {
|
||||
* run with no artifacts shows the header (which already says why) and nothing
|
||||
* else, so the section is never blank.
|
||||
*/
|
||||
/** The gallery/list switch in the artifacts section header. */
|
||||
function artifactViewToggle() {
|
||||
const group = h("div", {
|
||||
class: "view-toggle",
|
||||
role: "group",
|
||||
"aria-label": "Artifact view",
|
||||
});
|
||||
for (const [key, label] of [
|
||||
["gallery", "Gallery"],
|
||||
["list", "List"],
|
||||
]) {
|
||||
group.append(
|
||||
h("button", {
|
||||
class: `view-toggle-button${state.artifactView === key ? " active" : ""}`,
|
||||
type: "button",
|
||||
"aria-pressed": state.artifactView === key ? "true" : "false",
|
||||
text: label,
|
||||
onclick: () => {
|
||||
state.artifactView = key;
|
||||
writeArtifactView(key);
|
||||
renderContent();
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
return group;
|
||||
}
|
||||
|
||||
function renderArtifactGallery(steps) {
|
||||
const wrap = h("div", { class: "artifact-gallery" });
|
||||
const groups = artifactGroups(steps);
|
||||
if (!groups.length) return wrap;
|
||||
if (!groups.length) {
|
||||
wrap.append(h("div", { class: "muted artifact-hint", text: "No stage artifacts recorded." }));
|
||||
return wrap;
|
||||
}
|
||||
if (!artifactsResolvable()) {
|
||||
wrap.append(h("div", { class: "muted artifact-hint", text: ARTIFACT_SERVER_HINT }));
|
||||
}
|
||||
if (state.artifactView === "list") {
|
||||
wrap.append(renderArtifactList(groups));
|
||||
return wrap;
|
||||
}
|
||||
const viewable = pagedArtifacts(groups);
|
||||
const viewerIndexOf = viewerIndexByUrl(groups);
|
||||
for (const group of groups) {
|
||||
@@ -875,6 +1055,48 @@ function renderArtifactGallery(steps) {
|
||||
return wrap;
|
||||
}
|
||||
|
||||
/** The list form of the run's artifacts: one full-name row per file. */
|
||||
function renderArtifactList(groups) {
|
||||
const list = h("div", { class: "artifact-list" });
|
||||
const viewable = pagedArtifacts(groups);
|
||||
const viewerIndexOf = viewerIndexByUrl(groups);
|
||||
for (const group of groups) {
|
||||
list.append(
|
||||
h("div", { class: "artifact-group-head", text: `${group.stageKey} · visit ${group.visit}` }),
|
||||
);
|
||||
for (const artifact of group.artifacts) {
|
||||
list.append(renderArtifactListRow(artifact, viewable, viewerIndexOf));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/** One artifact list row: kind, full name, size, and hover-only actions. */
|
||||
function renderArtifactListRow(artifact, viewable, viewerIndexOf) {
|
||||
const resolved = resolvedArtifactUrl(artifact, state.url);
|
||||
const kind = artifactKind(artifact.content_type, artifact.name);
|
||||
const media = kind === ArtifactKind.Image || kind === ArtifactKind.Video;
|
||||
const opensViewer = isViewerArtifact(artifact.content_type, artifact.name);
|
||||
const name = artifact.name || "(unnamed artifact)";
|
||||
const wrap = h("div", { class: "artifact-list-row" });
|
||||
const open = h("button", {
|
||||
class: "artifact-list-open",
|
||||
type: "button",
|
||||
"aria-label": `Open ${name}`,
|
||||
title: name,
|
||||
});
|
||||
open.append(h("span", { class: "artifact-kind", text: artifactKindLabel(kind) }));
|
||||
open.append(h("span", { class: "artifact-list-name", text: name }));
|
||||
open.append(h("span", { class: "artifact-size", text: humanBytes(artifact.size_bytes) }));
|
||||
open.addEventListener("click", () => {
|
||||
const at = viewerIndexOf.get(artifact.url);
|
||||
if (opensViewer && at != null) openArtifactViewer(viewable, at, open);
|
||||
else if (resolved) window.open(resolved, "_blank", "noopener,noreferrer");
|
||||
});
|
||||
wrap.append(open, renderTileActions(resolved, media));
|
||||
return wrap;
|
||||
}
|
||||
|
||||
/**
|
||||
* The per-visit artifacts section shown inside one step: the summary line, the
|
||||
* capture notes, the no-server-URL hint and a headerless grid of that visit's
|
||||
@@ -882,12 +1104,14 @@ function renderArtifactGallery(steps) {
|
||||
* that visit's viewable artifacts (media and markdown), exactly as the Android
|
||||
* section does.
|
||||
*/
|
||||
function renderVisitArtifacts(step) {
|
||||
function renderVisitArtifacts(step, allSteps = null) {
|
||||
const wrap = h("div", { class: "artifacts" });
|
||||
const artifacts = presentedArtifacts(step);
|
||||
const artifacts = visitArtifacts(step, allSteps ?? [step]);
|
||||
// The section title already carries the count, so the body repeats it only when
|
||||
// there is nothing to show and the reason itself is the useful part.
|
||||
if (artifacts.length === 0) wrap.append(h("div", { class: "artifacts-summary", text: artifactsSummary(step) }));
|
||||
if (artifacts.length === 0) {
|
||||
wrap.append(h("div", { class: "artifacts-summary", text: artifactsSummary(step, 0) }));
|
||||
}
|
||||
for (const note of artifactCaptureNotes(step)) {
|
||||
wrap.append(h("div", { class: "artifacts-note muted", text: note }));
|
||||
}
|
||||
@@ -934,6 +1158,7 @@ function renderArtifactTile(artifact, viewable, viewerIndexOf) {
|
||||
"data-artifact-name": artifact.name ?? "",
|
||||
"data-artifact-kind": kind,
|
||||
"data-artifact-url": artifact.url ?? "",
|
||||
title: name,
|
||||
});
|
||||
const openViewer = () => {
|
||||
const at = viewerIndexOf.get(artifact.url);
|
||||
@@ -973,7 +1198,7 @@ function renderArtifactTile(artifact, viewable, viewerIndexOf) {
|
||||
return wrap;
|
||||
}
|
||||
|
||||
/** The compact per-tile actions: copy-link (non-media tiles) and share. */
|
||||
/** The compact per-tile actions: icon-only link/share, shown on hover or focus. */
|
||||
function renderTileActions(resolved, media) {
|
||||
const actions = h("div", { class: "artifact-actions" });
|
||||
const stop = (fn) => (event) => {
|
||||
@@ -982,27 +1207,45 @@ function renderTileActions(resolved, media) {
|
||||
};
|
||||
if (!media) {
|
||||
actions.append(
|
||||
h("button", {
|
||||
class: "artifact-action",
|
||||
type: "button",
|
||||
text: "Copy link",
|
||||
disabled: !resolved || !canCopyLink(),
|
||||
onclick: stop(() => copyArtifactLink(resolved)),
|
||||
}),
|
||||
artifactAction("link", "Copy link", !resolved || !canCopyLink(), stop(() => copyArtifactLink(resolved))),
|
||||
);
|
||||
}
|
||||
actions.append(
|
||||
h("button", {
|
||||
class: "artifact-action",
|
||||
type: "button",
|
||||
text: "Share",
|
||||
disabled: !resolved || !canShare(),
|
||||
onclick: stop(() => shareArtifact(resolved)),
|
||||
}),
|
||||
artifactAction("share", "Share", !resolved || !canShare(), stop(() => shareArtifact(resolved))),
|
||||
);
|
||||
return actions;
|
||||
}
|
||||
|
||||
const ARTIFACT_SVG_NS = "http://www.w3.org/2000/svg";
|
||||
|
||||
/** One icon-only artifact action (24px target, accessible name, hover-visible). */
|
||||
function artifactAction(kind, label, disabled, onclick) {
|
||||
const button = h("button", {
|
||||
class: "artifact-action",
|
||||
type: "button",
|
||||
"aria-label": label,
|
||||
title: label,
|
||||
disabled,
|
||||
onclick,
|
||||
});
|
||||
const svg = document.createElementNS(ARTIFACT_SVG_NS, "svg");
|
||||
svg.setAttribute("viewBox", "0 0 24 24");
|
||||
svg.setAttribute("aria-hidden", "true");
|
||||
svg.setAttribute("focusable", "false");
|
||||
const path = document.createElementNS(ARTIFACT_SVG_NS, "path");
|
||||
path.setAttribute("d", kind === "link"
|
||||
? "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"
|
||||
: "M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8M16 6l-4-4-4 4M12 2v13");
|
||||
path.setAttribute("fill", "none");
|
||||
path.setAttribute("stroke", "currentColor");
|
||||
path.setAttribute("stroke-width", "2");
|
||||
path.setAttribute("stroke-linecap", "round");
|
||||
path.setAttribute("stroke-linejoin", "round");
|
||||
svg.append(path);
|
||||
button.append(svg);
|
||||
return button;
|
||||
}
|
||||
|
||||
/**
|
||||
* The step's session export: a link opening the read-only session.html in a new
|
||||
* tab, or the plain notice when the visit exported nothing (parity R9).
|
||||
|
||||
Reference in New Issue
Block a user