Skip to content

Commit 71e3a75

Browse files
committed
Make selection of assigned changes and commits/branches mutually exclusive
1 parent cf55ffa commit 71e3a75

File tree

5 files changed

+30
-5
lines changed

5 files changed

+30
-5
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
hasConflicts: boolean;
7777
isAncestorMostConflicted: boolean;
7878
}) => void;
79+
onselect?: () => void;
7980
}
8081
8182
let {
@@ -89,7 +90,8 @@
8990
stackingReorderDropzoneManager,
9091
handleUncommit,
9192
startEditingCommitMessage,
92-
handleEditPatch
93+
handleEditPatch,
94+
onselect
9395
}: Props = $props();
9496
9597
const [stackService, uiState, forge, baseBranchService, dropzoneRegistry] = inject(
@@ -153,6 +155,7 @@
153155
} else {
154156
stackState.selection.set({ branchName, commitId, upstream });
155157
}
158+
onselect?.();
156159
}
157160
</script>
158161

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@
2626
stackId: string;
2727
branches: BranchDetails[];
2828
focusedStackId?: string;
29+
onselect?: () => void;
2930
};
3031
31-
const { projectId, branches, stackId, focusedStackId }: Props = $props();
32+
const { projectId, branches, stackId, focusedStackId, onselect }: Props = $props();
3233
const [stackService, uiState, modeService] = inject(StackService, UiState, ModeService);
3334
3435
const projectState = $derived(uiState.project(projectId));
@@ -154,6 +155,7 @@
154155
} else {
155156
uiState.stack(stackId).selection.set({ branchName });
156157
}
158+
onselect?.();
157159
}}
158160
>
159161
{#snippet menu({ rightClickTrigger })}
@@ -186,6 +188,7 @@
186188
{handleUncommit}
187189
{startEditingCommitMessage}
188190
{handleEditPatch}
191+
{onselect}
189192
/>
190193
{/snippet}
191194
</BranchCard>

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
active?: boolean;
4444
conflictEntries?: ConflictEntriesObj;
4545
draggableFiles: boolean;
46+
onselect?: () => void;
4647
};
4748
4849
const {
@@ -54,7 +55,8 @@
5455
active,
5556
stackId,
5657
conflictEntries,
57-
draggableFiles
58+
draggableFiles,
59+
onselect
5860
}: Props = $props();
5961
6062
const [
@@ -204,6 +206,7 @@
204206
selected={idSelection.has(change.path, selectionId)}
205207
onclick={(e) => {
206208
selectFilesInList(e, change, sortedChanges, idSelection, true, idx, selectionId);
209+
onselect?.();
207210
}}
208211
{conflictEntries}
209212
/>

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@
169169
onDropzoneActivated={(activated) => {
170170
dropzoneActivated = activated;
171171
}}
172+
onselect={() => {
173+
// Clear one selection when you modify the other.
174+
stackState?.selection.set(undefined);
175+
}}
172176
>
173177
{#snippet emptyPlaceholder()}
174178
{#if !isCommitting}
@@ -204,7 +208,16 @@
204208
</div>
205209
</div>
206210

207-
<BranchList {projectId} {branches} stackId={stack.id} {focusedStackId} />
211+
<BranchList
212+
{projectId}
213+
{branches}
214+
stackId={stack.id}
215+
{focusedStackId}
216+
onselect={() => {
217+
// Clear one selection when you modify the other.
218+
idSelection.clear({ type: 'worktree', stackId: stack.id });
219+
}}
220+
/>
208221
<Resizer
209222
viewport={laneEl!}
210223
direction="right"

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
3333
emptyPlaceholder?: Snippet;
3434
notScrollable?: boolean;
35+
onselect?: () => void;
3536
};
3637
3738
let {
@@ -44,7 +45,8 @@
4445
4546
onDropzoneActivated,
4647
emptyPlaceholder,
47-
notScrollable = false
48+
notScrollable = false,
49+
onselect
4850
}: Props = $props();
4951
5052
const [uiState, stackService, diffService, uncommittedService] = inject(
@@ -98,6 +100,7 @@
98100
{listMode}
99101
{active}
100102
{stackId}
103+
{onselect}
101104
/>
102105
</div>
103106
{/snippet}

0 commit comments

Comments
 (0)