Initial commit: Luminary photo catalog and RAW editor

Browser-based photo catalog with an optional team server (SQLite + LibRaw).
Local database, uploaded photos, build output and dependencies are gitignored.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-23 15:19:25 +00:00
commit cd52a2f82f
121 changed files with 101872 additions and 0 deletions
+152
View File
@@ -0,0 +1,152 @@
import { useEffect, useState } from 'react';
import {
loadCameraLensDefaults,
removeCameraLensDefault,
type CameraLensDefault,
} from '../lib/lensDefaults';
interface Props {
onClose: () => void;
/** Called after a saved row is removed so an open Optics panel can refresh. */
onChanged?: () => void;
}
const correctionLabel = (entry: CameraLensDefault) => {
const corrections = entry.profile.corrections;
const enabled = [
corrections.distortion ? 'distortion' : '',
corrections.tca ? 'chromatic aberration' : '',
corrections.vignetting ? 'vignetting' : '',
].filter(Boolean);
return enabled.length ? enabled.join(' · ') : 'no corrections enabled';
};
export default function LensDefaultsModal({ onClose, onChanged }: Props) {
const [defaults, setDefaults] = useState<CameraLensDefault[] | null>(null);
const [busy, setBusy] = useState<string | null>(null);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
let alive = true;
loadCameraLensDefaults()
.then((saved) => alive && setDefaults(saved))
.catch((err) => {
if (!alive) return;
setDefaults([]);
setError(err instanceof Error ? err.message : 'Could not load saved defaults');
});
return () => {
alive = false;
};
}, []);
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
if (e.key !== 'Escape') return;
e.preventDefault();
e.stopImmediatePropagation();
if (!busy) onClose();
};
window.addEventListener('keydown', onKey, true);
return () => window.removeEventListener('keydown', onKey, true);
}, [busy, onClose]);
const remove = async (entry: CameraLensDefault) => {
const key = `${entry.camera}\u0000${entry.exifLens}`;
if (busy) return;
setBusy(key);
setError(null);
try {
await removeCameraLensDefault({ camera: entry.camera, lens: entry.exifLens });
setDefaults((current) =>
current?.filter(
(saved) => saved.camera !== entry.camera || saved.exifLens !== entry.exifLens,
) ?? [],
);
onChanged?.();
} catch (err) {
setError(err instanceof Error ? err.message : 'Could not remove that default');
} finally {
setBusy(null);
}
};
return (
<div className="modal-backdrop" onPointerDown={(e) => e.target === e.currentTarget && onClose()}>
<div className="modal lens-defaults-modal">
<header className="modal-head">
<div>
<span className="settings-kicker">Settings</span>
<h2>Camera lens defaults</h2>
</div>
<button className="icon-btn" onClick={onClose} title="Close">
✕
</button>
</header>
<div className="modal-body">
<p className="muted small lens-defaults-lead">
These profiles apply automatically on this browser when a new import has the same camera
and EXIF lens. Removing one only affects future imports.
</p>
{defaults === null ? (
<p className="muted small">Loading saved defaults…</p>
) : defaults.length === 0 ? (
<div className="lens-defaults-empty">
<strong>No camera-lens defaults saved</strong>
<p className="muted small">
Open the Optics panel in Develop, choose a lens profile, then use “Set as camera
default”.
</p>
</div>
) : (
<div className="lens-defaults-list">
{defaults.map((entry) => {
const key = `${entry.camera}\u0000${entry.exifLens}`;
return (
<article className="lens-default-item" key={key}>
<div className="lens-default-main">
<div className="lens-default-title">
<strong>
{entry.profile.maker} {entry.profile.model}
</strong>
<span className="muted small">crop {entry.profile.crop}×</span>
</div>
<p className="lens-default-match">
{entry.camera} <span className="muted">+</span> {entry.exifLens}
</p>
<p className="muted small lens-default-meta">
{correctionLabel(entry)} · saved{' '}
{new Date(entry.updatedAt).toLocaleDateString(undefined, {
year: 'numeric',
month: 'short',
day: 'numeric',
})}
</p>
</div>
<button
className="btn ghost small"
disabled={busy === key}
onClick={() => void remove(entry)}
>
{busy === key ? 'Removing…' : 'Remove'}
</button>
</article>
);
})}
</div>
)}
{error && <p className="small lens-error">{error}</p>}
</div>
<footer className="modal-foot">
<button className="btn ghost" onClick={onClose}>
Done
</button>
</footer>
</div>
</div>
);
}