From 108533777e10fa9aeeb7feb125aaed741afa5784 Mon Sep 17 00:00:00 2001 From: estib Date: Wed, 25 Sep 2024 17:19:04 +0200 Subject: [PATCH] PullRequestCard: 'View details' button Add a button to the PR card that shows a Modal with the PR details --- apps/desktop/src/lib/gitHost/github/types.ts | 1 + .../src/lib/gitHost/interface/types.ts | 1 + apps/desktop/src/lib/pr/PrDetailsModal.svelte | 75 +++++++++++++++++++ .../desktop/src/lib/pr/PullRequestCard.svelte | 38 +++++++++- 4 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 apps/desktop/src/lib/pr/PrDetailsModal.svelte diff --git a/apps/desktop/src/lib/gitHost/github/types.ts b/apps/desktop/src/lib/gitHost/github/types.ts index f3af01219..7552b9f70 100644 --- a/apps/desktop/src/lib/gitHost/github/types.ts +++ b/apps/desktop/src/lib/gitHost/github/types.ts @@ -10,6 +10,7 @@ export function parseGitHubDetailedPullRequest( id: data.id, number: data.number, title: data.title, + body: data.body ?? undefined, sourceBranch: data.base?.ref, draft: data.draft, htmlUrl: data.html_url, diff --git a/apps/desktop/src/lib/gitHost/interface/types.ts b/apps/desktop/src/lib/gitHost/interface/types.ts index 11bba81f5..1fa1479db 100644 --- a/apps/desktop/src/lib/gitHost/interface/types.ts +++ b/apps/desktop/src/lib/gitHost/interface/types.ts @@ -30,6 +30,7 @@ export interface PullRequest { export interface DetailedPullRequest { id: number; title: string; + body: string | undefined; number: number; sourceBranch: string; draft?: boolean; diff --git a/apps/desktop/src/lib/pr/PrDetailsModal.svelte b/apps/desktop/src/lib/pr/PrDetailsModal.svelte new file mode 100644 index 000000000..b352da191 --- /dev/null +++ b/apps/desktop/src/lib/pr/PrDetailsModal.svelte @@ -0,0 +1,75 @@ + + + + {#snippet children(_, close)} + +
+
+
+ {pr.title} +
+ {#if pr.body} +
+ +
+ {:else} +
No PR description.
+ {/if} +
+
+
+ + {/snippet} +
+ + diff --git a/apps/desktop/src/lib/pr/PullRequestCard.svelte b/apps/desktop/src/lib/pr/PullRequestCard.svelte index 5ca8703b6..449b31513 100644 --- a/apps/desktop/src/lib/pr/PullRequestCard.svelte +++ b/apps/desktop/src/lib/pr/PullRequestCard.svelte @@ -1,5 +1,6 @@