Skip to content

feat(event): add-to-calendar on the registration confirmation #105

Closed

Description

@Ardnived

Summary

Product direction (confirmed):

We previously added and removed an Add to Calendar button. Let's reintroduce it as part of the registration confirmation screen. It needs to support all major providers. If possible rely on a small external library.

Reintroduce calendar export at the moment it is most wanted — right after a successful registration — rather than back into the event action row it was cut from. Today no calendar export exists at all (zero repo hits for .ics / VCALENDAR / Blob — .claude/reports/RELEASE_READINESS.md §7 and Appendix D), even though the CMS already supplies icalRule on the wire. A viewer cannot get an event into their own calendar — a real end-user portability gap.

Prior art (git archaeology)

  • Added as part of the feat(event): redesign event display & registration surfaces #52/feat(event): redesign event display & registration surfaces #58 event-surfaces redesign: 93047ba feat(lib): calendar export, distance formatter, display formatting hook shipped a hand-rolled RFC 5545 builder — src/lib/ics.ts (buildEventIcs / buildGoogleCalendarUrl, RRULE + EXDATE expansion, ~294 lines + ~311 lines of tests) — and 726d098 put the action in the event panel's action row. Landed on main in squash b52d831 (PR feat(event): redesign event display & registration surfaces #58).
  • Removed end-to-end in 4f6b397 feat(events)!: remove the Add to calendar action and the iCalendar export, landed on main in 6af130c (PR fix: bug sweep — dark-mode marker, drawer stack depth, event surfaces, drop Add to calendar #83). The stated shape: "Drops the feature end to end rather than hiding the CTA" — the removal was a product-scoping call from the action-row rebalance to a four-action maximum (Directions · Website · Contact · Share, 996ba3c), not a technical defect. The deleted builder + its spec are recoverable: git show 4f6b397^:src/lib/ics.ts (and :src/lib/ics.test.ts).
  • The removal also deleted actions.add_calendar / actions.download_ics from all ten locales — those translations are recoverable from 4f6b397^ too.
  • The wire contract deliberately kept the door open: src/config/api/fetch.ts:93 still selects icalRule on the feed, and the comment at src/config/api/fetch.ts:77-80 notes the calendar-export-only fields (monthDay, weekdayOfMonth, untilDate, exclusions) stay off the feed — "the export runs on the full doc". src/types/event.ts:66 still parses icalRule: z.string().nullish().

Proposed changes

  • Placement: the registration confirmation screen — the submitted branch of RegistrationForm (src/components/organisms/RegistrationForm/RegistrationForm.tsx:87 holds the state; the confirmation block renders at RegistrationForm.tsx:159-163). The form is deliberately event-decoupled ("generic and config-driven (no Event coupling)" — RegistrationForm.tsx:67); RegistrationView already holds the full event doc (useEventFromPath, src/views/RegistrationView/RegistrationView.tsx:53), so pass the export inputs down as props (or render the CTA block via a slot) without re-coupling the form.
  • Providers (all major): Google Calendar, Apple (ICS download), Outlook.com, Office 365, Yahoo.
  • Library: prefer a small external one, evaluated by bundle cost first. Candidates like calendar-link (provider-URL builder) + a tiny ICS blob generator are the expected weight class; add-to-calendar-button (a full web component) is likely too heavy. The eager payload is already 477 KiB gz (readiness report §1.1), so whatever is chosen must be lazy-loaded on the confirmation screen (dynamic import when submitted flips) and must not join the eager graph; its gz size must be stated in the implementation report. Hand-rolled provider-URL builders + a tiny ICS blob generator is an acceptable outcome if libraries are too heavy — the removed lib/ics.ts is a working starting point.
  • Recurrence must be correct. The CMS recurrence is structured and icalRule rides the full doc — verify what icalRule actually contains for weekly and monthly events (and for exclusions / untilDate) before trusting it; provider URLs need the recurrence too where the provider supports it.
  • Localized labels via pnpm i18n:add across all 10 locales (cs, de, en, es, fr, hu, nl, pt-BR, ru, uk) — consider resurrecting the removed keys' translations from 4f6b397^.

Acceptance criteria

  • The registration confirmation screen offers add-to-calendar for Google Calendar, Apple/ICS download, Outlook.com, Office 365, and Yahoo.
  • A one-off event exports with correct start/end + timezone; a weekly and a monthly event export with correct recurrence — verified against what icalRule / the structured schedule actually contain, with findings stated in the implementation report.
  • The export builds from the full event doc (getEvent via useEventFromPath), never the trimmed feed (per fetch.ts:77-80).
  • The chosen library (or hand-rolled module) is lazy-loaded from the confirmation screen; the eager payload (entry + every modulepreload in dist/index.html, gzipped, measured both ways) does not grow; the chunk's gz cost is stated in the implementation report.
  • RegistrationForm stays event-decoupled — export inputs arrive via props/slot from RegistrationView.
  • New labels exist across all 10 locales (added via pnpm i18n:add).
  • Unit tests for the ICS / provider-URL builder in the node lane (co-located src/lib/*.test.ts).
  • If the change introduces any new fetched cross-origin target (top-level provider-link navigations and blob: downloads don't count), update the CSP table in the integrator docs (README) — additively.
  • Lint + typecheck + pnpm test:run pass.
  • Verified in the running widget: register against the local seed, open each provider link, import the .ics into a real calendar app.
  • Write an implementation report to .claude/reports/<issue-number>-<short-slug>.md — in the MAIN checkout at /Users/devindra/Documents/Projects/SahajAtlasWeb even when implementing from a worktree (the folder is gitignored) — covering what changed, what was deliberately NOT changed, and which readiness-report findings are resolved.

Files affected

  • src/components/organisms/RegistrationForm/RegistrationForm.tsx — confirmation-screen region only (a sibling a11y ticket owns the form's submit/focus logic)
  • src/views/RegistrationView/RegistrationView.tsx — pass the event/export inputs down
  • src/lib/ics.ts (new, or similarly named) + src/lib/ics.test.ts
  • the new lazy chunk for the export module/library
  • public/locales/<lng>/events.json × 10 (via pnpm i18n:add)

Parallel implementation: this ticket OWNS the files listed above; sibling release-hardening tickets run concurrently — avoid edits outside owned files except strictly additive ones.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Hold Until

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions