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.4 KB
Raw Blame
import { useBlockEntityCommands } from '@app/features/next-soup/actions';
import { DEFAULT_CHAT_NAME } from '@block-chat/definition';
import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
import { SidePanel } from '@components/app/side-panel';
import { useBlockId } from '@core/block';
import { DocumentBlockContainer } from '@core/component/DocumentBlockContainer';
import { useBlockDocumentName } from '@core/util/currentBlockDocumentName';
import { NotificationReadMarker } from '@notifications';
import { Show } from 'solid-js';
import { chatBlockData } from '../signal/chatBlockData';
import { Chat } from './Chat';
import { ChatSidePanelSections } from './sidepanel/ChatSidePanelSections';

export default function ChatBlock() {
  useBlockEntityCommands();
  const blockId = useBlockId();
  const notificationSource = useGlobalNotificationSource();
  const name = useBlockDocumentName(DEFAULT_CHAT_NAME);

  return (
    <DocumentBlockContainer title={name()}>
      <div class="size-full" tabIndex={-1}>
        <NotificationReadMarker
          notificationSource={notificationSource}
          entity={{ type: 'chat', id: blockId }}
        />
        <SidePanel.Layout defaultOpen={false} floating>
          <ChatSidePanelSections />
          <Show when={chatBlockData()}>{(data) => <Chat data={data()} />}</Show>
        </SidePanel.Layout>
      </div>
    </DocumentBlockContainer>
  );
}