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
import { MobileDrawer } from '@components/app/mobile/MobileDrawer';
import { isMobile } from '@core/mobile/isMobile';
import CheckIcon from '@icon/system/regular/check.svg';
import CloseIcon from '@icon/system/regular/x.svg';
import { RadioGroup as KobalteRadioGroup } from '@kobalte/core/radio-group';
import type { CalendarRsvpScope } from '@service-email/client';
import { Button, Dialog, Panel, RadioGroup } from '@ui';
import { For, Show } from 'solid-js';
const SCOPE_OPTIONS = [
{ scope: 'this_event', label: 'This event' },
{ scope: 'all', label: 'All events' },
] as const satisfies readonly {
scope: CalendarRsvpScope;
label: string;
}[];
/** The caller owns the pending response; dismissing never submits it. */
export function EventRsvpScopeDialog(props: {
open: boolean;
scope: CalendarRsvpScope;
onScopeChange: (scope: CalendarRsvpScope) => void;
onClose: () => void;
onConfirm: () => void;
}) {
return (
<Show
when={isMobile()}
fallback={
<Dialog
open={props.open}
onOpenChange={(open) => !open && props.onClose()}
>
<Panel depth={2} class="max-w-[calc(100vw-2rem)] rounded-xl text-ink">
<Panel.Header class="gap-1 px-2">
<Dialog.CloseButton
as={Button}
aria-label="Close RSVP"
tooltip="Close RSVP"
variant="ghost"
size="icon-sm"
>
<CloseIcon class="size-3.5 touch:size-6 shrink-0 pointer-events-none" />
</Dialog.CloseButton>
<Dialog.Title as="span" class="m-0 p-0 text-sm font-medium">
RSVP to recurring event
</Dialog.Title>
</Panel.Header>
<Panel.Body class="flex flex-col gap-3 p-3">
<RadioGroup
value={props.scope}
onChange={(value) =>
props.onScopeChange(value as CalendarRsvpScope)
}
aria-label="Response applies to"
class="max-w-80 text-sm text-ink-muted"
>
<For each={SCOPE_OPTIONS}>
{(option) => (
<RadioGroup.Item value={option.scope}>
<RadioGroup.ItemControl />
<RadioGroup.ItemLabel>
{option.label}
</RadioGroup.ItemLabel>
</RadioGroup.Item>
)}
</For>
</RadioGroup>
<div class="flex justify-end gap-1 pt-2">
<Button variant="ghost" onClick={props.onClose}>
Cancel
</Button>
<Button variant="secondary" onClick={props.onConfirm}>
OK
</Button>
</div>
</Panel.Body>
</Panel>
</Dialog>
}
>
<MobileDrawer
side="bottom"
open={props.open}
onOpenChange={(open) => !open && props.onClose()}
preventScroll={false}
preventScrollbarShift={false}
>
<MobileDrawer.Portal>
<MobileDrawer.Overlay />
<MobileDrawer.Content
aria-label="RSVP to recurring event"
class="overflow-hidden"
>
<MobileDrawer.Handle class="pb-1" />
<div class="flex shrink-0 items-center justify-between gap-3 px-6 pb-4">
<h2 class="text-lg font-semibold text-ink">
RSVP to recurring event
</h2>
<MobileDrawer.Close
as={Button}
variant="ghost"
size="icon-sm"
aria-label="Close RSVP"
class="size-11 shrink-0 rounded-full bg-ink/6"
>
<CloseIcon class="size-5" />
</MobileDrawer.Close>
</div>
<MobileDrawer.ScrollBody>
<p class="px-6 pb-3 text-sm text-ink-muted">
Apply your response to:
</p>
<MobileDrawer.Section>
<KobalteRadioGroup
value={props.scope}
onChange={(value) => {
const option = SCOPE_OPTIONS.find(
(option) => option.scope === value
);
if (option) props.onScopeChange(option.scope);
}}
aria-label="Response applies to"
class="flex flex-col gap-1"
>
<For each={SCOPE_OPTIONS}>
{(option) => (
<KobalteRadioGroup.Item
value={option.scope}
class="relative rounded-[20px] text-ink data-checked:bg-ink/8 focus-within:outline-2 focus-within:outline-accent"
>
<KobalteRadioGroup.ItemInput />
<KobalteRadioGroup.ItemLabel class="flex min-h-12 items-center justify-between gap-3 px-4 py-3 text-base">
{option.label}
<KobalteRadioGroup.ItemControl class="flex size-5 items-center justify-center">
<KobalteRadioGroup.ItemIndicator>
<CheckIcon class="size-5 text-accent" />
</KobalteRadioGroup.ItemIndicator>
</KobalteRadioGroup.ItemControl>
</KobalteRadioGroup.ItemLabel>
</KobalteRadioGroup.Item>
)}
</For>
</KobalteRadioGroup>
</MobileDrawer.Section>
<div class="flex gap-3 px-6 pt-5 pb-2">
<Button
variant="ghost"
class="min-h-11 flex-1"
onClick={props.onClose}
>
Cancel
</Button>
<Button
variant="secondary"
class="min-h-11 flex-1"
onClick={props.onConfirm}
>
Save response
</Button>
</div>
</MobileDrawer.ScrollBody>
</MobileDrawer.Content>
</MobileDrawer.Portal>
</MobileDrawer>
</Show>
);
}