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:
@@ -8,6 +8,40 @@ import { Badge } from "@/components/ui/badge";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { PhotoViewer, type ViewerPhoto } from "./photo-viewer";
|
||||
import type { PhotoAdjustments } from "@/lib/photo-adjustments";
|
||||
import type { AdvancedEditView } from "@/lib/advanced-edit";
|
||||
|
||||
/**
|
||||
* Grid image that degrades to a readable tile instead of a blank square when
|
||||
* the thumbnail cannot be produced (damaged or unsupported RAW, missing file).
|
||||
*/
|
||||
function GalleryImage({ src, alt }: { src: string; alt: string }) {
|
||||
const [failed, setFailed] = useState(false);
|
||||
|
||||
if (failed) {
|
||||
return (
|
||||
<div className="flex h-full w-full flex-col items-center justify-center gap-1 px-2 text-center text-muted-foreground">
|
||||
<FileImage className="h-8 w-8" aria-hidden="true" />
|
||||
<span className="text-[11px] font-medium">Preview unavailable</span>
|
||||
<span className="w-full truncate text-[10px]" title={alt}>
|
||||
{alt}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
// Frames are private; the serving route sets the cache policy.
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img
|
||||
src={src}
|
||||
alt={alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
onError={() => setFailed(true)}
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export interface GalleryPhoto {
|
||||
id: string;
|
||||
@@ -19,6 +53,10 @@ export interface GalleryPhoto {
|
||||
previewable: boolean;
|
||||
editable: boolean;
|
||||
adjustments: PhotoAdjustments;
|
||||
/** The saved edit was produced by the advanced (Lumenroom) editor. */
|
||||
advancedEdit: boolean;
|
||||
/** Read-only view of the advanced recipe and a quick-editor seed. */
|
||||
advancedSummary: AdvancedEditView | null;
|
||||
editedAt: string | null;
|
||||
editedSizeBytes: number | null;
|
||||
}
|
||||
@@ -303,15 +341,7 @@ export function PhotoGallery({
|
||||
onClick={() => setViewing(photo)}
|
||||
>
|
||||
{photo.previewable || photo.editedAt || photo.kind === "raw" ? (
|
||||
// Frames are private; the serving route sets the cache policy.
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img
|
||||
src={displaySrc}
|
||||
alt={photo.filename}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
<GalleryImage src={displaySrc} alt={photo.filename} />
|
||||
) : (
|
||||
<div className="flex flex-col items-center gap-1 text-muted-foreground">
|
||||
<FileImage className="h-8 w-8" aria-hidden="true" />
|
||||
@@ -353,13 +383,31 @@ export function PhotoGallery({
|
||||
{photo.uploaderName}
|
||||
</p>
|
||||
<div className="flex flex-wrap items-center gap-1">
|
||||
<a
|
||||
href={`${src}?download=1`}
|
||||
className="inline-flex items-center gap-1 rounded px-1.5 py-1 text-[11px] font-medium text-primary hover:underline"
|
||||
>
|
||||
<Download className="h-3 w-3" aria-hidden="true" />
|
||||
Download
|
||||
</a>
|
||||
{photo.editedAt ? (
|
||||
<>
|
||||
<a
|
||||
href={`${src}?variant=edited&download=1&v=${version}`}
|
||||
className="inline-flex items-center gap-1 rounded px-1.5 py-1 text-[11px] font-medium text-primary hover:underline"
|
||||
>
|
||||
<Download className="h-3 w-3" aria-hidden="true" />
|
||||
Download edited
|
||||
</a>
|
||||
<a
|
||||
href={`${src}?download=1`}
|
||||
className="inline-flex items-center gap-1 rounded px-1.5 py-1 text-[11px] font-medium text-muted-foreground hover:underline"
|
||||
>
|
||||
Original
|
||||
</a>
|
||||
</>
|
||||
) : (
|
||||
<a
|
||||
href={`${src}?download=1`}
|
||||
className="inline-flex items-center gap-1 rounded px-1.5 py-1 text-[11px] font-medium text-primary hover:underline"
|
||||
>
|
||||
<Download className="h-3 w-3" aria-hidden="true" />
|
||||
Download
|
||||
</a>
|
||||
)}
|
||||
{editable && (
|
||||
<button
|
||||
type="button"
|
||||
@@ -400,6 +448,8 @@ export function PhotoGallery({
|
||||
editedAt: viewing.editedAt,
|
||||
editedSizeBytes: viewing.editedSizeBytes,
|
||||
adjustments: viewing.adjustments,
|
||||
advancedEdit: viewing.advancedEdit,
|
||||
advancedSummary: viewing.advancedSummary,
|
||||
} satisfies ViewerPhoto}
|
||||
onClose={() => setViewing(null)}
|
||||
onSaved={() => router.refresh()}
|
||||
|
||||
Reference in New Issue
Block a user