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.

1.3 KB
Raw Blame
import { fireAndForget } from '@core/util/fireAndForget';
import type { Accessor } from 'solid-js';
import { RoutinesList } from '../components/routines-list';
import type { RoutineListSource } from '../context/routine-sources';
import type { RoutineTemplate } from '../core/routine-templates';
import { createRoutineRows } from '../primitives/routines-list';

export function RoutinesListView(props: {
  source: RoutineListSource;
  userId: Accessor<string | undefined>;
  showTitle?: boolean;
  registerSearchFocus?: (focus: () => void) => void;
  onCreate(): void;
  onOpen(id: string): void;
  /** Templates to start from, above the list. */
  templates?: RoutineTemplate[];
  onTemplate?: (template: RoutineTemplate) => void;
}) {
  const rows = createRoutineRows(props.source, props.userId);
  return (
    <RoutinesList
      showTitle={props.showTitle}
      registerSearchFocus={props.registerSearchFocus}
      rows={rows()}
      loading={props.source.loading()}
      error={props.source.error()}
      onRetry={() => fireAndForget(props.source.refresh(), 'routines')}
      onCreate={props.onCreate}
      onOpen={props.onOpen}
      pendingId={props.source.pendingId()}
      onToggle={(row) => props.source.setEnabled(row.id, !row.enabled)}
      templates={props.templates}
      onTemplate={props.onTemplate}
    />
  );
}