diff --git a/web/src/lib/actions/gridKeyNav.ts b/web/src/lib/actions/gridKeyNav.ts index c890e4f..7f553ae 100644 --- a/web/src/lib/actions/gridKeyNav.ts +++ b/web/src/lib/actions/gridKeyNav.ts @@ -12,6 +12,7 @@ import { } from '$lib/services/photoprism'; import { acceptDateAndKeep, cachedPhoto } from '$lib/services/photoActions'; import { suggestDateFromPath } from '$lib/utils/suggestDateFromPath'; +import { photoNameAndDir } from '$lib/types/photoprism'; import { queryClient } from '$lib/queryClient'; import { filters } from '$lib/stores/filters.svelte'; import { @@ -486,7 +487,10 @@ export function gridKeyNav(node: HTMLElement, params: GridKeyNavParams = {}) { for (const id of ids) { const p = cachedPhoto(id); if (!p) return; - if (!suggestDateFromPath({ fileName: p.FileName, path: p.Path })) return; + const { fileName, path } = photoNameAndDir(p); + if (!suggestDateFromPath({ fileName, originalName: p.OriginalName, path })) { + return; + } } e.preventDefault(); void acceptDateAndKeep(ids); diff --git a/web/src/lib/components/sidebar/RightSidebar.svelte b/web/src/lib/components/sidebar/RightSidebar.svelte index 6b2c11a..23699d5 100644 --- a/web/src/lib/components/sidebar/RightSidebar.svelte +++ b/web/src/lib/components/sidebar/RightSidebar.svelte @@ -38,7 +38,7 @@ import { isAuthenticated } from '$lib/stores/session.svelte'; import { push as pushUndo } from '$lib/stores/undo.svelte'; import { getMetadataSectionOpen, setMetadataSection } from '$lib/stores/view.svelte'; - import { primaryFile, type PpPhoto } from '$lib/types/photoprism'; + import { photoNameAndDir, primaryFile, type PpPhoto } from '$lib/types/photoprism'; import { COLOR_SWATCHES } from '$lib/utils/tagGroups'; import { suggestDateFromPath } from '$lib/utils/suggestDateFromPath'; @@ -139,15 +139,20 @@ page.url.pathname === '/review' && page.url.searchParams.get('tab') === 'stripped_exif' ); - const dateSuggestion = $derived( - suggestDateFromPath({ fileName: photo.FileName, path: photo.Path }) - ); + const dateSuggestion = $derived.by(() => { + const { fileName, path } = photoNameAndDir(photo); + return suggestDateFromPath({ + fileName, + originalName: photo.OriginalName, + path + }); + }); const showDateSuggestion = $derived( - onExifStrippedTab && !!dateSuggestion && dateSuggestion !== takenAt + onExifStrippedTab && !!dateSuggestion && dateSuggestion.iso !== takenAt ); function applyDateSuggestion() { if (!dateSuggestion) return; - takenAt = dateSuggestion; + takenAt = dateSuggestion.iso; commitTakenAt(); } function commitTakenAt() { @@ -344,17 +349,23 @@ /> - - {#if showDateSuggestion} + + {#if showDateSuggestion && dateSuggestion}
- Suggested from path: {dateSuggestion} + Suggested from path: {dateSuggestion.iso} + {#if dateSuggestion.source === 'path-ym-default-day'} + (estimated day) + {/if} {#if allHaveSuggestion} @@ -372,7 +376,7 @@ {/if}