/* Copyright (C) 2025 QuantumNous This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ // 多选导出:底部悬浮操作条。展示型组件,状态由父级(Playground/index.jsx)持有。 import React, { useState } from 'react'; import { Button, RadioGroup, Radio } from '@douyinfe/semi-ui'; import { Download, X } from 'lucide-react'; import { useTranslation } from 'react-i18next'; const MessageSelectionBar = ({ selectedCount = 0, selectableCount = 0, isAllSelected = false, onSelectAll, onClearSelection, onExport, onCancel, isMobile = false, }) => { const { t } = useTranslation(); const [exporting, setExporting] = useState(false); const [format, setFormat] = useState('txt'); const handleExport = async () => { if (selectedCount === 0 || exporting) return; setExporting(true); try { await onExport?.(format); } finally { setExporting(false); } }; const selectAllBtn = ( ); const formatPicker = ( setFormat(e.target.value)} > {t('文本 TXT')} {t('Word 文档')} ); const exportBtn = ( ); const cancelBtn = ( ); const countText = ( {t('已选 {{count}} / {{total}} 条', { count: selectedCount, total: selectableCount, })} ); return (
{isMobile ? (
{countText} {formatPicker}
{selectAllBtn}
{cancelBtn} {exportBtn}
) : (
{countText} {selectAllBtn} {formatPicker} {exportBtn} {cancelBtn}
)}
); }; export default MessageSelectionBar;