From d6bdbff76f4320b37bc0df1281f7c795cba645de Mon Sep 17 00:00:00 2001 From: gestchild Date: Wed, 12 Jun 2024 12:00:47 +0100 Subject: [PATCH 1/2] only display the the next 4 months (inclusive) --- content/webapp/components/EventsByMonth/EventsByMonth.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/webapp/components/EventsByMonth/EventsByMonth.tsx b/content/webapp/components/EventsByMonth/EventsByMonth.tsx index 994d2aef92..c4331e865d 100644 --- a/content/webapp/components/EventsByMonth/EventsByMonth.tsx +++ b/content/webapp/components/EventsByMonth/EventsByMonth.tsx @@ -20,8 +20,8 @@ const EventsByMonth: FunctionComponent = ({ events, links }) => { const { isEnhanced } = useContext(AppContext); // Group the events into the per-month tabs that we render on the // What's On page, e.g. a group for May, June, July, ... - const monthsWithEvents = groupEventsByMonth(events).map( - ({ month, events }) => { + const monthsWithEvents = groupEventsByMonth(events) + .map(({ month, events }) => { const id = `${month.month}-${month.year}`.toLowerCase(); return { @@ -31,8 +31,8 @@ const EventsByMonth: FunctionComponent = ({ events, links }) => { month, events, }; - } - ); + }) + .slice(0, 4); // never show more than 4 months // We assume that there will always be some upcoming events scheduled, // which means there will be at least one month in `monthsWithEvents` From 493b0b7669891b9940ab00d2d594889da880beb8 Mon Sep 17 00:00:00 2001 From: gestchild Date: Wed, 12 Jun 2024 12:06:38 +0100 Subject: [PATCH 2/2] =?UTF-8?q?remove=20months=20that=20don=E2=80=99t=20ha?= =?UTF-8?q?ve=20events=20in=20them?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/webapp/components/EventsByMonth/EventsByMonth.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/webapp/components/EventsByMonth/EventsByMonth.tsx b/content/webapp/components/EventsByMonth/EventsByMonth.tsx index c4331e865d..cda2ece747 100644 --- a/content/webapp/components/EventsByMonth/EventsByMonth.tsx +++ b/content/webapp/components/EventsByMonth/EventsByMonth.tsx @@ -32,7 +32,8 @@ const EventsByMonth: FunctionComponent = ({ events, links }) => { events, }; }) - .slice(0, 4); // never show more than 4 months + .slice(0, 4) // never show more than 4 months + .filter(month => month.events.length > 0); // only include months that have events // We assume that there will always be some upcoming events scheduled, // which means there will be at least one month in `monthsWithEvents`