Reopen advanced edits from their saved recipe, seed or take over the quick editor from them, refresh thumbnails after a save, and add an edited-only download. Also fixes the Lumenroom library collapsing to slivers on large shoots and documents deploying both containers on a new host. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -653,15 +653,22 @@ export default function App() {
|
||||
height: activePhoto.height,
|
||||
}),
|
||||
});
|
||||
const data = (await res.json().catch(() => ({}))) as { error?: string };
|
||||
const data = (await res.json().catch(() => ({}))) as {
|
||||
error?: string;
|
||||
thumbVersion?: number;
|
||||
};
|
||||
if (!res.ok) throw new Error(data.error || 'The photo could not be saved');
|
||||
if (typeof data.thumbVersion === 'number') {
|
||||
// Refresh the grid thumbnail so it shows this render, not the original.
|
||||
updatePhoto(activePhoto.id, { thumbVersion: data.thumbVersion });
|
||||
}
|
||||
setToast(`Saved ${activePhoto.name} to the event`);
|
||||
} catch (err) {
|
||||
setToast(err instanceof Error ? err.message : 'The photo could not be saved');
|
||||
} finally {
|
||||
setBridgeBusy(false);
|
||||
}
|
||||
}, [activePhoto, bridgeEvent]);
|
||||
}, [activePhoto, bridgeEvent, updatePhoto]);
|
||||
|
||||
const handleCloudLogin = useCallback(
|
||||
async (email: string, password: string) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { ASPECTS, defaultEdits, thumbTransform } from '../lib/edits';
|
||||
import { getBitmap } from '../lib/images';
|
||||
import { getBitmap, thumbSrc } from '../lib/images';
|
||||
import { rotatedBounds, Renderer } from '../gl/renderer';
|
||||
import type { Edits, EventRecord, PhotoRecord, Preset } from '../types';
|
||||
import ContextMenu, { type MenuEntry } from './ContextMenu';
|
||||
@@ -703,7 +703,7 @@ export default function Develop({
|
||||
title={p.name}
|
||||
>
|
||||
<img
|
||||
src={p.thumbUrl ?? p.thumb}
|
||||
src={thumbSrc(p)}
|
||||
alt={p.name}
|
||||
loading="lazy"
|
||||
draggable={false}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useRef, useState } from 'react';
|
||||
import { COLOR_LABELS, isEdited, thumbTransform } from '../lib/edits';
|
||||
import { draggedPhotoIds, endDrag, PHOTO_DRAG, startPhotoDrag } from '../lib/drag';
|
||||
import { thumbSrc } from '../lib/images';
|
||||
import type { ColorLabel, Flag, PhotoRecord } from '../types';
|
||||
import Stars, { ColorSwatches, FlagButtons } from './Stars';
|
||||
|
||||
@@ -312,7 +313,7 @@ export default function LibraryGrid({
|
||||
>
|
||||
<div className="card-thumb">
|
||||
<img
|
||||
src={p.thumbUrl ?? p.thumb}
|
||||
src={thumbSrc(p)}
|
||||
alt={p.name}
|
||||
loading="lazy"
|
||||
draggable={false}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { computeAutoEdits } from '../lib/auto';
|
||||
import { clamp } from '../lib/curves';
|
||||
import type { CurveChannel, Edits, EventRecord, HistoryEntry, PhotoRecord, Preset } from '../types';
|
||||
import CurveEditor from './CurveEditor';
|
||||
import { getBitmap } from '../lib/images';
|
||||
import { getBitmap, thumbSrc } from '../lib/images';
|
||||
import { grainSampleWindow, rotatedBounds, Renderer } from '../gl/renderer';
|
||||
import { applyFilmVariant, FILM_VARIANTS, type FilmVariant } from '../lib/presets';
|
||||
import { usePresetThumbs } from './PresetThumbs';
|
||||
@@ -653,7 +653,7 @@ export function NavigatorPanel({ photo }: { photo: PhotoRecord }) {
|
||||
</div>
|
||||
<div className="navigator-thumb">
|
||||
<img
|
||||
src={photo.thumbUrl ?? photo.thumb}
|
||||
src={thumbSrc(photo)}
|
||||
alt={photo.name}
|
||||
style={{ transform: thumbTransform(photo) }}
|
||||
/>
|
||||
|
||||
@@ -266,6 +266,7 @@ export function normalizePhoto(input: Partial<PhotoRecord> & { id: string }): Ph
|
||||
decode: input.decode,
|
||||
previewUrl: input.previewUrl,
|
||||
thumbUrl: input.thumbUrl,
|
||||
thumbVersion: input.thumbVersion,
|
||||
name: input.name ?? 'Untitled',
|
||||
width: input.width ?? 0,
|
||||
height: input.height ?? 0,
|
||||
|
||||
@@ -4,6 +4,17 @@ import { getAsset, putAsset } from './db';
|
||||
const CACHE_LIMIT = 6;
|
||||
const cache = new Map<string, ImageBitmap>();
|
||||
|
||||
/**
|
||||
* Grid/filmstrip thumbnail URL. The version stamp changes when the saved edit is
|
||||
* re-rendered, so the browser does not keep showing the pre-edit thumbnail.
|
||||
*/
|
||||
export function thumbSrc(photo: PhotoRecord): string {
|
||||
if (!photo.thumbUrl) return photo.thumb;
|
||||
return photo.thumbVersion
|
||||
? `${photo.thumbUrl}?v=${photo.thumbVersion}`
|
||||
: photo.thumbUrl;
|
||||
}
|
||||
|
||||
/** Where to fetch the original (or raw proxy) when it is not cached on this device. */
|
||||
export function remoteAssetUrl(photo: PhotoRecord): string {
|
||||
if (photo.raw) return photo.previewUrl || `/api/photos/${encodeURIComponent(photo.id)}/preview`;
|
||||
|
||||
@@ -562,6 +562,9 @@ img {
|
||||
overflow-y: auto;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
/* Keep every row at its natural height. Without this, a large library makes
|
||||
the auto rows shrink to fit the viewport and the thumbnails collapse. */
|
||||
grid-auto-rows: max-content;
|
||||
gap: 12px;
|
||||
padding: 14px;
|
||||
align-content: start;
|
||||
|
||||
@@ -103,6 +103,8 @@ export interface PhotoRecord {
|
||||
previewUrl?: string;
|
||||
/** server URL for the grid thumbnail */
|
||||
thumbUrl?: string;
|
||||
/** bumps the thumbnail URL whenever the saved edit is re-rendered */
|
||||
thumbVersion?: number;
|
||||
/** Set when the photo is proxied from a dashboard bridge session. */
|
||||
bridgeSource?: { sessionId: string; sourceId: string };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user