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(empty states): Add docs to empty states (#3760)

Aidan Holloway-Bidwell5d68715f559f
diff --git a/js/app/packages/app/component/next-soup/soup-view/empty-states.tsx b/js/app/packages/app/component/next-soup/soup-view/empty-states.tsx
index bfb864581b..c59ab8b616 100644
--- a/js/app/packages/app/component/next-soup/soup-view/empty-states.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/empty-states.tsx
@@ -12,36 +12,42 @@ import EmptyStateInboxZeroIcon from '@design/empty-state-inbox-zero.svg';
import EmptyStateNoFilterMatchIcon from '@design/empty-state-no-filter-match.svg';
import EmptyStateNoSearchMatchIcon from '@design/empty-state-no-search-match.svg';
import EmptyStateTasksIcon from '@design/empty-state-tasks.svg';
-import PlusCircleIcon from '@phosphor/plus-circle.svg';
-import { Button, EmptyStatePanel, FilteredHiddenBanner } from '@ui';
+import PlusIcon from '@phosphor/plus.svg';
+import { EmptyStatePanel, FilteredHiddenBanner } from '@ui';
import { type Component, Match, Switch } from 'solid-js';
import { FolderDropZone } from './FolderDropZone';
import { useSoupView } from './soup-view-context';
+// Base URL for the public documentation site (https://docs.macro.com).
+const DOCS_BASE = 'https://docs.macro.com';
+
type FallbackContent = {
plural: string;
graphic?: Component<{ class?: string }>;
create?: { label: string; blockName: BlockName | BlockAlias };
+ documentationUrl?: string;
};
const FALLBACK_CONTENT: Partial<Record<ListView, FallbackContent>> = {
documents: {
plural: 'documents',
graphic: EmptyStateDocIcon,
- create: { label: 'Create document', blockName: 'md' },
+ create: { label: 'New document', blockName: 'md' },
+ documentationUrl: `${DOCS_BASE}/product/docs`,
},
channels: {
plural: 'channels',
- create: { label: 'Create channel', blockName: 'channel' },
+ create: { label: 'New channel', blockName: 'channel' },
+ documentationUrl: `${DOCS_BASE}/product/channels`,
},
- calls: { plural: 'calls' },
+ calls: { plural: 'calls', documentationUrl: `${DOCS_BASE}/product/calls` },
search: { plural: 'items' },
};
function InboxZeroNumber(props: { class?: string }) {
return (
<div
- class={`flex items-center justify-center font-mono text-[9rem] font-thin leading-none text-ink-muted opacity-50 ${props.class ?? ''}`}
+ class={`flex items-center justify-center font-mono text-[9rem] font-thin leading-none text-ink-muted ${props.class ?? ''}`}
>
0
</div>
@@ -77,6 +83,7 @@ export function EmptyState(props: {
? `No results for "${soup.searchText()}"`
: 'No results'
}
+ documentationUrl={`${DOCS_BASE}/product/search-1`}
/>
</Match>
@@ -109,6 +116,7 @@ export function EmptyState(props: {
label: 'Connect email',
onClick: onConnectEmail,
}}
+ documentationUrl={`${DOCS_BASE}/product/email`}
/>
</Match>
@@ -118,6 +126,7 @@ export function EmptyState(props: {
graphic={InboxZeroNumber}
title="Inbox zero"
description="You're all caught up. Important items will appear here as they arrive."
+ documentationUrl={`${DOCS_BASE}/product/inbox`}
/>
</Match>
@@ -127,6 +136,7 @@ export function EmptyState(props: {
graphic={InboxZeroNumber}
title="Inbox zero"
description="You're all caught up. New email will appear here as it arrives."
+ documentationUrl={`${DOCS_BASE}/product/email`}
/>
</Match>
@@ -134,8 +144,15 @@ export function EmptyState(props: {
<EmptyStatePanel
align="center"
graphic={EmptyStateTasksIcon}
+ graphicClass="h-36 w-36"
title="Nothing to do"
description="Tasks you create or that get assigned to you will show up here."
+ primaryAction={{
+ label: 'New task',
+ icon: PlusIcon,
+ onClick: () => runCreateAction('task'),
+ }}
+ documentationUrl={`${DOCS_BASE}/product/tasks`}
/>
</Match>
@@ -147,7 +164,8 @@ export function EmptyState(props: {
graphic={EmptyStateInboxZeroIcon}
title="No automations to show"
primaryAction={{
- label: 'Create automation',
+ label: 'New automation',
+ icon: PlusIcon,
onClick: () => runCreateAction('automation'),
}}
/>
@@ -182,11 +200,13 @@ export function EmptyState(props: {
fallback.create
? {
label: fallback.create.label,
+ icon: PlusIcon,
onClick: () =>
runCreateAction(fallback.create!.blockName),
}
: undefined
}
+ documentationUrl={fallback.documentationUrl}
/>
);
})()}
@@ -196,34 +216,23 @@ export function EmptyState(props: {
}
function AgentsEmptyState() {
+ // Shares the left-aligned EmptyStatePanel layout with the folders / connect-email
+ // empty states; the MCP setup cards render below the actions as panel children.
return (
- <div class="size-full relative overflow-hidden" data-soup-empty-state>
- <div class="relative size-full flex flex-col items-center overflow-y-auto p-4">
- <div class="w-full max-w-2xl mt-32 @max-sm:mt-20 px-4 pb-8 flex flex-col gap-6">
- <div class="flex flex-col items-center gap-2">
- <div class="h-48 w-48 -mb-8 text-ink-muted">
- <EmptyStateAiIcon class="size-full" />
- </div>
- <Button
- variant="cta"
- size="lg"
- onClick={() => runCreateAction('chat')}
- >
- <PlusCircleIcon />
- <span>New Agent</span>
- </Button>
- </div>
- <div class="flex flex-col gap-4">
- <div>
- <p class="mt-1 text-sm text-ink-extra-muted">
- Create an agent above, or use Macro with your favorite AI chat
- client or code editor via MCP.
- </p>
- </div>
- <McpSetupCards />
- </div>
- </div>
- </div>
+ <div class="size-full" data-soup-empty-state>
+ <EmptyStatePanel
+ graphic={EmptyStateAiIcon}
+ title="Get started with agents"
+ description="Create an agent, or use Macro with your favorite AI chat client or code editor via MCP."
+ primaryAction={{
+ label: 'New agent',
+ icon: PlusIcon,
+ onClick: () => runCreateAction('chat'),
+ }}
+ documentationUrl={`${DOCS_BASE}/product/agents`}
+ >
+ <McpSetupCards />
+ </EmptyStatePanel>
</div>
);
}
diff --git a/js/app/packages/design/empty-state-ai.svg b/js/app/packages/design/empty-state-ai.svg
index 92e56cd4f6..e1e7ff7c74 100644
--- a/js/app/packages/design/empty-state-ai.svg
+++ b/js/app/packages/design/empty-state-ai.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="100%" height="100%" fill="none" stroke="currentColor" stroke-width="0.5"><g transform="translate(5.865 13.85)"><g fill="currentColor" stroke="none"><path d="M30.7.9c-10.48,6.05-12.91,5.88-18.76,2.5-.4-.23-1.05-.23-1.45,0s-.4.6,0,.84c5.85,3.37,6.15,4.78-4.33,10.83-.4.23-.4.6,0,.84s1.05.23,1.45,0c10.48-6.05,12.91-5.88,18.76-2.5.4.23,1.05.23,1.45,0s.4-.6,0-.84c-5.85-3.38-6.15-4.78,4.33-10.83.4-.23.4-.6,0-.84s-1.05-.23-1.45,0ZM21.69,9.86c-2.05.21-3.01.21-5.06,0-.36-1.18-.36-1.74,0-2.92,2.05-.21,3.01-.21,5.06,0,.36,1.18.36,1.74,0,2.92Z"/><path d="M19.88,7.98c.4.23.4.6,0,.84s-1.05.23-1.45,0-.4-.6,0-.84,1.05-.23,1.45,0Z"/></g><g opacity="0.5"><path d="M36.89,10.4l-19.05,11c-1.67.97-4.6.85-6.53-.27L1.85,15.67c-1.93-1.12-2.14-2.81-.47-3.77L20.43.9c1.67-.97,4.6-.85,6.53.27l9.45,5.46c1.93,1.12,2.14,2.81.47,3.77Z" stroke-dasharray="2.48 2.48" stroke-linecap="round" stroke-linejoin="round"/></g></g></svg>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="5 0 50 50" width="100%" height="100%" fill="none" stroke="currentColor" stroke-width="0.5"><g transform="translate(5.865 13.85)"><g fill="currentColor" stroke="none"><path d="M30.7.9c-10.48,6.05-12.91,5.88-18.76,2.5-.4-.23-1.05-.23-1.45,0s-.4.6,0,.84c5.85,3.37,6.15,4.78-4.33,10.83-.4.23-.4.6,0,.84s1.05.23,1.45,0c10.48-6.05,12.91-5.88,18.76-2.5.4.23,1.05.23,1.45,0s.4-.6,0-.84c-5.85-3.38-6.15-4.78,4.33-10.83.4-.23.4-.6,0-.84s-1.05-.23-1.45,0ZM21.69,9.86c-2.05.21-3.01.21-5.06,0-.36-1.18-.36-1.74,0-2.92,2.05-.21,3.01-.21,5.06,0,.36,1.18.36,1.74,0,2.92Z"/><path d="M19.88,7.98c.4.23.4.6,0,.84s-1.05.23-1.45,0-.4-.6,0-.84,1.05-.23,1.45,0Z"/></g><g opacity="0.5"><path d="M36.89,10.4l-19.05,11c-1.67.97-4.6.85-6.53-.27L1.85,15.67c-1.93-1.12-2.14-2.81-.47-3.77L20.43.9c1.67-.97,4.6-.85,6.53.27l9.45,5.46c1.93,1.12,2.14,2.81.47,3.77Z" stroke-dasharray="2.48 2.48" stroke-linecap="round" stroke-linejoin="round"/></g></g></svg>
diff --git a/js/app/packages/ui/components/EmptyStatePanel.tsx b/js/app/packages/ui/components/EmptyStatePanel.tsx
index 3c2e6af4fe..c5493a7c64 100644
--- a/js/app/packages/ui/components/EmptyStatePanel.tsx
+++ b/js/app/packages/ui/components/EmptyStatePanel.tsx
@@ -1,3 +1,4 @@
+import { openExternalUrl } from '@core/util/url';
import { type Component, type JSXElement, Show } from 'solid-js';
import { Dynamic } from 'solid-js/web';
import { cn } from '../utils/classname';
@@ -6,6 +7,8 @@ import { Button } from './Button';
export interface EmptyStateAction {
label: string;
onClick: () => void;
+ /** Optional leading icon, e.g. a plus for "create" actions. */
+ icon?: Component<{ class?: string }>;
}
export interface EmptyStatePanelProps {
@@ -14,6 +17,12 @@ export interface EmptyStatePanelProps {
title?: string;
description?: JSXElement;
primaryAction?: EmptyStateAction;
+ /**
+ * When set, renders a secondary "Documentation" button that opens the given
+ * URL in a new tab. Omit when no relevant documentation page exists.
+ */
+ documentationUrl?: string;
+ documentationLabel?: string;
align?: 'left' | 'center';
children?: JSXElement;
class?: string;
@@ -28,7 +37,7 @@ export function EmptyStatePanel(props: EmptyStatePanelProps) {
<div
role="status"
class={cn(
- 'flex size-full flex-col px-8',
+ 'flex size-full flex-col overflow-y-auto px-8 pb-8',
'@max-sm:px-4 @max-sm:text-center @max-sm:items-center',
isCentered()
? 'items-center text-center'
@@ -49,7 +58,11 @@ export function EmptyStatePanel(props: EmptyStatePanelProps) {
{(graphic) => (
<div
aria-hidden="true"
- class={cn(DEFAULT_GRAPHIC_CLASS, '-mb-8', props.graphicClass)}
+ class={cn(
+ DEFAULT_GRAPHIC_CLASS,
+ '-mb-8 opacity-70',
+ props.graphicClass
+ )}
>
<Dynamic component={graphic()} class="size-full" />
</div>
@@ -61,17 +74,45 @@ export function EmptyStatePanel(props: EmptyStatePanelProps) {
<Show when={props.description}>
<div class="text-sm/6 text-ink-muted">{props.description}</div>
</Show>
- <Show when={props.primaryAction}>
- {(action) => (
- <Button
- variant="cta"
- size="md"
- class="mt-2"
- onClick={action().onClick}
- >
- {action().label}
- </Button>
- )}
+ <Show when={props.primaryAction || props.documentationUrl}>
+ <div
+ class={cn(
+ 'mt-2 flex flex-wrap gap-2',
+ isCentered() ? 'justify-center' : 'justify-start',
+ '@max-sm:w-full @max-sm:flex-col @max-sm:justify-center'
+ )}
+ >
+ <Show when={props.primaryAction}>
+ {(action) => (
+ <Button
+ variant="cta"
+ size="md"
+ class={cn(
+ 'rounded-full',
+ action().icon ? 'pl-3 pr-4' : 'px-4'
+ )}
+ onClick={action().onClick}
+ >
+ <Show when={action().icon}>
+ {(icon) => <Dynamic component={icon()} class="size-4" />}
+ </Show>
+ {action().label}
+ </Button>
+ )}
+ </Show>
+ <Show when={props.documentationUrl}>
+ {(url) => (
+ <Button
+ variant="base"
+ size="md"
+ class="rounded-full px-4"
+ onClick={() => openExternalUrl(url())}
+ >
+ {props.documentationLabel ?? 'Documentation'}
+ </Button>
+ )}
+ </Show>
+ </div>
</Show>
<Show when={props.children}>{props.children}</Show>
</div>