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
feat(tasks): add assign task btn to user card, cleanup styles on user card (#2581)
Seamus15977ae850ea
diff --git a/js/app/packages/app/component/split-layout/componentRegistry.tsx b/js/app/packages/app/component/split-layout/componentRegistry.tsxindex a5a4426fd0..1079b2d0b1 100644--- a/js/app/packages/app/component/split-layout/componentRegistry.tsx+++ b/js/app/packages/app/component/split-layout/componentRegistry.tsx@@ -271,6 +271,7 @@ registerComponent('task-compose', (params) => {<ComposeTaskinitialContent={params?.initialContent}initialTitle={params?.initialTitle}+ initialAssigneeId={params?.initialAssigneeId}/>);});diff --git a/js/app/packages/block-email/component/EmailUserTooltip.tsx b/js/app/packages/block-email/component/EmailUserTooltip.tsxindex 122891a95c..f369a34d20 100644--- a/js/app/packages/block-email/component/EmailUserTooltip.tsx+++ b/js/app/packages/block-email/component/EmailUserTooltip.tsx@@ -20,7 +20,7 @@ export function EmailUserTooltip(props: EmailUserTooltipProps) {placement="bottom"unstyledspanMode- tooltip={+ tooltip={(close) => (<UserTooltipdisplayName={props.recipient?.name ?? props.recipient?.email ?? ''}email={props.recipient?.email ?? undefined}@@ -29,8 +29,9 @@ export function EmailUserTooltip(props: EmailUserTooltipProps) {? emailToMacroId(props.recipient.email): undefined}+ onClose={close}/>- }+ )}>{props.children}</Tooltip>diff --git a/js/app/packages/block-md/component/ComposeTask.tsx b/js/app/packages/block-md/component/ComposeTask.tsxindex d855a49172..150ca6e065 100644--- a/js/app/packages/block-md/component/ComposeTask.tsx+++ b/js/app/packages/block-md/component/ComposeTask.tsx@@ -160,6 +160,7 @@ export interface ComposeTaskProps {initialTitle?: string;initialContent?: string;placeholder?: string;+ initialAssigneeId?: string;}export function ComposeTask(props: ComposeTaskProps) {@@ -168,7 +169,7 @@ export function ComposeTask(props: ComposeTaskProps) {const currentUserId = useUserId();const getDefaultPropertyValues = (): Record<string, PropertyApiValues> => {- const id = currentUserId();+ const id = props.initialAssigneeId ?? currentUserId();return {[SYSTEM_PROPERTY_IDS.ASSIGNEES]: {valueType: 'ENTITY' as const,@@ -183,7 +184,11 @@ export function ComposeTask(props: ComposeTaskProps) {// draft init logicconst initializeFromDraft = () => {- if (!props.initialTitle && !props.initialContent) {+ if (+ !props.initialTitle &&+ !props.initialContent &&+ !props.initialAssigneeId+ ) {const draft = loadTaskComposerDraft();if (draft) {return {diff --git a/js/app/packages/core/component/RecipientSelector.tsx b/js/app/packages/core/component/RecipientSelector.tsxindex 9640b066ee..429d340773 100644--- a/js/app/packages/core/component/RecipientSelector.tsx+++ b/js/app/packages/core/component/RecipientSelector.tsx@@ -518,14 +518,15 @@ export function RecipientSelector<K extends CombinedRecipientKind>(<Tooltipplacement="bottom"unstyled- tooltip={+ tooltip={(close) => (<UserTooltipdisplayName={name || ''}email={email}id={opt.id}isDeleted={false}+ onClose={close}/>- }+ )}><RecipientChipicon={@@ -577,13 +578,14 @@ export function RecipientSelector<K extends CombinedRecipientKind>(<Tooltipplacement="bottom"unstyled- tooltip={+ tooltip={(close) => (<UserTooltipdisplayName={email}email={email}isDeleted={false}+ onClose={close}/>- }+ )}><RecipientChipicon={diff --git a/js/app/packages/core/component/Tooltip.tsx b/js/app/packages/core/component/Tooltip.tsxindex 6267b01eba..da7c75c1a0 100644--- a/js/app/packages/core/component/Tooltip.tsx+++ b/js/app/packages/core/component/Tooltip.tsx@@ -2,13 +2,20 @@ import type { HotkeyToken } from '@core/hotkey/tokens';import CorvuTooltip, { type FloatingOptions } from '@corvu/tooltip';import type { Placement } from '@floating-ui/dom';import { cn } from '@ui/utils/classname';-import { For, type JSX, mergeProps, type ParentProps, Show } from 'solid-js';+import {+ For,+ type JSX,+ mergeProps,+ type ParentProps,+ Show,+ createSignal,+} from 'solid-js';import { Hotkey } from './Hotkey';const TOOLTIP_DELAY = 250;export type TooltipProps = ParentProps<{- tooltip: JSX.Element;+ tooltip?: JSX.Element | ((close: () => void) => JSX.Element);placement?: Placement;floatingOptions?: FloatingOptions;ref?: (el: HTMLDivElement | HTMLSpanElement) => void;@@ -56,8 +63,20 @@ export function Tooltip(props: TooltipProps) {return 0;};+ const [open, setOpen] = createSignal(false);+ const close = () => setOpen(false);++ const tooltipContent = () => {+ if (typeof props.tooltip === 'function') {+ return props.tooltip(close);+ }+ return props.tooltip;+ };+return (<CorvuTooltip+ open={open()}+ onOpenChange={setOpen}placement={props.placement}floatingOptions={props.floatingOptions}group={'tooltip-single-group'} // hardcoding implies we only allow one tooltip to be open at a time throughout app@@ -81,9 +100,9 @@ export function Tooltip(props: TooltipProps) {'max-width': `calc(100vw - ${2 * padding()}px)`,}}>- <Show when={!props.unstyled} fallback={props.tooltip}>- <div class="flex items-center justify-center bg-panel p-1.5 text-ink-muted text-xs wrap-break-word rounded-sm border border-edge-muted shadow-md shadow-[#000]/5">- {props.tooltip}+ <Show when={!props.unstyled} fallback={tooltipContent()}>+ <div class="flex items-center justify-center bg-panel p-1.5 text-ink-muted text-xs wrap-break-word rounded-sm border border-edge-muted shadow-md shadow-[#000]/05">+ {tooltipContent()}</div></Show>{/* Note disabling arrows for now. I think its more on-brand - seamus */}diff --git a/js/app/packages/core/component/UserIcon.tsx b/js/app/packages/core/component/UserIcon.tsxindex f46dec7926..5503cf9ef6 100644--- a/js/app/packages/core/component/UserIcon.tsx+++ b/js/app/packages/core/component/UserIcon.tsx@@ -143,14 +143,15 @@ export function UserIcon(props: UserIconProps) {placement="left"class={sizeClasses().container}unstyled- tooltip={+ tooltip={(close) => (<UserTooltipdisplayName={displayName()() || ''}email={email()}id={props.id}isDeleted={props.isDeleted}+ onClose={close}/>- }+ )}>{icon()}</Tooltip>diff --git a/js/app/packages/core/component/UserTooltip.tsx b/js/app/packages/core/component/UserTooltip.tsxindex 7809d5a39c..c8bee60c9c 100644--- a/js/app/packages/core/component/UserTooltip.tsx+++ b/js/app/packages/core/component/UserTooltip.tsx@@ -6,6 +6,7 @@ import { isOk } from '@core/util/maybeResult';import IconCheck from '@icon/regular/check.svg';import WideCopy from '@macro-icons/wide/copy.svg';import WideChat from '@macro-icons/wide/chat.svg';+import WideTask from '@macro-icons/wide/task.svg';import Trash from '@phosphor-icons/core/regular/trash.svg?component-solid';import { commsServiceClient } from '@service-comms/client';import { useUserId } from '@core/context/user';@@ -19,6 +20,7 @@ export type UserTooltipProps = {email?: string;id?: string;isDeleted?: boolean;+ onClose?: () => void;};export function UserTooltip(props: UserTooltipProps) {@@ -33,13 +35,15 @@ export function UserTooltip(props: UserTooltipProps) {navigator.clipboard.writeText(email);toast.success('Email copied');resetCopied();+ props.onClose?.();}const currentUserId = useUserId();- const { openWithSplit } = useSplitLayout();+ const { openWithSplit, popoverSplit } = useSplitLayout();const openDM = async (e: PointerEvent | MouseEvent) => {e.preventDefault();e.stopPropagation();+ props.onClose?.();if (props.id) {try {const result = await commsServiceClient.getOrCreateDirectMessage({@@ -60,14 +64,25 @@ export function UserTooltip(props: UserTooltipProps) {}};- // TODO (seamus): add assign task button once launch popovet split with state is possible+ const openTaskComposer = (e: MouseEvent) => {+ e.preventDefault();+ e.stopPropagation();+ props.onClose?.();+ if (props.id) {+ popoverSplit({+ type: 'component',+ id: 'task-compose',+ params: { initialAssigneeId: props.id },+ });+ }+ };const buttonStyle =- 'px-3 text-xs w-full justify-start hover-transition-bg hover:bg-hover';+ 'px-3 text-xs w-full justify-start hover:bg-hover/20 rounded-xs';return (<ClippedPanel tl={!beveledCorners()} active>- <div class="bg-panel text-ink box-border border-accent overflow-hidden">+ <div class="bg-panel text-ink box-border border-accent overflow-hidden max-w-lg"><div class="flex items-center gap-2 p-2"><div class="size-10 shrink-0 rounded-full bg-ink-extra-muted pointer-events-none"><Switch>@@ -110,7 +125,7 @@ export function UserTooltip(props: UserTooltipProps) {<Show when={props.email || props.id}><div class="border-t border-edge/20"></div>- <div class="py-2 flex flex-col gap-0">+ <div class="p-2 flex flex-col gap-0"><Show when={props.email}><Button onClick={handleCopyEmail} class={buttonStyle}>{copied() ? (@@ -131,6 +146,12 @@ export function UserTooltip(props: UserTooltipProps) {DM</Button></Show>+ <Show when={props.id && !props.isDeleted}>+ <Button onClick={openTaskComposer} class={buttonStyle}>+ <WideTask class="w-3.5 h-3.5" />+ Assign task+ </Button>+ </Show></div></Show></div>diff --git a/js/app/packages/entity/src/extractors/entity-email-participants.tsx b/js/app/packages/entity/src/extractors/entity-email-participants.tsxindex d4c97aee49..cec1a985b8 100644--- a/js/app/packages/entity/src/extractors/entity-email-participants.tsx+++ b/js/app/packages/entity/src/extractors/entity-email-participants.tsx@@ -61,13 +61,14 @@ function ParticipantWithTooltip(props: {<TooltipunstyledspanMode- tooltip={+ tooltip={(close) => (<UserTooltipdisplayName={tooltipName()}email={props.participant.email}id={macroId()}+ onClose={close}/>- }+ )}><Showwhen={props.highlighted}