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.

Add documentation links to sidebar and launcher (#3965)

Jacob Beckermanf994203769d4
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 b22a00e8a6..26aa9f9de7 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
@@ -1,4 +1,5 @@
import { runCreateAction } from '@app/component/Launcher';
+import { DOCS_BASE } from '@app/constants/docs-links';
import type { ListView } from '@app/constants/list-views';
import type { BlockAlias, BlockName } from '@core/block';
import { McpSetupCards } from '@core/component/AI/component/McpSetupCards';
@@ -21,9 +22,6 @@ import { type Component, type JSXElement, 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 }>;
@@ -104,7 +102,7 @@ export function EmptyState(props: {
: 'No results'
}
description="Search across messages, documents, tasks, and more. Try a different query or broaden your filters."
- documentationUrl={`${DOCS_BASE}/product/search-1`}
+ documentationUrl={`${DOCS_BASE}/product/search`}
/>
</Match>
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
index ed3d5ad1b5..517270ab64 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
@@ -64,6 +64,7 @@ import {
} from '@app/component/split-layout/components/SplitHeader';
import { SplitPanelContext } from '@app/component/split-layout/context';
import { useSplitPanelOrThrow } from '@app/component/split-layout/layoutUtils';
+import { LIST_VIEW_DOCS_URL } from '@app/constants/docs-links';
import { isListViewID, type ListView } from '@app/constants/list-views';
import { usePreference } from '@app/preferences/use-preference';
import { CustomScrollbar } from '@core/component/CustomScrollbar';
@@ -82,6 +83,7 @@ import { TOKENS } from '@core/hotkey/tokens';
import { isMobile } from '@core/mobile/isMobile';
import { useDisplayName } from '@core/user/displayName';
import { type MacroId, tryMacroId } from '@core/user/macroId';
+import { openExternalUrl } from '@core/util/url';
import { useIsKeyPressActive } from '@core/util/useIsKeyPressActive';
import {
type EntityData,
@@ -95,6 +97,7 @@ import { createEffectOnEntityTypeNotification } from '@notifications';
import CaretDownIcon from '@phosphor/caret-down.svg';
import ChevronRightIcon from '@phosphor/caret-right.svg';
import CheckIcon from '@phosphor/check.svg';
+import InfoIcon from '@phosphor/info.svg';
import Spinner from '@phosphor/spinner.svg';
import { PropertyValueIcon } from '@property/component/propertyValue/PropertyValueIcon';
import { SYSTEM_PROPERTY_IDS } from '@property/constants';
@@ -364,6 +367,11 @@ export const SoupView = (props: SoupViewProps) => {
return id && isListViewID(id) ? id : undefined;
});
+ const docsUrl = createMemo(() => {
+ const view = activeListView();
+ return view ? LIST_VIEW_DOCS_URL[view] : undefined;
+ });
+
const [narrowSearchExpanded, setNarrowSearchExpanded] = createSignal(false);
const [mobileSearchOpen, setMobileSearchOpen] = createSignal(false);
const [searchIsCollapsed, setSearchIsCollapsed] = createSignal(false);
@@ -442,7 +450,21 @@ export const SoupView = (props: SoupViewProps) => {
})}
>
<Show when={!isMobile() && !narrowSearchExpanded()}>
- <span class="text-base font-bold">{props.viewName}</span>
+ <div class="flex items-center gap-1">
+ <span class="text-base font-bold">{props.viewName}</span>
+ <Show when={docsUrl()}>
+ {(url) => (
+ <Button
+ variant="ghost"
+ class="p-0.5 rounded-sm text-ink-extra-muted hover:text-ink-muted"
+ label="View documentation"
+ onClick={() => openExternalUrl(url())}
+ >
+ <InfoIcon class="size-3.5" />
+ </Button>
+ )}
+ </Show>
+ </div>
</Show>
<Show
when={
diff --git a/js/app/packages/app/constants/docs-links.ts b/js/app/packages/app/constants/docs-links.ts
new file mode 100644
index 0000000000..488b0b3e1b
--- /dev/null
+++ b/js/app/packages/app/constants/docs-links.ts
@@ -0,0 +1,21 @@
+import type { ListView } from '@app/constants/list-views';
+
+/** Base URL for the public documentation site. */
+export const DOCS_BASE = 'https://docs.macro.com';
+
+/**
+ * Public documentation page for each list view. Views without an entry have no
+ * docs page yet, so callers should render no link for them.
+ */
+export const LIST_VIEW_DOCS_URL: Partial<Record<ListView, string>> = {
+ inbox: `${DOCS_BASE}/product/inbox`,
+ agents: `${DOCS_BASE}/product/agents`,
+ mail: `${DOCS_BASE}/product/email`,
+ documents: `${DOCS_BASE}/product/docs`,
+ tasks: `${DOCS_BASE}/product/tasks`,
+ channels: `${DOCS_BASE}/product/channels`,
+ calls: `${DOCS_BASE}/product/calls`,
+ companies: `${DOCS_BASE}/product/crm`,
+ folders: `${DOCS_BASE}/product/folders`,
+ search: `${DOCS_BASE}/product/search`,
+};