From b86c9c3e0b7f67be8ecfbe8bce9516269044d6c8 Mon Sep 17 00:00:00 2001 From: chamila Date: Mon, 26 Feb 2024 23:41:10 +1300 Subject: [PATCH] Cleanup test and debug code --- web-old/src/routes/Events.jsx | 69 ++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 25 deletions(-) diff --git a/web-old/src/routes/Events.jsx b/web-old/src/routes/Events.jsx index f91d90b71..d51461646 100644 --- a/web-old/src/routes/Events.jsx +++ b/web-old/src/routes/Events.jsx @@ -145,7 +145,6 @@ export default function Events({ path, ...props }) { isValidating, } = useSWRInfinite(getKey, eventsFetcher); const mutate = () => { - console.log("mutating refresh events"); refreshEvents(); refreshOngoingEvents(); }; @@ -319,16 +318,7 @@ export default function Events({ path, ...props }) { e.stopPropagation(); console.log("clear unretained button clicked"); if (!eventPages) { - // unless output like this, eventPages is undefined. Not sure, I don't know web - // console.log(eventPages); - // eventPages?.map((page, i) => { - // console.log("found ", page.length, " events in page ", i); - // }); - // } else { - console.log("refreshing events"); - // console.debug(eventPages); - // const refreshedEvents = eventsFetcher('events'. searchParams).then((res) => res.data); - // console.log("refreshed: ", refreshedEvents); + console.debug("refreshing events"); await mutate(['events', searchParams]); } @@ -339,18 +329,23 @@ export default function Events({ path, ...props }) { if (ev.retain_indefinitely) { favorites.push(ev.id); } else { - console.log("adding deletable event id: ", ev.id); deletables.push(ev.id); } } - // console.log("found ", page.length, " events in page ", i); }); - console.log("found ", favorites.length, " favorites"); - console.log("found ", deletables.length, " events to clear"); - // console.log("eventPages is undefined"); + console.debug("found ", favorites.length, " favorites"); + console.debug("found ", deletables.length, " events to clear"); - setClearUnretainedState({...state, deletableEventList: deletables, favoriteCount: favorites.length, showConfirmation: true, showFeedback: false, showProgress: false}); + setClearUnretainedState( + { + ...state, + deletableEventList: deletables, + favoriteCount: favorites.length, + showConfirmation: true, + showFeedback: false, + showProgress: false + }); }, [eventPages, mutate, searchParams, setClearUnretainedState] ); @@ -512,6 +507,7 @@ export default function Events({ path, ...props }) { /> + {/* Separate box for batch mutable actions */}
)} + {clearUnretainedState.showConfirmation && (
@@ -739,16 +736,24 @@ export default function Events({ path, ...props }) {

Confirm deletion of all unsaved events currently on display?

{ clearUnretainedState.favoriteCount > 0 ? ( -

{clearUnretainedState.favoriteCount} saved events will not be deleted.

+

{clearUnretainedState.favoriteCount} saved events will not be deleted.

) : ( -

This selection has no saved events!!

+

This selection has no saved events!!

)}

Events not loaded to the web UI and any ongoing events are also not deleted.