Skip to content

Commit 945ef1c

Browse files
CopilotByron
andcommitted
Add editable prop to CommitTitle component for context-aware messages
This way we can show empty commits without the 'drag changes here' text. Co-authored-by: Byron <[email protected]>
1 parent 0e3dbba commit 945ef1c

File tree

8 files changed

+14
-3
lines changed

8 files changed

+14
-3
lines changed

apps/desktop/src/components/BranchCommitList.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@
289289
{active}
290290
onclick={() => handleCommitClick(commit.id, true)}
291291
disableCommitActions={false}
292+
editable={!!stackId}
292293
/>
293294
{/if}
294295
{/each}
@@ -428,6 +429,7 @@
428429
{active}
429430
onclick={() => handleCommitClick(commit.id, false)}
430431
disableCommitActions={false}
432+
editable={!!stackId}
431433
>
432434
{#snippet menu({ rightClickTrigger })}
433435
{@const data = {

apps/desktop/src/components/BranchesViewBranch.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
});
8787
}}
8888
lastCommit={idx === branch.upstreamCommits.length - 1 && branch.commits.length === 0}
89+
editable={false}
8990
/>
9091
{/each}
9192
{#each branch.commits || [] as commit, idx}
@@ -108,6 +109,7 @@
108109
}}
109110
lastCommit={idx === branch.commits.length - 1}
110111
active
112+
editable={false}
111113
/>
112114
{/each}
113115
</div>

apps/desktop/src/components/CommitRow.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
active?: boolean;
2828
hasConflicts?: boolean;
2929
disabled?: boolean;
30+
editable?: boolean;
3031
menu?: Snippet<[{ rightClickTrigger: HTMLElement }]>;
3132
onclick?: () => void;
3233
};
@@ -74,6 +75,7 @@
7475
disabled,
7576
hasConflicts,
7677
active,
78+
editable = true,
7779
onclick,
7880
menu,
7981
...args
@@ -144,7 +146,7 @@
144146
{/if}
145147

146148
<div class="commit-name truncate">
147-
<CommitTitle {commitMessage} truncate className="text-13 text-semibold" />
149+
<CommitTitle {commitMessage} truncate className="text-13 text-semibold" {editable} />
148150
</div>
149151

150152
{#if !args.disableCommitActions}

apps/desktop/src/components/CommitTitle.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66
truncate?: boolean;
77
commitMessage: string;
88
className?: string;
9+
editable?: boolean;
910
};
1011
11-
const { commitMessage, truncate, className }: Props = $props();
12+
const { commitMessage, truncate, className, editable = true }: Props = $props();
1213
1314
const title = $derived(splitMessage(commitMessage).title);
1415
1516
function getTitle() {
1617
if (title) {
1718
return title;
1819
}
19-
return 'Empty commit. Drag changes here';
20+
return editable ? 'Empty commit. Drag changes here' : 'Empty commit';
2021
}
2122
</script>
2223

apps/desktop/src/components/CommitView.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
truncate
172172
commitMessage={commit.message}
173173
className="text-14 text-semibold text-body"
174+
editable={!isReadOnly}
174175
/>
175176
{/snippet}
176177

apps/desktop/src/components/TargetCommitList.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
commitMessage={commit.message}
106106
createdAt={commit.createdAt}
107107
author={commit.author}
108+
editable={false}
108109
onclick={() => {
109110
branchesState.set({
110111
commitId: commit.id,

apps/desktop/src/components/UnappliedCommitView.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
truncate
3131
commitMessage={commit.message}
3232
className="text-14 text-semibold text-body"
33+
editable={false}
3334
/>
3435
{/snippet}
3536

apps/desktop/src/components/codegen/CodegenPage.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,7 @@
10011001
lastCommit={i === commits.length - 1}
10021002
{lastBranch}
10031003
tooltip={commitStatusLabel(commit.state.type)}
1004+
editable={false}
10041005
/>
10051006
{/each}
10061007
{/snippet}

0 commit comments

Comments
 (0)