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(user-card): fix dm btn, style user card and document preview popovers (#3701)
Seamusd7039d3e8440
diff --git a/js/app/packages/core/component/DocumentPreview.tsx b/js/app/packages/core/component/DocumentPreview.tsxindex 2eae999cea..5b55f2f163 100644--- a/js/app/packages/core/component/DocumentPreview.tsx+++ b/js/app/packages/core/component/DocumentPreview.tsx@@ -757,7 +757,7 @@ export function PopupPreview(props: {onMouseEnter={props.mouseEnter}onMouseLeave={props.mouseLeave}>- <Surface active depth={3}>+ <Surface active depth={3} class="rounded-xl shadow-lg shadow-drop-shadow"><Switch>{/* Loading state */}<Match when={item().loading}>diff --git a/js/app/packages/core/component/UserTooltip.tsx b/js/app/packages/core/component/UserTooltip.tsxindex b39a7efaed..7d88896669 100644--- a/js/app/packages/core/component/UserTooltip.tsx+++ b/js/app/packages/core/component/UserTooltip.tsx@@ -7,8 +7,8 @@ import WideTask from '@icon/wide-task.svg';import IconCheck from '@phosphor/check.svg';import { useGetOrCreateDirectMessageMutation } from '@queries/channel/get-or-create-dm';import { debounce } from '@solid-primitives/scheduled';-import { Button, Surface } from '@ui';-import { createSignal, Show } from 'solid-js';+import { cn, Surface } from '@ui';+import { createSignal, type JSX, Show } from 'solid-js';import { UserIcon } from './UserIcon';type UserTooltipProps = {@@ -39,23 +39,21 @@ export function UserTooltip(props: UserTooltipProps) {onError: () => toast.failure('Failed to open direct message'),});- const openDM = (e: PointerEvent | MouseEvent) => {+ const openDM = async (e: MouseEvent) => {e.preventDefault();e.stopPropagation();- props.onClose?.();if (!props.id) return;const preferNewSplit = e.shiftKey;- getOrCreateDmMutation.mutate(- { recipient_id: props.id },- {- onSuccess: ({ channel_id }) => {- openWithSplit(- { type: 'channel', id: channel_id },- { preferNewSplit }- );- },- }- );+ try {+ const { channel_id } = await getOrCreateDmMutation.mutateAsync({+ recipient_id: props.id,+ });+ openWithSplit({ type: 'channel', id: channel_id }, { preferNewSplit });+ } catch {+ // The mutation's onError callback handles the toast.+ } finally {+ props.onClose?.();+ }};const openTaskComposer = (e: MouseEvent) => {@@ -71,9 +69,6 @@ export function UserTooltip(props: UserTooltipProps) {}};- const buttonStyle =- 'px-3 text-xs w-full justify-start hover:bg-hover rounded-xs';-// Determine avatar props based on what we haveconst avatarProps = () => {if (props.id) {@@ -87,7 +82,7 @@ export function UserTooltip(props: UserTooltipProps) {};return (- <Surface depth={2} active>+ <Surface active depth={2} class="rounded-xl shadow-lg shadow-drop-shadow"><div class="text-ink max-w-lg"><div class="flex items-center gap-2 p-2"><UserIcon@@ -109,32 +104,32 @@ export function UserTooltip(props: UserTooltipProps) {<Show when={props.email || props.id}><div class="border-t border-edge"></div>- <div class="p-2 flex flex-col gap-0">+ <div class="p-1.5 flex flex-col gap-0.5"><Show when={props.email}>- <Button onClick={handleCopyEmail} class={buttonStyle}>+ <ActionItem onClick={handleCopyEmail}>{copied() ? (<IconCheck class="size-3.5" />) : (<WideCopy class="size-3.5" />)}Copy email- </Button>+ </ActionItem></Show><Showwhen={props.id && !props.isDeleted && props.id !== currentUserId()}>- <Button onClick={openDM} class={buttonStyle}>+ <ActionItem onClick={openDM}><WideChat class="size-3.5" />DM- </Button>+ </ActionItem></Show><Show when={props.id && !props.isDeleted}>- <Button onClick={openTaskComposer} class={buttonStyle}>+ <ActionItem onClick={openTaskComposer}><WideTask class="size-3.5" />Assign task- </Button>+ </ActionItem></Show></div></Show>@@ -142,3 +137,22 @@ export function UserTooltip(props: UserTooltipProps) {</Surface>);}++function ActionItem(props: {+ children: JSX.Element;+ onClick: JSX.EventHandler<HTMLButtonElement, MouseEvent>;+ class?: string;+}) {+ return (+ <button+ type="button"+ class={cn(+ 'group rounded-lg w-full flex items-center gap-2 px-2 h-8 text-left font-medium text-xs cursor-default outline-none hover:bg-ink/5 focus:bg-ink/5 data-highlighted:bg-ink/5 data-disabled:opacity-50 data-disabled:cursor-not-allowed',+ props.class+ )}+ onClick={props.onClick}+ >+ {props.children}+ </button>+ );+}