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(core): fix text overflow and display name for sidepanel notifs + refs (#4248)
Seamusf665ecb530ad
diff --git a/js/app/packages/core/component/ItemPreview.tsx b/js/app/packages/core/component/ItemPreview.tsxindex ba9325efcf..95cc2129f6 100644--- a/js/app/packages/core/component/ItemPreview.tsx+++ b/js/app/packages/core/component/ItemPreview.tsx@@ -342,11 +342,11 @@ export function InlineItemPreview(props: ItemEntity) {{(loadedItem) => (<Switch><Match when={matches(loadedItem(), isAccessiblePreviewItem)}>- <span class="inline-flex items-baseline gap-1 align-baseline">+ <span class="inline-flex min-w-0 max-w-full items-baseline gap-1 align-baseline"><span class="relative top-[0.125em] inline-flex size-[1em] shrink-0"><ItemEntityIcon size="fill" /></span>- <span class="underline decoration-current/20 decoration-[max(1px,0.1em)] underline-offset-2">+ <span class="min-w-0 truncate underline decoration-current/20 decoration-[max(1px,0.1em)] underline-offset-2">{truncateString(name(), 80)}</span></span>diff --git a/js/app/packages/core/component/NotificationRenderer.tsx b/js/app/packages/core/component/NotificationRenderer.tsxindex 0682155596..45cfee5fd1 100644--- a/js/app/packages/core/component/NotificationRenderer.tsx+++ b/js/app/packages/core/component/NotificationRenderer.tsx@@ -20,7 +20,9 @@ export function NotificationRenderer(props: NotificationRendererProps) {const time = () => formatDate(props.notification.created_at);const actorId = () => props.notification.sender_id ?? '';const macroId = () => tryMacroId(actorId());- const [actorName] = useDisplayName(macroId());+ const [actorName] = useDisplayName(macroId(), {+ emailFallback: 'local-part',+ });const emailFallback = () => {const mid = macroId();return mid ? macroIdToEmail(mid) : actorId() || undefined;@@ -44,18 +46,22 @@ export function NotificationRenderer(props: NotificationRendererProps) {{(_metadata) => {if (props.mode === 'preview') {return (- <div class="truncate flex items-baseline gap-[0.2em] text-xs text-ink-muted font-medium font-sans">- <span class="font-medium text-ink">{displayName()}</span>- <span class="font-normal">{action()}</span>+ <div class="flex min-w-0 max-w-full items-baseline gap-[0.2em] overflow-hidden text-xs text-ink-muted font-medium font-sans">+ <span class="shrink-0 max-w-[8rem] truncate font-medium text-ink">+ {displayName()}+ </span>+ <span class="shrink-0 font-normal">{action()}</span><Show when={showTarget() && isChannel() && entityId()}>- <div class="self-center max-h-lh">+ <div class="min-w-0 flex-1 self-center max-h-lh overflow-hidden"><InlineItemPreview id={entityId()} type="channel" /></div></Show><Show when={showTarget() && targetName() && !isChannel()}>- <span class="font-medium text-ink">{targetName()}</span>+ <span class="min-w-0 flex-1 truncate font-medium text-ink">+ {targetName()}+ </span></Show>- <span class="text-ink-extra-muted ml-2 font-mono uppercase font-normal">+ <span class="shrink-0 ml-auto text-ink-extra-muted font-mono uppercase font-normal">{time()}</span></div>@@ -64,13 +70,20 @@ export function NotificationRenderer(props: NotificationRendererProps) {return (<>- <div class="text-sm text-ink inline-flex items-center gap-1">- <span class="font-medium">{displayName()}</span> {action()}{' '}+ <div class="text-sm text-ink inline-flex min-w-0 max-w-full items-center gap-1 overflow-hidden">+ <span class="shrink-0 max-w-[10rem] truncate font-medium">+ {displayName()}+ </span>+ <span class="shrink-0">{action()}</span><Show when={showTarget() && isChannel() && entityId()}>- <InlineItemPreview id={entityId()} type="channel" />+ <span class="min-w-0 flex-1 overflow-hidden">+ <InlineItemPreview id={entityId()} type="channel" />+ </span></Show><Show when={showTarget() && targetName() && !isChannel()}>- <span class="font-medium">{targetName()}</span>+ <span class="min-w-0 flex-1 truncate font-medium">+ {targetName()}+ </span></Show></div>diff --git a/js/app/packages/core/component/References.tsx b/js/app/packages/core/component/References.tsxindex fa4bf0c61f..3ee10bf8e1 100644--- a/js/app/packages/core/component/References.tsx+++ b/js/app/packages/core/component/References.tsx@@ -98,14 +98,14 @@ function ReferenceRow(props: ReferenceRowProps) {><div class="flex items-center gap-2 min-w-0 text-xs leading-5"><Show when={props.senderAvatar}>{props.senderAvatar}</Show>- <div class="min-w-0 flex items-center gap-1.5 overflow-hidden">+ <div class="min-w-0 flex flex-1 items-center gap-1.5 overflow-hidden"><Show when={props.senderName}><span class="ph-no-capture shrink-0 font-medium text-ink truncate max-w-[8rem]">{props.senderName}</span><span class="shrink-0 text-ink-muted/70">in</span></Show>- <div class="min-w-0 flex items-center overflow-hidden text-ink-muted">+ <div class="min-w-0 flex flex-1 items-center overflow-hidden text-ink-muted">{props.source}</div></div>@@ -135,7 +135,8 @@ function ChannelReferenceRow(props: {onOpen: (e: KeyboardEvent | MouseEvent) => void;}) {const { firstName, fullName } = useDisplayNameParts(- tryMacroId(props.reference.sender_id)+ tryMacroId(props.reference.sender_id),+ { emailFallback: 'local-part' });const senderName = () => firstName() || fullName();const hasContent = () => {@@ -178,7 +179,9 @@ function GenericReferenceRow(props: {onOpen: (item: PreviewItem, e?: KeyboardEvent | MouseEvent) => void;}) {const userId = props.reference.user_id!;- const { firstName, fullName } = useDisplayNameParts(tryMacroId(userId));+ const { firstName, fullName } = useDisplayNameParts(tryMacroId(userId), {+ emailFallback: 'local-part',+ });const senderName = () => firstName() || fullName();const [item] = useItemPreview(() => ({id: props.reference.source_entity_id,diff --git a/js/app/packages/entity/src/extractors-notification/notification-description.tsx b/js/app/packages/entity/src/extractors-notification/notification-description.tsxindex 2f60863789..e33f8bb9db 100644--- a/js/app/packages/entity/src/extractors-notification/notification-description.tsx+++ b/js/app/packages/entity/src/extractors-notification/notification-description.tsx@@ -67,7 +67,9 @@ export function NotificationDescription(props: NotificationDescriptionProps) {const hasMultipleSenders = () => additionalSenderCount() > 0;const primarySenderNameParts = () =>- useDisplayNameParts(tryMacroId(primarySenderId() ?? ''));+ useDisplayNameParts(tryMacroId(primarySenderId() ?? ''), {+ emailFallback: 'local-part',+ });const primarySenderFirstName = () => {const firstName = primarySenderNameParts().firstName();@@ -75,7 +77,9 @@ export function NotificationDescription(props: NotificationDescriptionProps) {};const secondarySenderNameParts = () =>- useDisplayNameParts(tryMacroId(senderIds()[1] ?? ''));+ useDisplayNameParts(tryMacroId(senderIds()[1] ?? ''), {+ emailFallback: 'local-part',+ });const secondarySenderFirstName = () => {const firstName = secondarySenderNameParts().firstName();diff --git a/js/app/packages/entity/src/extractors-notification/notification-row.tsx b/js/app/packages/entity/src/extractors-notification/notification-row.tsxindex adfa19eb15..f2bbe9204d 100644--- a/js/app/packages/entity/src/extractors-notification/notification-row.tsx+++ b/js/app/packages/entity/src/extractors-notification/notification-row.tsx@@ -172,7 +172,7 @@ function HeaderLeading(props: {<NotificationSenderIcon notification={props.notification} size="sm" /><spanclass={cn(- 'ph-no-capture truncate min-w-0 text-xs text-ink',+ 'ph-no-capture min-w-0 shrink truncate text-xs text-ink',props.unread && 'font-medium')}>@@ -235,7 +235,7 @@ function CompactBody(props: BodyProps) {("Gabriel mentioned you") + timestamp already tell the story. Hidebelow the container's md breakpoint.*/}- <span class="hidden @md/notif-row:flex flex-1 min-w-0 ph-no-capture truncate text-xs text-ink-muted/60">+ <span class="hidden @md/notif-row:flex flex-1 min-w-0 overflow-hidden ph-no-capture truncate text-xs text-ink-muted/60">{props.contentOverride ?? (<NotificationRowContentnotification={props.notification}@@ -260,12 +260,12 @@ function ExpandedBody(props: BodyProps) {props.class)}>- <div class="flex items-center gap-2.5 min-w-0">+ <div class="flex items-center gap-2.5 min-w-0 overflow-hidden"><HeaderLeadingnotification={props.notification}unread={props.unread}/>- <span class="flex-1" />+ <span class="min-w-0 flex-1" /><HeaderTrailingnotification={props.notification}canMarkDone={props.canMarkDone}diff --git a/js/app/packages/entity/src/extractors-notification/notification-stacks.tsx b/js/app/packages/entity/src/extractors-notification/notification-stacks.tsxindex 128f4e194a..1bf75444c1 100644--- a/js/app/packages/entity/src/extractors-notification/notification-stacks.tsx+++ b/js/app/packages/entity/src/extractors-notification/notification-stacks.tsx@@ -135,18 +135,21 @@ export function NotificationStackRow(props: {<NotificationSenderIcon stack={props.stack} size="sm" /></div><span- class={cn('ph-no-capture truncate min-w-0 text-xs text-ink', {- 'font-medium': unread(),- })}+ class={cn(+ 'ph-no-capture min-w-0 shrink truncate text-xs text-ink',+ {+ 'font-medium': unread(),+ }+ )}><NotificationDescription stack={props.stack} /></span>- <span class="ph-no-capture truncate min-w-0 text-xs text-ink-muted/60 flex-1">+ <span class="ph-no-capture min-w-0 flex-1 overflow-hidden truncate text-xs text-ink-muted/60">{props.content ?? (<NotificationContent stack={props.stack} singleLine />)}</span>- <div class="shrink-0 ml-auto">+ <div class="shrink-0 ml-auto h-5 flex items-center justify-end"><spanclass={cn('text-ink-extra-muted text-xs tabular-nums', {'group-hover/notif:hidden': canMarkDone(),