Skip to content

Add button to subscribe to calendar#72

Merged
daancs merged 13 commits intocthit:devfrom
olillin:subscribe-calendar
Aug 21, 2025
Merged

Add button to subscribe to calendar#72
daancs merged 13 commits intocthit:devfrom
olillin:subscribe-calendar

Conversation

@olillin
Copy link
Contributor

@olillin olillin commented Aug 16, 2025

The purpose of this PR is to add a way to subscribe to the mottagning schedule. It does this by creating a new API route /api/schema.ics which serves an iCalendar file containing the events from the calendar. It also adds a new button on the schedule page which let's you subscribe this calendar file.

Changelog

Below is a list of the changes in this pull request. The format is based on Keep a Changelog.

Added

  • /api/schema.ics which server an iCalendar file containing the mottagning schedule. The file is generated by combining the calendars fetched from the _kalender[n] links. The calendar takes the name and other data from _kalender0 and appends all the events of the other calendars. The calendar is cached and expires after a set time (see below) or if the calendar URLs are changed.
  • CachedCalendar class which holds a cached calendar body as a serialized string.
  • the environment variable CALENDAR_CACHE_EXPIRATION_TIME which defines a time in minutes before a cached calendar will expire and need to be regenerated. The default is 3 hours.
  • Modal component, used for popup windows.
  • CalendarSubscribeModal, a popup for subscribing to a calendar at a certain URL, defined by a prop.
  • a button on the /schema page which opens a CalendarSubscribeModal for subscribing to /api/schema.ics.
  • iamcal dependency for editing calendars, used in the merging of calendars.

Changed

  • the z-index of the page header from 50 to 20 so that modals can be shown on top of it.

@olillin olillin marked this pull request as ready for review August 17, 2025 14:21
Copy link
Contributor

@daancs daancs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@daancs daancs merged commit 52d74e3 into cthit:dev Aug 21, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants