From 0c9f042d43f78f725dbf621a17ef144b1c87bbf6 Mon Sep 17 00:00:00 2001 From: midzelis Date: Tue, 16 Sep 2025 12:56:43 +0000 Subject: [PATCH] refactor: Finish timeline migration by removing AssetGrid wrapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove AssetGrid wrapper - Update all remaining route files to import Timeline directly - Fix component signatures where needed (onThumbnailClick → onAssetOpen) - Update album-viewer component to use Timeline - Update geolocation route with proper callback signature All routes now use Timeline component directly: - album-viewer component The major parts of the refactoring are complete. --- mise.toml | 2 +- .../components/album-page/album-viewer.svelte | 6 +- .../asset-viewer/actions/delete-action.svelte | 2 +- .../photos-page/actions/delete-assets.svelte | 4 +- .../photos-page/asset-date-group.svelte | 254 -------- .../components/photos-page/asset-grid.svelte | 102 --- .../photos-page/delete-asset-dialog.svelte | 47 -- .../components/photos-page/skeleton.svelte | 48 -- .../gallery-viewer/gallery-viewer.svelte | 2 +- .../scrubber/scrubber.svelte | 593 ------------------ .../actions/timeline-keyboard-actions.svelte | 2 +- .../[[assetId=id]]/+page.svelte | 6 +- .../[[assetId=id]]/+page.svelte | 6 +- .../[[assetId=id]]/+page.svelte | 6 +- .../[[assetId=id]]/+page.svelte | 6 +- .../[[assetId=id]]/+page.svelte | 4 +- .../[[assetId=id]]/+page.svelte | 6 +- .../(user)/photos/[[assetId=id]]/+page.svelte | 6 +- .../[[assetId=id]]/+page.svelte | 6 +- .../[[assetId=id]]/+page.svelte | 6 +- .../(user)/utilities/geolocation/+page.svelte | 24 +- 21 files changed, 42 insertions(+), 1096 deletions(-) delete mode 100644 web/src/lib/components/photos-page/asset-date-group.svelte delete mode 100644 web/src/lib/components/photos-page/asset-grid.svelte delete mode 100644 web/src/lib/components/photos-page/delete-asset-dialog.svelte delete mode 100644 web/src/lib/components/photos-page/skeleton.svelte delete mode 100644 web/src/lib/components/shared-components/scrubber/scrubber.svelte diff --git a/mise.toml b/mise.toml index 47acb66b21..0a9025e2da 100644 --- a/mise.toml +++ b/mise.toml @@ -300,7 +300,7 @@ run = "tsc --noEmit" depends = "web:svelte-kit-sync" env._.path = "web/node_modules/.bin" dir = "web" -run = "svelte-check --no-tsconfig --fail-on-warnings --compiler-warnings 'reactive_declaration_non_reactive_property:ignore' --ignore src/lib/components/photos-page/asset-grid.svelte" +run = "svelte-check --no-tsconfig --fail-on-warnings" [tasks."web:checklist"] run = [ diff --git a/web/src/lib/components/album-page/album-viewer.svelte b/web/src/lib/components/album-page/album-viewer.svelte index 8c91d29a34..9be19b18db 100644 --- a/web/src/lib/components/album-page/album-viewer.svelte +++ b/web/src/lib/components/album-page/album-viewer.svelte @@ -18,7 +18,7 @@ import { onDestroy } from 'svelte'; import { t } from 'svelte-i18n'; import DownloadAction from '../photos-page/actions/download-action.svelte'; - import AssetGrid from '../photos-page/asset-grid.svelte'; + import Timeline from '../timeline/timeline.svelte'; import ControlAppBar from '../shared-components/control-app-bar.svelte'; import ImmichLogoSmallLink from '../shared-components/immich-logo-small-link.svelte'; import ThemeButton from '../shared-components/theme-button.svelte'; @@ -61,7 +61,7 @@ />
- +

{/if}

-
+
diff --git a/web/src/lib/components/asset-viewer/actions/delete-action.svelte b/web/src/lib/components/asset-viewer/actions/delete-action.svelte index 82b88127f6..34dd41f6b4 100644 --- a/web/src/lib/components/asset-viewer/actions/delete-action.svelte +++ b/web/src/lib/components/asset-viewer/actions/delete-action.svelte @@ -1,6 +1,6 @@ - -{#each filterIntersecting(monthGroup.dayGroups) as dayGroup, groupIndex (dayGroup.day)} - {@const absoluteWidth = dayGroup.left} - - -
{ - isMouseOverGroup = true; - assetMouseEventHandler(dayGroup.groupTitle, null); - }} - onmouseleave={() => { - isMouseOverGroup = false; - assetMouseEventHandler(dayGroup.groupTitle, null); - }} - > - -
- {#if !singleSelect} -
handleSelectGroup(dayGroup.groupTitle, assetsSnapshot(dayGroup.getAssets()))} - onkeydown={() => handleSelectGroup(dayGroup.groupTitle, assetsSnapshot(dayGroup.getAssets()))} - > - {#if assetInteraction.selectedGroup.has(dayGroup.groupTitle)} - - {:else} - - {/if} -
- {/if} - - - {dayGroup.groupTitle} - -
- - -
- {#each filterIntersecting(dayGroup.viewerAssets) as viewerAsset (viewerAsset.id)} - {@const position = viewerAsset.position!} - {@const asset = viewerAsset.asset!} - - - -
- { - if (typeof onThumbnailClick === 'function') { - onThumbnailClick(asset, timelineManager, dayGroup, _onClick); - } else { - _onClick(timelineManager, dayGroup.getAssets(), dayGroup.groupTitle, asset); - } - }} - onSelect={(asset) => assetSelectHandler(timelineManager, asset, dayGroup.getAssets(), dayGroup.groupTitle)} - onMouseEvent={() => assetMouseEventHandler(dayGroup.groupTitle, assetSnapshot(asset))} - selected={assetInteraction.hasSelectedAsset(asset.id) || - dayGroup.monthGroup.timelineManager.albumAssets.has(asset.id)} - selectionCandidate={assetInteraction.hasSelectionCandidate(asset.id)} - disabled={dayGroup.monthGroup.timelineManager.albumAssets.has(asset.id)} - thumbnailWidth={position.width} - thumbnailHeight={position.height} - /> - {#if customLayout} - {@render customLayout(asset)} - {/if} -
- - {/each} -
-
-{/each} - - diff --git a/web/src/lib/components/photos-page/asset-grid.svelte b/web/src/lib/components/photos-page/asset-grid.svelte deleted file mode 100644 index e8025a6542..0000000000 --- a/web/src/lib/components/photos-page/asset-grid.svelte +++ /dev/null @@ -1,102 +0,0 @@ - - - - - diff --git a/web/src/lib/components/photos-page/delete-asset-dialog.svelte b/web/src/lib/components/photos-page/delete-asset-dialog.svelte deleted file mode 100644 index c04b5f39d0..0000000000 --- a/web/src/lib/components/photos-page/delete-asset-dialog.svelte +++ /dev/null @@ -1,47 +0,0 @@ - - - (confirmed ? handleConfirm() : onCancel())} -> - {#snippet promptSnippet()} -

- - {#snippet children({ message })} - {message} - {/snippet} - -

-

{$t('cannot_undo_this_action')}

- -
- -
- {/snippet} -
diff --git a/web/src/lib/components/photos-page/skeleton.svelte b/web/src/lib/components/photos-page/skeleton.svelte deleted file mode 100644 index 7ce2c3cee3..0000000000 --- a/web/src/lib/components/photos-page/skeleton.svelte +++ /dev/null @@ -1,48 +0,0 @@ - - -
-
- {title} -
-
-
- - diff --git a/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte b/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte index e9282ae5d8..9498261204 100644 --- a/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte +++ b/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte @@ -3,6 +3,7 @@ import { shortcuts, type ShortcutOptions } from '$lib/actions/shortcut'; import type { Action } from '$lib/components/asset-viewer/actions/action'; import Thumbnail from '$lib/components/assets/thumbnail/thumbnail.svelte'; + import DeleteAssetDialog from '$lib/components/timeline/actions/delete-asset-dialog.svelte'; import { AppRoute, AssetAction } from '$lib/constants'; import type { TimelineAsset, Viewport } from '$lib/managers/timeline-manager/types'; import ShortcutsModal from '$lib/modals/ShortcutsModal.svelte'; @@ -23,7 +24,6 @@ import { debounce } from 'lodash-es'; import { t } from 'svelte-i18n'; import AssetViewer from '../../asset-viewer/asset-viewer.svelte'; - import DeleteAssetDialog from '../../photos-page/delete-asset-dialog.svelte'; import Portal from '../portal/portal.svelte'; interface Props { diff --git a/web/src/lib/components/shared-components/scrubber/scrubber.svelte b/web/src/lib/components/shared-components/scrubber/scrubber.svelte deleted file mode 100644 index b1f8f5eb03..0000000000 --- a/web/src/lib/components/shared-components/scrubber/scrubber.svelte +++ /dev/null @@ -1,593 +0,0 @@ - - - (isDragging || isHover) && handleMouseEvent({ clientY })} - onmousedown={({ clientY }) => isHover && handleMouseEvent({ clientY, isDragging: true })} - onmouseup={({ clientY }) => handleMouseEvent({ clientY, isDragging: false })} -/> - -
(isHover = true)} - onmouseleave={() => (isHover = false)} - onkeydown={keydown} - draggable="false" -> - {#if !usingMobileDevice && hoverLabel && (isHover || isDragging)} -
- {hoverLabel} -
- {/if} - {#if usingMobileDevice && ((timelineManager.scrolling && scrollHoverLabel) || isHover || isDragging)} -
- - - {#if (timelineManager.scrolling && scrollHoverLabel) || isHover || isDragging} -

- {scrollHoverLabel} -

- {/if} -
- {/if} - - {#if !usingMobileDevice && !isDragging} -
- {#if timelineManager.scrolling && scrollHoverLabel && !isHover} -

- {scrollHoverLabel} -

- {/if} -
- {/if} -
- {#if relativeTopOffset > 6} -
- {/if} -
- - {#each segments as segment (segment.year + '-' + segment.month)} -
- {#if !usingMobileDevice} - {#if segment.hasLabel} -
- {segment.year} -
- {/if} - {#if segment.hasDot} -
- {/if} - {/if} -
- {/each} -
-
diff --git a/web/src/lib/components/timeline/actions/timeline-keyboard-actions.svelte b/web/src/lib/components/timeline/actions/timeline-keyboard-actions.svelte index b04e1cc8a9..7fc49c2324 100644 --- a/web/src/lib/components/timeline/actions/timeline-keyboard-actions.svelte +++ b/web/src/lib/components/timeline/actions/timeline-keyboard-actions.svelte @@ -9,6 +9,7 @@ type AbsoluteResult, type RelativeResult, } from '$lib/components/shared-components/change-date.svelte'; + import DeleteAssetDialog from '$lib/components/timeline/actions/delete-asset-dialog.svelte'; import { AppRoute } from '$lib/constants'; import { TimelineManager } from '$lib/managers/timeline-manager/timeline-manager.svelte'; import type { TimelineAsset } from '$lib/managers/timeline-manager/types'; @@ -26,7 +27,6 @@ import { mdiCalendarBlankOutline } from '@mdi/js'; import { DateTime } from 'luxon'; import { t } from 'svelte-i18n'; - import DeleteAssetDialog from './delete-asset-dialog.svelte'; let { isViewing: showAssetViewer } = assetViewingStore; interface Props { 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.svelte index 3565a33f21..536426602b 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 @@ -22,7 +22,7 @@ import SelectAllAssets from '$lib/components/photos-page/actions/select-all-assets.svelte'; import SetVisibilityAction from '$lib/components/photos-page/actions/set-visibility-action.svelte'; import TagAction from '$lib/components/photos-page/actions/tag-action.svelte'; - import AssetGrid from '$lib/components/photos-page/asset-grid.svelte'; + import Timeline from '$lib/components/timeline/timeline.svelte'; import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte'; import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte'; import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte'; @@ -443,7 +443,7 @@
- {/if} {/if} - + {#if showActivityStatus && !activityManager.isLoading}
diff --git a/web/src/routes/(user)/archive/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/archive/[[photos=photos]]/[[assetId=id]]/+page.svelte index 5481224057..f3f113ca38 100644 --- a/web/src/routes/(user)/archive/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/archive/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -7,7 +7,7 @@ import DownloadAction from '$lib/components/photos-page/actions/download-action.svelte'; import FavoriteAction from '$lib/components/photos-page/actions/favorite-action.svelte'; import SelectAllAssets from '$lib/components/photos-page/actions/select-all-assets.svelte'; - import AssetGrid from '$lib/components/photos-page/asset-grid.svelte'; + import Timeline from '$lib/components/timeline/timeline.svelte'; import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte'; import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte'; import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte'; @@ -47,7 +47,7 @@ - {/snippet} - + {#if assetInteraction.selectionActive} diff --git a/web/src/routes/(user)/favorites/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/favorites/[[photos=photos]]/[[assetId=id]]/+page.svelte index ae24a82da7..7cc911696c 100644 --- a/web/src/routes/(user)/favorites/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/favorites/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -12,7 +12,7 @@ import SelectAllAssets from '$lib/components/photos-page/actions/select-all-assets.svelte'; import SetVisibilityAction from '$lib/components/photos-page/actions/set-visibility-action.svelte'; import TagAction from '$lib/components/photos-page/actions/tag-action.svelte'; - import AssetGrid from '$lib/components/photos-page/asset-grid.svelte'; + import Timeline from '$lib/components/timeline/timeline.svelte'; import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte'; import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte'; import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte'; @@ -51,7 +51,7 @@ - {/snippet} - + diff --git a/web/src/routes/(user)/locked/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/locked/[[photos=photos]]/[[assetId=id]]/+page.svelte index 733e93db71..cc02cd1df3 100644 --- a/web/src/routes/(user)/locked/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/locked/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -7,7 +7,7 @@ import DownloadAction from '$lib/components/photos-page/actions/download-action.svelte'; import SelectAllAssets from '$lib/components/photos-page/actions/select-all-assets.svelte'; import SetVisibilityAction from '$lib/components/photos-page/actions/set-visibility-action.svelte'; - import AssetGrid from '$lib/components/photos-page/asset-grid.svelte'; + import Timeline from '$lib/components/timeline/timeline.svelte'; import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte'; import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte'; import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte'; @@ -58,7 +58,7 @@ {/snippet} - {/snippet} - + 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.svelte index 83962c5a90..3b3b2dc212 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 @@ -3,7 +3,7 @@ import AddToAlbum from '$lib/components/photos-page/actions/add-to-album.svelte'; import CreateSharedLink from '$lib/components/photos-page/actions/create-shared-link.svelte'; import DownloadAction from '$lib/components/photos-page/actions/download-action.svelte'; - import AssetGrid from '$lib/components/photos-page/asset-grid.svelte'; + import Timeline from '$lib/components/timeline/timeline.svelte'; import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte'; import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte'; import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte'; @@ -43,7 +43,7 @@
- +
{#if assetInteraction.selectionActive} 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.svelte index 807819b585..df57e2b173 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 @@ -20,7 +20,7 @@ import SelectAllAssets from '$lib/components/photos-page/actions/select-all-assets.svelte'; import SetVisibilityAction from '$lib/components/photos-page/actions/set-visibility-action.svelte'; import TagAction from '$lib/components/photos-page/actions/tag-action.svelte'; - import AssetGrid from '$lib/components/photos-page/asset-grid.svelte'; + import Timeline from '$lib/components/timeline/timeline.svelte'; import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte'; import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte'; import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte'; @@ -386,7 +386,7 @@ }} > {#key person.id} - {/if} - + {/key}
diff --git a/web/src/routes/(user)/photos/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/photos/[[assetId=id]]/+page.svelte index 0098667873..2bdbb1098b 100644 --- a/web/src/routes/(user)/photos/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/photos/[[assetId=id]]/+page.svelte @@ -16,7 +16,7 @@ import SetVisibilityAction from '$lib/components/photos-page/actions/set-visibility-action.svelte'; import StackAction from '$lib/components/photos-page/actions/stack-action.svelte'; import TagAction from '$lib/components/photos-page/actions/tag-action.svelte'; - import AssetGrid from '$lib/components/photos-page/asset-grid.svelte'; + import Timeline from '$lib/components/timeline/timeline.svelte'; import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte'; import MemoryLane from '$lib/components/photos-page/memory-lane.svelte'; import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte'; @@ -89,7 +89,7 @@ - openFileUploadDialog()} /> {/snippet} - + {#if assetInteraction.selectionActive} diff --git a/web/src/routes/(user)/tags/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/tags/[[photos=photos]]/[[assetId=id]]/+page.svelte index a25dc5643c..a7ce04b444 100644 --- a/web/src/routes/(user)/tags/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/tags/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -2,7 +2,7 @@ import { goto } from '$app/navigation'; import SkipLink from '$lib/components/elements/buttons/skip-link.svelte'; import UserPageLayout, { headerId } from '$lib/components/layouts/user-page-layout.svelte'; - import AssetGrid from '$lib/components/photos-page/asset-grid.svelte'; + import Timeline from '$lib/components/timeline/timeline.svelte'; import Breadcrumbs from '$lib/components/shared-components/tree/breadcrumbs.svelte'; import TreeItemThumbnails from '$lib/components/shared-components/tree/tree-item-thumbnails.svelte'; import TreeItems from '$lib/components/shared-components/tree/tree-items.svelte'; @@ -117,11 +117,11 @@
{#if tag.hasAssets} - + {#snippet empty()} {/snippet} - + {:else} {/if} diff --git a/web/src/routes/(user)/trash/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/trash/[[photos=photos]]/[[assetId=id]]/+page.svelte index 2989a78a13..6f93737f52 100644 --- a/web/src/routes/(user)/trash/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/trash/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -5,7 +5,7 @@ import DeleteAssets from '$lib/components/photos-page/actions/delete-assets.svelte'; import RestoreAssets from '$lib/components/photos-page/actions/restore-assets.svelte'; import SelectAllAssets from '$lib/components/photos-page/actions/select-all-assets.svelte'; - import AssetGrid from '$lib/components/photos-page/asset-grid.svelte'; + import Timeline from '$lib/components/timeline/timeline.svelte'; import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte'; import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte'; import { @@ -116,14 +116,14 @@ {/snippet} - +

{$t('trashed_items_will_be_permanently_deleted_after', { values: { days: $serverConfig.trashDays } })}

{#snippet empty()} {/snippet} -
+ {/if} diff --git a/web/src/routes/(user)/utilities/geolocation/+page.svelte b/web/src/routes/(user)/utilities/geolocation/+page.svelte index ab0a59f3ef..6fbb35e17b 100644 --- a/web/src/routes/(user)/utilities/geolocation/+page.svelte +++ b/web/src/routes/(user)/utilities/geolocation/+page.svelte @@ -1,6 +1,6 @@ @@ -185,7 +175,7 @@
{/if} - - {#snippet customLayout(asset: TimelineAsset)} + {#snippet customThumbnailLayout(asset: TimelineAsset)} {#if hasGps(asset)}
{asset.city || $t('gps')} @@ -209,5 +199,5 @@ {#snippet empty()} {}} /> {/snippet} - +