diff --git a/web/src/components/admin/AdminPast.jsx b/web/src/components/admin/AdminPast.jsx index 673d7a8..c996a6e 100644 --- a/web/src/components/admin/AdminPast.jsx +++ b/web/src/components/admin/AdminPast.jsx @@ -6,7 +6,9 @@ import ImageSlot from '../ImageSlot.jsx'; // Manages the gallery of one past event: unlimited photos, add / delete / // set-as-principal. Only available once the event exists (has an id). -function PhotoManager({ eventId, photos, setPhotos }) { +// `refused` lists participants of the linked rencontre who declined image +// publication, warned about before photos are added. +function PhotoManager({ eventId, photos, setPhotos, refused = [] }) { const { user } = useAuth(); const [error, setError] = useState(''); @@ -46,6 +48,15 @@ function PhotoManager({ eventId, photos, setPhotos }) { return (
+ {refused.length > 0 && ( +
+ ⚠ + + {refused.length} participant{refused.length > 1 ? 's ont' : ' a'} refusé la publication de {refused.length > 1 ? 'leur' : 'son'} image :{' '} + {refused.join(', ')}. Ne {refused.length > 1 ? 'les' : 'le/la'} faites pas figurer sur les photos publiées ici. + +
+ )}
Photos ({photos.length})
{photos.map((p, idx) => ( @@ -82,6 +93,7 @@ function PastEventFormModal({ event, rencontres, onClose, onSaved }) { : { date_label: '', lieu: '', titre: '', texte: '', participants: 0, rencontre_id: '' } ); const [photos, setPhotos] = useState(event?.photos || []); + const [refused, setRefused] = useState([]); const [error, setError] = useState(''); const [savedMsg, setSavedMsg] = useState(false); @@ -89,6 +101,15 @@ function PastEventFormModal({ event, rencontres, onClose, onSaved }) { const linked = form.rencontre_id ? rencontres.find((r) => r.id === Number(form.rencontre_id)) : null; + // When the event is linked to a rencontre, list the participants who + // declined image publication so the admin avoids publishing their photo. + useEffect(() => { + if (!form.rencontre_id) { setRefused([]); return; } + api.get(`/api/admin/rencontres/${form.rencontre_id}/inscriptions`) + .then((d) => setRefused(d.inscriptions.filter((i) => i.image_consent === false).map((i) => i.nom))) + .catch(() => setRefused([])); + }, [form.rencontre_id]); + const submit = async (e) => { e.preventDefault(); setError(''); @@ -176,7 +197,7 @@ function PastEventFormModal({ event, rencontres, onClose, onSaved }) { {savedId && (
- +

La première photo (★ principale) est mise en avant sur la page d'accueil. Le nombre de photos affiché sur le site correspond automatiquement aux photos ci-dessus.