Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(email): show "Connect another email" when one inbox is linked (#4492)

Jacob Beckerman3a64e2ca9641
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/inbox-selector.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/inbox-selector.tsx
index 806ff5d623..4730434e16 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/inbox-selector.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/inbox-selector.tsx
@@ -16,9 +16,11 @@ import { SearchableMultiSelect } from './searchable-multi-select';
/**
* Scopes the list to a subset of the user's linked inboxes. Multi-select,
* default = all (no clause). Shown whenever the multi-inbox flag is on (or
- * the user already has multiple inboxes) so the "Add inbox" action row is
- * discoverable even with zero or one inbox connected. Selection is held in
- * soup-view's `inboxFilter` and compiled into `Owner` email literals.
+ * the user already has multiple inboxes). With exactly one inbox connected
+ * there is nothing to filter, so the dropdown is replaced by a "Connect
+ * another email" button that jumps straight into the add-inbox flow.
+ * Selection is held in soup-view's `inboxFilter` and compiled into `Owner`
+ * email literals.
*/
export function InboxSelector() {
const { inboxFilter, setInboxFilter } = useSoupView();
@@ -31,6 +33,11 @@ export function InboxSelector() {
});
const { openSettings } = useSettingsState();
+ const startAddInboxFlow = () => {
+ openSettings('Connected');
+ openAddInboxDialog();
+ };
+
const label = () => {
const ids = inboxFilter();
if (ids === undefined) return 'All inboxes';
@@ -53,10 +60,7 @@ export function InboxSelector() {
? {
label: 'Add inbox',
icon: () => <PlusIcon class="size-4" />,
- onSelect: () => {
- openSettings('Connected');
- openAddInboxDialog();
- },
+ onSelect: startAddInboxFlow,
}
: undefined
}
@@ -81,14 +85,42 @@ export function InboxSelector() {
</SearchableMultiSelect>
);
+ const ConnectAnotherEmail = (buttonProps: { hideLabel?: boolean }) => (
+ <Button
+ variant="base"
+ size="sm"
+ depth={2}
+ aria-label={buttonProps.hideLabel ? 'Connect another email' : undefined}
+ tooltip={buttonProps.hideLabel ? 'Connect another email' : undefined}
+ class={cn('bg-surface gap-1', buttonProps.hideLabel && 'px-1')}
+ onClick={startAddInboxFlow}
+ >
+ <TrayIcon />
+ <Show when={!buttonProps.hideLabel}>
+ <span class="truncate">Connect another email</span>
+ </Show>
+ </Button>
+ );
+
+ const showConnectButton = () =>
+ multiInboxFlag().enabled && picker.options().length === 1;
+
return (
<Show when={multiInboxFlag().enabled || picker.hasMultiple()}>
<CollapsibleHeaderItem
id="inbox-selector"
priority={3}
containerClass="h-full"
- expanded={() => <Selector />}
- collapsed={() => <Selector hideLabel />}
+ expanded={() => (
+ <Show when={showConnectButton()} fallback={<Selector />}>
+ <ConnectAnotherEmail />
+ </Show>
+ )}
+ collapsed={() => (
+ <Show when={showConnectButton()} fallback={<Selector hideLabel />}>
+ <ConnectAnotherEmail hideLabel />
+ </Show>
+ )}
/>
</Show>
);