Skip to content

Commit 26ae409

Browse files
committed
Commit goes here for empty branch
Adds the little indicator right under the branch header.
1 parent c172ae6 commit 26ae409

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
branchName: string;
1818
iconName: keyof typeof iconsJson;
1919
draft?: boolean;
20+
isCommitting?: boolean;
2021
} & (
2122
| { draft: true; description?: Snippet }
2223
| {
@@ -43,7 +44,7 @@
4344
}
4445
);
4546
46-
let { projectId, branchName, iconName, ...args }: Props = $props();
47+
let { projectId, branchName, iconName, isCommitting, ...args }: Props = $props();
4748
4849
const [uiState] = inject(UiState);
4950
@@ -84,6 +85,7 @@
8485
trackingBranch={args.trackingBranch}
8586
{isMenuOpenByBtn}
8687
{isMenuOpenByMouse}
88+
{isCommitting}
8789
selected={selected && selection?.current?.commitId === undefined}
8890
isTopBranch={args.first}
8991
isNewBranch={args.isNewBranch}
@@ -153,7 +155,7 @@
153155
/>
154156
{/if}
155157

156-
{#if !args.draft && !args.isNewBranch}
158+
{#if !args.draft}
157159
{@render args.commitList?.()}
158160
{/if}
159161
</div>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
stackId: string;
1313
branchName: string;
1414
selectedCommitId?: string;
15+
empty?: Snippet;
1516
upstreamTemplate?: Snippet<
1617
[
1718
{
@@ -42,6 +43,7 @@
4243
stackId,
4344
branchName,
4445
selectedCommitId,
46+
empty,
4547
localAndRemoteTemplate,
4648
upstreamTemplate
4749
}: Props = $props();
@@ -60,6 +62,9 @@
6062
result={combineResults(upstreamOnlyCommits.current, localAndRemoteCommits.current)}
6163
>
6264
{#snippet children([upstreamOnlyCommits, localAndRemoteCommits], { stackId })}
65+
{#if localAndRemoteCommits.length === 0}
66+
{@render empty?.()}
67+
{/if}
6368
<div class="commit-list">
6469
{#if upstreamTemplate}
6570
{#each upstreamOnlyCommits as commit, i (commit.id)}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
lineColor: string;
2020
menuBtnEl?: HTMLButtonElement;
2121
draft?: boolean;
22+
isCommitting?: boolean;
2223
} & (
2324
| { draft: true }
2425
| {
@@ -44,6 +45,7 @@
4445
readonly,
4546
iconName,
4647
lineColor,
48+
isCommitting,
4749
menuBtnEl = $bindable(),
4850
...args
4951
}: Props = $props();
@@ -80,6 +82,7 @@
8082
role="button"
8183
class="branch-header"
8284
class:new-branch={args.isNewBranch}
85+
class:is-committing={isCommitting}
8386
class:selected={args.selected}
8487
onclick={args.onclick}
8588
oncontextmenu={(e) => {
@@ -228,8 +231,7 @@
228231
border-bottom: none;
229232
border-radius: var(--radius-ml);
230233
}
231-
&.draft {
232-
border-bottom: none;
234+
&.is-committing {
233235
border-radius: var(--radius-ml) var(--radius-ml) 0 0;
234236
}
235237
}

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
{first}
9393
{last}
9494
{isNewBranch}
95+
{isCommitting}
9596
pushStatus={branchDetails.pushStatus}
9697
isConflicted={branchDetails.isConflicted}
9798
lastUpdatedAt={branchDetails.lastUpdatedAt}
@@ -101,6 +102,11 @@
101102
>
102103
{#snippet commitList()}
103104
<BranchCommitList {projectId} {stackId} {branchName} {selectedCommitId}>
105+
{#snippet empty()}
106+
{#if isCommitting}
107+
<CommitGoesHere selected first last />
108+
{/if}
109+
{/snippet}
104110
{#snippet upstreamTemplate({ commit, first, lastCommit, selected })}
105111
{@const commitId = commit.id}
106112
{#if !isCommitting}
@@ -133,11 +139,11 @@
133139
/>
134140
{/if}
135141
{@const dzCommit: DzCommitData = {
136-
id: commit.id,
137-
isRemote: isUpstreamCommit(commit),
138-
isIntegrated: isLocalAndRemoteCommit(commit) && commit.state.type === 'Integrated',
139-
isConflicted: isLocalAndRemoteCommit(commit) && commit.hasConflicts,
140-
}}
142+
id: commit.id,
143+
isRemote: isUpstreamCommit(commit),
144+
isIntegrated: isLocalAndRemoteCommit(commit) && commit.state.type === 'Integrated',
145+
isConflicted: isLocalAndRemoteCommit(commit) && commit.hasConflicts,
146+
}}
141147
{@const amendHandler = new AmendCommitWithChangeDzHandler(
142148
projectId,
143149
stackService,

0 commit comments

Comments
 (0)