Skip to content

feat(mail): create Calendar events from email - #533

Open
imattau wants to merge 2 commits into
ProtonMail:mainfrom
imattau:feature/mail-calendar-create-event
Open

imattau wants to merge 2 commits into
ProtonMail:mainfrom
imattau:feature/mail-calendar-create-event

Conversation

@imattau

@imattau imattau commented Sep 5, 2026

Copy link
Copy Markdown

Description

Add a "create Calendar event from email" capability to Mail, with drag-and-drop as the primary desktop interaction and an "Add to Calendar" menu action as the accessible alternative.

Dropping a single Mail message onto the Calendar drawer's grid opens the standard event editor with:

  • the email subject as the event title
  • the drop position as the event start time (day/week) - or the dropped day's start time on month view
  • a minimal From: <sender> description reference
  • the user's normal default calendar and event defaults
  • no automatic save

It reuses the existing Mail drag system, Calendar drawer iframe, drawer messaging protocol and Calendar event editor - no parallel drag or persistence path is introduced.

Implementation notes

  • Three new typed drawer events in packages/shared/lib/drawer/interfaces.ts: CALENDAR_MAIL_DRAG_STATE, CALENDAR_MAIL_DROP and CALENDAR_CREATE_EVENT_FROM_MAIL.
  • Mail layout state now tracks a single-message drag count and (only for single-message drags) the dragged ID; multi-message drags retain no ID in global state.
  • The Calendar day/week/month grids become drop targets via useCalendarMailDrop; the slot date/time is computed with the existing getTargetMinutes/getNewTime helpers, then reported back to Mail via CALENDAR_MAIL_DROP.
  • Mail resolves the dragged message and forwards only messageID, subject and sender metadata (never the body) via CALENDAR_CREATE_EVENT_FROM_MAIL.
  • Calendar opens the existing editor through interactiveRef.createEventFromMail.
  • "Add to Calendar" menu action opens the drawer (waiting for the iframe READY handshake on a cold open) and prefills subject/sender with default date/time.
  • The Calendar drawer icon highlights as a drop target during a single-message drag and opens on hover.
  • Interaction telemetry mail_calendar_create_event with a drag_drop / menu_action entry-point dimension (no message content).

Testing

New unit tests (which I verified pass via a local node --test harness, since I could not run the monorepo install):

  • dateHelpers.spec.ts - drop-to-timestamp mapping for day, week and month grids (snapping, clamping, guards).
  • createEventFromMessage.test.ts - only messageID/subject/sender forwarded (asserts no body), sender fallback, missing-subject normalisation.
  • layoutSlice.spec.ts - drag count / dragged-ID transitions.
  • drawer.spec.ts - the three new event types are recognised as drawer messages.

Note: I was unable to run yarn install in my environment (the @proton/* scope registry and vendor/* workspaces are only reachable from Proton's internal network), so the CI prettier / eslint / check-types gates have not been executed on my side. The changed files parse cleanly under TypeScript, but please run CI. Also, the new measurement group mail.web.calendar_create_event requires backend whitelisting or it will be silently dropped.

Out of scope

Month view maps a drop to the start of the dropped day (default-time event) rather than an exact time. Stable email backlinks, conversation-level events and date/time extraction are left for follow-ups.

Add the typed drawer protocol and infrastructure to create a Calendar event
from a Mail message via drag & drop:

- New drawer events CALENDAR_MAIL_DRAG_STATE, CALENDAR_MAIL_DROP and
  CALENDAR_CREATE_EVENT_FROM_MAIL in packages/shared/lib/drawer/interfaces.
- Extend Mail layout state with a single-message drag count and dragged ID.
- Calendar day/week grid becomes a Mail drop target and reports the computed
  slot timestamp back; Mail resolves the dragged message and initialises the
  existing event editor (title/subject + start, never auto-saved, no body).

Includes unit tests for slot/time mapping, message-to-payload resolution and
drawer message recognition.
User-facing entry points on top of the create-event drawer messaging:

- 'Add to Calendar' action in the message More menu: opens the Calendar drawer
  and prefills the event editor with the email subject and sender.
- Highlight the Calendar drawer icon as a valid target while a single message
  is dragged, and open the drawer on hover.
- Month view drop target: dropping on a day cell creates an event at the
  default time on that date.
- Interaction telemetry (mail_calendar_create_event) with a drag_drop /
  menu_action entry-point dimension and no message content.
@imattau imattau changed the title Create Calendar events from Mail feat(mail): create Calendar events from email Sep 5, 2026
@mmso
mmso force-pushed the main branch 10 times, most recently from 5eb5e79 to 28d81d1 Compare September 11, 2026 16:16
@mmso
mmso force-pushed the main branch 5 times, most recently from 40a6c9b to 079f4b5 Compare September 16, 2026 16:17
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