feat(stream): add an 'add to calendar' (.ics) action for stream end dates (#566) - #635
Merged
Jaydbrown merged 2 commits intoOct 1, 2026
Merged
Conversation
…it-protocol#566) Add an accessible 'Calendar' button on /stream/[id] that downloads a standard RFC 5545 .ics invitation for a bounded stream's end date: - lib/calendar.ts — buildStreamEndIcs (UTC timestamps, TEXT escaping, 75-octet line folding, deterministic UID, VALARM reminder) and downloadIcs (Blob + anchor download with object-URL cleanup) - components/stream/AddToCalendarButton.tsx — icon button matching the PDF header button, aria-label, success/failure toasts - rendered only when info.endTime > 0 (open-ended streams have no date to schedule) - tests: lib/calendar.test.ts (27), AddToCalendarButton.test.tsx (7), StreamPage calendar-action presence/absence (2) - CHANGELOG entry, CalendarPlus lucide mock stub Closes conduit-protocol#566
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #566
Adds an "Add to calendar" action on
/stream/[id]so a recipient can drop thestream's end date into their own calendar instead of retyping it.
What's here:
lib/calendar.ts— builds the.icstext by hand: RFC 5545 CRLF line endings,escaping for
,;\and newlines, and line folding at 75 octets with a leadingspace on continuation lines.
buildStreamIcs()takes the stream id, end date, tokensymbol, contract id, start date and the app URL and emits a single VEVENT with
DTSTART/DTENDat the completion instant.components/stream/AddToCalendarButton.tsx— a small button rendered next to the enddate. It builds the file in the browser and downloads it via a Blob + object URL, so
no server round trip and no new dependency. It is disabled while the end date is
missing and cleans up the object URL after the click.
app/stream/[id]/page.tsx— renders the button with the data the page already has(
StreamTimelineshows the same date), plus the two new mocks needed for the tests.lib/calendar.test.tscovers the escaping, the folding (unfolds the outputbefore matching, since a long description is legitimately split), the exact byte
layout of the header, and the round trip of a real end date; the component test drives
the download path with a stubbed
URL.createObjectURL; the page test asserts thebutton appears with the stream's end date.
Verification on this branch:
Those four are pre-existing and unrelated: they sit in a test file this branch does not
touch, and they are parse errors in a file whose content is identical to
main. Noerrors in any of the files added here.
Two judgement calls worth flagging:
split mid-word in the raw file. That is what RFC 5545 asks for and Google/Apple
Calendar unfold it, but if you would rather keep the text readable in a terminal I can
shorten the description instead.
client-side. If you prefer a
/api/streams/[id]/icsendpoint (so the link isshareable), say so and I will move it.