eternagame / eternagame.org

Website for the Eterna citizen science game
https://eternagame.org
BSD 3-Clause "New" or "Revised" License
19 stars 17 forks source link

Limit number of events displayed on homepage calendar #315

Closed tkaragianes closed 2 years ago

tkaragianes commented 2 years ago

We only want to display the upcoming n events in our homepage event list. FullCalendar is rather limited in this area of its API. The Google Calendar API supports a maxResults parameter, but FullCalendar hardcodesthis value. To get around this, we fetch events for the next two weeks, then use FullCalendar's event API to remove all but the first n events. This is complicated by the FullCalendar Vue component. The component makes the FullCalendar object available via ref, but the ref is undefined in the parent component mounted hook (perhaps as a result of the way the FullCalendar Vue component instantiates itself) and doesn't emit any ready events. Instead, we use the non-public Vue "hook:mounted", which allows us to listen for the FullCalendar component mount in the parent PlayerHome component.

I have to merge into dev to test the fix with the Google Calendar integration, because our calendar currently disallows requests from localhost. Need to change the referrers policy to allow it once I have developer console access.