mirror of
https://github.com/immich-app/immich.git
synced 2026-02-14 12:58:17 +03:00
refactor: new timeline component
- Create new timeline component (extracted from asset-gird) without removing old code - Add timeline/, timeline/actions/, timeline/base-components/, and timeline/internal-components/ directories - Copy needed components (delete-asset-dialog, scrubber, skeleton) to new locations - Add new timeline components (base-timeline, base-timeline-viewer, timeline-month, etc.) - Update timeline-util.ts with new functions (findMonthAtScrollPosition, formatGroupTitleFull) - Add asset-viewer-actions and asset-viewer-and-actions components This allows the timeline to exist alongside the current AssetGrid component.
This commit is contained in:
@@ -1,36 +1,18 @@
|
||||
<script lang="ts">
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import type { UpdatePayload } from 'vite';
|
||||
|
||||
type Props = {
|
||||
onBeforeUpdate?: (payload: UpdatePayload) => void;
|
||||
onAfterUpdate?: (payload: UpdatePayload) => void;
|
||||
};
|
||||
interface Props {
|
||||
onAfterUpdate: (payload: UpdatePayload) => void;
|
||||
}
|
||||
|
||||
let { onBeforeUpdate, onAfterUpdate }: Props = $props();
|
||||
|
||||
const unsubscribes: (() => void)[] = [];
|
||||
let { onAfterUpdate }: Props = $props();
|
||||
|
||||
onMount(() => {
|
||||
const hot = import.meta.hot;
|
||||
if (!hot) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (onBeforeUpdate) {
|
||||
hot.on('vite:beforeUpdate', onBeforeUpdate);
|
||||
unsubscribes.push(() => hot.off('vite:beforeUpdate', onBeforeUpdate));
|
||||
}
|
||||
|
||||
if (onAfterUpdate) {
|
||||
if (hot) {
|
||||
hot.on('vite:afterUpdate', onAfterUpdate);
|
||||
unsubscribes.push(() => hot.off('vite:afterUpdate', onAfterUpdate));
|
||||
}
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
for (const unsubscribe of unsubscribes) {
|
||||
unsubscribe();
|
||||
return () => hot.off('vite:afterUpdate', onAfterUpdate);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user