diff --git a/web/src/lib/components/repo/CommitLogView.stories.svelte b/web/src/lib/components/repo/CommitLogView.stories.svelte index 24ef6c8c8..9ff60bb33 100644 --- a/web/src/lib/components/repo/CommitLogView.stories.svelte +++ b/web/src/lib/components/repo/CommitLogView.stories.svelte @@ -20,9 +20,13 @@ type PlayContext = Pick>, "canvas">; const firstPage = async ({ canvas }: PlayContext) => { - await expect(canvas.getByRole("button", { name: "Previous page" })).toBeDisabled(); + // Pagination spends its arrows with aria-disabled, never the attribute + await expect(canvas.getByRole("button", { name: "Previous page" })).toHaveAttribute( + "aria-disabled", + "true" + ); const next = canvas.getByRole("button", { name: "Next page" }); - await expect(next).toBeEnabled(); + await expect(next).not.toHaveAttribute("aria-disabled"); await expect(canvas.getByRole("button", { name: "Page 1" })).toHaveAttribute( "aria-current", "page" @@ -30,7 +34,8 @@ await userEvent.click(next); await expect(onPageChange).toHaveBeenCalledWith(2); - await expect(canvas.getAllByTitle("Copy SHA")).toHaveLength(commits.length); + // desktop and mobile rows each render the sha cluster + await expect(canvas.getAllByTitle("Copy SHA")).toHaveLength(commits.length * 2); await expect(canvas.getAllByTitle("Browse repository at this commit")).toHaveLength( commits.length * 2 ); @@ -42,8 +47,12 @@ }; const middlePage = async ({ canvas }: PlayContext) => { - await expect(canvas.getByRole("button", { name: "Previous page" })).toBeEnabled(); - await expect(canvas.getByRole("button", { name: "Next page" })).toBeEnabled(); + await expect(canvas.getByRole("button", { name: "Previous page" })).not.toHaveAttribute( + "aria-disabled" + ); + await expect(canvas.getByRole("button", { name: "Next page" })).not.toHaveAttribute( + "aria-disabled" + ); await expect(canvas.getByRole("button", { name: "Page 4" })).toHaveAttribute( "aria-current", "page" diff --git a/web/src/lib/components/repo/CommitLogView.svelte b/web/src/lib/components/repo/CommitLogView.svelte index b789231c7..92461c570 100644 --- a/web/src/lib/components/repo/CommitLogView.svelte +++ b/web/src/lib/components/repo/CommitLogView.svelte @@ -1,16 +1,11 @@ -{#snippet authorCell(commit: CommitSummary)} - - {#if commit.authorHandle} - - {:else if commit.authorName && commit.authorEmail && !commit.authorDid} - - - - {:else} - - {/if} - -{/snippet} - -{#snippet shaChip(commit: CommitSummary, mobile: boolean)} - - {commit.shortHash} - -{/snippet} - -{#snippet treeLink(commit: CommitSummary)} - - -{/snippet} - -{#snippet copyButton(commit: CommitSummary)} - -{/snippet} - -{#snippet pipelineCell(commit: CommitSummary)} - {#if pipelineStatuses} - - - {@const pipeline = (await pipelineStatuses)[commit.hash]} - {#if pipeline} - - {/if} - - - {/if} -{/snippet} - -{#snippet messageCell(commit: CommitSummary)} -
- - {commit.subject} - - {#if commit.body} - - {/if} - {#if tagsByCommit} - - {#each (await tagsByCommit)[commit.hash] ?? [] as name (name)} - {name} - {/each} - - {/if} -
- {#if commit.body && expanded[commit.hash]} -

- {commit.body} -

- {/if} -{/snippet} - -
-

Commits

- + {#if commits.length === 0}

No commits at {ref}.

{:else} - +

+

-
- {#each commits as commit, index (commit.hash)} -
-
-
- {@render messageCell(commit)} -
- {@render treeLink(commit)} -
-
- - {@render shaChip(commit, true)} - - - {@render authorCell(commit)} - {#if commit.when} - - - {/if} - {@render pipelineCell(commit)} -
-
+ + {#each commits as commit (commit.hash)} + {/each} -
+ {/if} -
+ {#if pageCount > 1}
diff --git a/web/src/lib/components/repo/CommitRow.stories.svelte b/web/src/lib/components/repo/CommitRow.stories.svelte new file mode 100644 index 000000000..ebbd4575f --- /dev/null +++ b/web/src/lib/components/repo/CommitRow.stories.svelte @@ -0,0 +1,80 @@ + + + + {#snippet template(args)} + + {/snippet} + + + + {#snippet template(args)} + + {/snippet} + + + + {#snippet template(args)} + + {/snippet} + + + + {#snippet template(args)} + + {/snippet} + diff --git a/web/src/lib/components/repo/CommitRow.svelte b/web/src/lib/components/repo/CommitRow.svelte new file mode 100644 index 000000000..c9f0cc7de --- /dev/null +++ b/web/src/lib/components/repo/CommitRow.svelte @@ -0,0 +1,177 @@ + + +{#snippet author()} + + + {#if commit.authorHandle} + + {:else if commit.authorName && commit.authorEmail && !commit.authorDid} + + + + {:else} + + {/if} + +{/snippet} + +{#snippet sha()} + + {commit.shortHash} + +{/snippet} + +{#snippet actions()} + +
+ +
+
+{/snippet} + +{#snippet subject()} + + + {commit.subject} + + {#if commit.body} + + {/if} + {#if tagsByCommit} + + {#each (await tagsByCommit)[commit.hash] ?? [] as name (name)} + {name} + {/each} + + {/if} + +{/snippet} + +{#snippet pipeline()} + {#if pipelineStatuses} + + + {@const status = (await pipelineStatuses)[commit.hash]} + {#if status} + + {/if} + + + {/if} +{/snippet} + +{#snippet when()} + +{/snippet} + + +
+ + +
+ {@render subject()} +
+ {@render author()} + + {@render pipeline()} + {@render actions()} + +
+
+ {@render sha()} + {@render when()} +
+
+ + {#if commit.body && expanded} +

+ {commit.body} +

+ {/if} +
diff --git a/web/src/lib/components/repo/CommitRows.svelte b/web/src/lib/components/repo/CommitRows.svelte new file mode 100644 index 000000000..87528a73b --- /dev/null +++ b/web/src/lib/components/repo/CommitRows.svelte @@ -0,0 +1,25 @@ + + + +
+ {@render children()} +
diff --git a/web/src/lib/components/repo/FileHistoryView.svelte b/web/src/lib/components/repo/FileHistoryView.svelte index 4c6266aeb..1b05299e2 100644 --- a/web/src/lib/components/repo/FileHistoryView.svelte +++ b/web/src/lib/components/repo/FileHistoryView.svelte @@ -1,14 +1,9 @@ -{#snippet author(commit: CommitSummary)} - - {#if commit.authorHandle} - - {:else if commit.authorName && commit.authorEmail && !commit.authorDid} - - - - {:else} - - {/if} - -{/snippet} - -{#snippet info(commit: CommitSummary)} - - - {commit.shortHash} - -
- -
-
-{/snippet} - -{#snippet subject(commit: CommitSummary)} - - - {commit.subject} - - {#if commit.body} - - {/if} - -{/snippet} - -{#snippet when(commit: CommitSummary)} - -{/snippet} - -{#snippet row(commit: CommitSummary)} -
- - -
- {@render subject(commit)} -
- {@render author(commit)} - {@render info(commit)} - {@render when(commit)} -
-
- - {#if commit.body && expanded[commit.hash]} -

- {commit.body} -

- {/if} -
-{/snippet} - -

+

@@ -172,17 +66,19 @@ No commits touch this file at {ref}.

{:else} -
+
{#each groups as group (group.commits[0].hash)}

{group.label}

-
+ {#each group.commits as commit (commit.hash)} - {@render row(commit)} + {/each} -
+
{/each}