High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
refactor: use ControlBar UI Library component (#28567)
Brandon Wees7c25bcc0a776
diff --git a/e2e/src/ui/specs/timeline/timeline.e2e-spec.ts b/e2e/src/ui/specs/timeline/timeline.e2e-spec.tsindex c2a3b8e724..6f986df84f 100644--- a/e2e/src/ui/specs/timeline/timeline.e2e-spec.ts+++ b/e2e/src/ui/specs/timeline/timeline.e2e-spec.ts@@ -536,7 +536,7 @@ test.describe('Timeline', () => {force: false,ids: [assetToTrash.id],});- await page.locator('#asset-selection-app-bar').getByLabel('Close').click();+ await page.locator('#control-bar').getByLabel('Close').click();await page.getByText('Trash', { exact: true }).click();await timelineUtils.waitForTimelineLoad(page);await thumbnailUtils.expectInViewport(page, assetToTrash.id);@@ -676,7 +676,7 @@ test.describe('Timeline', () => {ids: [assetToArchive.id],});await thumbnailUtils.expectThumbnailIsArchive(page, assetToArchive.id);- await page.locator('#asset-selection-app-bar').getByLabel('Close').click();+ await page.locator('#control-bar').getByLabel('Close').click();await page.getByRole('link').getByText('Archive').click();await timelineUtils.waitForTimelineLoad(page);await thumbnailUtils.expectInViewport(page, assetToArchive.id);@@ -823,7 +823,7 @@ test.describe('Timeline', () => {});// ensure thumbnail still exists and has favorite iconawait thumbnailUtils.expectThumbnailIsFavorite(page, assetToFavorite.id);- await page.locator('#asset-selection-app-bar').getByLabel('Close').click();+ await page.locator('#control-bar').getByLabel('Close').click();await page.getByRole('link').getByText('Favorites').click();await timelineUtils.waitForTimelineLoad(page);await pageUtils.goToAsset(page, assetToFavorite.fileCreatedAt);diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 91a94de23c..f380d940d1 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -758,8 +758,8 @@ importers:specifier: workspace:*version: link:../packages/sdk'@immich/ui':- specifier: ^0.77.0- version: 0.77.3(@sveltejs/[email protected](@opentelemetry/[email protected])(@sveltejs/[email protected]([email protected](@typescript-eslint/[email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])))([email protected](@typescript-eslint/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])))([email protected](@typescript-eslint/[email protected]))+ specifier: ^0.79.0+ version: 0.79.0(@sveltejs/[email protected](@opentelemetry/[email protected])(@sveltejs/[email protected]([email protected](@typescript-eslint/[email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])))([email protected](@typescript-eslint/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])))([email protected](@typescript-eslint/[email protected]))'@mapbox/mapbox-gl-rtl-text':specifier: 0.4.0version: 0.4.0@@ -3204,8 +3204,8 @@ packages:resolution: {integrity: sha512-O1SJ+BbeFVsUTF4af1MfagJZM+lPgLjI8lQ3SZNjpo8SGJReSbUl2ii03OKuGni/G0yp2GnRLpOTNSHYGtVrcg==}hasBin: true- '@immich/[email protected]':- resolution: {integrity: sha512-h3jrYE3JyGDOwXF7A4tVUHenP0L7TsDV22FyFInBTdwlWjjXoknwE1HWeTvvLxLeMuO5SHCZ9Q2D2al84xVjNw==}+ '@immich/[email protected]':+ resolution: {integrity: sha512-UEQZrP8CTc4Kth1xCV8/6Xmk1P51GQKISC7vKqcrM0BO0fxCaNwJK8Ocn6R8baVqH52JYfPb1yQR9bweBnCjXw==}peerDependencies:'@sveltejs/kit': ^2.13.0svelte: ^5.0.0@@ -15879,7 +15879,7 @@ snapshots:pg-connection-string: 2.13.0postgres: 3.4.9- '@immich/[email protected](@sveltejs/[email protected](@opentelemetry/[email protected])(@sveltejs/[email protected]([email protected](@typescript-eslint/[email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])))([email protected](@typescript-eslint/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])))([email protected](@typescript-eslint/[email protected]))':+ '@immich/[email protected](@sveltejs/[email protected](@opentelemetry/[email protected])(@sveltejs/[email protected]([email protected](@typescript-eslint/[email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])))([email protected](@typescript-eslint/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])))([email protected](@typescript-eslint/[email protected]))':dependencies:'@internationalized/date': 3.12.1'@mdi/js': 7.4.47diff --git a/web/package.json b/web/package.jsonindex 13725c2d56..aa6e3a2692 100644--- a/web/package.json+++ b/web/package.json@@ -27,7 +27,7 @@"@formatjs/icu-messageformat-parser": "^3.0.0","@immich/justified-layout-wasm": "^0.4.3","@immich/sdk": "workspace:*",- "@immich/ui": "^0.77.0",+ "@immich/ui": "^0.79.0","@mapbox/mapbox-gl-rtl-text": "0.4.0","@mdi/js": "^7.4.47","@noble/hashes": "^2.2.0",diff --git a/web/src/lib/components/album-page/AlbumViewer.svelte b/web/src/lib/components/album-page/AlbumViewer.svelteindex 85a032067f..4e7d6bce1a 100644--- a/web/src/lib/components/album-page/AlbumViewer.svelte+++ b/web/src/lib/components/album-page/AlbumViewer.svelte@@ -103,7 +103,7 @@{/if}</AssetSelectControlBar>{:else}- <ControlAppBar showBackButton={false}>+ <ControlAppBar>{#snippet leading()}<a data-sveltekit-preload-data="hover" class="ms-4" href="/"><Logo variant={mediaQueryManager.maxMd ? 'icon' : 'inline'} class="min-w-10" />diff --git a/web/src/lib/components/pages/SharedLinkPage.svelte b/web/src/lib/components/pages/SharedLinkPage.svelteindex 40cf0a193f..8cb4aadd7b 100644--- a/web/src/lib/components/pages/SharedLinkPage.svelte+++ b/web/src/lib/components/pages/SharedLinkPage.svelte@@ -91,7 +91,7 @@</div></main><header>- <ControlAppBar showBackButton={false}>+ <ControlAppBar>{#snippet leading()}<a data-sveltekit-preload-data="hover" class="ms-4" href="/"><Logo variant="inline" />diff --git a/web/src/lib/components/share-page/IndividualSharedViewer.svelte b/web/src/lib/components/share-page/IndividualSharedViewer.svelteindex 86b716da40..936ccb0f41 100644--- a/web/src/lib/components/share-page/IndividualSharedViewer.svelte+++ b/web/src/lib/components/share-page/IndividualSharedViewer.svelte@@ -18,7 +18,7 @@import { toTimelineAsset } from '$lib/utils/timeline-util';import { getAssetInfo, type SharedLinkResponseDto } from '@immich/sdk';import { IconButton, Logo, toastManager } from '@immich/ui';- import { mdiArrowLeft, mdiDownload, mdiFileImagePlusOutline, mdiSelectAll } from '@mdi/js';+ import { mdiDownload, mdiFileImagePlusOutline, mdiSelectAll } from '@mdi/js';import { t } from 'svelte-i18n';import ControlAppBar from '../shared-components/ControlAppBar.svelte';import GalleryViewer from '../shared-components/gallery-viewer/GalleryViewer.svelte';@@ -97,7 +97,7 @@{/if}</AssetSelectControlBar>{:else}- <ControlAppBar onClose={() => goto(Route.photos())} backIcon={mdiArrowLeft} showBackButton={false}>+ <ControlAppBar>{#snippet leading()}<a data-sveltekit-preload-data="hover" class="ms-4" href="/"><Logo variant={mediaQueryManager.maxMd ? 'icon' : 'inline'} class="min-w-10" />diff --git a/web/src/lib/components/shared-components/ControlAppBar.svelte b/web/src/lib/components/shared-components/ControlAppBar.svelteindex 85990a3b5c..eb021be775 100644--- a/web/src/lib/components/shared-components/ControlAppBar.svelte+++ b/web/src/lib/components/shared-components/ControlAppBar.svelte@@ -1,97 +1,49 @@<script lang="ts">- import { browser } from '$app/environment';- import { IconButton } from '@immich/ui';+ import { ControlBar, ControlBarContent, ControlBarHeader, ControlBarOverflow, ControlBarTitle } from '@immich/ui';import { mdiClose } from '@mdi/js';- import { onDestroy, onMount, type Snippet } from 'svelte';- import { t } from 'svelte-i18n';- import { fly } from 'svelte/transition';+ import type { Snippet } from 'svelte';+ import type { ClassValue } from 'svelte/elements';interface Props {- showBackButton?: boolean;backIcon?: string;- tailwindClasses?: string;- forceDark?: boolean;- multiRow?: boolean;+ class?: ClassValue;onClose?: () => void;+ title?: Snippet | string;leading?: Snippet;children?: Snippet;trailing?: Snippet;}- let {- showBackButton = true,- backIcon = mdiClose,- tailwindClasses = '',- forceDark = false,- multiRow = false,- onClose = () => {},- leading,- children,- trailing,- }: Props = $props();-- let appBarBorder = $state('border border-subtle');-- const onScroll = () => {- if (window.scrollY > 80) {- appBarBorder = 'border border-gray-200 bg-gray-50 dark:border-gray-600';-- if (forceDark) {- appBarBorder = 'border border-gray-600';- }- } else {- appBarBorder = 'border border-subtle';- }- };-- onMount(() => {- if (browser) {- document.addEventListener('scroll', onScroll, { passive: true });- }- });-- onDestroy(() => {- if (browser) {- document.removeEventListener('scroll', onScroll);- }- });+ let { backIcon = mdiClose, class: className = '', onClose, title, leading, children, trailing }: Props = $props();</script>-<div in:fly={{ y: 10, duration: 200 }} class="absolute top-0 w-full bg-transparent">- <nav- id="asset-selection-app-bar"- class={[- 'grid',- multiRow && 'grid-cols-[100%] md:grid-cols-[25%_50%_25%]',- !multiRow && 'grid-cols-[10%_80%_10%] sm:grid-cols-[25%_50%_25%]',- 'justify-between lg:grid-cols-[25%_50%_25%]',- appBarBorder,- 'm-2 place-items-center rounded-full p-2 transition-all max-md:p-0',- tailwindClasses,- forceDark ? 'bg-immich-dark-gray! text-white' : 'bg-light-50 dark:bg-immich-dark-gray',- ]}- >- <div class="flex place-items-center justify-self-start sm:gap-6 dark:text-immich-dark-fg {forceDark ? 'dark' : ''}">- {#if showBackButton}- <IconButton- aria-label={$t('close')}- onclick={onClose}- color="secondary"- shape="round"- variant="ghost"- icon={backIcon}- size="large"- />- {/if}- {@render leading?.()}- </div>-- <div class="w-full">- {@render children?.()}- </div>-- <div class="me-4 flex place-items-center gap-1 justify-self-end max-[350px]:me-0 max-[350px]:gap-0">- {@render trailing?.()}- </div>- </nav>+<div class="absolute top-0 w-full bg-transparent p-2" id="control-bar">+ <ControlBar closeIcon={backIcon} {onClose} shape="round" class={className}>+ {#if title || leading}+ <ControlBarHeader>+ {#if title}+ <ControlBarTitle>+ {#if typeof title === 'string'}+ {title}+ {:else}+ {@render title()}+ {/if}+ </ControlBarTitle>+ {/if}+ {@render leading?.()}+ </ControlBarHeader>+ {/if}++ {#if children}+ <ControlBarContent>+ {@render children()}+ </ControlBarContent>+ {/if}++ {#if trailing}+ <ControlBarOverflow>+ {@render trailing()}+ </ControlBarOverflow>+ {/if}+ </ControlBar></div>diff --git a/web/src/lib/components/timeline/AssetSelectControlBar.svelte b/web/src/lib/components/timeline/AssetSelectControlBar.svelteindex 49a3f26884..b88213a3b0 100644--- a/web/src/lib/components/timeline/AssetSelectControlBar.svelte+++ b/web/src/lib/components/timeline/AssetSelectControlBar.svelte@@ -7,19 +7,18 @@type Props = {children?: Snippet;- forceDark?: boolean;};- let { children, forceDark }: Props = $props();+ let { children }: Props = $props();const onClose = () => assetMultiSelectManager.clear();const assets = $derived(assetMultiSelectManager.assets);</script>-<ControlAppBar {onClose} {forceDark} backIcon={mdiClose} tailwindClasses="bg-white shadow-md">+<ControlAppBar {onClose} backIcon={mdiClose}>{#snippet leading()}- <div class="font-medium {forceDark ? 'text-immich-dark-primary' : 'text-primary'}">+ <div class="font-medium text-primary"><p class="block sm:hidden">{assets.length}</p><p class="hidden sm:block">{$t('selected_count', { values: { count: assets.length } })}</p></div>diff --git a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelteindex 6258df34aa..42072c122b 100644--- a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte+++ b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte@@ -1,10 +1,8 @@<script lang="ts">import { goto, invalidate, onNavigate } from '$app/navigation';import { scrollMemoryClearer } from '$lib/actions/scroll-memory';- import AlbumDescription from './AlbumDescription.svelte';import AlbumMap from '$lib/components/album-page/AlbumMap.svelte';import AlbumSummary from '$lib/components/album-page/AlbumSummary.svelte';- import AlbumTitle from './AlbumTitle.svelte';import ActivityStatus from '$lib/components/asset-viewer/ActivityStatus.svelte';import ActivityViewer from '$lib/components/asset-viewer/ActivityViewer.svelte';import HeaderActionButton from '$lib/components/HeaderActionButton.svelte';@@ -78,6 +76,8 @@import { t } from 'svelte-i18n';import { fly } from 'svelte/transition';import type { PageData } from './$types';+ import AlbumDescription from './AlbumDescription.svelte';+ import AlbumTitle from './AlbumTitle.svelte';interface Props {data: PageData;@@ -499,7 +499,7 @@</AssetSelectControlBar>{:else}{#if viewMode === AlbumPageViewMode.VIEW}- <ControlAppBar showBackButton backIcon={mdiArrowLeft} onClose={() => goto(Route.albums())}>+ <ControlAppBar backIcon={mdiArrowLeft} onClose={() => goto(Route.albums())}>{#snippet trailing()}<ActionButton action={Cast} />diff --git a/web/src/routes/(user)/memory/[[photos=photos]]/[[assetId=id]]/MemoryViewer.svelte b/web/src/routes/(user)/memory/[[photos=photos]]/[[assetId=id]]/MemoryViewer.svelteindex 6b373de8cb..ef671c399a 100644--- a/web/src/routes/(user)/memory/[[photos=photos]]/[[assetId=id]]/MemoryViewer.svelte+++ b/web/src/routes/(user)/memory/[[photos=photos]]/[[assetId=id]]/MemoryViewer.svelte@@ -2,11 +2,8 @@import { afterNavigate, goto } from '$app/navigation';import { page } from '$app/state';import { shortcuts } from '$lib/actions/shortcut';- import MemoryPhotoViewer from './MemoryPhotoViewer.svelte';- import MemoryVideoViewer from './MemoryVideoViewer.svelte';import ButtonContextMenu from '$lib/components/shared-components/context-menu/ButtonContextMenu.svelte';import MenuOption from '$lib/components/shared-components/context-menu/MenuOption.svelte';- import ControlAppBar from '$lib/components/shared-components/ControlAppBar.svelte';import GalleryViewer from '$lib/components/shared-components/gallery-viewer/GalleryViewer.svelte';import ArchiveAction from '$lib/components/timeline/actions/ArchiveAction.svelte';import ChangeDate from '$lib/components/timeline/actions/ChangeDateAction.svelte';@@ -37,6 +34,7 @@mdiChevronLeft,mdiChevronRight,mdiChevronUp,+ mdiClose,mdiDotsVertical,mdiHeart,mdiHeartOutline,@@ -54,6 +52,8 @@import { t } from 'svelte-i18n';import type { Attachment } from 'svelte/attachments';import { Tween } from 'svelte/motion';+ import MemoryPhotoViewer from './MemoryPhotoViewer.svelte';+ import MemoryVideoViewer from './MemoryVideoViewer.svelte';let memoryGallery: HTMLElement | undefined = $state();let memoryWrapper: HTMLElement | undefined = $state();@@ -328,7 +328,7 @@{#if assetMultiSelectManager.selectionActive}<div class="dark sticky top-0 z-1">- <AssetSelectControlBar forceDark>+ <AssetSelectControlBar>{@const Actions = getAssetBulkActions($t)}<CreateSharedLink /><IconButton@@ -365,22 +365,31 @@<sectionid="memory-viewer"- class="w-full bg-immich-dark-gray"+ class="dark w-full bg-immich-dark-gray text-white"bind:this={memoryWrapper}bind:clientHeight={viewport.height}bind:clientWidth={viewport.width}>{#if current}- <ControlAppBar onClose={() => goto(Route.photos())} forceDark multiRow>- {#snippet leading()}- {#if current}+ <div class="dark grid grid-cols-[100%] p-2 max-md:h-auto max-md:flex-col md:grid-cols-[25%_50%_25%] md:p-4">+ {#if current}+ <div class="flex items-center gap-2 md:gap-6">+ <IconButton+ shape="round"+ variant="ghost"+ color="secondary"+ icon={mdiClose}+ aria-label={$t('close')}+ size="large"+ onclick={() => goto(Route.photos())}+ /><p class="text-lg">{$memoryLaneTitle(current.memory)}</p>- {/if}- {/snippet}+ </div>+ {/if}- <div class="dark flex place-content-center place-items-center gap-2">+ <div class="dark flex w-full place-content-center place-items-center gap-2"><IconButtonshape="round"variant="ghost"@@ -438,7 +447,7 @@</media-mute-button>{/if}</div>- </ControlAppBar>+ </div>{#if galleryInView}<div@@ -462,7 +471,7 @@</div>{/if}<!-- Viewer -->- <section class="overflow-hidden pt-32 md:pt-20" bind:clientHeight={viewerHeight}>+ <section class="overflow-hidden pt-6 md:pt-0" bind:clientHeight={viewerHeight}><divclass="ms-[-100%] box-border flex h-[calc(100vh-224px)] w-[300%] items-center justify-center gap-10 overflow-hidden md:h-[calc(100vh-180px)]">diff --git a/web/src/routes/(user)/partners/[userId]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/partners/[userId]/[[photos=photos]]/[[assetId=id]]/+page.svelteindex 6cb60bafbe..8e355d3efb 100644--- a/web/src/routes/(user)/partners/[userId]/[[photos=photos]]/[[assetId=id]]/+page.svelte+++ b/web/src/routes/(user)/partners/[userId]/[[photos=photos]]/[[assetId=id]]/+page.svelte@@ -47,7 +47,7 @@<DownloadAction /></AssetSelectControlBar>{:else}- <ControlAppBar showBackButton backIcon={mdiArrowLeft} onClose={() => goto(Route.sharing())}>+ <ControlAppBar backIcon={mdiArrowLeft} onClose={() => goto(Route.sharing())}>{#snippet leading()}<p class="whitespace-nowrap text-immich-fg dark:text-immich-dark-fg">{$t('partner_list_user_photos', { values: { user: data.partner.name } })}diff --git a/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelteindex c32f0bce70..803c078700 100644--- a/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte+++ b/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte@@ -5,9 +5,6 @@import { listNavigation } from '$lib/actions/list-navigation';import { scrollMemoryClearer } from '$lib/actions/scroll-memory';import ImageThumbnail from '$lib/components/assets/thumbnail/ImageThumbnail.svelte';- import EditNameInput from './EditNameInput.svelte';- import MergeFaceSelector from './MergeFaceSelector.svelte';- import UnmergeFaceSelector from './UnmergeFaceSelector.svelte';import OnEvents from '$lib/components/OnEvents.svelte';import ButtonContextMenu from '$lib/components/shared-components/context-menu/ButtonContextMenu.svelte';import MenuOption from '$lib/components/shared-components/context-menu/MenuOption.svelte';@@ -54,6 +51,9 @@import { onMount } from 'svelte';import { t } from 'svelte-i18n';import type { PageData } from './$types';+ import EditNameInput from './EditNameInput.svelte';+ import MergeFaceSelector from './MergeFaceSelector.svelte';+ import UnmergeFaceSelector from './UnmergeFaceSelector.svelte';interface Props {data: PageData;@@ -493,7 +493,7 @@</AssetSelectControlBar>{:else}{#if viewMode === PersonPageViewMode.VIEW_ASSETS}- <ControlAppBar showBackButton backIcon={mdiArrowLeft} onClose={() => goto(previousRoute)}>+ <ControlAppBar backIcon={mdiArrowLeft} onClose={() => goto(previousRoute)}>{#snippet trailing()}<ContextMenuButtonitems={[SelectFeaturePhoto, HidePerson, ShowPerson, SetDateOfBirth, Merge, Favorite, Unfavorite]}diff --git a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelteindex 2f79b1143f..86a3040d5a 100644--- a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte+++ b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte@@ -387,8 +387,7 @@{:else}<div class="fixed inset-s-0 top-0 z-2 w-full"><ControlAppBar onClose={() => goto(previousRoute)} backIcon={mdiArrowLeft}>- <div class="absolute bg-light"></div>- <div class="w-full flex-1 ps-4">+ <div class="mx-auto w-full max-w-2xl pe-2"><SearchBar grayTheme={false} value={terms?.query ?? ''} searchQuery={terms} /></div></ControlAppBar>