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(search): has different empty state (#621)
gbirman9053bf1f6245
diff --git a/js/app/packages/app/component/HelpDrawer.tsx b/js/app/packages/app/component/HelpDrawer.tsxindex dff590c300..69ed848ab5 100644--- a/js/app/packages/app/component/HelpDrawer.tsx+++ b/js/app/packages/app/component/HelpDrawer.tsx@@ -5,7 +5,7 @@ import { useEmailLinks, useEmailLinksStatus } from '@core/email-link';import { TOKENS } from '@core/hotkey/tokens';import { isTouchDevice } from '@core/mobile/isTouchDevice';import { isMobileWidth } from '@core/mobile/mobileWidth';-import type { ViewId } from '@core/types/view';+import type { DefaultView, ViewId } from '@core/types/view';import CloseIcon from '@icon/regular/x.svg';import { authServiceClient } from '@service-auth/client';import { useTutorialCompleted } from '@service-gql/client';@@ -236,7 +236,7 @@ export function HelpDrawerInner(props: HelpDrawerInnerProps) {} = splitPanelContext;const tuturialComplete = useTutorialCompleted();const hideAllHelpDrawers = () => {- setShowHelpDrawer(new Set<string>());+ setShowHelpDrawer(new Set<DefaultView>());toast.success('Press ? to re-open the help drawer.');if (!tuturialComplete()) {authServiceClientdiff --git a/js/app/packages/app/component/Soup.tsx b/js/app/packages/app/component/Soup.tsxindex c2bd6f1189..5216d016f9 100644--- a/js/app/packages/app/component/Soup.tsx+++ b/js/app/packages/app/component/Soup.tsx@@ -234,11 +234,11 @@ export function Soup() {hotkey: ['shift+/'],scopeId: splitHotkeyScope,description: () =>- `${showHelpDrawer().has(selectedView()) ? 'Hide' : 'Show'} help drawer`,+ `${showHelpDrawer().has(selectedView() as DefaultView) ? 'Hide' : 'Show'} help drawer`,hotkeyToken: TOKENS.split.showHelpDrawer,keyDownHandler: () => {- if (showHelpDrawer().has(selectedView())) {- setShowHelpDrawer(new Set<string>());+ if (showHelpDrawer().has(selectedView() as DefaultView)) {+ setShowHelpDrawer(new Set<DefaultView>());} else {setShowHelpDrawer(new Set(DEFAULT_VIEWS));}@@ -387,7 +387,7 @@ export function Soup() {class="@container/soup [container-type:inline-size] flex flex-col gap-1 size-full overflow-x-clip"classList={{'border-r border-edge-muted': preview(),- 'pt-2 pb-0': showHelpDrawer().has(selectedView()),+ 'pt-2 pb-0': showHelpDrawer().has(selectedView() as DefaultView),}}value={selectedView()}onChange={setSelectedView}@@ -435,7 +435,7 @@ export function Soup() {/></Show></div>- <Show when={showHelpDrawer().has(selectedView())}>+ <Show when={showHelpDrawer().has(selectedView() as DefaultView)}><HelpDrawer viewId={view().id} /></Show></div>diff --git a/js/app/packages/app/component/SoupContext.tsx b/js/app/packages/app/component/SoupContext.tsxindex 049db691c1..9616f637c0 100644--- a/js/app/packages/app/component/SoupContext.tsx+++ b/js/app/packages/app/component/SoupContext.tsx@@ -89,8 +89,8 @@ export type UnifiedListContext = {entityListRefSignal: Signal<HTMLDivElement | undefined>;entitiesSignal: Signal<EntityData[] | undefined>;emailViewSignal: Signal<PreviewViewStandardLabel>;- showHelpDrawer: Accessor<Set<string>>;- setShowHelpDrawer: Setter<Set<string>>;+ showHelpDrawer: Accessor<Set<DefaultView>>;+ setShowHelpDrawer: Setter<Set<DefaultView>>;actionRegistry: EntityActionRegistry;};@@ -108,7 +108,7 @@ export function createSoupContext(): UnifiedListContext {const entitiesSignal = createSignal<EntityData[]>();const emailViewSignal = createSignal<PreviewViewStandardLabel>('inbox');const tutorialCompleted = useTutorialCompleted();- const [showHelpDrawer, setShowHelpDrawer] = createSignal<Set<string>>(+ const [showHelpDrawer, setShowHelpDrawer] = createSignal<Set<DefaultView>>(!tutorialCompleted() ? new Set(DEFAULT_VIEWS) : new Set());const setViewDataStore: SetStoreFunction<ViewDataMap> = (...args: any[]) => {@@ -229,7 +229,7 @@ export function createNavigationEntityListShortcut({const viewData = createMemo(() => viewsData[selectedView()]);const viewIds = createMemo<ViewId[]>(() => Object.keys(viewsData));- const [attachEntityHotkeys, entityHotkeyScope] = useHotkeyDOMScope('entity');+ const [attachEntityHotkeys, _entityHotkeyScope] = useHotkeyDOMScope('entity');const selectedEntity = () => viewData().selectedEntity;const notificationSource = useGlobalNotificationSource();@@ -1509,7 +1509,7 @@ export function scrollToKeepGap({}}-let globalKeyboardEvent!: KeyboardEvent | undefined;+let globalKeyboardEvent: KeyboardEvent | undefined;type ExecuteKeyDownHandlerCallback = (props: {keyboardEvent?: KeyboardEvent;@@ -1533,7 +1533,6 @@ function registerEntityHotkey(commandScopeId: string;};} {- const id = opts.scopeId + JSON.stringify(opts.hotkey);onCleanup(() => {globalKeyboardEvent = undefined;});diff --git a/js/app/packages/app/component/UnifiedListEmptyState.tsx b/js/app/packages/app/component/UnifiedListEmptyState.tsxindex 839a1f165b..cef3c9c73c 100644--- a/js/app/packages/app/component/UnifiedListEmptyState.tsx+++ b/js/app/packages/app/component/UnifiedListEmptyState.tsx@@ -5,7 +5,7 @@ import { folderSelector } from '@core/directive/folderSelector';import { useEmailLinksStatus } from '@core/email-link';import { isTouchDevice } from '@core/mobile/isTouchDevice';import { isMobileWidth } from '@core/mobile/mobileWidth';-import type { ViewId } from '@core/types/view';+import type { DefaultView, ViewId } from '@core/types/view';import { handleFolderSelect } from '@core/util/upload';import { createMemo, Match, onMount, Show, Switch } from 'solid-js';import { useSplitPanelOrThrow } from './split-layout/layoutUtils';@@ -13,21 +13,38 @@ import { useSplitPanelOrThrow } from './split-layout/layoutUtils';false && fileSelector;false && folderSelector;-export function EmptyState(props: { viewId?: ViewId }) {- const emailActive = useEmailLinksStatus();- const splitPanelContext = useSplitPanelOrThrow();+function EmptyStateHelpDrawer(props: {+ message?: string;+ helpDrawer: DefaultView;+ showDropZone?: boolean;+}) {const {unifiedListContext: { setShowHelpDrawer },- } = splitPanelContext;+ } = useSplitPanelOrThrow();+ onMount(() => {+ setShowHelpDrawer((prev) => new Set([...prev, props.helpDrawer]));+ });+ return (+ <EmptyStateInner+ emptyMessage={props.message}+ showDropZone={props.showDropZone}+ />+ );+}++export function EmptyState(props: { viewId?: ViewId; search?: boolean }) {+ const emailActive = useEmailLinksStatus();+return (<Switch>+ <Match when={props.search}>+ <EmptyStateInner emptyMessage={'No results.'} />+ </Match><Match when={props.viewId === 'noise' && !emailActive()}>- {(_) => {- onMount(() =>- setShowHelpDrawer((prev) => new Set([...prev, 'noise']))- );- return <EmptyStateInner emptyMessage={'Email not connected.'} />;- }}+ <EmptyStateHelpDrawer+ message={'Email not connected.'}+ helpDrawer={'noise'}+ /></Match><Matchwhen={@@ -38,49 +55,45 @@ export function EmptyState(props: { viewId?: ViewId }) {<EmptyStateInner emptyMessage={'Inbox zero.'} /></Match><Match when={props.viewId === 'signal' && !emailActive()}>- {(_) => {- onMount(() =>- setShowHelpDrawer((prev) => new Set([...prev, 'signal']))- );- return (- <EmptyStateInner- emptyMessage={'Nothing to show. Email not connected.'}- />- );- }}+ <EmptyStateHelpDrawer+ message={'Nothing to show. Email not connected.'}+ helpDrawer={'signal'}+ /></Match>- <Match when={props.viewId === 'comms'}>- {(_) => {- onMount(() =>- setShowHelpDrawer((prev) => new Set([...prev, 'comms']))- );- return <EmptyStateInner emptyMessage={'No messages to show.'} />;- }}+ <Match when={props.viewId === 'people'}>+ <EmptyStateHelpDrawer+ message={'No messages to show.'}+ helpDrawer={'people'}+ /></Match>- <Match when={props.viewId === 'docs'}>- {(_) => {- onMount(() =>- setShowHelpDrawer((prev) => new Set([...prev, 'docs']))- );- return <EmptyStateInner showDropZone />;- }}- </Match>- <Match when={props.viewId === 'ai'}>- {(_) => {- onMount(() => setShowHelpDrawer((prev) => new Set([...prev, 'ai'])));- return <EmptyStateInner emptyMessage={'No AI chats to show.'} />;- }}+ <Match when={props.viewId === 'files'}>+ <EmptyStateHelpDrawer+ message={'No files to show.'}+ helpDrawer={'files'}+ showDropZone+ /></Match><Match when={props.viewId === 'folders'}>- {(_) => {- onMount(() =>- setShowHelpDrawer((prev) => new Set([...prev, 'folders']))- );- return <EmptyStateInner showDropZone />;- }}+ <EmptyStateHelpDrawer+ message={'No folders to show.'}+ helpDrawer={'folders'}+ showDropZone+ />+ </Match>+ <Match when={props.viewId === 'tasks'}>+ <EmptyStateHelpDrawer+ message={'No tasks to show.'}+ helpDrawer={'tasks'}+ />+ </Match>+ <Match when={props.viewId === 'all'}>+ <EmptyStateHelpDrawer+ message={'No items to show.'}+ helpDrawer={'all'}+ /></Match><Match when={true}>- <EmptyStateInner showDropZone />+ <EmptyStateInner emptyMessage={'No items to show.'} showDropZone /></Match></Switch>);diff --git a/js/app/packages/app/component/UnifiedListView.tsx b/js/app/packages/app/component/UnifiedListView.tsxindex a43d39fc2b..18062f4c9d 100644--- a/js/app/packages/app/component/UnifiedListView.tsx+++ b/js/app/packages/app/component/UnifiedListView.tsx@@ -1485,7 +1485,12 @@ export function UnifiedListView(props: UnifiedListViewProps) {<UnifiedListComponententityListRef={setLocalEntityListRef}virtualizerHandle={setVirtualizerHandle}- emptyState={<EmptyState viewId={view()?.id} />}+ emptyState={+ <EmptyState+ viewId={view()?.id}+ search={searchText().length > 0}+ />+ }hasRefinementsFromBase={isViewConfigChanged}>{(innerProps) => {