Skip to content

feat(profile): calendar subscription card for RSVP'd events - #51

Open
elijahchancey wants to merge 2 commits into
p2p-lanes:mainfrom
elijahchancey:feat/ical-calendar-subscription
Open

feat(profile): calendar subscription card for RSVP'd events#51
elijahchancey wants to merge 2 commits into
p2p-lanes:mainfrom
elijahchancey:feat/ical-calendar-subscription

Conversation

@elijahchancey

Copy link
Copy Markdown

What & why

Surfaces the iCal calendar subscription URL on the profile page so a user can sync the events they've RSVP'd to into Apple, Google, or Outlook Calendar. The feed and token come from the backend — see p2p-lanes/EdgeOS_API#16, which this PR depends on.

Calendar apps poll subscription URLs unauthenticated, so the backend issues a per-user, revocable token embedded in the URL; this PR just displays it and lets the user copy / subscribe / regenerate.

Changes

  • CalendarSubscriptions card (src/components/profile/CalendarSubscriptions.tsx) on the profile page, placed under Referral Links. Mirrors the existing ReferralLinks copy pattern:
    • read-only URL field + copy-to-clipboard (with Check/Copy feedback),
    • a webcal:// "Subscribe" button (one-tap add in calendar apps),
    • a "Regenerate link" action with a confirmation (it revokes the old link),
    • sonner toasts for copy / regenerate feedback, plus loading/error states.
  • useCalendarSubscription hook (src/hooks/useCalendarSubscription.ts): idempotently get-or-creates the token via POST /calendar/subscription and rotates it via POST /calendar/subscription/regenerate, reusing the existing localStorage Bearer-token auth pattern (same as useGetProfile).
  • CalendarSubscription type (src/types/CalendarSubscription.ts).

No new dependencies; lockfiles untouched.

Scope

This is the RSVP'd-events feed only, matching the backend PR. An "all events" feed was intentionally deferred (needs a popup→Social-Layer-group mapping).

Testing

  • npm run lint — no new findings in the added files.
  • npm run build — succeeds and type-checks; /portal/profile compiles with the new card.

End-to-end render against a live backend + authenticated session wasn't run here (needs running infra); the card reuses the established profile-card + auth-header patterns and the build/type-check pass.

🤖 Generated with Claude Code

Surfaces the iCal subscription URL from the EdgeOS_API backend on the
profile page so users can sync the events they've RSVP'd to into Apple,
Google, or Outlook Calendar.

- CalendarSubscriptions card: shows the RSVP feed URL with copy-to-
  clipboard, a webcal:// "Subscribe" button, and a "Regenerate link"
  action (with confirmation, since it revokes the old link).
- useCalendarSubscription hook: idempotently get-or-creates the token via
  POST /calendar/subscription and rotates it via .../regenerate, reusing
  the existing Bearer-token auth pattern.
- sonner toasts for copy / regenerate feedback.

Depends on p2p-lanes/EdgeOS_API#16 (the backend endpoints).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown

@elijahchancey is attempting to deploy a commit to the p2planes Team on Vercel.

A member of the Team first needs to authorize it.

Address Codex review: a rapid double-fire of regenerate() could rotate the
token twice and apply the earlier (already-revoked) response as current
state, leaving the user with a dead calendar URL. Add a ref-based
single-flight guard so concurrent regenerations are ignored until the
in-flight one settles.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant