Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(email): open Calendar beside the email on shift-click of Open in calendar (#8734)

gbirman515d9c26ec7a
diff --git a/apps/web/src/features/email-message/components/calendar-invite-card.tsx b/apps/web/src/features/email-message/components/calendar-invite-card.tsx
index 34883e8000..a20ae1e961 100644
--- a/apps/web/src/features/email-message/components/calendar-invite-card.tsx
+++ b/apps/web/src/features/email-message/components/calendar-invite-card.tsx
@@ -334,7 +334,11 @@ export function CalendarInviteCard(props: {
variant="outline"
size="icon-md"
label="Open in calendar"
- onClick={() => props.actions?.openCalendar?.()}
+ onClick={(event) =>
+ props.actions?.openCalendar?.({
+ openInNewSplit: event.shiftKey,
+ })
+ }
>
<CalendarBlank class="size-4" />
</Button>
diff --git a/apps/web/src/features/email-message/core/calendar-invitation.ts b/apps/web/src/features/email-message/core/calendar-invitation.ts
index 0310a8988b..ab44959b4e 100644
--- a/apps/web/src/features/email-message/core/calendar-invitation.ts
+++ b/apps/web/src/features/email-message/core/calendar-invitation.ts
@@ -45,7 +45,8 @@ export type CalendarInvitationActions = {
notice?: string;
retryCalendar?: () => void;
respond?: (response: InvitationResponse) => void;
- openCalendar?: () => void;
+ /** Shift-click asks for a new split, as other app links do. */
+ openCalendar?: (options: { openInNewSplit: boolean }) => void;
openExternal?: (url: string) => void;
connectCalendar?: () => void;
showDay?: () => void;
diff --git a/apps/web/src/features/email-thread/calendar-invitation.test.tsx b/apps/web/src/features/email-thread/calendar-invitation.test.tsx
index 19817b7735..c0b9495c47 100644
--- a/apps/web/src/features/email-thread/calendar-invitation.test.tsx
+++ b/apps/web/src/features/email-thread/calendar-invitation.test.tsx
@@ -218,3 +218,23 @@ it('leaves before opening the calendar so a dialog around the card can close fir
fireEvent.click(open);
expect(order).toEqual(['leave', 'open event']);
});
+
+it('asks for a new split when Open in calendar is shift-clicked', () => {
+ queryState.failed = () => false;
+ queryState.data = { [`message:${invitationFixture.id}`]: wire };
+ const opened: (boolean | undefined)[] = [];
+ render(() => (
+ <EmailCalendarInvitation
+ threadId="thread"
+ messageId="message"
+ invitation={invitationFixture}
+ hour12
+ openCalendar={(target) => opened.push(target.openInNewSplit)}
+ />
+ ));
+ const open = document.querySelector('button[label="Open in calendar"]');
+ if (!open) throw new Error('Open in calendar is missing');
+ fireEvent.click(open);
+ fireEvent.click(open, { shiftKey: true });
+ expect(opened).toEqual([false, true]);
+});
diff --git a/apps/web/src/features/email-thread/calendar-invitation.tsx b/apps/web/src/features/email-thread/calendar-invitation.tsx
index 410d20c5ea..5071d82c1d 100644
--- a/apps/web/src/features/email-thread/calendar-invitation.tsx
+++ b/apps/web/src/features/email-thread/calendar-invitation.tsx
@@ -23,6 +23,8 @@ export type CalendarInvitationOpenTarget = {
eventId: string;
occurrenceKey: string;
time: EventTime;
+ /** Open Calendar beside the email unless a Calendar split is already open. */
+ openInNewSplit?: boolean;
};
export function EmailCalendarInvitation(props: {
@@ -147,9 +149,9 @@ function ConnectedInvitation(
const open = props.openCalendar;
const leave = props.onNavigate;
return target && open
- ? () => {
+ ? (options: { openInNewSplit: boolean }) => {
leave?.();
- open(target);
+ open({ ...target, openInNewSplit: options.openInNewSplit });
}
: undefined;
},
diff --git a/docs/agent-guide/calendar.md b/docs/agent-guide/calendar.md
index cc67808967..c56c390987 100644
--- a/docs/agent-guide/calendar.md
+++ b/docs/agent-guide/calendar.md
@@ -1291,7 +1291,9 @@ error; offline responses are not sent. Cancellation and response/proposal notifi
do not offer RSVP or Join. Disconnected, ambiguous, and syncing states explain why an
action is unavailable.
-`Open in calendar` focuses the current occurrence, even if its date changed.
+`Open in calendar` focuses the current occurrence, even if its date changed. It retargets a
+Calendar split that is already open; otherwise a click replaces the email with Calendar and a
+shift-click opens Calendar in a new split beside it, from the inline card and the `.ics` dialog.
`View your day` opens a compact agenda without changing the active split; Close returns
focus to its trigger. Busy overlapping events are labeled, while cancelled, declined,
and free events do not count as conflicts. Calendar 12/24-hour preferences apply to