From ac4e983ae36f2af9c322714796cc2558287a35ea Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Fri, 28 Aug 2026 19:54:06 +0100 Subject: [PATCH] web/components: improve PR UI, add stories for all components Signed-off-by: oppiliappan --- .../lib/components/repo/DiffStatPill.svelte | 8 +- .../repo/pipelines/PipelineEmptyState.svelte | 2 +- .../repo/pulls/PullActions.stories.svelte | 76 ++++++++ .../pulls/PullCommitListDiff.stories.svelte | 104 ++++++++++ .../pulls/PullCommitListHeader.stories.svelte | 137 ++++++++++++++ .../PullCommitListInterdiff.stories.svelte | 118 ++++++++++++ .../repo/pulls/PullDiff.stories.svelte | 177 ++++++++++++++++++ .../lib/components/repo/pulls/PullDiff.svelte | 15 +- .../repo/pulls/PullDiffFileCard.svelte | 4 +- .../repo/pulls/PullDiscussion.stories.svelte | 124 ++++++++++++ .../repo/pulls/PullDiscussion.svelte | 2 +- .../repo/pulls/PullReviewCommentForm.svelte | 2 +- .../[version]/[[range]]/PullViewPage.svelte | 27 +-- 13 files changed, 765 insertions(+), 31 deletions(-) create mode 100644 web/src/lib/components/repo/pulls/PullActions.stories.svelte create mode 100644 web/src/lib/components/repo/pulls/PullCommitListDiff.stories.svelte create mode 100644 web/src/lib/components/repo/pulls/PullCommitListHeader.stories.svelte create mode 100644 web/src/lib/components/repo/pulls/PullCommitListInterdiff.stories.svelte create mode 100644 web/src/lib/components/repo/pulls/PullDiff.stories.svelte create mode 100644 web/src/lib/components/repo/pulls/PullDiscussion.stories.svelte diff --git a/web/src/lib/components/repo/DiffStatPill.svelte b/web/src/lib/components/repo/DiffStatPill.svelte index 7a8005408..7604defae 100644 --- a/web/src/lib/components/repo/DiffStatPill.svelte +++ b/web/src/lib/components/repo/DiffStatPill.svelte @@ -13,24 +13,24 @@
{#if stat.insertions > 0 && stat.deletions > 0} +{stat.insertions} -{stat.deletions} {:else if stat.insertions > 0} +{stat.insertions} {:else} -{stat.deletions} diff --git a/web/src/lib/components/repo/pipelines/PipelineEmptyState.svelte b/web/src/lib/components/repo/pipelines/PipelineEmptyState.svelte index f9a13601c..77f8de81d 100644 --- a/web/src/lib/components/repo/pipelines/PipelineEmptyState.svelte +++ b/web/src/lib/components/repo/pipelines/PipelineEmptyState.svelte @@ -6,7 +6,7 @@ root: "flex flex-col items-center gap-6 rounded-sm border border-border-default bg-background-default px-6 py-12 text-center shadow-xs", icon: "size-16 text-foreground-disabled", intro: "flex flex-col gap-2", - heading: "typography-paragraph-large text-foreground-subtle italic", + heading: "typography-paragraph-large text-foreground-subtle", body: "max-w-md typography-paragraph-small text-foreground-muted", steps: "flex max-w-md flex-col gap-3 text-left", step: "flex items-start gap-3", diff --git a/web/src/lib/components/repo/pulls/PullActions.stories.svelte b/web/src/lib/components/repo/pulls/PullActions.stories.svelte new file mode 100644 index 000000000..4b301e030 --- /dev/null +++ b/web/src/lib/components/repo/pulls/PullActions.stories.svelte @@ -0,0 +1,76 @@ + + + + + + {#snippet template(args)} +
+ +
+ {/snippet} +
+ + + + + + + + + + + + + + + + + + + {#snippet template(args)} +
+ { + pullState = next; + calls.push(`state -> ${next}`); + }} + onMerge={(style: MergeStyle) => { + pullState = "merged"; + calls.push(`merge (${style})`); + }} + /> + + {#each calls as call, i (i)} +

{call}

+ {/each} +
+
+ {/snippet} +
diff --git a/web/src/lib/components/repo/pulls/PullCommitListDiff.stories.svelte b/web/src/lib/components/repo/pulls/PullCommitListDiff.stories.svelte new file mode 100644 index 000000000..398012674 --- /dev/null +++ b/web/src/lib/components/repo/pulls/PullCommitListDiff.stories.svelte @@ -0,0 +1,104 @@ + + + + +{#snippet frame(args: Props)} +
+ +
+{/snippet} + + + {#snippet template(args)} + {@render frame(args)} + {/snippet} + + + + {#snippet template(args)} + {@render frame(args)} + {/snippet} + + + commit.hash)) + ) + }} +> + {#snippet template(args)} + {@render frame(args)} + {/snippet} + + + + {#snippet template(args)} +
+ (picked = next)} + /> + picked v{picked.start}..v{picked.end} +
+ {/snippet} +
diff --git a/web/src/lib/components/repo/pulls/PullCommitListHeader.stories.svelte b/web/src/lib/components/repo/pulls/PullCommitListHeader.stories.svelte new file mode 100644 index 000000000..da42127f9 --- /dev/null +++ b/web/src/lib/components/repo/pulls/PullCommitListHeader.stories.svelte @@ -0,0 +1,137 @@ + + + + +{#snippet frame(args: Props)} +
+ +
+{/snippet} + + + {#snippet template(args)} + {@render frame(args)} + {/snippet} + + + + + {#snippet template(args)} + {@render frame(args)} + {/snippet} + + + + + {#snippet template(args)} +
+ + {#snippet actions()} + + {/snippet} + +
+ {/snippet} +
+ + + {#snippet template(args)} + {@render frame(args)} + {/snippet} + + + + {#snippet template(args)} +
+ { + viewed = next; + commits_++; + }} + /> + + viewing v{viewed.start}{viewed.start === viewed.end ? "" : `..v${viewed.end}`} · {commits_} + commit{commits_ === 1 ? "" : "s"} + +
+ {/snippet} +
diff --git a/web/src/lib/components/repo/pulls/PullCommitListInterdiff.stories.svelte b/web/src/lib/components/repo/pulls/PullCommitListInterdiff.stories.svelte new file mode 100644 index 000000000..95271e9b2 --- /dev/null +++ b/web/src/lib/components/repo/pulls/PullCommitListInterdiff.stories.svelte @@ -0,0 +1,118 @@ + + + + +{#snippet frame(args: Props)} +
+ {}} /> +
+{/snippet} + + + {#snippet template(args)} + {@render frame(args)} + {/snippet} + + + + {#snippet template(args)} + {@render frame(args)} + {/snippet} + + + + + {#snippet template(args)} + {@render frame(args)} + {/snippet} + + + commit.hash)) + ) + }} +> + {#snippet template(args)} + {@render frame(args)} + {/snippet} + + + + {#snippet template(args)} +
+ (picked = next)} + /> + + narrowed to {picked || "all changes"} + +
+ {/snippet} +
diff --git a/web/src/lib/components/repo/pulls/PullDiff.stories.svelte b/web/src/lib/components/repo/pulls/PullDiff.stories.svelte new file mode 100644 index 000000000..3d6abe870 --- /dev/null +++ b/web/src/lib/components/repo/pulls/PullDiff.stories.svelte @@ -0,0 +1,177 @@ + + + + + + + + + + + diff --git a/web/src/lib/components/repo/pulls/PullDiff.svelte b/web/src/lib/components/repo/pulls/PullDiff.svelte index aef98f8a1..3ffcecfd0 100644 --- a/web/src/lib/components/repo/pulls/PullDiff.svelte +++ b/web/src/lib/components/repo/pulls/PullDiff.svelte @@ -29,14 +29,13 @@ let diffStyle = $state("unified"); -
+
{#if treeOpen}