Store location last seen date to check for New label

Stores the last location's page seeing date in localStorage to hide the Location's new label in list, on top of the date limit
This commit is contained in:
2022-09-14 11:32:58 +02:00
parent 683edc05fc
commit f38a8fcdc7
4 changed files with 43 additions and 10 deletions

View File

@@ -12,6 +12,7 @@
import { quartOut } from '$animations/easings'
import { getAssetUrlKey } from '$utils/api'
import { DELAY } from '$utils/contants'
import { seenLocations } from '$utils/stores'
import { photoFields } from '$utils/api'
import { PUBLIC_LIST_INCREMENT } from '$env/static/public'
// Components
@@ -110,6 +111,14 @@
onMount(() => {
// Define location's last seen state
$seenLocations = JSON.stringify({
// Add existing values
...JSON.parse($seenLocations),
// Add location ID with current time
[location.id]: new Date(),
})
// Photos IntersectionObserver
observerPhotos = new IntersectionObserver(entries => {
entries.forEach(({ isIntersecting, target }: IntersectionObserverEntry) => {