Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make events accordion actually change
  • Loading branch information
regalijan committed Nov 9, 2024
1 parent 368be24 commit ab427cf
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion app/routes/events-calendar.tsx
Expand Up @@ -132,7 +132,29 @@ export default function () {
);
onOpen();
}}
onSelectSlot={(s) => {}}
onSelectSlot={(s) => {
const day = s.start.getUTCDate();
const month = s.start.getUTCMonth() + 1;

for (const [type, setter] of Object.entries({
fotd: setTodayFOTD,
gamenight: setTodayGameNight,
qotd: setTodayQOTD,
rotw: setTodayROTW,
})) {
const event = data.eventList.find(
(ev) => ev.type === type && ev.day === day && ev.month === month,
);

if (!event) continue;

setter(
event.type === "rotw"
? `${event.details}\n\nAnswer: ${event.answer}`
: (event.details as string),
);
}
}}
popup
startAccessor={(event) => new Date(event.start)}
style={{ height: 500 }}
Expand Down

0 comments on commit ab427cf

Please sign in to comment.