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(share): dropdown scoping and share modal styles (#3595)
Seamus1cef19bd53d0
diff --git a/js/app/packages/core/component/ForwardToChannel.tsx b/js/app/packages/core/component/ForwardToChannel.tsxindex c3c29ca3f4..84ac583e48 100644--- a/js/app/packages/core/component/ForwardToChannel.tsx+++ b/js/app/packages/core/component/ForwardToChannel.tsx@@ -17,8 +17,8 @@ import { useCombinedRecipients } from '@core/signal/useCombinedRecipient';import type { WithCustomUserInput } from '@core/user';import { useSendMessageToPeople } from '@core/util/channels';import { getDestinationFromOptions } from '@core/util/destination';-import PaperPlane from '@icon/wide-paper-plane-cutout.svg';import CheckIcon from '@phosphor/check.svg?component-solid';+import PaperPlaneTilt from '@phosphor/paper-plane-tilt.svg';import { blockNameToItemType } from '@service-storage/client';import type { AccessLevel } from '@service-storage/generated/schemas/accessLevel';import type { SharePermissionV2ChannelSharePermissions } from '@service-storage/generated/schemas/sharePermissionV2ChannelSharePermissions';@@ -440,8 +440,8 @@ export function ForwardToChannel(props: ForwardToChannelProps) {><Show when={isAuthenticated()}>{/* Row 1: Recipient input + ShareOptions */}- <div class="flex items-center">- <div class="min-w-0 flex-1 px-1 min-h-11">+ <div class="flex items-center pr-2">+ <div class="min-w-0 flex-1 min-h-11"><RecipientSelector<'user' | 'contact' | 'channel'>placeholder="To: Email or group"setSelectedOptions={setSelectedOptions}@@ -483,7 +483,7 @@ export function ForwardToChannel(props: ForwardToChannelProps) {<ScrollIndicators scrollRef={mdScrollRef} noBorderStart /><CustomScrollbar scrollContainer={mdScrollRef} /><div- class="grow shrink min-h-20 max-h-40 overflow-y-auto scrollbar-hidden px-3 py-1.5 w-full text-sm"+ class="grow shrink min-h-20 max-h-40 overflow-y-auto scrollbar-hidden px-4 py-1.5 w-full text-sm"onClick={() => markdownEditor.controls.focus()}ref={setMdScrollRef}>@@ -497,7 +497,7 @@ export function ForwardToChannel(props: ForwardToChannelProps) {</div>{/* Row 3: Send As Group (optional) + Cancel + Send */}- <div class="shrink-0 flex w-full items-center p-3 gap-3 flex-wrap">+ <div class="shrink-0 flex w-full items-center px-4 py-4 gap-3 flex-wrap"><Show when={canSendAsGroup()}><labelclass={cn(@@ -555,14 +555,15 @@ export function ForwardToChannel(props: ForwardToChannelProps) {<Buttonvariant="ghost"size="sm"+ class="text-ink-extra-muted"onClick={() => props.onCancel?.()}>Cancel</Button><Button- variant={selectedOptions().length > 0 ? 'active' : 'base'}- size="sm"- class="px-2 rounded-xs flex items-center gap-1"+ variant={selectedOptions().length > 0 ? 'active' : 'ghost'}+ depth={3}+ class="rounded-lg border-0"disabled={selectedOptions().length === 0}onClick={() => {const options = selectedOptions();@@ -571,7 +572,7 @@ export function ForwardToChannel(props: ForwardToChannelProps) {}}}>- <PaperPlane class="size-4" />+ <PaperPlaneTilt class="size-4" />Share</Button></div>diff --git a/js/app/packages/core/component/TopBar/ShareButton.tsx b/js/app/packages/core/component/TopBar/ShareButton.tsxindex 857b1c4d23..f3302aa289 100644--- a/js/app/packages/core/component/TopBar/ShareButton.tsx+++ b/js/app/packages/core/component/TopBar/ShareButton.tsx@@ -34,16 +34,16 @@ import { idToEmail } from '@core/user';import { useBlockDocumentName } from '@core/util/currentBlockDocumentName';import type { ResultError } from '@core/util/result';import { buildSimpleEntityUrl } from '@core/util/url';-import IconComment from '@icon/wide-comment.svg';-import WideCopy from '@icon/wide-copy.svg';-import IconEdit from '@icon/wide-edit.svg';-import IconEye from '@icon/wide-eye.svg';import UserCircle from '@icon/wide-user-circle.svg';import WideUsers from '@icon/wide-users.svg';import { Dialog } from '@kobalte/core/dialog';import ChevronDownIcon from '@phosphor/caret-down.svg';+import IconComment from '@phosphor/chat-teardrop.svg';import CheckIcon from '@phosphor/check.svg';+import CopyIcon from '@phosphor/copy.svg';+import IconEye from '@phosphor/eye.svg';import IconLink from '@phosphor/link.svg';+import IconEdit from '@phosphor/pencil.svg';import IconShared from '@phosphor/share.svg';import IconX from '@phosphor/x.svg';import { cognitionApiServiceClient } from '@service-cognition/client';@@ -511,13 +511,8 @@ function MobileShareDrawer(props: MobileShareDrawerProps) {setPermissions={props.setPublicPermissions}/></span>- <Button- variant="base"- size="sm"- class="flex items-center gap-1 rounded-xs px-2 py-1"- onClick={props.copyPublicLink}- >- <WideCopy class="size-4" />+ <Button variant="base" onClick={props.copyPublicLink}>+ <CopyIcon class="size-4" /><span>Copy Link</span></Button></div>@@ -951,12 +946,12 @@ export function ShareModal(props: ShareModalProps) {<Dialog.Overlay class="z-modal fixed inset-0 bg-modal-overlay pattern-edge-muted pattern-diagonal-4" /><div class="z-modal fixed inset-0"><Dialog.Content- class="max-w-[calc(100vw-16px)] mt-20 sm:mt-40 mx-auto overflow-y-auto scrollbar-hidden portal-scope flex flex-col gap-2 *:max-h-[75vh]"+ class="max-w-[calc(100vw-16px)] mt-20 sm:mt-40 mx-auto overflow-y-auto scrollbar-hidden portal-scope isolate flex flex-col gap-2 *:max-h-[75vh]"style={{ width: '800px' }}>{/* Card 1: Share form — gradient border */}- <Panel active depth={2}>- <Panel.Header class="px-3">+ <Panel active depth={2} class="rounded-xl">+ <Panel.Header class="px-4"><Dialog.Title class="flex items-center gap-1.5 min-w-0 overflow-hidden whitespace-nowrap w-full text-sm font-medium"><span class="shrink-0">Share:</span><EntityIcon@@ -991,8 +986,8 @@ export function ShareModal(props: ShareModalProps) {{/* Card 2: Recipients — plain border */}<Show when={(recipients()?.length ?? 0) > 0 || !!props.owner}>- <Panel depth={2}>- <Panel.Header class="px-3">+ <Panel depth={2} class="rounded-xl">+ <Panel.Header class="px-4"><span class="text-sm font-medium">People with access to this{' '}{props.itemType === 'email'@@ -1012,7 +1007,7 @@ export function ShareModal(props: ShareModalProps) {class="overflow-y-auto scrollbar-hidden max-h-[calc(27vh-40px)]"ref={setRecipientScrollRef}>- <div class="grid gap-3 text-ink text-sm select-none p-3">+ <div class="grid gap-3 text-ink text-sm select-none p-4"><Show when={props.owner}><div class="flex justify-between"><div class="flex items-center gap-2 overflow-hidden">@@ -1125,8 +1120,13 @@ export function ShareModal(props: ShareModalProps) {props.itemType !== 'email'}>- <Panel depth={2}>- <Panel.Header class="justify-between px-3">+ <Panel depth={2} class="rounded-xl">+ <Panel.Header+ class={cn(+ 'justify-between px-4',+ publicAccessLevel() == null && 'border-b-0'+ )}+ ><div class="flex items-center gap-2"><span class="text-sm font-medium">Public link</span><div@@ -1151,7 +1151,7 @@ export function ShareModal(props: ShareModalProps) {</div><ToggleSwitchlabel="Enable public link"- labelClass="whitespace-nowrap"+ labelClass="text-xs whitespace-nowrap"checked={publicAccessLevel() != null}onChange={(on) =>setPublicPermissions(on ? 'view' : null)@@ -1160,14 +1160,9 @@ export function ShareModal(props: ShareModalProps) {</Panel.Header><Show when={publicAccessLevel() != null}><Panel.Body class="text-ink">- <div class="flex items-center p-3 justify-between">- <Button- variant="base"- size="sm"- class="flex items-center gap-1 rounded-xs px-2 py-1"- onClick={copyPublicLink}- >- <WideCopy class="size-4" />+ <div class="flex items-center p-4 justify-between">+ <Button variant="base" onClick={copyPublicLink}>+ <CopyIcon class="size-4" /><span class="hidden sm:inline">Copy Link</span></Button><span class="text-sm text-ink-muted flex items-center">@@ -1392,6 +1387,12 @@ export function ShareOptions(props: {return accessLevelText(value as AccessLevel);});+ const CurrentIcon = createMemo(() => {+ const value = currentValue();+ if (value === 'none') return IconX;+ return PERMISSION_ICONS[value as keyof typeof PERMISSION_ICONS];+ });+const [isOpen, setIsOpen] = createSignal(false);const handleChange = (value: string) => {@@ -1406,9 +1407,9 @@ export function ShareOptions(props: {return (<Dropdown open={isOpen()} onOpenChange={setIsOpen}><Dropdown.Trigger- variant="ghost"+ variant="base"disabled={props.disabled}- class={`min-w-16.75 py-1 pl-2 pr-1 rounded-xs flex items-center gap-1 ${props.noBorder ? 'border-0 sm:border' : ''}`}+ class={`min-w-16.75 py-1 pl-2 pr-1 rounded-md flex items-center gap-1 ${props.noBorder ? 'border-0 sm:border' : ''}`}on:keydown={(e: KeyboardEvent) => {if (e.key === 'Enter' || e.key === ' ') {e.stopPropagation();@@ -1417,10 +1418,11 @@ export function ShareOptions(props: {}}}>+ <Dynamic component={CurrentIcon()} class="size-4 shrink-0" />{currentValueText()}- <ChevronDownIcon class="size-4 text-ink-extra-muted/50" />+ <ChevronDownIcon class="size-4 text-ink-extra-muted" /></Dropdown.Trigger>- <Dropdown.Content>+ <Dropdown.Content portalScope="local"><Dropdown.RadioGroup value={currentValue()} onChange={handleChange}><Dropdown.Group><For each={options().filter((o) => o.value !== 'none')}>diff --git a/js/app/packages/ui/components/Dialog.tsx b/js/app/packages/ui/components/Dialog.tsxindex 6b19d4d209..9f44ede664 100644--- a/js/app/packages/ui/components/Dialog.tsx+++ b/js/app/packages/ui/components/Dialog.tsx@@ -26,7 +26,7 @@ export function Dialog(props: DialogProps) {<div class={cn('fixed inset-0 z-modal flex justify-center px-2', props.position === 'center' ? 'items-center' : 'items-start pt-[10vh]')}><KobalteDialog.Contentref={props.contentRef}- class={cn('w-200 max-w-[calc(100vw-16px)] overflow-hidden portal-scope', props.class)}+ class={cn('w-200 max-w-[calc(100vw-16px)] overflow-hidden portal-scope isolate', props.class)}onCloseAutoFocus={props.onCloseAutoFocus}onEscapeKeyDown={props.onEscapeKeyDown}onOpenAutoFocus={props.onOpenAutoFocus}diff --git a/js/app/packages/ui/components/Dropdown.tsx b/js/app/packages/ui/components/Dropdown.tsxindex 56ed693d1c..f62da2853d 100644--- a/js/app/packages/ui/components/Dropdown.tsx+++ b/js/app/packages/ui/components/Dropdown.tsx@@ -27,8 +27,11 @@ import { splitProps, type ComponentProps } from 'solid-js';// const DROPDOWN_CONTENT_CLASS = 'z-action-menu bg-surface rounded-xl ring-1 ring-edge shadow-[0_8px_24px_-16px_rgba(0,0,0,0.24),0_2px_8px_-6px_rgba(0,0,0,0.18)] p-1.5';// const DROPDOWN_ITEM_CLASS = 'rounded-md hover:bg-ink/3 focus:bg-ink/3 data-[highlighted]:bg-ink/3';-export type DropdownSubContentProps = ComponentProps<typeof KobalteDropdownMenu.SubContent> & { depth?: SurfaceProps['depth']; mount?: PortalMount; };-export type DropdownContentProps = ComponentProps<typeof KobalteDropdownMenu.Content> & { depth?: SurfaceProps['depth']; mount?: PortalMount; };+type PortalMount = ComponentProps<typeof KobalteDropdownMenu.Portal>['mount'];+type DropdownPortalScope = 'local';++export type DropdownSubContentProps = ComponentProps<typeof KobalteDropdownMenu.SubContent> & { depth?: SurfaceProps['depth']; mount?: PortalMount; portalScope?: DropdownPortalScope; };+export type DropdownContentProps = ComponentProps<typeof KobalteDropdownMenu.Content> & { depth?: SurfaceProps['depth']; mount?: PortalMount; portalScope?: DropdownPortalScope; };export type DropdownTriggerProps = ComponentProps<typeof KobalteDropdownMenu.Trigger> & ButtonProps;export type DropdownItemIndicatorProps = ComponentProps<typeof KobalteDropdownMenu.ItemIndicator>;export type DropdownCheckboxItemProps = ComponentProps<typeof KobalteDropdownMenu.CheckboxItem>;@@ -38,39 +41,59 @@ export type DropdownGroupLabelProps = ComponentProps<typeof KobalteDropdownMenu.export type DropdownGroupProps = ComponentProps<typeof KobalteDropdownMenu.Group>;export type DropdownItemProps = ComponentProps<typeof KobalteDropdownMenu.Item>;export type DropdownSubProps = ComponentProps<typeof KobalteDropdownMenu.Sub>;-type PortalMount = ComponentProps<typeof KobalteDropdownMenu.Portal>['mount'];const ROW_CLASS = 'rounded-lg w-full flex items-center gap-2.5 px-2 h-8 text-left text-xs cursor-default outline-none hover:bg-ink/5 data-highlighted:bg-ink/5 data-disabled:opacity-50 data-disabled:cursor-not-allowed';+function resolvePortalMount(+ searchRef: HTMLElement | undefined,+ mount: PortalMount,+ portalScope: DropdownPortalScope | undefined+): PortalMount {+ if (mount || portalScope !== 'local') return mount;+ return searchRef?.closest<HTMLElement>('.portal-scope') ?? undefined;+}+function DropdownContent(props: DropdownContentProps) {- const [local, rest] = splitProps(props, ['depth', 'class', 'mount', 'children']);+ let searchRef: HTMLDivElement | undefined;+ const [local, rest] = splitProps(props, ['depth', 'class', 'mount', 'portalScope', 'children']);return (- <KobalteDropdownMenu.Portal mount={local.mount}>- <KobalteDropdownMenu.Content- class={cn('rounded-xl size-auto z-action-menu', local.class)}- depth={local.depth ?? 2}- as={Surface}- {...rest}+ <>+ <div class="hidden" ref={searchRef} />+ <KobalteDropdownMenu.Portal+ mount={resolvePortalMount(searchRef, local.mount, local.portalScope)}>- <div class="flex flex-col gap-px bg-edge-muted size-full">{local.children}</div>- </KobalteDropdownMenu.Content>- </KobalteDropdownMenu.Portal>+ <KobalteDropdownMenu.Content+ class={cn('rounded-xl size-auto z-action-menu', local.class)}+ depth={local.depth ?? 2}+ as={Surface}+ {...rest}+ >+ <div class="flex flex-col gap-px bg-edge-muted size-full">{local.children}</div>+ </KobalteDropdownMenu.Content>+ </KobalteDropdownMenu.Portal>+ </>);}function DropdownSubContent(props: DropdownSubContentProps) {- const [local, rest] = splitProps(props, ['depth', 'class', 'mount', 'children']);+ let searchRef: HTMLDivElement | undefined;+ const [local, rest] = splitProps(props, ['depth', 'class', 'mount', 'portalScope', 'children']);return (- <KobalteDropdownMenu.Portal mount={local.mount}>- <KobalteDropdownMenu.SubContent- class={cn('rounded-xl size-auto z-action-menu', local.class)}- depth={local.depth ?? 2}- as={Surface}- {...rest}+ <>+ <div class="hidden" ref={searchRef} />+ <KobalteDropdownMenu.Portal+ mount={resolvePortalMount(searchRef, local.mount, local.portalScope)}>- <div class="flex flex-col gap-px bg-edge-muted size-full">{local.children}</div>- </KobalteDropdownMenu.SubContent>- </KobalteDropdownMenu.Portal>+ <KobalteDropdownMenu.SubContent+ class={cn('rounded-xl size-auto z-action-menu', local.class)}+ depth={local.depth ?? 2}+ as={Surface}+ {...rest}+ >+ <div class="flex flex-col gap-px bg-edge-muted size-full">{local.children}</div>+ </KobalteDropdownMenu.SubContent>+ </KobalteDropdownMenu.Portal>+ </>);}