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): make locked composer pills look and act disabled (#8654)

gbirman9c9184862fc4
diff --git a/apps/web/src/features/calendar/components/composer/EventDateTimeRangeFields.tsx b/apps/web/src/features/calendar/components/composer/EventDateTimeRangeFields.tsx
index e4d6ddae0f..b1511d9546 100644
--- a/apps/web/src/features/calendar/components/composer/EventDateTimeRangeFields.tsx
+++ b/apps/web/src/features/calendar/components/composer/EventDateTimeRangeFields.tsx
@@ -97,7 +97,7 @@ function EventDateTimeDropdown(props: EventDateTimeDropdownProps) {
aria-invalid={props.invalid || undefined}
aria-describedby={props.describedBy}
class={cn(
- 'group inline-flex h-7 w-fit max-w-48 min-w-0 items-center justify-between gap-1.5 rounded-lg border border-edge-muted bg-control px-2 py-1 text-left text-xs leading-tight text-ink-muted hover:bg-hover hover:text-ink focus-visible:bg-active focus-visible:text-ink focus-visible:ring-accent/10 data-expanded:bg-hover data-expanded:text-ink',
+ 'group inline-flex h-7 w-fit max-w-48 min-w-0 items-center justify-between gap-1.5 rounded-lg border border-edge-muted bg-control px-2 py-1 text-left text-xs leading-tight text-ink-muted hover:bg-hover hover:text-ink focus-visible:bg-active focus-visible:text-ink focus-visible:ring-accent/10 data-expanded:bg-hover data-expanded:text-ink disabled:pointer-events-none disabled:opacity-50',
open() && 'bg-hover text-ink',
props.invalid &&
'border-failure text-failure hover:text-failure focus-visible:text-failure data-expanded:text-failure'
diff --git a/apps/web/src/features/calendar/components/composer/EventForm.test.tsx b/apps/web/src/features/calendar/components/composer/EventForm.test.tsx
index fcb11a396b..60e780977d 100644
--- a/apps/web/src/features/calendar/components/composer/EventForm.test.tsx
+++ b/apps/web/src/features/calendar/components/composer/EventForm.test.tsx
@@ -154,6 +154,14 @@ it('keeps a guest the organizer does not let modify to their own reminders', asy
expect(
screen.getByRole('button', { name: /Video conferencing/ })
).toHaveProperty('disabled', true);
+ // Read-only on every edit, the kind and calendar no longer open their one
+ // value as a list once the details are locked.
+ for (const name of ['Event kind', 'Calendar']) {
+ const pill = screen.getByLabelText(name);
+ expect(pill).toHaveProperty('disabled', true);
+ await user.click(pill);
+ expect(screen.queryByRole('listbox')).toBeNull();
+ }
expect(
screen.getByText('Only the organizer can change this event.')
).toBeTruthy();
diff --git a/apps/web/src/features/calendar/components/composer/EventForm.tsx b/apps/web/src/features/calendar/components/composer/EventForm.tsx
index 9d4f2ffd93..e232e89844 100644
--- a/apps/web/src/features/calendar/components/composer/EventForm.tsx
+++ b/apps/web/src/features/calendar/components/composer/EventForm.tsx
@@ -127,6 +127,7 @@ export function EventForm(props: EventFormProps) {
props.disabledFields?.[field] === true;
const fieldIsDisabled = (field: keyof EventEditorDisabledFields) =>
formIsDisabled() || fieldIsReadOnly(field);
+ const detailsLocked = () => props.detailsReadOnlyReason !== undefined;
const capabilities = () => controller.selectedCalendarOption()?.capabilities;
const conferenceLocked = () =>
@@ -292,21 +293,27 @@ export function EventForm(props: EventFormProps) {
</div>
<div class="flex min-w-0 flex-wrap items-center gap-2">
- <EventComposerKindPill
- eventType={state().eventType}
- onChange={controller.setEventKind}
- disabled={formIsDisabled()}
- readOnly={isEdit()}
- />
- <EventComposerCalendarPill
- options={controller.calendarOptions()}
- value={controller.selectedCalendarOption()}
- onChange={(calendarId) =>
- controller.setField('calendarId', calendarId)
- }
- disabled={formIsDisabled()}
- readOnly={fieldIsReadOnly('calendar')}
- />
+ {/* Read-only on every edit, they open their one value as a list;
+ locked, they are as unavailable as the other details. */}
+ <LockedField reason={props.detailsReadOnlyReason}>
+ <EventComposerKindPill
+ eventType={state().eventType}
+ onChange={controller.setEventKind}
+ disabled={formIsDisabled() || detailsLocked()}
+ readOnly={isEdit()}
+ />
+ </LockedField>
+ <LockedField reason={props.detailsReadOnlyReason}>
+ <EventComposerCalendarPill
+ options={controller.calendarOptions()}
+ value={controller.selectedCalendarOption()}
+ onChange={(calendarId) =>
+ controller.setField('calendarId', calendarId)
+ }
+ disabled={formIsDisabled() || detailsLocked()}
+ readOnly={fieldIsReadOnly('calendar')}
+ />
+ </LockedField>
<LockedField reason={props.detailsReadOnlyReason}>
<EventComposerRecurrencePill
options={controller.recurrenceOptions()}
diff --git a/apps/web/src/features/calendar/components/composer/EventPropertyPills.tsx b/apps/web/src/features/calendar/components/composer/EventPropertyPills.tsx
index 27a641a23d..2a1dbbc9a6 100644
--- a/apps/web/src/features/calendar/components/composer/EventPropertyPills.tsx
+++ b/apps/web/src/features/calendar/components/composer/EventPropertyPills.tsx
@@ -45,8 +45,10 @@ import {
eventKindOf,
} from './out-of-office';
+// A disabled pill dims, as the date and time pills do, and takes no pointer,
+// so it shows no hover; a tooltip around it still explains why.
const PROPERTY_TRIGGER_CLASS =
- 'group flex h-7 items-center justify-between gap-1.5 rounded-full border border-edge-muted bg-control px-2 py-1 text-left text-xs leading-tight text-ink-muted hover:bg-hover hover:text-ink focus-visible:bg-active focus-visible:text-ink focus-visible:ring-accent/10 data-expanded:bg-hover data-expanded:text-ink';
+ 'group flex h-7 items-center justify-between gap-1.5 rounded-full border border-edge-muted bg-control px-2 py-1 text-left text-xs leading-tight text-ink-muted hover:bg-hover hover:text-ink focus-visible:bg-active focus-visible:text-ink focus-visible:ring-accent/10 data-expanded:bg-hover data-expanded:text-ink disabled:pointer-events-none disabled:opacity-50';
const PROPERTY_VALUE_CLASS =
'group-hover:text-ink group-focus-visible:text-ink group-data-expanded:text-ink';
diff --git a/docs/agent-guide/calendar.md b/docs/agent-guide/calendar.md
index 9b6fe02a49..faf0aa2b82 100644
--- a/docs/agent-guide/calendar.md
+++ b/docs/agent-guide/calendar.md
@@ -488,7 +488,9 @@ A guest the organizer does not let modify the event (`viewerCan.editDetails` fal
`viewerCan.rsvp` is true) opens an editor whose date/time, all-day, title, description,
repeat, conferencing and location controls are disabled, each with the tooltip `Only the
organizer can change this event.`; the same line shows under the pills, which is all a
-touch device shows. Notifications stay editable and Save sends only `reminders` (plus any
+touch device shows. The event kind and calendar pills, which on any other edit open their one
+value as a list, are disabled too. Disabled pills, the date and time pills included, are
+dimmed and show no hover. Notifications stay editable and Save sends only `reminders` (plus any
invitation). An editor already open when the organizer turns modifying off follows the
guest's copy once it syncs: the same fields lock, return to the event's own (keeping
notification and guest changes) and a toast shows the line. That guest cannot drag or resize