Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(workflows): align expanded evidence beneath step content

louis45754ed17686
diff --git a/apps/screenpipe-workflows-web/scripts/eval-workflow-editor.cjs b/apps/screenpipe-workflows-web/scripts/eval-workflow-editor.cjs
index dab948c44..d72d20063 100644
--- a/apps/screenpipe-workflows-web/scripts/eval-workflow-editor.cjs
+++ b/apps/screenpipe-workflows-web/scripts/eval-workflow-editor.cjs
@@ -92,6 +92,31 @@ require("node:fs").mkdirSync(out, { recursive: true });
await references.getByRole("img", { name: "Captured moment for Collect sources", exact: true }).waitFor();
await references.getByRole("button", { name: "Close recording for Collect sources" }).click();
});
+ await check("expanded sources align with step content at wide and narrow widths", async () => {
+ const references = page.getByRole("region", { name: "References for Collect sources", exact: true });
+ const toggle = references.getByRole("button", { name: "1 source", exact: true });
+ for (const width of [1440, 720, 390]) {
+ await page.setViewportSize({ width, height: 1000 });
+ if (width < 680) await button("Collapse left sidebar").click();
+ await toggle.click();
+ const sources = references.getByRole("region", { name: "Sources for Collect sources", exact: true });
+ const sourceBounds = await sources.boundingBox();
+ const referenceBounds = await references.boundingBox();
+ assert(Math.abs(sourceBounds.x - referenceBounds.x) < 2);
+ assert(sourceBounds.x + sourceBounds.width <= referenceBounds.x + referenceBounds.width + 2);
+ const sourceRow = sources.locator("summary").first();
+ const meta = await sourceRow.locator("span").first().boundingBox();
+ const disclosure = await sourceRow.locator("span").last().boundingBox();
+ if (Math.abs(meta.y - disclosure.y) < 3) assert(disclosure.x - meta.x - meta.width < 20);
+ await sources.scrollIntoViewIfNeeded();
+ await page.screenshot({ path: `${out}/source-alignment-${width}.png` });
+ await toggle.click();
+ assert.equal(await sources.isVisible(), false);
+ }
+ await page.setViewportSize({ width: 1440, height: 1100 });
+ await button("Open left sidebar").click();
+ await field("Workflow title").focus();
+ });
await check("step controls stay reachable and dismiss with Escape or an outside click", async () => {
await field("Step 1 title").hover();
const grip = button("Move step 1");
diff --git a/packages/workflows-ui/src/workflow-step-evidence.module.css b/packages/workflows-ui/src/workflow-step-evidence.module.css
index 1fbed0add..6f7a34fe3 100644
--- a/packages/workflows-ui/src/workflow-step-evidence.module.css
+++ b/packages/workflows-ui/src/workflow-step-evidence.module.css
@@ -11,14 +11,14 @@
.figure figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; line-height: 1.5; color: var(--muted); }
.figure figcaption > span { min-width: 0; overflow-wrap: anywhere; }
.links { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 12px; font-size: 11px; color: var(--muted); }
-.links > button { font-size: 11px; }
-.sources { flex: 1; min-width: min(240px, 100%); }
+.links > button { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0; font-size: 11px; }
+.sourceToggle[aria-expanded="true"] > svg { transform: rotate(180deg); }
.evidence summary { display: flex; align-items: center; gap: 6px; width: fit-content; min-height: 28px; list-style: none; cursor: pointer; font-size: 11px; color: var(--muted); }
.evidence summary::-webkit-details-marker { display: none; }
.evidence summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.evidence details[open] > summary > svg { transform: rotate(180deg); }
.sourceList { max-height: 320px; overflow: auto; overscroll-behavior: contain; border-left: 1px solid var(--line); margin: 4px 0 8px; padding-left: 12px; }
-.rawSource > summary { width: 100%; justify-content: space-between; flex-wrap: wrap; padding: 4px 0; }
+.rawSource > summary { width: 100%; justify-content: flex-start; gap: 8px 16px; flex-wrap: wrap; padding: 4px 0; }
.rawSource > summary > span:last-child { display: inline-flex; gap: 4px; align-items: center; }
.rawText { max-height: 160px; overflow: auto; overscroll-behavior: contain; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; padding: 10px 12px; background: var(--soft); border-radius: 4px; color: var(--muted); }
.questions { font-size: 12px; color: var(--muted); }
diff --git a/packages/workflows-ui/src/workflow-step-evidence.tsx b/packages/workflows-ui/src/workflow-step-evidence.tsx
index c72532b26..62e30b132 100644
--- a/packages/workflows-ui/src/workflow-step-evidence.tsx
+++ b/packages/workflows-ui/src/workflow-step-evidence.tsx
@@ -2,7 +2,7 @@
// https://screenpipe.com
"use client";
-import { useMemo, useState } from "react";
+import { useId, useMemo, useState } from "react";
import { ChevronDown, Maximize2, Minimize2, Play, X } from "lucide-react";
import type { WorkflowMap, WorkflowStage } from "./model";
import type { WorkflowsPlatform } from "./platform";
@@ -17,6 +17,8 @@ export function WorkflowStepEvidence({ workflow, stage, platform }: {
workflow: WorkflowMap; stage: WorkflowStage; platform: WorkflowsPlatform;
}) {
const [expanded, setExpanded] = useState(false);
+ const [sourcesOpen, setSourcesOpen] = useState(false);
+ const sourcesId = useId();
const [playing, setPlaying] = useState(false);
const [opening, setOpening] = useState(false);
const [openError, setOpenError] = useState(false);
@@ -61,16 +63,14 @@ export function WorkflowStepEvidence({ workflow, stage, platform }: {
<div className={styles.links}>
{(canReplay || (screenshot && platform.openCapturedMoment)) && !playing && <button type="button" disabled={opening} onClick={() => void openRecording()} aria-label={`${platform.openCapturedMoment ? "Open" : "View"} recording for ${stage.name}`}><Play size={13} />{opening ? "Opening…" : platform.openCapturedMoment ? "Open recording" : "View recording"}</button>}
{openError && <span role="alert">Could not open this capture. Try again.</span>}
- {!!sources.length && <details className={styles.sources}>
- <summary>{sources.length} source{sources.length === 1 ? "" : "s"}<ChevronDown size={12} /></summary>
- <div className={styles.sourceList}>
+ {!!sources.length && <button type="button" className={styles.sourceToggle} aria-expanded={sourcesOpen} aria-controls={sourcesId} onClick={() => setSourcesOpen(!sourcesOpen)}>{sources.length} source{sources.length === 1 ? "" : "s"}<ChevronDown size={12} /></button>}
+ </div>
+ {!!sources.length && <div id={sourcesId} hidden={!sourcesOpen} className={styles.sourceList} role="region" aria-label={`Sources for ${stage.name}`}>
{sources.map((source, index) => <details className={styles.rawSource} key={`${source.timestamp}-${index}`}>
<summary><span>{source.app || "Captured source"} · {when(source.timestamp)}</span><span>Captured text<ChevronDown size={12} /></span></summary>
<div className={styles.rawText} role="region" aria-label={`Captured text ${index + 1} for ${stage.name}`} tabIndex={0}>{source.text}</div>
</details>)}
- </div>
- </details>}
- </div>
+ </div>}
{!!stage.openQuestions?.length && <details className={styles.questions}><summary>Unresolved details<ChevronDown size={12} /></summary><ul>{stage.openQuestions.map(q => <li key={q}><WorkflowQuestion workflow={workflow} question={q} stage={stage.name} interactive={!!platform.assistant?.saveFeedback} /></li>)}</ul></details>}
</section>;
}