'use client'; import { DEFAULT_ALBUM_SORT } from '@/lib/albumSort'; import { IconCamera, IconCopy, IconGripVertical, IconImage, IconTrash, IconX } from '../Icons'; import { Listbox } from '../Listbox'; import { SORT_OPTIONS } from './sortOptions'; import type { AlbumEntry, HeroPickerTarget, OrderEditorTarget } from './types'; import PasswordField from '../fields/PasswordField'; import { useModalDialog } from '@/hooks/useModalDialog'; interface AlbumDrawerProps { album: AlbumEntry; name: string; count: number; thumbnailId: string | null; onUpdate: (updates: Partial) => void; onRemove: () => void; onClose: () => void; onPickHero: (target: HeroPickerTarget | null) => void; onEditOrder: (target: OrderEditorTarget | null) => void; } /** * Per-album settings, opened from a card in the builder or from inside the * subpage drawer. Which album it edits — and how an edit is written back — * is resolved by the caller and arrives as `onUpdate`/`onRemove`. */ export default function AlbumDrawer({ album, name, count, thumbnailId, onUpdate, onRemove, onClose, onPickHero, onEditOrder, }: AlbumDrawerProps) { const heroThumb = album.heroImage || thumbnailId; const cardRef = useModalDialog(onClose); return (
onClose()}>
e.stopPropagation()} >

Edit Album Details

{/* One scrolling column: cover banner, then the form. Anything the form already shows (password state, custom hero) is not repeated as a read-only stat. */}
{heroThumb ? ( ) : (
)}
{album.title || name} {count} {count === 1 ? 'photo' : 'photos'} {album.title ? ` · Original: ${name}` : ''}
onUpdate({ title: e.target.value || undefined })} placeholder={name} />