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.5 KB
Raw Blame
import type { DateValue } from '@core/util/date';
import type { EntityData } from '@entity';
import { For, Show } from 'solid-js';
import { AttachmentEntityRow } from './AttachmentEntityRow';
import { AttachmentSection, LoadMoreButton } from './SectionHeader';

export type AttachmentEntityListRow = {
  entity: EntityData;
  timestamp?: DateValue | null;
  senderId?: string;
  onClick?: (event: MouseEvent) => void;
};

export function AttachmentEntityList(props: {
  rows: AttachmentEntityListRow[];
  hasNextPage: boolean;
  isFetchingNextPage: boolean;
  onLoadMore: () => void;
}) {
  const hasDocuments = () => props.rows.length > 0;

  return (
    <AttachmentSection
      label="Documents"
      class={hasDocuments() ? 'flex-1' : undefined}
    >
      <div class="grid grid-cols-1">
        <Show when={!hasDocuments()}>
          <div class="px-6 py-3 text-sm text-ink-subtle">
            No documents in this channel yet.
          </div>
        </Show>

        <Show when={hasDocuments()}>
          <For each={props.rows}>
            {(row) => (
              <AttachmentEntityRow
                entity={row.entity}
                timestamp={row.timestamp}
                senderId={row.senderId}
                onClick={row.onClick}
              />
            )}
          </For>

          <Show when={props.hasNextPage}>
            <LoadMoreButton
              onLoadMore={props.onLoadMore}
              isFetching={() => props.isFetchingNextPage}
            />
          </Show>
        </Show>
      </div>
    </AttachmentSection>
  );
}