From ac837f5bd564c3676a608918245f659890c56466 Mon Sep 17 00:00:00 2001 From: Mikael Kristiansson Date: Wed, 16 Oct 2024 20:32:34 +0200 Subject: [PATCH] feat: add draft status and review status (#28) --- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src/components/Reviews.svelte | 119 ++++++++++++++++++++++++++-------- src/lib/api.ts | 4 +- src/types.ts | 5 +- 6 files changed, 103 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index 28b96fe..ae47330 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gitbar", "private": true, - "version": "0.7.1", + "version": "0.8.0", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index feab8b7..f299579 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -917,7 +917,7 @@ dependencies = [ [[package]] name = "gitbar" -version = "0.7.1" +version = "0.8.0" dependencies = [ "ascii", "auto-launch", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index ba0fa2e..d144edc 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gitbar" -version = "0.7.1" +version = "0.8.0" description = "Github review counter" authors = ["mikael.kristiansson"] license = "MIT" diff --git a/src/components/Reviews.svelte b/src/components/Reviews.svelte index dc03674..1d76fc4 100644 --- a/src/components/Reviews.svelte +++ b/src/components/Reviews.svelte @@ -127,6 +127,17 @@ d="M22.266 2.711a.75.75 0 1 0-1.061-1.06l-1.983 1.983-1.984-1.983a.75.75 0 1 0-1.06 1.06l1.983 1.983-1.983 1.984a.75.75 0 0 0 1.06 1.06l1.984-1.983 1.983 1.983a.75.75 0 0 0 1.06-1.06l-1.983-1.984 1.984-1.983ZM4.75 1.5a3.25 3.25 0 0 1 .745 6.414A.827.827 0 0 1 5.5 8v8a.827.827 0 0 1-.005.086A3.25 3.25 0 0 1 4.75 22.5a3.25 3.25 0 0 1-.745-6.414A.827.827 0 0 1 4 16V8c0-.029.002-.057.005-.086A3.25 3.25 0 0 1 4.75 1.5ZM16 19.25a3.252 3.252 0 0 1 2.5-3.163V9.625a.75.75 0 0 1 1.5 0v6.462a3.252 3.252 0 0 1-.75 6.413A3.25 3.25 0 0 1 16 19.25ZM3 4.75a1.75 1.75 0 1 0 3.501-.001A1.75 1.75 0 0 0 3 4.75Zm0 14.5a1.75 1.75 0 1 0 3.501-.001A1.75 1.75 0 0 0 3 19.25Zm16.25-1.75a1.75 1.75 0 1 0 .001 3.501 1.75 1.75 0 0 0-.001-3.501Z" > + {:else if review.node.isDraft} + {:else} {review.node.repository.nameWithOwner} #{review.node.number} {#if !review.node.isReadByViewer} -
+
{/if}
@@ -172,31 +183,44 @@ {/if} {/key} - - {#if review.node.statusCheckRollup?.state === 'SUCCESS'} - - {:else} - - {/if} - + {#if review.node.statusCheckRollup && review.node.statusCheckRollup?.state !== 'ERROR'} + + {#if review.node.statusCheckRollup.state === 'SUCCESS'} + + {:else if review.node.statusCheckRollup.state === 'FAILURE'} + + {:else} + + {/if} Checks + + {/if}
{#each review.node.labels.edges as label} @@ -217,6 +241,49 @@ {/if} {/each}
+ + {#if review.node.reviewDecision === 'APPROVED'} + + {:else} + + {/if} Reviews + + {#if review.node.totalCommentsCount > 0} + + + {review.node.totalCommentsCount} + + {/if} {/if}
diff --git a/src/lib/api.ts b/src/lib/api.ts index 7eaa73c..f9026b2 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -74,7 +74,9 @@ export const getReviews = async (account: AuthState, settings: GithubSettings): title merged closed - changedFiles + isDraft + reviewDecision + totalCommentsCount labels(first: 10) { edges { node { diff --git a/src/types.ts b/src/types.ts index 2428cfd..ac888a2 100644 --- a/src/types.ts +++ b/src/types.ts @@ -70,6 +70,9 @@ export interface Review { title: string; merged: boolean; closed: boolean; + isDraft: boolean; + reviewDecision: 'APPROVED' | 'CHANGES_REQUESTED' | 'REVIEW_REQUIRED'; + totalCommentsCount: number; labels: { edges: Array<{ node: { @@ -79,7 +82,7 @@ export interface Review { }>; }; statusCheckRollup: { - state: 'SUCCESS' | 'FAILURE'; + state: 'SUCCESS' | 'FAILURE' | 'PENDING' | 'ERROR' | 'EXPECTED'; }; isReadByViewer: boolean; };