Skip to content

Commit 89095ab

Browse files
feat(details): add beginning and ending of commits history
1 parent 5d929e7 commit 89095ab

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

src/lib/components/Step.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<script lang="ts">
22
import type { Snippet } from "svelte";
3+
import type { ClassValue } from "svelte/elements";
34
import type { Icon } from "@lucide/svelte";
45
import { cn } from "$lib/utils";
56
67
type Props = {
7-
class?: string | undefined | null;
8+
class?: ClassValue;
89
icon?: typeof Icon;
910
children?: Snippet;
1011
};

src/lib/components/Steps.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<script lang="ts">
22
import type { Snippet } from "svelte";
3+
import type { ClassValue } from "svelte/elements";
34
import { cn } from "$lib/utils";
45
56
type Props = {
6-
class?: string | undefined | null;
7+
class?: ClassValue;
78
children?: Snippet;
89
[key: string]: unknown;
910
};

src/routes/[pid=pid]/[org]/[repo]/[id=number]/PageRenderer.svelte

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
ChevronLeft,
4545
FileDiff,
4646
GitCommitVertical,
47+
GitMerge,
48+
GitPullRequestClosed,
49+
GitPullRequestCreateArrow,
4750
Lock,
4851
MessagesSquare,
4952
Tag
@@ -609,6 +612,12 @@
609612
secondaryLabel="{commits.length} commit{commits.length > 1 ? 's' : ''}"
610613
>
611614
<Steps class="my-4">
615+
<Step icon={GitPullRequestCreateArrow} class="text-base [&>span>svg]:text-green-500">
616+
<div class="flex flex-col">
617+
<span>Pull request open</span>
618+
<span class="text-muted-foreground">{formatToDateTime(info.created_at)}</span>
619+
</div>
620+
</Step>
612621
{#each commits as commit (commit.sha)}
613622
{@const [commitMessage, ...commitDescriptions] = commit.commit.message.split("\n")}
614623
{@const commitDescription = commitDescriptions.join("\n").trim()}
@@ -682,6 +691,22 @@
682691
</div>
683692
</Step>
684693
{/each}
694+
{#if "merged" in info && info.closed_at}
695+
<Step
696+
icon={info.merged ? GitMerge : GitPullRequestClosed}
697+
class={[
698+
"text-base",
699+
info.merged ? "[&>span>svg]:text-purple-400" : "[&>span>svg]:text-red-400"
700+
]}
701+
>
702+
<!-- hide the bottom tip of the steps line -->
703+
<div class="absolute bottom-0 -left-8 h-4 outline outline-background"></div>
704+
<div class="flex flex-col">
705+
<span>Pull request {info.merged ? "merged" : "closed"}</span>
706+
<span class="text-muted-foreground">{formatToDateTime(info.closed_at)}</span>
707+
</div>
708+
</Step>
709+
{/if}
685710
</Steps>
686711
</BottomCollapsible>
687712
{/if}

0 commit comments

Comments
 (0)