feat(media): primary media storage, growth goals, retention and delivery tools
CI / build (push) Has been cancelled
CI / build (push) Has been cancelled
Event photos and videos are now stored only on the NFS/local share named in Settings -> Media storage. Uploads, photo editing, video processing and the per-event filing step refuse to run until that share is configured and writable, so nothing is silently written inside the container. Video originals, renditions, posters and sidecars share one folder on the share. Also adds volunteer growth goals with a mentor queue, an admin retention and storage sweep with a cron entry point, cached gallery thumbnails with per-folder ZIP downloads, a server-rendered booth-sheet PDF, and in-app confirm/release for every upcoming assignment. Service reminders now ignore the one-off event reminder rule, which had been queueing an extra bogus reminder for each published service. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -85,6 +85,8 @@ export function PhotoGallery({
|
||||
canContribute,
|
||||
canManage,
|
||||
currentUserId,
|
||||
storageReady,
|
||||
storageMessage,
|
||||
}: {
|
||||
eventId: string;
|
||||
folderId: string;
|
||||
@@ -92,6 +94,9 @@ export function PhotoGallery({
|
||||
canContribute: boolean;
|
||||
canManage: boolean;
|
||||
currentUserId: string;
|
||||
/** Photos are stored only on the configured media storage share. */
|
||||
storageReady: boolean;
|
||||
storageMessage: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
@@ -105,7 +110,9 @@ export function PhotoGallery({
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [notice, setNotice] = useState<string | null>(null);
|
||||
const [viewing, setViewing] = useState<GalleryPhoto | null>(null);
|
||||
const editablePhotos = photos.filter((photo) => photo.editable);
|
||||
const editablePhotos = photos.filter(
|
||||
(photo) => photo.editable && storageReady,
|
||||
);
|
||||
const viewingIndex = viewing
|
||||
? editablePhotos.findIndex((photo) => photo.id === viewing.id)
|
||||
: -1;
|
||||
@@ -196,6 +203,15 @@ export function PhotoGallery({
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
{canContribute && !storageReady && (
|
||||
<p
|
||||
role="alert"
|
||||
className="rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-xs text-amber-900 dark:text-amber-200"
|
||||
>
|
||||
Photo uploads and editing are disabled. {storageMessage}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{canContribute && (
|
||||
<div className="space-y-2 rounded-md border border-border p-3">
|
||||
<p className="text-sm font-medium">Upload photos to this folder</p>
|
||||
@@ -207,7 +223,7 @@ export function PhotoGallery({
|
||||
accept={ACCEPT}
|
||||
aria-label="Choose photos to upload"
|
||||
className="h-9 max-w-md text-xs"
|
||||
disabled={uploading}
|
||||
disabled={uploading || !storageReady}
|
||||
onChange={(event) => {
|
||||
setFiles(Array.from(event.target.files ?? []));
|
||||
setNotice(null);
|
||||
@@ -217,7 +233,7 @@ export function PhotoGallery({
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
disabled={uploading || files.length === 0}
|
||||
disabled={uploading || files.length === 0 || !storageReady}
|
||||
onClick={upload}
|
||||
>
|
||||
{uploading ? "Uploading…" : `Upload ${files.length || ""}`.trim()}
|
||||
@@ -262,11 +278,14 @@ export function PhotoGallery({
|
||||
<ul className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4">
|
||||
{photos.map((photo) => {
|
||||
const src = `/api/events/${eventId}/folders/${folderId}/photos/${photo.id}`;
|
||||
const editable = photo.editable && storageReady;
|
||||
const canRemove = canManage || photo.uploaderId === currentUserId;
|
||||
const version = photo.editedAt ? Date.parse(photo.editedAt) : 0;
|
||||
// The grid uses the cached 640px thumbnail; a saved edit is shown
|
||||
// from the full-resolution export so the badge and the image agree.
|
||||
const displaySrc = photo.editedAt
|
||||
? `${src}?variant=edited&v=${version}`
|
||||
: src;
|
||||
: `${src}/thumb`;
|
||||
return (
|
||||
<li
|
||||
key={photo.id}
|
||||
@@ -276,14 +295,14 @@ export function PhotoGallery({
|
||||
type="button"
|
||||
className="group relative flex aspect-square w-full items-center justify-center bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
aria-label={
|
||||
photo.editable
|
||||
editable
|
||||
? `View and edit ${photo.filename}`
|
||||
: `View ${photo.filename}`
|
||||
}
|
||||
disabled={!photo.editable}
|
||||
disabled={!editable}
|
||||
onClick={() => setViewing(photo)}
|
||||
>
|
||||
{photo.previewable || photo.editedAt ? (
|
||||
{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
|
||||
@@ -301,7 +320,7 @@ export function PhotoGallery({
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
{photo.editable && (
|
||||
{editable && (
|
||||
<span className="absolute inset-x-0 bottom-0 translate-y-full bg-black/70 px-2 py-1 text-[11px] font-medium text-white transition-transform group-hover:translate-y-0 group-focus-visible:translate-y-0">
|
||||
<Pencil className="mr-1 inline h-3 w-3" aria-hidden="true" />
|
||||
View & edit
|
||||
@@ -341,7 +360,7 @@ export function PhotoGallery({
|
||||
<Download className="h-3 w-3" aria-hidden="true" />
|
||||
Download
|
||||
</a>
|
||||
{photo.editable && (
|
||||
{editable && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setViewing(photo)}
|
||||
|
||||
Reference in New Issue
Block a user