/* media.jsx — Video Wishes + Gallery (upload, masonry, slideshow) */ const { useState: useStateMed, useRef: useRefMed } = React; function MediaUploader({ kind, accept, cta, hint }) { const [file, setFile] = useStateMed(null); const [preview, setPreview] = useStateMed(null); const [name, setName] = useStateMed(''); const [caption, setCaption] = useStateMed(''); const [busy, setBusy] = useStateMed(false); const [drag, setDrag] = useStateMed(false); const inputRef = useRefMed(null); const take = (f) => { if (!f) return; if (!f.type.startsWith('image/')) { window.R50UI && window.R50UI.toast('Please choose a photo file.'); return; } if (f.size > 2 * 1024 * 1024) { window.R50UI && window.R50UI.toast('That photo is over 2MB — please choose a smaller one.'); return; } setFile(f); setPreview(URL.createObjectURL(f)); }; const post = async () => { if (!file) return; setBusy(true); await R50.addMedia({ kind, name: name.trim(), file, caption: caption.trim() }); bumpMedia(); setBusy(false); setFile(null); setPreview(null); setName(''); setCaption(''); window.R50UI && window.R50UI.toast(kind === 'wish' ? 'Your video wish is posted 💛' : 'Added to the gallery 💛'); }; return (
Add your favorite photos — before, during, and after the party. One shared album for everyone.