✨ 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:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user