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.

1.2 KB
Raw Blame
import { type IThreadType, ThreadType } from '@lobechat/types';
import { cssVar, Divider, Flexbox, Icon } from '@lobehub/ui';
import { GitBranch } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';

interface ThreadDividerProps {
  threadType?: IThreadType;
}

/**
 * Sits under the fork message — the only main-chat message rendered in the
 * thread portal — and states what context the thread carries: a standalone
 * thread inherits just that message, everything else continues with the main
 * chat history up to it.
 */
const ThreadDivider = memo<ThreadDividerProps>(({ threadType }) => {
  const { t } = useTranslation('chat');

  return (
    <div style={{ padding: '0 20px' }}>
      <Divider style={{ padding: '20px 0' }}>
        <Flexbox
          horizontal
          align={'center'}
          gap={6}
          style={{ color: cssVar.colorTextDescription, fontSize: 12 }}
        >
          <Icon icon={GitBranch} size={12} />
          {threadType === ThreadType.Standalone
            ? t('thread.dividerStandalone')
            : t('thread.dividerContinuation')}
        </Flexbox>
      </Divider>
    </div>
  );
});

export default ThreadDivider;