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.

1022 B
Raw Blame
import { CommandState } from '@app/features/command/state';
import { useAnalytics } from '@app/lib/analytics/analytics-context';
import type { JSX } from 'solid-js';
import { EntitySelectionToolbarModal } from './EntitySelectionToolbarModal';
import type { EntityData } from './types/entity';

export type EntitySelectionToolbarProps = {
  selected: EntityData[];
  onClear: VoidFunction;
  analyticsSource?: string;
  children?: JSX.Element;
};

export function EntitySelectionToolbar(props: EntitySelectionToolbarProps) {
  const analytics = useAnalytics();

  return (
    <EntitySelectionToolbarModal
      multiSelectEntities={props.selected}
      onClose={props.onClear}
      onAction={() => {
        if (props.selected.length === 0) return;
        analytics.track('command_menu_open', {
          from: props.analyticsSource ?? 'entity_list_selection_toolbar',
        });
        CommandState.openForEntityAction(props.selected);
      }}
    >
      {props.children}
    </EntitySelectionToolbarModal>
  );
}