diff --git a/web/src/routes/Events.jsx b/web/src/routes/Events.jsx index 4da3bee63..3be927f57 100644 --- a/web/src/routes/Events.jsx +++ b/web/src/routes/Events.jsx @@ -59,6 +59,10 @@ export default function Events({ path, ...props }) { has_snapshot: false, plus_id: undefined, }); + const [deleteFavoriteState, setDeleteFavoriteState] = useState({ + deletingFavoriteEventId: null, + showDeleteFavorite: false, + }); const eventsFetcher = useCallback((path, params) => { params = { ...params, include_thumbnails: 0, limit: API_LIMIT }; @@ -114,11 +118,16 @@ export default function Events({ path, ...props }) { } }; - const onDelete = async (e, eventId) => { + const onDelete = async (e, eventId, saved) => { e.stopPropagation(); - const response = await axios.delete(`events/${eventId}`); - if (response.status === 200) { - mutate(); + + if (saved) { + setDeleteFavoriteState({ deletingFavoriteEventId: eventId, showDeleteFavorite: true }); + } else { + const response = await axios.delete(`events/${eventId}`); + if (response.status === 200) { + mutate(); + } } }; @@ -374,6 +383,19 @@ export default function Events({ path, ...props }) { )} + {deleteFavoriteState.showDeleteFavorite && ( + +
+ Delete Saved Event? +

Confirm deletion of saved event.

+
+
+ +
+
+ )}
{eventPages ? ( eventPages.map((page, i) => { @@ -441,7 +463,7 @@ export default function Events({ path, ...props }) { )}
- onDelete(e, event.id)} /> + onDelete(e, event.id, event.retain_indefinitely)} />