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.0 KB
Raw Blame
'use client';

import { Checkbox, Flexbox } from '@lobehub/ui';
import type { ReactNode } from 'react';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';

interface DeleteTopicConfirmContentProps {
  defaultRemoveFiles?: boolean;
  description?: ReactNode;
  onChange: (removeFiles: boolean) => void;
  showRemoveFiles: boolean;
}

export const DeleteTopicConfirmContent = memo<DeleteTopicConfirmContentProps>(
  ({ description, onChange, showRemoveFiles, defaultRemoveFiles = true }) => {
    const { t } = useTranslation('topic');
    const [checked, setChecked] = useState(defaultRemoveFiles);

    return (
      <Flexbox gap={12}>
        {description ?? t('actions.confirmRemoveTopic')}
        {showRemoveFiles && (
          <Checkbox
            checked={checked}
            onChange={(value) => {
              setChecked(value);
              onChange(value);
            }}
          >
            {t('actions.confirmRemoveTopicFiles')}
          </Checkbox>
        )}
      </Flexbox>
    );
  },
);