From 3f74c66fb749914c21ddc01b53e1ac696118e9e7 Mon Sep 17 00:00:00 2001 From: Kiril Videlov Date: Wed, 18 Oct 2023 14:09:32 +0200 Subject: [PATCH] refactor: move remote branches out of tray and into their own component --- .../repo/[projectId]/RemoteBranches.svelte | 159 ++++++++++++++++++ .../src/routes/repo/[projectId]/Tray.svelte | 150 ++--------------- 2 files changed, 174 insertions(+), 135 deletions(-) create mode 100644 packages/ui/src/routes/repo/[projectId]/RemoteBranches.svelte diff --git a/packages/ui/src/routes/repo/[projectId]/RemoteBranches.svelte b/packages/ui/src/routes/repo/[projectId]/RemoteBranches.svelte new file mode 100644 index 000000000..0388f0a98 --- /dev/null +++ b/packages/ui/src/routes/repo/[projectId]/RemoteBranches.svelte @@ -0,0 +1,159 @@ + + +
+
+
Remote Branches
+ + + +
+
+ +
+
+ +
+
+
+ {#if $remoteBranchesState.isLoading} +
loading...
+ {:else if $remoteBranchesState.isError} +
Something went wrong
+ {:else if !$remoteBranchStore || $remoteBranchStore.length == 0} +
+

+ There are no local or remote Git branches that can be imported as virtual branches +

+ + Learn more + +
+ {:else if $remoteBranchStore} + {#each $remoteBranchStore as branch, i} +
select(branch, i)} + on:keypress={() => select(branch, i)} + class:bg-color-4={$selectedItem == branch && peekTrayExpanded} + class="border-color-4 flex flex-col justify-between gap-1 border-b px-2 py-1 pt-2 -outline-offset-2 outline-blue-200 last:border-b focus:outline-2" + > +
+
+ {#if branch.name.match('refs/remotes')} + + + + {:else} + + + + {/if} +
+
+ {branch.name + .replace('refs/remotes/', '') + .replace('origin/', '') + .replace('refs/heads/', '')} +
+
+
+
+ +
+
+ +
+ {branch.ahead()} / {branch.behind} +
+
+ {#await branch.isMergeable then isMergeable} + {#if !isMergeable} +
!
+ {/if} + {/await} +
+
+ {#each branch.authors() as author} + Gravatar for {author.email} + {/each} +
+
+
+ {/each} + {/if} +
+
+ +
diff --git a/packages/ui/src/routes/repo/[projectId]/Tray.svelte b/packages/ui/src/routes/repo/[projectId]/Tray.svelte index f7ced6dab..6fdbc826b 100644 --- a/packages/ui/src/routes/repo/[projectId]/Tray.svelte +++ b/packages/ui/src/routes/repo/[projectId]/Tray.svelte @@ -1,7 +1,6 @@