Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

756 B
Raw Blame
'use client';

import type { BuiltinRenderProps } from '@lobechat/types';
import { memo } from 'react';

import type { CreateDocumentArgs, CreateDocumentState } from '../../../types';
import DocumentCard from './DocumentCard';

export type CreateDocumentRenderProps = Pick<
  BuiltinRenderProps<CreateDocumentArgs, CreateDocumentState>,
  'args' | 'pluginState'
>;

const CreateDocument = memo<CreateDocumentRenderProps>(({ args, pluginState }) => {
  const title = args?.title;
  const content = args?.content;

  if (!title || !content) return null;

  return (
    <DocumentCard
      content={content}
      documentId={pluginState?.documentId}
      readonly={pluginState?.readonly}
      title={title}
    />
  );
});

export default CreateDocument;