Skip to content

Commit ec9a70c

Browse files
committed
fix: general PR cleanup
- add skip link unit test - remove unused tailwind styles - adjust asset grid spacing - fix event propogation
1 parent fc43ec0 commit ec9a70c

File tree

7 files changed

+36
-31
lines changed

7 files changed

+36
-31
lines changed

web/src/lib/actions/__test__/focus-trap-test.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
44
interface Props {
55
show: boolean;
6+
active?: boolean;
67
}
78
8-
let { show = $bindable() }: Props = $props();
9+
let { show = $bindable(), active = $bindable() }: Props = $props();
910
</script>
1011

1112
<button type="button" onclick={() => (show = true)}>Open</button>
1213

1314
{#if show}
14-
<div use:focusTrap>
15+
<div use:focusTrap={{ active }}>
1516
<div>
1617
<span>text</span>
1718
<button data-testid="one" type="button" onclick={() => (show = false)}>Close</button>

web/src/lib/actions/__test__/focus-trap.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ describe('focusTrap action', () => {
1212
expect(document.activeElement).toEqual(screen.getByTestId('one'));
1313
});
1414

15+
it('should not set focus if inactive', async () => {
16+
render(FocusTrapTest, { show: true, active: false });
17+
await tick();
18+
expect(document.activeElement).toBe(document.body);
19+
});
20+
1521
it('supports backward focus wrapping', async () => {
1622
render(FocusTrapTest, { show: true });
1723
await tick();

web/src/lib/actions/focus-trap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ interface Options {
55
/**
66
* Set whether the trap is active or not.
77
*/
8-
active: boolean;
8+
active?: boolean;
99
}
1010

1111
const selectors =

web/src/lib/components/photos-page/asset-grid.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@
816816
<!-- Right margin MUST be equal to the width of immich-scrubbable-scrollbar -->
817817
<section
818818
id="asset-grid"
819-
class="scrollbar-hidden h-full overflow-y-auto outline-none pl-2 {isEmpty ? 'm-0' : 'ml-4 tall:ml-0 mr-[60px]'}"
819+
class="scrollbar-hidden h-full overflow-y-auto outline-none {isEmpty ? 'm-0' : 'ml-4 mr-[60px]'}"
820820
tabindex="-1"
821821
use:resizeObserver={({ height, width }) => ((viewport.width = width), (viewport.height = height))}
822822
bind:this={element}

web/src/lib/components/shared-components/navigation-bar/navigation-bar.svelte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@
7373
isSidebarOpen.value = !isSidebarOpen.value;
7474
}}
7575
onmousedown={(event: MouseEvent) => {
76-
// stops event from reaching the default handler when clicking outside of the sidebar
77-
event.stopPropagation();
76+
if (isSidebarOpen.value) {
77+
// stops event from reaching the default handler when clicking outside of the sidebar
78+
event.stopPropagation();
79+
}
7880
}}
7981
class="md:hidden"
8082
/>
@@ -84,7 +86,7 @@
8486
</a>
8587
</div>
8688
<div class="flex justify-between gap-4 lg:gap-8 pr-6">
87-
<div class="hidden flex-1 tall:pl-0 sm:block">
89+
<div class="hidden w-full max-w-5xl flex-1 tall:pl-0 sm:block">
8890
{#if $featureFlags.search}
8991
<SearchBar grayTheme={true} />
9092
{/if}

web/src/lib/components/shared-components/side-bar/side-bar.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@
8484
bind:isSelected={isSharingSelected}
8585
></SideBarLink>
8686

87-
<div class="text-xs transition-all duration-200 dark:text-immich-dark-fg">
88-
<p class="p-6">{$t('library').toUpperCase()}</p>
89-
</div>
87+
<p class="text-xs p-6 dark:text-immich-dark-fg">{$t('library').toUpperCase()}</p>
9088

9189
<SideBarLink
9290
title={$t('favorites')}

web/src/lib/components/shared-components/side-bar/storage-space.svelte

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,34 +46,32 @@
4646
</script>
4747

4848
<div
49-
class="storage-status p-4 bg-gray-100 dark:bg-immich-dark-primary/10 ml-4 rounded-lg text-sm min-w-52 overflow-hidden"
49+
class="storage-status p-4 bg-gray-100 dark:bg-immich-dark-primary/10 ml-4 rounded-lg text-sm min-w-52"
5050
title={$t('storage_usage', {
5151
values: {
5252
used: getByteUnitString(usedBytes, $locale, 3),
5353
available: getByteUnitString(availableBytes, $locale, 3),
5454
},
5555
})}
5656
>
57-
<div>
58-
<p class="font-medium text-immich-dark-gray dark:text-white mb-2">{$t('storage')}</p>
57+
<p class="font-medium text-immich-dark-gray dark:text-white mb-2">{$t('storage')}</p>
5958

60-
{#if userInteraction.serverInfo}
61-
<p class="text-gray-500 dark:text-gray-300">
62-
{$t('storage_usage', {
63-
values: {
64-
used: getByteUnitString(usedBytes, $locale),
65-
available: getByteUnitString(availableBytes, $locale),
66-
},
67-
})}
68-
</p>
59+
{#if userInteraction.serverInfo}
60+
<p class="text-gray-500 dark:text-gray-300">
61+
{$t('storage_usage', {
62+
values: {
63+
used: getByteUnitString(usedBytes, $locale),
64+
available: getByteUnitString(availableBytes, $locale),
65+
},
66+
})}
67+
</p>
6968

70-
<div class="mt-4 h-[7px] w-full rounded-full bg-gray-200 dark:bg-gray-700">
71-
<div class="h-[7px] rounded-full {usageClasses}" style="width: {usedPercentage}%"></div>
72-
</div>
73-
{:else}
74-
<div class="mt-2">
75-
<LoadingSpinner />
76-
</div>
77-
{/if}
78-
</div>
69+
<div class="mt-4 h-[7px] w-full rounded-full bg-gray-200 dark:bg-gray-700">
70+
<div class="h-[7px] rounded-full {usageClasses}" style="width: {usedPercentage}%"></div>
71+
</div>
72+
{:else}
73+
<div class="mt-2">
74+
<LoadingSpinner />
75+
</div>
76+
{/if}
7977
</div>

0 commit comments

Comments
 (0)