diff --git a/apps/desktop/src/components/SelectionView.svelte b/apps/desktop/src/components/SelectionView.svelte index 056dbbb84d..fffe5a59df 100644 --- a/apps/desktop/src/components/SelectionView.svelte +++ b/apps/desktop/src/components/SelectionView.svelte @@ -6,7 +6,7 @@ import { isExecutableStatus } from '$lib/hunks/change'; import { DIFF_SERVICE } from '$lib/hunks/diffService.svelte'; import { FILE_SELECTION_MANAGER } from '$lib/selection/fileSelectionManager.svelte'; - import { readKey, type SelectionId } from '$lib/selection/key'; + import { type SelectionId } from '$lib/selection/key'; import { inject } from '@gitbutler/core/context'; type Props = { @@ -35,13 +35,11 @@ const diffService = inject(DIFF_SERVICE); const selection = $derived(selectionId ? idSelection.valuesReactive(selectionId) : undefined); - const lastAdded = $derived(selectionId ? idSelection.getById(selectionId).lastAdded : undefined); - const selectedFile = $derived.by(() => { - if (!selectionId || !selection) return; - if (selection.current.length === 0) return; - if (selection.current.length === 1 || !$lastAdded) return selection.current[0]; - return readKey($lastAdded.key); + const selectedFiles = $derived.by(() => { + if (!selectionId || !selection) return []; + if (selection.current.length === 0) return []; + return selection.current; }); const stackId = $derived( @@ -52,49 +50,51 @@
- {#if selectedFile} - {@const changeQuery = idSelection.changeByKey(projectId, selectedFile)} - - {#snippet children(change)} - {@const diffQuery = diffService.getDiff(projectId, change)} - {@const isExecutable = isExecutableStatus(change.status)} - - {#snippet children(diff, env)} -
- {#if !diffOnly} - 0} + {#each selectedFiles as selectedFile, index (selectedFile.path)} + {@const changeQuery = idSelection.changeByKey(projectId, selectedFile)} + + {#snippet children(change)} + {@const diffQuery = diffService.getDiff(projectId, change)} + {@const isExecutable = isExecutableStatus(change.status)} + + {#snippet children(diff, env)} +
+ {#if !diffOnly} + + {/if} + - {/if} - -
- {/snippet} -
- {/snippet} -
+
+ {/snippet} +
+ {/snippet} +
+ {/each} {:else} {/if} @@ -104,6 +104,7 @@ .selection-view { display: flex; flex-grow: 1; + flex-direction: column; width: 100%; height: 100%; }