Files
mule-image/web/src/lib/stores/preview.svelte.ts
dtoro 8c2526d982 feat: PhotoPrism M0 bring-up — compose stack, web client, sidecar, migrate
Replace the legacy mule-image backend with PhotoPrism plus a thin
SvelteKit client and a Node sidecar for endpoints PhotoPrism doesn't
expose (file rename), and add a two-phase migrator (metadata via PUT,
heaps → albums) for the existing Postgres library.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 16:06:58 +02:00

37 lines
969 B
TypeScript

/**
* Single-photo preview overlay state. The lightbox sits in +layout.svelte
* and listens to this store; any view (timeline, duplicates view, heaps)
* can `open(uid)` to pop it. The order array is mirrored from whatever
* list the user is currently looking at so prev/next stay in context.
*/
export const preview = $state<{
uid: string | null;
order: string[];
}>({
uid: null,
order: []
});
export function openPreview(uid: string, order?: string[]): void {
if (order) preview.order = order;
preview.uid = uid;
}
export function closePreview(): void {
preview.uid = null;
}
export function previewNext(): void {
if (!preview.uid) return;
const i = preview.order.indexOf(preview.uid);
if (i < 0 || i >= preview.order.length - 1) return;
preview.uid = preview.order[i + 1];
}
export function previewPrev(): void {
if (!preview.uid) return;
const i = preview.order.indexOf(preview.uid);
if (i <= 0) return;
preview.uid = preview.order[i - 1];
}