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
style(ui): settings popover, user menu items, command menu (#4420)
Seamusb21d114baf7e
diff --git a/js/app/packages/app/component/app-sidebar/sidebar-create-menu.tsx b/js/app/packages/app/component/app-sidebar/sidebar-create-menu.tsxindex 098101774e..b09bbd10cf 100644--- a/js/app/packages/app/component/app-sidebar/sidebar-create-menu.tsx+++ b/js/app/packages/app/component/app-sidebar/sidebar-create-menu.tsx@@ -79,7 +79,7 @@ export const SidebarCreateMenu = (props: { isSlim: () => boolean }) => {><Dropdown.Triggeras={NavRow}- class="center h-8 bg-ink/2 ring ring-edge-muted/40"+ class="center h-8 bg-ink/4"fullWidthtooltipPlacement="right"tooltipDisabled={!props.isSlim()}diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsxindex b452c448de..3828264a31 100644--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx@@ -10,7 +10,7 @@ import {SidebarPromoCard,SidebarPromoHint,} from '@app/component/app-sidebar/sidebar-promo';-import { InteractiveOnboardingModal } from '@app/component/interactive-onboarding/InteractiveOnboardingModal';+import { CommandState } from '@app/component/command';import { buildDocumentTypeQuery } from '@app/component/next-soup/filters/configs/document-type-query';import { getDocumentsFilterSplit } from '@app/component/next-soup/soup-view/documents-filter-controllers';import {@@ -50,9 +50,8 @@ import {import {getSettingsTabItem,useSettingsTabAvailable,- useSettingsTabs,} from '@core/constant/settingsTabsConfig';-import { useUserId } from '@core/context/user';+import { useAuthor, useEmail, useUserId } from '@core/context/user';import { registerHotkey } from '@core/hotkey/hotkeys';import { clearPressedKeys } from '@core/hotkey/state';import { type HotkeyToken, TOKENS } from '@core/hotkey/tokens';@@ -72,8 +71,8 @@ import { AnimatedTaskIcon } from '@icon/wide-task';import { ContextMenu } from '@kobalte/core/context-menu';import CaretDownIcon from '@phosphor/caret-down.svg';import CaretUpIcon from '@phosphor/caret-up.svg';+import GearIcon from '@phosphor/gear.svg';import HomeIcon from '@phosphor/house.svg';-import PlayIcon from '@phosphor/play.svg';import SignOutIcon from '@phosphor/sign-out.svg';import { useEmailLinksQuery } from '@queries/email/link';import { debounce } from '@solid-primitives/scheduled';@@ -563,8 +562,8 @@ type SidebarSettingsWidgetProps = {const SidebarSettingsWidget = (props: SidebarSettingsWidgetProps) => {const userId = useUserId();- const [onboardingModalOpen, setOnboardingModalOpen] = createSignal(false);- const { groups: settingGroups } = useSettingsTabs();+ const author = useAuthor();+ const email = useEmail();const logout = useLogout();return (@@ -604,56 +603,71 @@ const SidebarSettingsWidget = (props: SidebarSettingsWidgetProps) => {</span><CaretUpIcon class="size-3 text-ink-extra-muted shrink-0 group-data-[slim=true]/sidebar:hidden" /></Dropdown.Trigger>- <Dropdown.Content>- <Dropdown.Group>+ <Dropdown.Content class="min-w-64">+ <Dropdown.Group class="p-1.5 gap-0">+ <div class="flex items-center gap-3 px-1 py-1">+ <Show+ when={userId()}+ fallback={<div class="size-10 shrink-0 rounded-full bg-ink/10" />}+ >+ {(id) => (+ <div class="size-10 shrink-0">+ <UserIcon+ id={id()}+ size="fill"+ suppressClick+ showTooltip={false}+ />+ </div>+ )}+ </Show>+ <div class="min-w-0">+ <div class="truncate text-sm font-semibold text-ink">+ {author()}+ </div>+ <div class="truncate text-sm text-ink-muted">{email()}</div>+ </div>+ </div>+ <div class="-mx-1.5 mt-2 mb-1.5 h-px bg-edge-muted" /><Dropdown.Itemclass="flex items-center gap-2 px-2.5 py-2 text-sm cursor-default outline-none text-ink-muted"- onSelect={() => setOnboardingModalOpen(true)}+ onSelect={() => CommandState.open()}>- <span class="size-5 flex items-center justify-center">- <PlayIcon class="size-4 shrink-0 text-ink-extra-muted" />+ <span class="size-5 flex items-center justify-center text-ink-extra-muted">+ ⌘</span>- <span class="text-ink">Play tutorial</span>+ <span class="flex-1 text-ink">Command menu</span>+ <Hotkey+ token={TOKENS.global.commandMenu}+ theme="subtle"+ class="ml-6"+ /></Dropdown.Item>- </Dropdown.Group>- <For each={settingGroups()}>- {(group) => (- <Dropdown.Group>- <For each={group.items}>- {(item) => (- <Dropdown.Item- class="flex items-center gap-2 px-2.5 py-2 text-sm cursor-default outline-none text-ink-muted"- onSelect={() => props.onSelect(item.tab)}- >- <span class="size-5 flex items-center justify-center">- <Dynamic- component={item.icon}- class="size-4 shrink-0 text-ink-extra-muted"- />- </span>- <span class="text-ink">{item.label}</span>- </Dropdown.Item>- )}- </For>- </Dropdown.Group>- )}- </For>- <Dropdown.Group><Dropdown.Itemclass="flex items-center gap-2 px-2.5 py-2 text-sm cursor-default outline-none text-ink-muted"+ onSelect={() => props.onSelect('Account')}+ >+ <span class="size-5 flex items-center justify-center">+ <GearIcon class="size-4 shrink-0 text-ink-extra-muted" />+ </span>+ <span class="flex-1 text-ink">Settings</span>+ <Hotkey+ token={TOKENS.global.toggleSettings}+ theme="subtle"+ class="ml-6"+ />+ </Dropdown.Item>+ <Dropdown.Item+ class="flex items-center gap-2 px-2.5 py-2 text-sm cursor-default outline-none text-red-500"onSelect={() => logout()}><span class="size-5 flex items-center justify-center">- <SignOutIcon class="size-4 shrink-0 text-ink-extra-muted" />+ <SignOutIcon class="size-4 shrink-0" /></span>- <span class="text-ink">Log out</span>+ <span>Log out</span></Dropdown.Item></Dropdown.Group></Dropdown.Content>- <InteractiveOnboardingModal- open={onboardingModalOpen()}- onOpenChange={setOnboardingModalOpen}- /></Dropdown>);};diff --git a/js/app/packages/app/component/command/CommandItem.tsx b/js/app/packages/app/component/command/CommandItem.tsxindex fca94cac26..a4e7c46774 100644--- a/js/app/packages/app/component/command/CommandItem.tsx+++ b/js/app/packages/app/component/command/CommandItem.tsx@@ -1,4 +1,5 @@import { useFeatureFlag } from '@app/lib/analytics/posthog';+import { UserIcon } from '@core/component/UserIcon';import { hasValidHotkey } from '@core/hotkey/utils';import { Entity, type EntityData } from '@entity';import SearchIcon from '@icon/macro-magnifying-glass.svg';@@ -20,7 +21,9 @@ import {isCommandItem,isEntityItem,isSearchItem,+ isUserItem,type SearchItem,+ type UserItem,} from './useCommandItems';interface CommandItemProps {@@ -148,6 +151,26 @@ function EntityDisplay(props: { entity: EntityData }) {);}+function UserDisplay(props: { item: UserItem }) {+ const name = () => props.item.data.name;+ const email = () => props.item.data.email;+ const showEmail = () => Boolean(name()) && name() !== email();++ return (+ <div class="flex items-center gap-2 flex-1 min-w-0">+ <div class="size-5 flex items-center justify-center shrink-0">+ <UserIcon id={props.item.id} size="sm" isDeleted={false} />+ </div>+ <span class="truncate">+ <Show when={showEmail()} fallback={email()}>+ {name()}+ <span class="ml-[0.5em] opacity-50">{email()}</span>+ </Show>+ </span>+ </div>+ );+}+function SearchDisplay(props: { item: SearchItem }) {return (<div class="flex items-center gap-2 flex-1 min-w-0">@@ -189,6 +212,9 @@ function ItemDisplay(props: { item: CommandMenuItem }) {<Match when={isEntityItem(props.item) && props.item}>{(item) => <EntityDisplay entity={item().data} />}</Match>+ <Match when={isUserItem(props.item) && props.item}>+ {(item) => <UserDisplay item={item()} />}+ </Match></Switch>);}diff --git a/js/app/packages/app/component/command/CommandMenu.tsx b/js/app/packages/app/component/command/CommandMenu.tsxindex ff1971ea03..16eb23a51e 100644--- a/js/app/packages/app/component/command/CommandMenu.tsx+++ b/js/app/packages/app/component/command/CommandMenu.tsx@@ -571,7 +571,7 @@ export function CommandMenuInner(props: {<Show when={isEntityActionMode() || !isInCommandScope()}><Panel.Toolbarclass={cn(- 'bg-surface px-1.5 border-0',+ 'bg-surface pl-2.5 pr-1.5 pt-2 border-0',isEntityActionMode() && 'gap-1.5')}>diff --git a/js/app/packages/app/component/command/useCommandItems.ts b/js/app/packages/app/component/command/useCommandItems.tsindex 4b0c96bb28..a5a47d172e 100644--- a/js/app/packages/app/component/command/useCommandItems.ts+++ b/js/app/packages/app/component/command/useCommandItems.ts@@ -71,7 +71,7 @@ function isEntityItem(item: CommandMenuItem): item is EntityItem {return item.kind === 'entity';}-function _isUserItem(item: CommandMenuItem): item is UserItem {+function isUserItem(item: CommandMenuItem): item is UserItem {return item.kind === 'user';}@@ -431,5 +431,5 @@ export function useCommandItems(return filteredItems;}-export type { AskAiItem, CommandMenuItem, SearchItem };-export { isAskAiItem, isCommandItem, isEntityItem, isSearchItem };+export type { AskAiItem, CommandMenuItem, SearchItem, UserItem };+export { isAskAiItem, isCommandItem, isEntityItem, isSearchItem, isUserItem };diff --git a/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/components/MentionsMenuItem.tsx b/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/components/MentionsMenuItem.tsxindex 88de9c9eb3..cb791d057f 100644--- a/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/components/MentionsMenuItem.tsx+++ b/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/components/MentionsMenuItem.tsx@@ -33,6 +33,15 @@ export function MentionsMenuItem(props: {const name = () => getMentionItemName(props.item);+ // For user items we render the email at reduced opacity (no pipe separator)+ // instead of baking it into the display string.+ const userParts = () => {+ if (props.item.kind !== 'user') return undefined;+ const { name, email } = props.item.data;+ if (!name || name === email) return { name: email, email: undefined };+ return { name, email };+ };+const icon = () => {switch (props.item.kind) {case 'user':@@ -93,7 +102,16 @@ export function MentionsMenuItem(props: {class="ph-no-capture min-w-0 max-w-full overflow-hidden text-nowrap text-ink text-xs sm:text-sm font-medium"style={{ 'text-overflow': 'ellipsis' }}>- {name()}+ <Show when={userParts()} fallback={name()}>+ {(parts) => (+ <>+ {parts().name}+ <Show when={parts().email}>+ <span class="ml-[0.5em] opacity-50">{parts().email}</span>+ </Show>+ </>+ )}+ </Show></span><Show when={isBotMentionItem(props.item)}><span class="inline-flex shrink-0 items-center rounded-sm bg-hover px-1.5 py-0.5 text-[10px] font-medium leading-none text-ink-muted">diff --git a/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/utils/entityUtils.ts b/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/utils/entityUtils.tsindex afc1be222f..0b0802c46d 100644--- a/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/utils/entityUtils.ts+++ b/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/utils/entityUtils.ts@@ -37,7 +37,7 @@ export function getMentionItemName(item: MentionItem): string {case 'user': {const { email, name } = item.data;if (name === email) return email;- return `${name} | ${email}`;+ return `${name} ${email}`;}case 'group':return `@${item.data.groupAlias}`;diff --git a/js/app/packages/core/component/RecipientSelector.tsx b/js/app/packages/core/component/RecipientSelector.tsxindex 408a435b9c..c39a646ac4 100644--- a/js/app/packages/core/component/RecipientSelector.tsx+++ b/js/app/packages/core/component/RecipientSelector.tsx@@ -202,8 +202,9 @@ function RecipientComboboxItem(props: RecipientComboboxItemProps): JSX.Element {const name = getRecipientOptionName(option);const email = getRecipientOptionEmail(option);- const contactInfo =- name && name !== email ? `${name} | ${email}` : email;+ // Render the email at reduced opacity (no pipe separator) when a+ // display name is present; otherwise show the email on its own.+ const showEmail = Boolean(name) && name !== email && Boolean(email);// Use appropriate id for UserIcon based on typeconst iconId = props.disabled ? '?' : option.id;@@ -217,7 +218,10 @@ function RecipientComboboxItem(props: RecipientComboboxItemProps): JSX.Element {props.disabled && 'italic')}>- {contactInfo}+ <Show when={showEmail} fallback={name || email}>+ {name}+ <span class="ml-[0.5em] opacity-50">{email}</span>+ </Show></p></Combobox.ItemLabel>);