Skip to content

Commit a9e58ae

Browse files
authored
feat (branches): center SelectionView and add notClosable prop to disable close button (#9428)
1 parent 961f723 commit a9e58ae

File tree

3 files changed

+35
-13
lines changed

3 files changed

+35
-13
lines changed

apps/desktop/src/components/BranchesView.svelte

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import BranchesViewBranch from '$components/BranchesViewBranch.svelte';
66
import BranchesViewPr from '$components/BranchesViewPR.svelte';
77
import BranchesViewStack from '$components/BranchesViewStack.svelte';
8+
import ConfigurableScrollableContainer from '$components/ConfigurableScrollableContainer.svelte';
89
import PrBranchView from '$components/PRBranchView.svelte';
910
import ReduxResult from '$components/ReduxResult.svelte';
1011
import Resizer from '$components/Resizer.svelte';
@@ -400,9 +401,19 @@
400401
{/if}
401402

402403
{#if !isNonLocalPr}
403-
<SelectionView testId={TestId.BranchesSelectionView} {projectId} {selectionId} />
404+
<div class="preview-selection">
405+
<ConfigurableScrollableContainer zIndex="var(--z-lifted)">
406+
<SelectionView
407+
testId={TestId.BranchesSelectionView}
408+
{projectId}
409+
{selectionId}
410+
notClosable
411+
/>
412+
</ConfigurableScrollableContainer>
413+
</div>
404414
{/if}
405415
</div>
416+
406417
<Scrollbar viewport={rightWrapper} horz />
407418
</div>
408419
</div>
@@ -484,4 +495,13 @@
484495
border-bottom: 1px solid var(--clr-border-2);
485496
background-color: var(--clr-bg-1);
486497
}
498+
499+
.preview-selection {
500+
display: flex;
501+
position: relative;
502+
flex: 1;
503+
flex-direction: column;
504+
min-height: 100%;
505+
overflow: hidden;
506+
}
487507
</style>

apps/desktop/src/components/FilePreviewPlaceholder.svelte

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
.select-some {
1414
display: flex;
1515
z-index: 0;
16-
position: relative;
16+
position: absolute;
17+
top: 50%;
18+
left: 50%;
1719
flex-direction: column;
1820
align-items: center;
1921
justify-content: center;
20-
width: 100%;
21-
height: 100%;
22-
padding: 40px 0;
23-
overflow: hidden;
22+
transform: translate(-50%, -50%);
2423
2524
&:after {
2625
z-index: -1;
@@ -33,7 +32,6 @@
3332
border-radius: 100%;
3433
background-color: red;
3534
background: radial-gradient(var(--clr-bg-2) 10%, oklch(from var(--clr-bg-2) l c h / 0) 50%);
36-
/* background: radial-gradient(red 10%, oklch(from red l c h / 0) 50%); */
3735
content: '';
3836
transition: opacity 0.1s;
3937
}

apps/desktop/src/components/SelectionView.svelte

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
draggableFiles?: boolean;
1919
diffOnly?: boolean;
2020
onclose?: () => void;
21+
notClosable?: boolean;
2122
testId?: string;
2223
bottomBorder?: boolean;
2324
};
@@ -28,6 +29,7 @@
2829
draggableFiles: draggable,
2930
diffOnly,
3031
onclose,
32+
notClosable,
3133
testId,
3234
bottomBorder
3335
}: Props = $props();
@@ -81,12 +83,14 @@
8183
isHeader
8284
executable={!!isExecutable}
8385
listMode="list"
84-
onCloseClick={() => {
85-
if (idSelection) {
86-
idSelection.remove(selectedFile.path, selectedFile);
87-
}
88-
onclose?.();
89-
}}
86+
onCloseClick={notClosable
87+
? undefined
88+
: () => {
89+
if (idSelection) {
90+
idSelection.remove(selectedFile.path, selectedFile);
91+
}
92+
onclose?.();
93+
}}
9094
/>
9195
{/if}
9296
<UnifiedDiffView

0 commit comments

Comments
 (0)