Skip to content

Commit 4cd0dcf

Browse files
committed
fix: rm empty branch from branchCommitList component
1 parent bc3ffb7 commit 4cd0dcf

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

apps/desktop/src/components/v3/Branch.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import { combineResults } from '$lib/state/helpers';
1010
import { inject } from '@gitbutler/shared/context';
1111
import { goto } from '$app/navigation';
12+
import EmptyBranch from './EmptyBranch.svelte';
1213
1314
interface Props {
1415
projectId: string;
@@ -50,6 +51,9 @@
5051
onclick={() => goto(branchPath(projectId, stackId, branch.name))}
5152
/>
5253
<BranchCommitList {projectId} {stackId} {branchName} {lastBranch} {selectedCommitId}>
54+
{#snippet empty()}
55+
<EmptyBranch {lastBranch} selected={branch.name === branchName} />
56+
{/snippet}
5357
{#snippet upstreamTemplate({ commit, commitKey, first, last: lastCommit, selected })}
5458
<CommitRow
5559
{projectId}

apps/desktop/src/components/v3/BranchCommitList.svelte

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script lang="ts">
2-
import EmptyBranch from './EmptyBranch.svelte';
32
import ReduxResult from '$components/ReduxResult.svelte';
43
import { StackService } from '$lib/stacks/stackService.svelte';
54
import { combineResults } from '$lib/state/helpers';
@@ -29,19 +28,17 @@
2928
localAndRemoteTemplate?: Snippet<
3029
[{ commit: Commit; commitKey: CommitKey; first: boolean; last: boolean; selected: boolean }]
3130
>;
32-
emptyBranchCommitHere?: Snippet;
31+
empty?: Snippet;
3332
}
3433
3534
let {
3635
projectId,
3736
stackId,
3837
branchName,
39-
lastBranch,
40-
selectedBranchName,
4138
selectedCommitId,
4239
localAndRemoteTemplate,
4340
upstreamTemplate,
44-
emptyBranchCommitHere
41+
empty
4542
}: Props = $props();
4643
4744
const [stackService] = inject(StackService);
@@ -57,13 +54,7 @@
5754
<ReduxResult result={combineResults(upstreamOnlyCommits, localAndRemoteCommits)}>
5855
{#snippet children([upstreamOnlyCommits, localAndRemoteCommits])}
5956
{#if !upstreamOnlyCommits.length && !localAndRemoteCommits.length}
60-
{#if selectedBranchName === branchName && emptyBranchCommitHere}
61-
<div class="empty-branch-commit-here">
62-
{@render emptyBranchCommitHere()}
63-
</div>
64-
{:else}
65-
<EmptyBranch {lastBranch} selected={selectedBranchName === branchName} />
66-
{/if}
57+
{@render empty?.()}
6758
{:else}
6859
<div class="commit-list">
6960
{#if upstreamTemplate}
@@ -91,7 +82,6 @@
9182
</ReduxResult>
9283

9384
<style lang="postcss">
94-
.empty-branch-commit-here,
9585
.commit-list {
9686
position: relative;
9787
display: flex;

apps/desktop/src/components/v3/CommitGoesHere.svelte

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import { inject } from '@gitbutler/shared/context';
1111
import Badge from '@gitbutler/ui/Badge.svelte';
1212
import { goto } from '$app/navigation';
13+
import EmptyBranch from './EmptyBranch.svelte';
1314
1415
type Props = {
1516
projectId: string;
@@ -79,8 +80,13 @@
7980
selectedBranchName={branchName}
8081
selectedCommitId={parentId}
8182
>
82-
{#snippet emptyBranchCommitHere()}
83-
{@render indicator({ first: true })}
83+
{@render indicator({ first: true })}
84+
{#snippet empty()}
85+
{#if branch.name !== branchName}
86+
<EmptyBranch />
87+
{:else}
88+
{@render indicator({ first: true })}
89+
{/if}
8490
{/snippet}
8591
{#snippet localAndRemoteTemplate({ commit, commitKey, first, last, selected })}
8692
{@const baseSha = $baseBranch?.baseSha}
@@ -125,6 +131,7 @@
125131
.commit-goes-here {
126132
display: flex;
127133
flex-direction: column;
134+
margin-bottom: 14px;
128135
}
129136
130137
.branch {
@@ -189,6 +196,7 @@
189196
width: 100%;
190197
background-color: var(--clr-bg-2);
191198
199+
/* Last commit row which does not have an "Your commit here" indicator after it */
192200
&.last:not(:has(~ .indicator)) {
193201
border-radius: 0 0 var(--radius-l) var(--radius-l);
194202
}

apps/desktop/src/components/v3/EmptyBranch.svelte

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@
3434
.commit-line {
3535
position: absolute;
3636
left: 20px;
37+
}
38+
:global(.commit-goes-here .empty-series .commit-line) {
3739
opacity: 0.4;
38-
39-
&.selected {
40-
opacity: 1;
41-
}
4240
}
4341
</style>

0 commit comments

Comments
 (0)