|
|
|
|
@ -37,16 +37,16 @@
|
|
|
|
|
import { DateTime } from 'luxon';
|
|
|
|
|
import { onMount, type Snippet } from 'svelte';
|
|
|
|
|
import type { UpdatePayload } from 'vite';
|
|
|
|
|
import AssetDateGroup from '../photos-page/asset-date-group.svelte';
|
|
|
|
|
import DeleteAssetDialog from '../photos-page/delete-asset-dialog.svelte';
|
|
|
|
|
import Portal from '../shared-components/portal/portal.svelte';
|
|
|
|
|
import AssetDateGroup from './asset-date-group.svelte';
|
|
|
|
|
import DeleteAssetDialog from './delete-asset-dialog.svelte';
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
isSelectionMode?: boolean;
|
|
|
|
|
singleSelect?: boolean;
|
|
|
|
|
/** `true` if this asset grid is responds to navigation events; if `true`, then look at the
|
|
|
|
|
`AssetViewingStore.gridScrollTarget` and load and scroll to the asset specified, and
|
|
|
|
|
additionally, update the page location/url with the asset as the asset-grid is scrolled */
|
|
|
|
|
additionally, update the page location/url with the asset as the timeline is scrolled */
|
|
|
|
|
enableRouting: boolean;
|
|
|
|
|
timelineManager: TimelineManager;
|
|
|
|
|
assetInteraction: AssetInteraction;
|
|
|
|
|
@ -225,14 +225,14 @@
|
|
|
|
|
|
|
|
|
|
const hmrSupport = () => {
|
|
|
|
|
// when hmr happens, skeleton is initialized to true by default
|
|
|
|
|
// normally, loading asset-grid is part of a navigation event, and the completion of
|
|
|
|
|
// normally, loading timeline is part of a navigation event, and the completion of
|
|
|
|
|
// that event triggers a scroll-to-asset, if necessary, when then clears the skeleton.
|
|
|
|
|
// this handler will run the navigation/scroll-to-asset handler when hmr is performed,
|
|
|
|
|
// preventing skeleton from showing after hmr
|
|
|
|
|
if (import.meta && import.meta.hot) {
|
|
|
|
|
const afterApdate = (payload: UpdatePayload) => {
|
|
|
|
|
const assetGridUpdate = payload.updates.some(
|
|
|
|
|
(update) => update.path.endsWith('asset-grid.svelte') || update.path.endsWith('assets-store.ts'),
|
|
|
|
|
(update) => update.path.endsWith('Timeline.svelte') || update.path.endsWith('assets-store.ts'),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (assetGridUpdate) {
|
|
|
|
|
@ -253,7 +253,7 @@
|
|
|
|
|
};
|
|
|
|
|
import.meta.hot?.on('vite:afterUpdate', afterApdate);
|
|
|
|
|
import.meta.hot?.on('vite:beforeUpdate', (payload) => {
|
|
|
|
|
const assetGridUpdate = payload.updates.some((update) => update.path.endsWith('asset-grid.svelte'));
|
|
|
|
|
const assetGridUpdate = payload.updates.some((update) => update.path.endsWith('Timeline.svelte'));
|
|
|
|
|
if (assetGridUpdate) {
|
|
|
|
|
timelineManager.destroy();
|
|
|
|
|
}
|