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.

3.0 KB
Raw Blame
import { DOCS_BASE } from '@app/constants/docs-links';
import { useAddInboxFlow, useEmailLinksStatus } from '@core/email-link';
import { fireAndForget } from '@core/util/fireAndForget';
import EmptyStateInboxTrayGraphic from '@design/empty-state-inbox-tray.svg';
import EmptyStateNoFilterMatchGraphic from '@design/empty-state-no-filter-match.svg';
import EmptyStateNoSearchMatchGraphic from '@design/empty-state-no-search-match.svg';
import { EmptyStatePanel, FilteredHiddenBanner } from '@ui';
import { Match, Switch } from 'solid-js';
import { useHomeView } from '../home-view-context';

export function HomeEmptyState() {
  const { state, setFacets } = useHomeView();
  const emailActive = useEmailLinksStatus();
  const startAddInbox = useAddInboxFlow();
  const searchText = () => state.search.trim();
  const hasActiveFilters = () =>
    Object.values(state.facets).some((optionIds) => optionIds.length > 0);

  return (
    <Switch>
      <Match when={searchText()}>
        {(search) => (
          <EmptyStatePanel
            centered
            graphic={EmptyStateNoSearchMatchGraphic}
            title={`No results for "${search()}"`}
            description="Search across messages, documents, tasks, and more. Try a different query or broaden your filters."
            documentationUrl={`${DOCS_BASE}/product/search`}
          />
        )}
      </Match>

      <Match when={hasActiveFilters()}>
        <EmptyStatePanel
          centered
          graphic={EmptyStateNoFilterMatchGraphic}
          title="No items matching the filters"
          description="Try adjusting or clearing your filters to see more results."
        >
          <FilteredHiddenBanner
            hasHiddenItems={false}
            onClearFilters={() => setFacets({})}
          />
        </EmptyStatePanel>
      </Match>

      <Match when={!emailActive()}>
        <EmptyStatePanel
          graphic={EmptyStateInboxTrayGraphic}
          title="Welcome home"
          description="Your recent work and notifications will appear here. Connect email to include your inbox, too."
          primaryAction={{
            label: 'Connect email',
            onClick: () => fireAndForget(startAddInbox(), 'add-inbox'),
          }}
          documentationUrl={`${DOCS_BASE}/product/home`}
        />
      </Match>

      <Match when={state.tab === 'noise'}>
        <EmptyStatePanel
          graphic={EmptyStateInboxTrayGraphic}
          title="No noise"
          description={
            <>
              Low-priority items like newsletters and notifications collect
              here.
              <br />
              Nothing to clear right now.
            </>
          }
          documentationUrl={`${DOCS_BASE}/product/home`}
        />
      </Match>

      <Match when={true}>
        <EmptyStatePanel
          graphic={EmptyStateInboxTrayGraphic}
          title="No activity yet"
          description="Your recent documents, sent emails, AI chats, and notifications will appear here."
          documentationUrl={`${DOCS_BASE}/product/home`}
        />
      </Match>
    </Switch>
  );
}