diff --git a/i18n/en.json b/i18n/en.json index 82c5c147aa..2eb26bc01e 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1339,6 +1339,8 @@ "my_albums": "My albums", "name": "Name", "name_or_nickname": "Name or nickname", + "navigate": "Navigate", + "navigate_to_time": "Navigate to Time", "network_requirement_photos_upload": "Use cellular data to backup photos", "network_requirement_videos_upload": "Use cellular data to backup videos", "network_requirements_updated": "Network requirements changed, resetting backup queue", diff --git a/web/package.json b/web/package.json index 4c4831c2e7..67f6bcb4cf 100644 --- a/web/package.json +++ b/web/package.json @@ -9,7 +9,7 @@ "build:stats": "BUILD_STATS=true vite build", "package": "svelte-kit package", "preview": "vite preview", - "check:svelte": "svelte-check --no-tsconfig --fail-on-warnings --compiler-warnings 'reactive_declaration_non_reactive_property:ignore' --ignore src/lib/components/photos-page/asset-grid.svelte", + "check:svelte": "svelte-check --no-tsconfig --fail-on-warnings", "check:typescript": "tsc --noEmit", "check:watch": "npm run check:svelte -- --watch", "check:code": "npm run format && npm run lint:p && npm run check:svelte && npm run check:typescript", diff --git a/web/src/lib/components/photos-page/asset-grid-actions.svelte b/web/src/lib/components/photos-page/asset-grid-actions.svelte index 2087bc1d74..9d40e384e7 100644 --- a/web/src/lib/components/photos-page/asset-grid-actions.svelte +++ b/web/src/lib/components/photos-page/asset-grid-actions.svelte @@ -5,9 +5,11 @@ setFocusToAsset as setFocusAssetInit, setFocusTo as setFocusToInit, } from '$lib/components/photos-page/actions/focus-actions'; - import ChangeDate, { AbsoluteResult, RelativeResult } from '$lib/components/shared-components/change-date.svelte'; + import ChangeDate, { + type AbsoluteResult, + type RelativeResult, + } from '$lib/components/shared-components/change-date.svelte'; import { AppRoute } from '$lib/constants'; - import { modalManager } from '$lib/managers/modal-manager.svelte'; import { TimelineManager } from '$lib/managers/timeline-manager/timeline-manager.svelte'; import type { TimelineAsset } from '$lib/managers/timeline-manager/types'; import ShortcutsModal from '$lib/modals/ShortcutsModal.svelte'; @@ -20,7 +22,10 @@ import { deleteAssets, updateStackedAssetInTimeline } from '$lib/utils/actions'; import { archiveAssets, cancelMultiselect, selectAllAssets, stackAssets } from '$lib/utils/asset-utils'; import { AssetVisibility } from '@immich/sdk'; + import { modalManager } from '@immich/ui'; + 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; @@ -197,15 +202,16 @@ {#if isShowSelectDate} { isShowSelectDate = false; if (result.mode === 'absolute') { - const asset = await timelineManager.getClosestAssetToDate( - (DateTime.fromISO(result.date) as DateTime).toObject(), - ); + const asset = await timelineManager.getClosestAssetToDate(result.dateTime.toObject()); if (asset) { setFocusAsset(asset); } diff --git a/web/src/lib/components/photos-page/asset-grid.svelte b/web/src/lib/components/photos-page/asset-grid.svelte index 2c91e4fe3c..0a0d376089 100644 --- a/web/src/lib/components/photos-page/asset-grid.svelte +++ b/web/src/lib/components/photos-page/asset-grid.svelte @@ -15,7 +15,7 @@ import { assetViewingStore } from '$lib/stores/asset-viewing.store'; import { mobileDevice } from '$lib/stores/mobile-device.svelte'; import { navigate } from '$lib/utils/navigation'; - import { type ScrubberListener } from '$lib/utils/timeline-util'; + import { getTimes, type ScrubberListener, type TimelineYearMonth } from '$lib/utils/timeline-util'; import { type AlbumResponseDto, type PersonResponseDto } from '@immich/sdk'; import { DateTime } from 'luxon'; import { onMount, type Snippet } from 'svelte'; @@ -82,7 +82,7 @@ onThumbnailClick, }: Props = $props(); - let { isViewing: showAssetViewer, gridScrollTarget, mutex, viewingAsset } = assetViewingStore; + let { isViewing: showAssetViewer, gridScrollTarget, asset: viewingAsset } = assetViewingStore; let element: HTMLElement | undefined = $state(); diff --git a/web/src/lib/components/shared-components/change-date.spec.ts b/web/src/lib/components/shared-components/change-date.spec.ts index 43035051f3..3c835c05ed 100644 --- a/web/src/lib/components/shared-components/change-date.spec.ts +++ b/web/src/lib/components/shared-components/change-date.spec.ts @@ -8,6 +8,9 @@ import ChangeDate from './change-date.svelte'; describe('ChangeDate component', () => { const initialDate = DateTime.fromISO('2024-01-01'); const initialTimeZone = 'Europe/Berlin'; + const targetDate = DateTime.fromISO('2024-01-01').setZone('UTC+1', { + keepLocalTime: true, + }); const currentInterval = { start: DateTime.fromISO('2000-02-01T14:00:00+01:00'), end: DateTime.fromISO('2001-02-01T14:00:00+01:00'), @@ -43,7 +46,11 @@ describe('ChangeDate component', () => { await fireEvent.click(getConfirmButton()); - expect(onConfirm).toHaveBeenCalledWith({ mode: 'absolute', date: '2024-01-01T00:00:00.000+01:00' }); + expect(onConfirm).toHaveBeenCalledWith({ + mode: 'absolute', + date: '2024-01-01T00:00:00.000+01:00', + dateTime: targetDate, + }); }); test('calls onCancel on cancel', async () => { @@ -58,7 +65,9 @@ describe('ChangeDate component', () => { describe('when date is in daylight saving time', () => { const dstDate = DateTime.fromISO('2024-07-01'); - + const targetDate = DateTime.fromISO('2024-07-01').setZone('UTC+2', { + keepLocalTime: true, + }); test('should render correct timezone with offset', () => { render(ChangeDate, { initialDate: dstDate, initialTimeZone, onCancel, onConfirm }); @@ -72,7 +81,11 @@ describe('ChangeDate component', () => { await fireEvent.click(getConfirmButton()); - expect(onConfirm).toHaveBeenCalledWith({ mode: 'absolute', date: '2024-07-01T00:00:00.000+02:00' }); + expect(onConfirm).toHaveBeenCalledWith({ + mode: 'absolute', + date: '2024-07-01T00:00:00.000+02:00', + dateTime: targetDate, + }); }); }); diff --git a/web/src/lib/components/shared-components/change-date.svelte b/web/src/lib/components/shared-components/change-date.svelte index 00a6b05dc5..dd027b38cc 100644 --- a/web/src/lib/components/shared-components/change-date.svelte +++ b/web/src/lib/components/shared-components/change-date.svelte @@ -1,15 +1,14 @@