diff --git a/web/src/lib/components/repo/RepoHeader.svelte b/web/src/lib/components/repo/RepoHeader.svelte index 3be50e0f2..b2c05e08c 100644 --- a/web/src/lib/components/repo/RepoHeader.svelte +++ b/web/src/lib/components/repo/RepoHeader.svelte @@ -82,7 +82,7 @@ {/snippet} -
+
- + diff --git a/web/src/lib/components/repo/pipelines/PipelineCardContent.svelte b/web/src/lib/components/repo/pipelines/PipelineCardContent.svelte index 99aa869f4..1c6ce5662 100644 --- a/web/src/lib/components/repo/pipelines/PipelineCardContent.svelte +++ b/web/src/lib/components/repo/pipelines/PipelineCardContent.svelte @@ -3,7 +3,7 @@ export const pipelineCardContent = tv({ slots: { - header: "flex min-w-0 items-start justify-between gap-sm pb-xs md:pb-none", + header: "flex min-w-0 items-center justify-between gap-sm pb-xs md:pb-none", trigger: "flex min-w-0 flex-wrap items-center gap-x-xs gap-y-2xs", triggerRow: "flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-2xs text-foreground-default", @@ -11,9 +11,10 @@ triggerVerb: "text-foreground-muted", triggerRef: "min-w-0 font-semibold wrap-anywhere", triggerArrow: "size-3.5 shrink-0 text-foreground-muted", - sha: "shrink-0 self-center rounded-md bg-background-inset px-xs py-3xs typography-monospace-small text-foreground-default no-underline hover:underline", + end: "flex shrink-0 items-center gap-xs", + sha: "shrink-0 rounded-md bg-background-inset px-xs py-3xs typography-monospace-small text-foreground-default no-underline hover:underline", meta: "flex flex-wrap items-center justify-between text-foreground-muted", - metaSub: "mr-xs flex flex-wrap items-center gap-xs", + metaSub: "mr-sm flex flex-wrap items-center gap-sm", workflows: "", duration: "inline-flex items-center gap-2xs", durationIcon: "size-3.5 shrink-0" @@ -44,7 +45,6 @@ import type { PipelineSummary } from "#lib/components/repo/types.ts"; import { longSummary, totalDuration } from "#lib/components/repo/pipelines/pipeline.ts"; import PipelineWorkflows from "#lib/components/repo/pipelines/PipelineWorkflows.svelte"; - import Separator from "#lib/components/ui/Separator.svelte"; import Pending from "#lib/components/ui/Pending.svelte"; import Bones from "#lib/components/ui/Bones.svelte"; import bonesLoadingprimitivesShortText from "#lib/bones/bones-loadingprimitives--short-text.bones.json"; @@ -57,11 +57,11 @@ pipeline: PipelineSummary; /** fork repo did -> `owner/name`, streams in behind the list */ forkLabels?: Record | Promise>; - link?: boolean; + plain?: boolean; actions?: Snippet; } - let { ownerHandle, repoName, pipeline, forkLabels, link = false, actions }: Props = $props(); + let { ownerHandle, repoName, pipeline, forkLabels, plain = false, actions }: Props = $props(); const duration = $derived(totalDuration(pipeline)); @@ -130,6 +130,15 @@ {/if} + {@render actions?.()} +
+ +
+ {#if pipeline.sha} + + {pipeline.sha.slice(0, 8)} + + {/if} {#if pipeline.trigger.kind === "pull_request" && pipeline.trigger.pullPath} {/if} - {@render actions?.()}
- - {#if pipeline.sha} - - {pipeline.sha.slice(0, 8)} - - {/if}
- + @@ -161,7 +163,6 @@
- {#if cutAtBottom} -
- {/if} {#if behindTail}
diff --git a/web/src/lib/components/repo/pipelines/WorkflowRunView.stories.svelte b/web/src/lib/components/repo/pipelines/WorkflowRunView.stories.svelte index 38065255d..37a96ae54 100644 --- a/web/src/lib/components/repo/pipelines/WorkflowRunView.stories.svelte +++ b/web/src/lib/components/repo/pipelines/WorkflowRunView.stories.svelte @@ -3,6 +3,7 @@ import { expect, fn, userEvent, waitFor } from "storybook/test"; import { pipelines } from "#fixtures/pipelines.ts"; import WorkflowRunView from "#lib/components/repo/pipelines/WorkflowRunView.svelte"; + import { viewportFrame } from "#lib/components/repo/pipelines/stories/frame.ts"; const pipeline = pipelines[0]; const workflow = pipeline.workflows[0]; @@ -10,6 +11,7 @@ const { Story } = defineMeta({ title: "Repo/Pipelines/WorkflowRunView", component: WorkflowRunView, + decorators: [viewportFrame()], args: { ownerHandle: "tangled.org", repoName: "core", diff --git a/web/src/lib/components/repo/pipelines/WorkflowRunView.svelte b/web/src/lib/components/repo/pipelines/WorkflowRunView.svelte index ea41c94f4..8de3971f0 100644 --- a/web/src/lib/components/repo/pipelines/WorkflowRunView.svelte +++ b/web/src/lib/components/repo/pipelines/WorkflowRunView.svelte @@ -77,17 +77,20 @@ }); - - - {#snippet actions()} - {#if retry && isFinished(currentPipeline)} - - {/if} - {/snippet} - - +
+ + + {#snippet actions()} + {#if retry && isFinished(currentPipeline)} + + {/if} + {/snippet} + + -
{#snippet template(args)} -
+
{#snippet activeExtra()} @@ -50,7 +50,7 @@ }} > {#snippet template(args)} -
+
{#snippet activeExtra()} diff --git a/web/src/lib/components/repo/pipelines/WorkflowSidebar.svelte b/web/src/lib/components/repo/pipelines/WorkflowSidebar.svelte index 8073c9233..9eaf1e32b 100644 --- a/web/src/lib/components/repo/pipelines/WorkflowSidebar.svelte +++ b/web/src/lib/components/repo/pipelines/WorkflowSidebar.svelte @@ -3,7 +3,7 @@ export const workflowSidebar = tv({ slots: { - list: "flex flex-col divide-y divide-border-default overflow-hidden rounded-md border border-border-default bg-background-subtle dark:divide-border-disabled dark:bg-background-default", + list: "flex flex-col divide-y divide-border-default border-b border-border-default dark:divide-border-disabled dark:border-border-disabled", // the whole card is the link to the workflow card: "flex flex-col gap-1.5 px-sm py-2.5 no-underline hover:bg-background-default hover:no-underline dark:hover:bg-background-subtle", // the step rows are buttons, and a button can't nest inside the card element @@ -19,7 +19,7 @@ status: "flex min-w-0 items-center gap-1.5", label: "truncate font-semibold text-foreground-default", duration: "shrink-0 text-foreground-muted tabular-nums", - extra: "min-w-0 bg-background-subtle p-2xs dark:bg-background-default" + extra: "relative min-w-0 bg-background-subtle p-2xs dark:bg-background-default" } }); @@ -45,10 +45,19 @@ /** falls back to the run's own stamp for a workflow the spindle hasn't started */ createdAt: string; activeExtra?: Snippet; + onselect?: () => void; } - let { ownerHandle, repoName, pipelineId, workflows, active, createdAt, activeExtra }: Props = - $props(); + let { + ownerHandle, + repoName, + pipelineId, + workflows, + active, + createdAt, + activeExtra, + onselect + }: Props = $props(); const classes = workflowSidebar; @@ -121,7 +130,7 @@ {/if}
{:else} - + onselect?.()}> {@render cardBody(workflow)} {/if} diff --git a/web/src/lib/components/repo/pipelines/WorkflowView.stories.svelte b/web/src/lib/components/repo/pipelines/WorkflowView.stories.svelte index 967fcb989..9b7b88c65 100644 --- a/web/src/lib/components/repo/pipelines/WorkflowView.stories.svelte +++ b/web/src/lib/components/repo/pipelines/WorkflowView.stories.svelte @@ -2,6 +2,7 @@ import { defineMeta } from "@storybook/addon-svelte-csf"; import type { WorkflowSummary } from "#lib/components/repo/types.ts"; import WorkflowView from "#lib/components/repo/pipelines/WorkflowView.svelte"; + import { viewportFrame } from "#lib/components/repo/pipelines/stories/frame.ts"; import { cancelledWorkflowLog, failedWorkflowLog, @@ -28,6 +29,7 @@ title: "Repo/Pipelines/WorkflowView", component: WorkflowView, tags: ["autodocs"], + decorators: [viewportFrame()], args: { ownerHandle: "tangled.org", repoName: "core", @@ -40,9 +42,57 @@ @@ -89,3 +139,58 @@ {/snippet} + + { + await userEvent.click(await canvas.findByRole("button", { name: /build/ })); + const rail = await canvas.findByRole("list", { name: "Workflow steps" }); + await userEvent.click(within(rail).getByRole("button", { name: /install dependencies/ })); + await waitFor(() => { + // the step opens and its first line lands at the top of the log + expect( + distanceFromTop(canvas.getByText("pnpm install --frozen-lockfile")) + ).toBeLessThan(80); + }); + }} +/> + + { + await userEvent.click(await canvas.findByRole("button", { name: /build/ })); + const rail = await canvas.findByRole("list", { name: "Workflow steps" }); + await userEvent.click(within(rail).getByRole("button", { name: /run tests/ })); + await waitFor(() => { + expect(distanceFromTop(canvas.getByText("pnpm test"))).toBeLessThan(80); + }); + expect(topRow(canvas.getByText("pnpm test"))).toContain("run tests"); + }} +/> + + { + const rail = await canvas.findByRole("list", { name: "Workflow steps" }); + await userEvent.click(within(rail).getByRole("button", { name: /install dependencies/ })); + await waitFor(() => { + expect( + distanceFromTop(canvas.getByText("pnpm install --frozen-lockfile")) + ).toBeLessThan(80); + }); + streaming.flush("one more line"); + await waitFor(() => { + expect( + distanceFromTop(canvas.getByText("pnpm install --frozen-lockfile")) + ).toBeLessThan(80); + }); + }} +/> diff --git a/web/src/lib/components/repo/pipelines/WorkflowView.svelte b/web/src/lib/components/repo/pipelines/WorkflowView.svelte index 4bff6f19d..cc3e6dc95 100644 --- a/web/src/lib/components/repo/pipelines/WorkflowView.svelte +++ b/web/src/lib/components/repo/pipelines/WorkflowView.svelte @@ -1,11 +1,19 @@ {#snippet stepRail()} @@ -41,56 +52,103 @@ {steps} workflowStatus={workflow.status} current={visibleStep} - onselect={(id) => scrollToStep?.(id)} + onselect={(id) => { + scrollToStep?.(id); + listSheetOpen = false; + }} /> {/snippet} -
-
- 0 ? stepRail : undefined} +{#snippet workflowList(onselect?: () => void)} + 0 ? stepRail : undefined} + {onselect} + /> +{/snippet} + + +
+ + {workflow.name}
- - -
- {#if workflow.error} - +
+ {#if listOpen}
-
-
+ + + + {@render workflowList(() => (listSheetOpen = false))} + diff --git a/web/src/lib/components/repo/pipelines/fillViewport.ts b/web/src/lib/components/repo/pipelines/fillViewport.ts new file mode 100644 index 000000000..920dc186f --- /dev/null +++ b/web/src/lib/components/repo/pipelines/fillViewport.ts @@ -0,0 +1,3 @@ +// the workflow run page hands its log pane the viewport, so the page itself never scrolls +export const fillsViewport = (routeId: string | null | undefined) => + (routeId ?? "").includes("/pipelines/[pipeline]/workflow/"); diff --git a/web/src/lib/components/repo/pipelines/stories/ViewportFrame.svelte b/web/src/lib/components/repo/pipelines/stories/ViewportFrame.svelte new file mode 100644 index 000000000..096eb7bb7 --- /dev/null +++ b/web/src/lib/components/repo/pipelines/stories/ViewportFrame.svelte @@ -0,0 +1,15 @@ + + +
+ {@render children()} +
diff --git a/web/src/lib/components/repo/pipelines/stories/frame.ts b/web/src/lib/components/repo/pipelines/stories/frame.ts new file mode 100644 index 000000000..b6c9e6ade --- /dev/null +++ b/web/src/lib/components/repo/pipelines/stories/frame.ts @@ -0,0 +1,6 @@ +import ViewportFrame from "#lib/components/repo/pipelines/stories/ViewportFrame.svelte"; + +// storybook types a decorator as taking the story's own props, which the frame's don't +// match: `never` fits either slot +export const viewportFrame = (height?: string) => + (() => ({ Component: ViewportFrame, props: height ? { height } : {} })) as never; diff --git a/web/src/routes/+layout.svelte b/web/src/routes/+layout.svelte index bfb3eafb2..ea209732f 100644 --- a/web/src/routes/+layout.svelte +++ b/web/src/routes/+layout.svelte @@ -14,6 +14,7 @@ import { restoreAvatarVersions } from "#lib/avatar.ts"; import { setBlobUrl } from "#lib/markup/paths.ts"; import { setSsrBudget } from "#lib/ssr/render.ts"; + import { fillsViewport } from "#lib/components/repo/pipelines/fillViewport.ts"; import { onMount, setContext, untrack } from "svelte"; import "../app.css"; @@ -100,6 +101,9 @@ const isNotFoundShell = $derived(!signedIn && page.status === 404); const migrating = $derived(data.migrationPending && !isBareShell); const isShowcaseShell = $derived(page.url.pathname.startsWith("/dev/components")); + // a viewport-tall page measures against the visible area, not the window a phone hides + // its url bar inside + const viewportPage = $derived(fillsViewport(page.route.id)); @@ -115,12 +119,15 @@
{#if !isBareShell && !isWelcomeShell && !migrating}
{#if migrating} diff --git a/web/src/routes/[handle]/[repo]/+layout@.svelte b/web/src/routes/[handle]/[repo]/+layout@.svelte index d227cda80..e6566df3a 100644 --- a/web/src/routes/[handle]/[repo]/+layout@.svelte +++ b/web/src/routes/[handle]/[repo]/+layout@.svelte @@ -20,6 +20,7 @@ import { repoCard } from "#lib/seo/og.ts"; import { markdownToText } from "#lib/markup/text.ts"; import { toLanguageSlices } from "#lib/api/repoIndex.ts"; + import { fillsViewport } from "#lib/components/repo/pipelines/fillViewport.ts"; import type { RepoCounts, RepoInfo } from "#lib/components/repo/types.ts"; const CUSTOM_OG_ROUTES = [ @@ -169,6 +170,9 @@ (page.route.id ?? "").includes("/pipelines/[pipeline]/workflow/") ); + // the workflow run page hands its log pane the viewport, so the page itself never scrolls + const fillViewport = $derived(fillsViewport(page.route.id)); + const GENERIC_MESSAGE = "Internal Error"; // kit's HttpError is not an Error subclass, the message lives on body. streamed @@ -275,9 +279,10 @@ class={standalone ? "contents" : fullWidth - ? `w-full pt-xs ${bare ? "sm:pl-xs" : "pb-xs sm:px-xs"}` + ? `w-full pt-xs ${bare ? "sm:pl-xs" : "flex min-h-0 grow flex-col pb-xs sm:px-xs"}` : "mx-auto w-full max-w-page py-xl"} data-flush-bottom={fullWidth && !bare ? "" : undefined} + data-fill-viewport={fillViewport ? "" : undefined} > {#key `${page.params.handle}/${page.params.repo}`}