Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(calendar): ui improvements (#5687)
dev-rb802c0e270d49
diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsxindex 784b060f5f..29530010b4 100644--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx@@ -558,6 +558,9 @@ registerComponent('calendar-event-compose', (params) => {| ((calendarId: string, color: string) => void)| undefined}+ onDirtyChange={+ params?.onDirtyChange as ((dirty: boolean) => void) | undefined+ }onSaveSuccess={params?.onSaveSuccess as (() => void) | undefined}/>);diff --git a/apps/web/src/features/calendar/CalendarPage.tsx b/apps/web/src/features/calendar/CalendarPage.tsxindex 2d9f534084..09f1ff1adf 100644--- a/apps/web/src/features/calendar/CalendarPage.tsx+++ b/apps/web/src/features/calendar/CalendarPage.tsx@@ -559,13 +559,11 @@ export function CalendarPage(props: { id: CalendarPageId; initialDate: Date }) {</FullCalendar.DayHeaderContent><FullCalendar.SlotLabelContent>- {({ date, text }) =>- calendarView.useNarrowDayHeaders()- ? formatCompactCalendarTime(- date,- calendarView.displaySettings.timeFormat- )- : text+ {({ date }) =>+ formatCompactCalendarTime(+ date,+ calendarView.displaySettings.timeFormat+ )}</FullCalendar.SlotLabelContent>@@ -608,15 +606,8 @@ export function CalendarPage(props: { id: CalendarPageId; initialDate: Date }) {</FullCalendar.EventContent><FullCalendar.NowIndicatorContent>- {({ isAxis, view }) => {- if (isAxis) {- return view.type === 'timeGridWeek' ? (- <span- aria-hidden="true"- class="calendar-now-axis-indicator calendar-now-axis-indicator-gutter"- />- ) : null;- }+ {({ isAxis }) => {+ if (isAxis) return null;return (<CurrentTimeAxisIndicatordiff --git a/apps/web/src/features/calendar/CalendarPeriodSelector.tsx b/apps/web/src/features/calendar/CalendarPeriodSelector.tsxindex 42ee8d0173..e8dcab7f77 100644--- a/apps/web/src/features/calendar/CalendarPeriodSelector.tsx+++ b/apps/web/src/features/calendar/CalendarPeriodSelector.tsx@@ -10,22 +10,23 @@ import { createMemo, For, Show } from 'solid-js';import { createStore } from 'solid-js/store';import { useCalendarPager } from './CalendarPagerContext';import { useCalendarView } from './CalendarViewContext';+import { calendarPeriodLabel } from './calendar-label';import type { CalendarPeriodView } from './events/types';const CALENDAR_VIEWS = [{value: 'dayGridMonth',- label: 'Month',+ label: calendarPeriodLabel('dayGridMonth'),hotkeyToken: TOKENS.calendar.view.month,},{value: 'timeGridWeek',- label: 'Week',+ label: calendarPeriodLabel('timeGridWeek'),hotkeyToken: TOKENS.calendar.view.week,},{value: 'timeGridDay',- label: 'Day',+ label: calendarPeriodLabel('timeGridDay'),hotkeyToken: TOKENS.calendar.view.day,},] satisfies Array<{@@ -184,7 +185,7 @@ export function CalendarPeriodSelector() {<Dropdown.Sub><Dropdown.SubTrigger><CalendarIcon class="size-3.5 text-ink-muted" />- <span class="flex-1">Custom date…</span>+ <span class="flex-1">Go to date</span><CaretRightIcon class="size-3 text-ink-muted" /></Dropdown.SubTrigger><Dropdown.SubContent class="w-72 max-w-[calc(100vw-1rem)]">diff --git a/apps/web/src/features/calendar/CalendarSettingsDropdown.tsx b/apps/web/src/features/calendar/CalendarSettingsDropdown.tsxindex dc43da48ee..30987e3e53 100644--- a/apps/web/src/features/calendar/CalendarSettingsDropdown.tsx+++ b/apps/web/src/features/calendar/CalendarSettingsDropdown.tsx@@ -95,7 +95,7 @@ function DesktopCalendarSettings(props: {variant="ghost"size="icon-sm"class="shrink-0 rounded-lg"- label="Calendar settings"+ aria-label="Calendar settings"><GearIcon class="size-3.5" /></Dropdown.Trigger>diff --git a/apps/web/src/features/calendar/CalendarSetupStatus.tsx b/apps/web/src/features/calendar/CalendarSetupStatus.tsxindex 08bd19e6b3..e5b26b10bb 100644--- a/apps/web/src/features/calendar/CalendarSetupStatus.tsx+++ b/apps/web/src/features/calendar/CalendarSetupStatus.tsx@@ -82,12 +82,7 @@ export function CalendarSetupStatus() {fallback={<div class="absolute right-2 bottom-2 z-20 flex items-center gap-2 rounded-full border border-edge-muted bg-surface py-1 pr-1 pl-2.5 text-xs text-ink-muted shadow-menu"><span>{setupMessage().title}</span>- <Button- variant="active"- size="sm"- label={setupMessage().action}- onClick={startSetup}- >+ <Button variant="active" size="sm" onClick={startSetup}>{setupMessage().action}</Button></div>@@ -102,12 +97,7 @@ export function CalendarSetupStatus() {{setupMessage().title}</div><p class="text-xs text-ink-muted">{setupMessage().description}</p>- <Button- variant="active"- size="sm"- label={setupMessage().action}- onClick={startSetup}- >+ <Button variant="active" size="sm" onClick={startSetup}>{setupMessage().action}</Button></div>diff --git a/apps/web/src/features/calendar/calendar-label.ts b/apps/web/src/features/calendar/calendar-label.tsindex 58de9fb22d..7759170fa3 100644--- a/apps/web/src/features/calendar/calendar-label.ts+++ b/apps/web/src/features/calendar/calendar-label.ts@@ -1,4 +1,16 @@import type { VisibleCalendar } from '@queries/calendar/calendars';+import type { CalendarPeriodView } from './events/types';++const CALENDAR_PERIOD_LABELS = {+ dayGridMonth: 'Month',+ timeGridWeek: 'Week',+ timeGridDay: 'Day',+} satisfies Record<CalendarPeriodView, string>;++/** Human-readable label for a calendar period view. */+export function calendarPeriodLabel(view: CalendarPeriodView): string {+ return CALENDAR_PERIOD_LABELS[view];+}/*** Display label for a calendar in pickers and filters. Google names primarydiff --git a/apps/web/src/features/calendar/calendar-view.tsx b/apps/web/src/features/calendar/calendar-view.tsxindex 4eee00fd49..e7e98c6440 100644--- a/apps/web/src/features/calendar/calendar-view.tsx+++ b/apps/web/src/features/calendar/calendar-view.tsx@@ -40,6 +40,7 @@ import {CalendarViewContextProvider,useCalendarView,} from './CalendarViewContext';+import { calendarPeriodLabel } from './calendar-label';import { SelectedEventDetails } from './events/EventDetailsPopover';import { useOpenEventComposer } from './events/useOpenEventComposer';import { useCalendarHotkeys } from './use-calendar-hotkeys';@@ -191,6 +192,9 @@ function CalendarWorkspace() {() => calendarPager.activeDateInfo()?.view.calendar.getDate() ?? initialDate);const dateTitle = createMemo(() => formatMonthTitle(currentDate()));+ const periodLabel = createMemo(() =>+ calendarPeriodLabel(calendarView.displaySettings.periodView).toLowerCase()+ );const visibleRange = createMemo(() => {const dateInfo = calendarPager.activeDateInfo();return dateInfo ? { end: dateInfo.end, start: dateInfo.start } : undefined;@@ -265,7 +269,6 @@ function CalendarWorkspace() {variant="ghost"size="sm"class="rounded-lg px-2"- label="New event"onClick={() => openEventComposer()}><PlusIcon class="size-3.5" />@@ -277,7 +280,7 @@ function CalendarWorkspace() {variant="ghost"size="icon-sm"class="rounded-lg"- label="Previous period"+ label={`Previous ${periodLabel()}`}hotkey={TOKENS.calendar.period.previous}onClick={() => void pager.previous()}>@@ -287,7 +290,7 @@ function CalendarWorkspace() {variant="ghost"size="icon-sm"class="rounded-lg"- label="Next period"+ label={`Next ${periodLabel()}`}hotkey={TOKENS.calendar.period.next}onClick={() => void pager.next()}>diff --git a/apps/web/src/features/calendar/calendar.css b/apps/web/src/features/calendar/calendar.cssindex 5e4f8763fc..6f1691e7c8 100644--- a/apps/web/src/features/calendar/calendar.css+++ b/apps/web/src/features/calendar/calendar.css@@ -329,6 +329,10 @@filter: invert(1) grayscale(1) contrast(100);}+.calendar-view .fc .fc-timegrid-event .fc-event-main {+ padding: 0;+}+.calendar-view .fc .fc-event .calendar-event-content {container-type: inline-size;border-radius: inherit;@@ -445,8 +449,6 @@--fc-event-border-color: var(--color-accent);--fc-event-bg-color: var(--color-accent);--fc-event-text-color: var(--color-surface);- box-shadow: 0 0 0 1px var(--color-accent);- border-style: solid;opacity: 1;}@@ -575,19 +577,6 @@display: none;}-.calendar-view .fc .fc-timeGridWeek-view .fc-timegrid-now-indicator-arrow {- right: 0;- left: 0;- display: flex;- height: auto;- margin-top: 0;- justify-content: flex-end;- overflow: visible;- border: 0;- background: transparent;- transform: translateY(calc(-50% + 0.5px));-}-.calendar-view .fc .fc-timeGridWeek-view .fc-timegrid-axis {width: 4.5rem;}@@ -616,14 +605,6 @@clip-path 420ms cubic-bezier(0.2, 0.8, 0.2, 1);}-.calendar-view .fc .calendar-now-axis-indicator-gutter {- width: 0.375rem;- height: 0.625rem;- border-radius: 0 9999px 9999px 0;- clip-path: none;- pointer-events: none;-}-.calendar-view.fc.fc-timegrid-now-indicator-linediff --git a/apps/web/src/features/calendar/events/EventComposer.tsx b/apps/web/src/features/calendar/events/EventComposer.tsxindex aa6eab86f6..79fc78450a 100644--- a/apps/web/src/features/calendar/events/EventComposer.tsx+++ b/apps/web/src/features/calendar/events/EventComposer.tsx@@ -11,6 +11,7 @@ export function EventComposer(props: {event?: CalendarEvent;initialValues?: EventEditorInitialValues;onCalendarChange?: (calendarId: string, color: string) => void;+ onDirtyChange?: (dirty: boolean) => void;onSaveSuccess?: () => void;}) {const panel = useSplitPanelOrThrow();@@ -44,6 +45,7 @@ export function EventComposer(props: {showRecurringEditNotice={editor.showRecurringEditNotice()}pending={editor.pending()}onCalendarChange={props.onCalendarChange}+ onDirtyChange={props.onDirtyChange}onCancel={close}onSubmit={editor.save}/>diff --git a/apps/web/src/features/calendar/events/EventComposerForm.tsx b/apps/web/src/features/calendar/events/EventComposerForm.tsxindex 6ae07c3ea8..c2af227274 100644--- a/apps/web/src/features/calendar/events/EventComposerForm.tsx+++ b/apps/web/src/features/calendar/events/EventComposerForm.tsx@@ -3,6 +3,7 @@ import { Button, cn, Layer } from '@ui';import {type Accessor,createEffect,+ createMemo,createSignal,createUniqueId,Show,@@ -28,6 +29,10 @@ import {moveAllDayRange,type SelectedEventEditorGuest,} from './EventEditorForm';+import {+ type EventComposerFormSnapshot,+ isEventComposerFormDirty,+} from './event-composer-dirty';import { RecurrenceBuilder } from './RecurrenceBuilder';export interface EventComposerFormProps {@@ -40,6 +45,7 @@ export interface EventComposerFormProps {pending: boolean;class?: string;onCalendarChange?: (calendarId: string, color: string) => void;+ onDirtyChange?: (dirty: boolean) => void;onCancel: () => void;onSubmit: (values: EventEditorSubmitValues) => void;}@@ -58,9 +64,14 @@ export function EventComposerForm(props: EventComposerFormProps) {recurrenceLines: [...initialValues.recurrenceLines],});+ const initialSelectedGuests = initialGuestOptions(+ initialValues.guests,+ props.guestOptions()+ );+ const initialGuestEmails = initialSelectedGuests.map(guestEmail);const [selectedGuests, setSelectedGuests] = createSignal<SelectedEventEditorGuest[]- >(initialGuestOptions(initialValues.guests, props.guestOptions()));+ >(initialSelectedGuests);const fieldIsReadOnly = (field: keyof EventEditorDisabledFields) =>props.disabledFields?.[field] === true;@@ -89,10 +100,40 @@ export function EventComposerForm(props: EventComposerFormProps) {(option) => option.id === effectiveCalendarId()) ?? props.calendarOptions[0];+ const initialSnapshot = (): EventComposerFormSnapshot => ({+ title: initialValues.title,+ allDay: initialValues.allDay,+ start: initialValues.start,+ end: initialValues.end,+ recurrenceLines: initialValues.recurrenceLines,+ calendarId: initialValues.calendarId ?? props.calendarOptions[0]?.id,+ guestEmails: initialGuestEmails,+ location: initialValues.location,+ description: initialValues.description,+ });+ const currentSnapshot = (): EventComposerFormSnapshot => {+ const current = state();+ return {+ title: current.title,+ allDay: current.allDay,+ start: current.start,+ end: current.end,+ recurrenceLines: recurrenceLines() ?? initialValues.recurrenceLines,+ calendarId: effectiveCalendarId(),+ guestEmails: selectedGuests().map(guestEmail),+ location: current.location,+ description: current.description,+ };+ };+ const isDirty = createMemo(() =>+ isEventComposerFormDirty(initialSnapshot(), currentSnapshot())+ );+createEffect(() => {const option = selectedCalendarOption();if (option) props.onCalendarChange?.(option.id, option.color);});+ createEffect(() => props.onDirtyChange?.(isDirty()));const changeCalendar = (calendarId: string) =>setState({ ...state(), calendarId });@@ -258,7 +299,6 @@ export function EventComposerForm(props: EventComposerFormProps) {variant="ghost"class="rounded-lg"disabled={props.pending}- label="Cancel"onClick={props.onCancel}>Cancel@@ -269,7 +309,7 @@ export function EventComposerForm(props: EventComposerFormProps) {depth={3}class="rounded-lg border-0"disabled={!canSave() || props.pending}- label={isEdit() ? 'Save' : 'Create event'}+ aria-label={isEdit() ? 'Save' : 'Create event'}><Showwhen={props.pending}diff --git a/apps/web/src/features/calendar/events/EventDetails.tsx b/apps/web/src/features/calendar/events/EventDetails.tsxindex 017783f767..5b7233da22 100644--- a/apps/web/src/features/calendar/events/EventDetails.tsx+++ b/apps/web/src/features/calendar/events/EventDetails.tsx@@ -502,7 +502,6 @@ export function EventDetails(props: {variant="cta"size="sm"class="h-8 rounded-lg [&_svg]:size-3.5!"- label={conferenceLabel()}onClick={() => openExternalUrl(url())}>{conferenceLabel()}diff --git a/apps/web/src/features/calendar/events/EventEditorForm.tsx b/apps/web/src/features/calendar/events/EventEditorForm.tsxindex 7da77a525a..4707e859eb 100644--- a/apps/web/src/features/calendar/events/EventEditorForm.tsx+++ b/apps/web/src/features/calendar/events/EventEditorForm.tsx@@ -979,7 +979,6 @@ export function EventEditorForm(props: EventEditorFormProps) {variant="ghost"class="rounded-lg"disabled={props.pending}- label="Cancel"onClick={props.onCancel}>Cancel@@ -989,7 +988,7 @@ export function EventEditorForm(props: EventEditorFormProps) {variant="cta"class="rounded-lg"disabled={!canSave() || props.pending}- label="Save"+ aria-label="Save"><Show when={props.pending} fallback="Save"><SpinnerIcon class="size-4 animate-spin" />diff --git a/apps/web/src/features/calendar/events/EventRsvpSection.tsx b/apps/web/src/features/calendar/events/EventRsvpSection.tsxindex 4a41b99ebb..7515a768a1 100644--- a/apps/web/src/features/calendar/events/EventRsvpSection.tsx+++ b/apps/web/src/features/calendar/events/EventRsvpSection.tsx@@ -109,7 +109,6 @@ export function EventRsvpSection(props: {size={props.buttonSize ?? 'sm'}depth={3}class="rounded-lg px-3"- label={option.label}onClick={() => respond(option.response)}>{option.label}@@ -151,17 +150,11 @@ export function EventRsvpSection(props: {<Buttonvariant="ghost"class="rounded-lg"- label="Cancel"onClick={() => setPendingResponse(undefined)}>Cancel</Button>- <Button- variant="active"- class="rounded-lg"- label="OK"- onClick={confirm}- >+ <Button variant="active" class="rounded-lg" onClick={confirm}>OK</Button></div>diff --git a/apps/web/src/features/calendar/events/event-composer-dirty.ts b/apps/web/src/features/calendar/events/event-composer-dirty.tsnew file mode 100644index 0000000000..9aaca3b477--- /dev/null+++ b/apps/web/src/features/calendar/events/event-composer-dirty.ts@@ -0,0 +1,64 @@+import {+ parseRecurrenceConfig,+ recurrenceConfigsEqual,+} from './recurrence-editor';++/** Form values that participate in event-composer dirty-state detection. */+export interface EventComposerFormSnapshot {+ title: string;+ allDay: boolean;+ start: string;+ end: string;+ recurrenceLines: readonly string[];+ calendarId?: string;+ guestEmails: readonly string[];+ location: string;+ description: string;+}++function normalizedGuestEmails(emails: readonly string[]) {+ return emails.map((email) => email.trim().toLowerCase()).sort();+}++function arraysEqual(first: readonly string[], second: readonly string[]) {+ return (+ first.length === second.length &&+ first.every((value, index) => value === second[index])+ );+}++function recurrenceLinesEqual(+ first: readonly string[],+ second: readonly string[]+) {+ if (arraysEqual(first, second)) return true;++ const firstConfig = parseRecurrenceConfig([...first]);+ const secondConfig = parseRecurrenceConfig([...second]);+ return (+ firstConfig !== undefined &&+ secondConfig !== undefined &&+ recurrenceConfigsEqual(firstConfig, secondConfig)+ );+}++/** Whether the current composer values differ meaningfully from their baseline. */+export function isEventComposerFormDirty(+ initial: EventComposerFormSnapshot,+ current: EventComposerFormSnapshot+) {+ return (+ initial.title !== current.title ||+ initial.allDay !== current.allDay ||+ initial.start !== current.start ||+ initial.end !== current.end ||+ initial.calendarId !== current.calendarId ||+ initial.location !== current.location ||+ initial.description !== current.description ||+ !arraysEqual(+ normalizedGuestEmails(initial.guestEmails),+ normalizedGuestEmails(current.guestEmails)+ ) ||+ !recurrenceLinesEqual(initial.recurrenceLines, current.recurrenceLines)+ );+}diff --git a/apps/web/src/features/calendar/events/useOpenEventComposer.ts b/apps/web/src/features/calendar/events/useOpenEventComposer.tsindex 46b8be770a..9c6c77b0af 100644--- a/apps/web/src/features/calendar/events/useOpenEventComposer.ts+++ b/apps/web/src/features/calendar/events/useOpenEventComposer.ts@@ -12,13 +12,14 @@ export interface OpenEventComposerOptions {onClose?: () => void;}-/** Opens an event composer with confirmation before discarding a new event. */+/** Opens an event composer with confirmation before discarding changes. */export function useOpenEventComposer() {const { popoverSplit } = useSplitLayout();const owner = getOwner();return (options: OpenEventComposerOptions = {}) => {let eventSaved = false;+ let formDirty = false;let closeConfirmationPending = false;return popoverSplit(@@ -29,6 +30,9 @@ export function useOpenEventComposer() {event: options.event,initialValues: options.initialValues,onCalendarChange: options.onCalendarChange,+ onDirtyChange: (dirty: boolean) => {+ formDirty = dirty;+ },onSaveSuccess: () => {eventSaved = true;},@@ -38,7 +42,7 @@ export function useOpenEventComposer() {onClose: async (close) => {if (closeConfirmationPending) return;- if (!eventSaved) {+ if (!eventSaved && formDirty) {closeConfirmationPending = true;try {const confirmed = await confirmDialog(