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(calendar): keep event details within calendar view (#7649)

gbirmanc23de37bb023
diff --git a/apps/web/src/features/calendar-view/components/SelectedEventDetails.tsx b/apps/web/src/features/calendar-view/components/SelectedEventDetails.tsx
index 5abb4e0997..2f916fa574 100644
--- a/apps/web/src/features/calendar-view/components/SelectedEventDetails.tsx
+++ b/apps/web/src/features/calendar-view/components/SelectedEventDetails.tsx
@@ -44,6 +44,7 @@ import {
import { type Accessor, createMemo, createSignal, For, Show } from 'solid-js';
interface SelectedEventDetailsProps {
+ boundary: HTMLElement;
anchor: Accessor<HTMLElement | undefined>;
event: Accessor<CalendarEvent | undefined>;
timeFormat: Accessor<CalendarTimeFormat>;
@@ -94,6 +95,7 @@ export function SelectedEventDetails(props: SelectedEventDetailsProps) {
<Show when={props.event()}>
{(currentEvent) => (
<EventDetailsPopover
+ boundary={props.boundary}
anchor={selected.anchor}
event={currentEvent()}
timeFormat={props.timeFormat()}
@@ -321,6 +323,7 @@ function EventDetailsDrawer(props: EventDetailsOverlayProps) {
interface EventDetailsPopoverProps extends EventDetailsOverlayProps {
anchor: HTMLElement;
+ boundary: HTMLElement;
}
function useDeleteEventDialog(props: {
@@ -425,8 +428,9 @@ function DeleteEventDialog(
/**
* Anchors event details and actions to a rendered calendar event.
- * The card stops at 32rem, or sooner when the space beside the event is
- * shorter. Details scroll inside that cap; the RSVP row stays pinned.
+ * The calendar viewport contains both the portal and its collision boundary.
+ * Wide events can overlap the card so it stays inside that viewport. Details
+ * scroll within 32rem or the available height; the RSVP row stays pinned.
*/
function EventDetailsPopover(props: EventDetailsPopoverProps) {
const openEventComposer = useOpenEventComposer();
@@ -443,6 +447,7 @@ function EventDetailsPopover(props: EventDetailsPopoverProps) {
return (
<Popover
anchorRef={() => props.anchor}
+ boundary={() => props.boundary}
open
onOpenChange={(open) => {
// Keep the popover mounted while its delete dialog is open.
@@ -453,12 +458,13 @@ function EventDetailsPopover(props: EventDetailsPopoverProps) {
gutter={8}
flip
slide
+ overlap
fitViewport
>
- <Popover.Portal>
+ <Popover.Portal mount={props.boundary}>
<Layer depth={3}>
<Popover.Content
- class="portal-scope z-modal max-w-[calc(100vw-2rem)] outline-none"
+ class="portal-scope z-modal max-w-[var(--kb-popper-content-available-width)] outline-none"
onInteractOutside={handleOpenEventOutsidePress}
onOpenAutoFocus={(event) => {
// Aims can arrive while the keyboard is elsewhere — arrow-key
@@ -485,7 +491,7 @@ function EventDetailsPopover(props: EventDetailsPopoverProps) {
}}
>
<Popover.Arrow class="fill-surface" />
- <div class="flex max-h-[min(32rem,var(--kb-popper-content-available-height,32rem))] w-fit min-w-[min(20rem,calc(100vw-2rem))] max-w-[min(24rem,calc(100vw-2rem))] flex-col overflow-hidden rounded-xl glass bg-menu-glass text-ink">
+ <div class="flex max-h-[min(32rem,var(--kb-popper-content-available-height,32rem))] w-fit min-w-[min(20rem,var(--kb-popper-content-available-width,20rem))] max-w-[min(24rem,var(--kb-popper-content-available-width,24rem))] flex-col overflow-hidden rounded-xl glass bg-menu-glass text-ink">
<Popover.Title class="sr-only">{props.event.title}</Popover.Title>
<div class="flex shrink-0 items-center justify-end gap-1 px-2 pt-2">
<Button
diff --git a/apps/web/src/features/calendar-view/components/Workspace.tsx b/apps/web/src/features/calendar-view/components/Workspace.tsx
index feb3701024..5349254ab6 100644
--- a/apps/web/src/features/calendar-view/components/Workspace.tsx
+++ b/apps/web/src/features/calendar-view/components/Workspace.tsx
@@ -40,6 +40,7 @@ import { SyncStatus } from './SyncStatus';
const CALENDAR_SWIPE_EDGE_INSET = 40;
function CalendarPages() {
+ const calendarView = useCalendarView();
const calendarPager = useCalendarPager();
const [viewport, setViewport] = createSignal<HTMLDivElement>();
const viewportSize = createElementSize(viewport);
@@ -83,7 +84,7 @@ function CalendarPages() {
/>
<div
ref={setViewport}
- class="relative flex min-w-0 min-h-0 flex-1"
+ class="relative flex min-w-0 min-h-0 flex-1 overflow-hidden"
role="region"
aria-label="Calendar periods"
>
@@ -102,6 +103,17 @@ function CalendarPages() {
)}
</For>
</Pager.Viewport>
+ <Show when={viewport()}>
+ {(boundary) => (
+ <SelectedEventDetails
+ boundary={boundary()}
+ anchor={calendarView.selectedEventAnchor}
+ event={calendarView.selectedEvent}
+ timeFormat={() => calendarView.displaySettings.timeFormat}
+ onClose={calendarView.closeEventDetails}
+ />
+ )}
+ </Show>
<Show when={isMobile()}>
<PagerSwipeGestures
edgeInset={CALENDAR_SWIPE_EDGE_INSET}
@@ -135,25 +147,14 @@ function CalendarPageContent() {
function WorkspaceContent() {
const panel = useSplitPanelOrThrow();
- const calendarView = useCalendarView();
// An inline preview keeps its host's name.
useSplitDisplayName(() => (panel.isInlinePreview ? undefined : 'Calendar'));
- const eventDetails = () => (
- <SelectedEventDetails
- anchor={calendarView.selectedEventAnchor}
- event={calendarView.selectedEvent}
- timeFormat={() => calendarView.displaySettings.timeFormat}
- onClose={calendarView.closeEventDetails}
- />
- );
-
return (
<Switch>
<Match when={panel.isInlinePreview}>
<Header presentation="preview" />
- {eventDetails()}
<main class="flex size-full min-h-0">
<CalendarPageContent />
</main>
@@ -180,7 +181,6 @@ function WorkspaceContent() {
</ViewShell.Content>
</ViewShell.Main>
</ViewShell.Root>
- {eventDetails()}
</SplitPanel.Body>
</SplitPanel.Root>
</Match>
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index 7e2dec8e0c..50c2ae52ba 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -1444,6 +1444,9 @@ On desktop, clicking or dragging empty grid time opens the event composer.
While an event's details are open, a press on empty grid time closes them and
does not start a new event; the next press creates one. Clicking another event
switches the open details.
+Desktop event details stay inside the visible calendar grid, including Home
+previews and narrow splits. They overlap wide Day-view events when needed and
+shrink to fit the pane; long details scroll while the RSVP row stays visible.
The `New event` composer (also opened by dragging a range on the grid) has an `Event kind`
pill choosing between `Event` and `Out of office`. Picking `Out of office` hides the guests,