feat: 参考原型图 ui优化提交 个人端-用户中心 相关的页面
This commit is contained in:
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button } from '@douyinfe/semi-ui';
|
||||
import { Button } from '@/components/ui';
|
||||
import {
|
||||
ListTodo,
|
||||
Clock,
|
||||
@@ -26,23 +26,61 @@ import {
|
||||
Download,
|
||||
XCircle,
|
||||
Loader2,
|
||||
FileDown,
|
||||
} from 'lucide-react';
|
||||
import { exportToCsv, formatTimestampForCsv } from '../../../helpers/exportCsv';
|
||||
|
||||
const TaskLogsActions = ({
|
||||
t,
|
||||
logs = [],
|
||||
isAdminUser,
|
||||
usageRecordMode = false,
|
||||
}) => {
|
||||
const ExportIcon = usageRecordMode ? FileDown : Download;
|
||||
const exportButtonClass = usageRecordMode
|
||||
? 'usage-record-action-button usage-record-action-button-soft'
|
||||
: 'hover:!bg-gray-100 dark:hover:!bg-neutral-800 !transition-all !duration-300';
|
||||
// CSV 导出:仅当前页已加载的数据,避免一次性拉取全量产生巨大请求
|
||||
export const exportTaskLogsPageCsv = (logs, isAdminUser, t) => {
|
||||
if (!logs || logs.length === 0) return;
|
||||
const columns = [
|
||||
{
|
||||
key: 'submit_time',
|
||||
title: t('提交时间'),
|
||||
format: (r) => formatTimestampForCsv(r.submit_time),
|
||||
},
|
||||
{
|
||||
key: 'finish_time',
|
||||
title: t('结束时间'),
|
||||
format: (r) => formatTimestampForCsv(r.finish_time),
|
||||
},
|
||||
{
|
||||
key: 'duration',
|
||||
title: t('耗时(秒)'),
|
||||
format: (r) =>
|
||||
r.submit_time && r.finish_time ? r.finish_time - r.submit_time : '',
|
||||
},
|
||||
...(isAdminUser
|
||||
? [
|
||||
{ key: 'channel_id', title: t('渠道ID') },
|
||||
{ key: 'channel_name', title: t('渠道名称') },
|
||||
]
|
||||
: []),
|
||||
{ key: 'platform', title: t('平台') },
|
||||
{ key: 'action', title: t('类型') },
|
||||
{
|
||||
key: 'model',
|
||||
title: t('模型'),
|
||||
format: (r) =>
|
||||
r.properties?.origin_model_name ||
|
||||
r.properties?.upstream_model_name ||
|
||||
'',
|
||||
},
|
||||
{ key: 'task_id', title: t('任务ID') },
|
||||
{ key: 'status', title: t('状态') },
|
||||
{ key: 'progress', title: t('进度') },
|
||||
{ key: 'quota', title: t('费用'), format: (r) => r.quota || '' },
|
||||
{ key: 'fail_reason', title: t('详情') },
|
||||
];
|
||||
const ts = formatTimestampForCsv(Math.floor(Date.now() / 1000)).replace(
|
||||
/[: ]/g,
|
||||
'-',
|
||||
);
|
||||
exportToCsv(columns, logs, `task-logs-${ts}.csv`);
|
||||
};
|
||||
|
||||
// 计算任务统计
|
||||
const stats = React.useMemo(() => {
|
||||
// 本页任务统计:仅统计当前页已加载数据
|
||||
export const useTaskPageStats = (logs = []) =>
|
||||
React.useMemo(() => {
|
||||
const successCount = logs.filter((log) => log.status === 'SUCCESS').length;
|
||||
const failureCount = logs.filter((log) => log.status === 'FAILURE').length;
|
||||
const pendingCount = logs.filter(
|
||||
@@ -55,54 +93,19 @@ const TaskLogsActions = ({
|
||||
return { successCount, failureCount, pendingCount, total: logs.length };
|
||||
}, [logs]);
|
||||
|
||||
// CSV 导出:仅当前页已加载的数据,避免一次性拉取全量产生巨大请求
|
||||
const handleExportCsv = () => {
|
||||
if (!logs || logs.length === 0) return;
|
||||
const columns = [
|
||||
{
|
||||
key: 'submit_time',
|
||||
title: t('提交时间'),
|
||||
format: (r) => formatTimestampForCsv(r.submit_time),
|
||||
},
|
||||
{
|
||||
key: 'finish_time',
|
||||
title: t('结束时间'),
|
||||
format: (r) => formatTimestampForCsv(r.finish_time),
|
||||
},
|
||||
{
|
||||
key: 'duration',
|
||||
title: t('耗时(秒)'),
|
||||
format: (r) =>
|
||||
r.submit_time && r.finish_time ? r.finish_time - r.submit_time : '',
|
||||
},
|
||||
...(isAdminUser
|
||||
? [
|
||||
{ key: 'channel_id', title: t('渠道ID') },
|
||||
{ key: 'channel_name', title: t('渠道名称') },
|
||||
]
|
||||
: []),
|
||||
{ key: 'platform', title: t('平台') },
|
||||
{ key: 'action', title: t('类型') },
|
||||
{
|
||||
key: 'model',
|
||||
title: t('模型'),
|
||||
format: (r) =>
|
||||
r.properties?.origin_model_name ||
|
||||
r.properties?.upstream_model_name ||
|
||||
'',
|
||||
},
|
||||
{ key: 'task_id', title: t('任务ID') },
|
||||
{ key: 'status', title: t('状态') },
|
||||
{ key: 'progress', title: t('进度') },
|
||||
{ key: 'quota', title: t('费用'), format: (r) => r.quota || '' },
|
||||
{ key: 'fail_reason', title: t('详情') },
|
||||
];
|
||||
const ts = formatTimestampForCsv(Math.floor(Date.now() / 1000)).replace(
|
||||
/[: ]/g,
|
||||
'-',
|
||||
);
|
||||
exportToCsv(columns, logs, `task-logs-${ts}.csv`);
|
||||
};
|
||||
const TaskLogsActions = ({
|
||||
t,
|
||||
logs = [],
|
||||
isAdminUser,
|
||||
usageRecordMode = false,
|
||||
}) => {
|
||||
const exportButtonClass =
|
||||
'hover:!bg-gray-100 dark:hover:!bg-neutral-800 !transition-all !duration-300';
|
||||
|
||||
// 计算任务统计
|
||||
const stats = useTaskPageStats(logs);
|
||||
|
||||
const handleExportCsv = () => exportTaskLogsPageCsv(logs, isAdminUser, t);
|
||||
|
||||
const StatBadge = ({ icon: Icon, label, value, gradient, iconBg }) => (
|
||||
<div className='relative group'>
|
||||
@@ -139,6 +142,26 @@ const TaskLogsActions = ({
|
||||
</div>
|
||||
);
|
||||
|
||||
// 个人端使用记录:原型为三张本页统计卡;导出本页移至“任务记录”表格卡标题栏
|
||||
if (usageRecordMode) {
|
||||
return (
|
||||
<div className='usage-record-task-stats'>
|
||||
<div className='usage-record-task-stat is-success'>
|
||||
<span>{t('本页成功')}</span>
|
||||
<strong>{stats.successCount}</strong>
|
||||
</div>
|
||||
<div className='usage-record-task-stat is-failure'>
|
||||
<span>{t('本页失败')}</span>
|
||||
<strong>{stats.failureCount}</strong>
|
||||
</div>
|
||||
<div className='usage-record-task-stat is-pending'>
|
||||
<span>{t('本页进行中')}</span>
|
||||
<strong>{stats.pendingCount}</strong>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='flex flex-col lg:flex-row justify-between items-start lg:items-center gap-4 w-full'>
|
||||
{/* 左侧:标题和统计 */}
|
||||
@@ -202,7 +225,7 @@ const TaskLogsActions = ({
|
||||
{/* 导出当前页为 CSV,空列表时禁用避免生成只有表头的无用文件 */}
|
||||
<Button
|
||||
size='small'
|
||||
icon={<ExportIcon className='w-3.5 h-3.5' />}
|
||||
icon={<Download className='w-3.5 h-3.5' />}
|
||||
onClick={handleExportCsv}
|
||||
disabled={!logs || logs.length === 0}
|
||||
className={exportButtonClass}
|
||||
|
||||
@@ -18,7 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Progress, Tooltip, Typography } from '@douyinfe/semi-ui';
|
||||
import { Tag as AntTag } from 'antd';
|
||||
import { Progress, Tooltip, Typography } from '@/components/ui';
|
||||
import {
|
||||
Music,
|
||||
FileText,
|
||||
@@ -286,6 +287,142 @@ const renderStatus = (type, t) => {
|
||||
);
|
||||
};
|
||||
|
||||
// ---- 使用记录(个人端)呈现:原型为 Ant Design 预设无边框标签、两行时间与纯文本 ----
|
||||
const RECORD_STATUS_COLORS = {
|
||||
SUCCESS: 'success',
|
||||
FAILURE: 'error',
|
||||
IN_PROGRESS: 'processing',
|
||||
SUBMITTED: 'warning',
|
||||
QUEUED: 'warning',
|
||||
};
|
||||
|
||||
const recordTagFrom = (node, color) =>
|
||||
node?.props?.label !== undefined ? (
|
||||
<AntTag bordered={false} color={color}>
|
||||
{node.props.label}
|
||||
</AntTag>
|
||||
) : (
|
||||
node
|
||||
);
|
||||
|
||||
const renderRecordTimestamp = (timestampInSeconds) => {
|
||||
const date = new Date(timestampInSeconds * 1000);
|
||||
const pad = (value) => ('0' + value).slice(-2);
|
||||
return (
|
||||
<div className='usage-record-time'>
|
||||
<span>{`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`}</span>
|
||||
<strong>{`${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`}</strong>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
// 仅替换展示,不改变列条件、复制/弹窗回调与数据来源
|
||||
const applyTaskRecordPresentation = (columns, { COLUMN_KEYS }) =>
|
||||
columns.map((column) => {
|
||||
const unwrap = (text, record, index) => {
|
||||
const node = column.render(text, record, index);
|
||||
return node?.type === 'div' ? node.props.children : node;
|
||||
};
|
||||
switch (column.key) {
|
||||
case COLUMN_KEYS.SUBMIT_TIME:
|
||||
case COLUMN_KEYS.FINISH_TIME:
|
||||
return {
|
||||
...column,
|
||||
render: (text) => (text ? renderRecordTimestamp(text) : '-'),
|
||||
};
|
||||
case COLUMN_KEYS.DURATION:
|
||||
return {
|
||||
...column,
|
||||
render: (finish, record) =>
|
||||
finish && record.submit_time
|
||||
? `${finish - record.submit_time} 秒`
|
||||
: '-',
|
||||
};
|
||||
case COLUMN_KEYS.CHANNEL:
|
||||
return {
|
||||
...column,
|
||||
render: (text, record, index) => {
|
||||
const node = column.render(text, record, index);
|
||||
if (!node) return null;
|
||||
return (
|
||||
<Tooltip content={record.channel_name || text}>
|
||||
<span
|
||||
className='usage-record-copy-text'
|
||||
onClick={node.props.children.props.onClick}
|
||||
>
|
||||
<AntTag bordered={false}>{text}</AntTag>
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
};
|
||||
case COLUMN_KEYS.PLATFORM:
|
||||
return {
|
||||
...column,
|
||||
render: (text, record, index) =>
|
||||
unwrap(text, record, index)?.props?.label ?? '-',
|
||||
};
|
||||
case COLUMN_KEYS.TYPE:
|
||||
return {
|
||||
...column,
|
||||
render: (text, record, index) =>
|
||||
recordTagFrom(unwrap(text, record, index), 'blue'),
|
||||
};
|
||||
case COLUMN_KEYS.MODEL:
|
||||
return {
|
||||
...column,
|
||||
render: (properties, record, index) => {
|
||||
const modelName =
|
||||
properties?.origin_model_name ||
|
||||
properties?.upstream_model_name ||
|
||||
'';
|
||||
if (!modelName) return '-';
|
||||
const node = column.render(properties, record, index);
|
||||
return (
|
||||
<Tooltip content={modelName}>
|
||||
<span
|
||||
className='usage-record-model usage-record-copy-text'
|
||||
onClick={node.props.children.props.onClick}
|
||||
>
|
||||
{modelName}
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
};
|
||||
case COLUMN_KEYS.TASK_ID:
|
||||
return {
|
||||
...column,
|
||||
render: (text, record, index) => (
|
||||
<span className='usage-record-mono'>
|
||||
{column.render(text, record, index)}
|
||||
</span>
|
||||
),
|
||||
};
|
||||
case COLUMN_KEYS.TASK_STATUS:
|
||||
return {
|
||||
...column,
|
||||
render: (text, record, index) =>
|
||||
recordTagFrom(
|
||||
unwrap(text, record, index),
|
||||
RECORD_STATUS_COLORS[text],
|
||||
),
|
||||
};
|
||||
case COLUMN_KEYS.QUOTA:
|
||||
return {
|
||||
...column,
|
||||
render: (quota) =>
|
||||
quota === undefined || quota === null || quota === 0 ? (
|
||||
'-'
|
||||
) : (
|
||||
<span className='usage-record-cost'>{renderQuota(quota, 6)}</span>
|
||||
),
|
||||
};
|
||||
default:
|
||||
return column;
|
||||
}
|
||||
});
|
||||
|
||||
export const getTaskLogsColumns = ({
|
||||
t,
|
||||
COLUMN_KEYS,
|
||||
@@ -293,8 +430,9 @@ export const getTaskLogsColumns = ({
|
||||
openContentModal,
|
||||
isAdminUser,
|
||||
openVideoModal,
|
||||
usageRecordMode = false,
|
||||
}) => {
|
||||
return [
|
||||
const columns = [
|
||||
{
|
||||
key: COLUMN_KEYS.SUBMIT_TIME,
|
||||
title: t('提交时间'),
|
||||
@@ -429,8 +567,10 @@ export const getTaskLogsColumns = ({
|
||||
<Progress
|
||||
stroke={
|
||||
isFailure
|
||||
? 'var(--semi-color-warning)'
|
||||
: 'var(--semi-color-primary)'
|
||||
? 'var(--ui-color-warning)'
|
||||
: usageRecordMode && percent >= 100
|
||||
? 'var(--ur-progress-done)'
|
||||
: 'var(--ui-color-primary)'
|
||||
}
|
||||
percent={percent}
|
||||
showInfo={true}
|
||||
@@ -485,7 +625,11 @@ export const getTaskLogsColumns = ({
|
||||
e.preventDefault();
|
||||
openVideoModal(videoUrl, text);
|
||||
}}
|
||||
className='inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-gradient-to-r from-blue-500 to-brand-to text-white hover:from-blue-600 hover:to-brand-to transition-all duration-300 shadow-sm hover:shadow-md'
|
||||
className={
|
||||
usageRecordMode
|
||||
? 'usage-record-link'
|
||||
: 'inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-gradient-to-r from-blue-500 to-brand-to text-white hover:from-blue-600 hover:to-brand-to transition-all duration-300 shadow-sm hover:shadow-md'
|
||||
}
|
||||
>
|
||||
<Video className='w-3.5 h-3.5' />
|
||||
{t('点击预览视频')}
|
||||
@@ -516,4 +660,7 @@ export const getTaskLogsColumns = ({
|
||||
},
|
||||
},
|
||||
];
|
||||
return usageRecordMode
|
||||
? applyTaskRecordPresentation(columns, { COLUMN_KEYS })
|
||||
: columns;
|
||||
};
|
||||
|
||||
@@ -18,17 +18,14 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button, Form } from '@douyinfe/semi-ui';
|
||||
import { Button, Form } from '@/components/ui';
|
||||
import {
|
||||
Calendar,
|
||||
Hash,
|
||||
Radio,
|
||||
RefreshCcw,
|
||||
RotateCcw,
|
||||
Search,
|
||||
SearchCheck,
|
||||
Settings2,
|
||||
SlidersHorizontal,
|
||||
Filter,
|
||||
Activity,
|
||||
Layers,
|
||||
@@ -56,15 +53,13 @@ const TaskLogsFilters = ({
|
||||
usageRecordMode = false,
|
||||
t,
|
||||
}) => {
|
||||
const SearchIcon = usageRecordMode ? SearchCheck : Search;
|
||||
const ResetIcon = usageRecordMode ? RefreshCcw : RotateCcw;
|
||||
const ColumnsIcon = usageRecordMode ? SlidersHorizontal : Settings2;
|
||||
const primaryButtonClass = usageRecordMode
|
||||
? 'usage-record-action-button usage-record-action-button-primary'
|
||||
: '!bg-gradient-to-r !from-cyan-500 !to-blue-600 !border-0 hover:!from-cyan-600 hover:!to-blue-700 !shadow-md hover:!shadow-lg !transition-all !duration-300';
|
||||
const softButtonClass = usageRecordMode
|
||||
? 'usage-record-action-button usage-record-action-button-soft'
|
||||
: 'hover:!bg-gray-100 dark:hover:!bg-neutral-800 !transition-all !duration-300';
|
||||
const SearchIcon = Search;
|
||||
const ResetIcon = RotateCcw;
|
||||
const ColumnsIcon = Settings2;
|
||||
const primaryButtonClass =
|
||||
'!bg-gradient-to-r !from-cyan-500 !to-blue-600 !border-0 hover:!from-cyan-600 hover:!to-blue-700 !shadow-md hover:!shadow-lg !transition-all !duration-300';
|
||||
const softButtonClass =
|
||||
'hover:!bg-gray-100 dark:hover:!bg-neutral-800 !transition-all !duration-300';
|
||||
|
||||
// 自定义输入框前缀样式
|
||||
const InputPrefix = ({ icon: Icon }) => (
|
||||
@@ -73,6 +68,182 @@ const TaskLogsFilters = ({
|
||||
</div>
|
||||
);
|
||||
|
||||
const resetFilters = () => {
|
||||
if (formApi) {
|
||||
// 使用最新的"此刻"值重置,而不是 formApi.reset()(后者恢复挂载时的旧 dateRange,跨日 bug)
|
||||
const fresh =
|
||||
typeof getFreshInitValues === 'function'
|
||||
? getFreshInitValues()
|
||||
: formInitValues;
|
||||
formApi.setValues(fresh, { isOverride: true });
|
||||
setTimeout(() => {
|
||||
refresh();
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
// 用户 ID 仅允许数字:键入过滤与粘贴清洗(两种布局共用)
|
||||
const digitsOnlyKeyDown = (e) => {
|
||||
if (
|
||||
[
|
||||
'Backspace',
|
||||
'Delete',
|
||||
'Tab',
|
||||
'Escape',
|
||||
'Enter',
|
||||
'ArrowLeft',
|
||||
'ArrowRight',
|
||||
'ArrowUp',
|
||||
'ArrowDown',
|
||||
'Home',
|
||||
'End',
|
||||
].includes(e.key)
|
||||
)
|
||||
return;
|
||||
if (
|
||||
(e.ctrlKey || e.metaKey) &&
|
||||
['a', 'c', 'v', 'x', 'z'].includes(e.key.toLowerCase())
|
||||
)
|
||||
return;
|
||||
if (!/^\d$/.test(e.key)) e.preventDefault();
|
||||
};
|
||||
const digitsOnlyPaste = (e) => {
|
||||
const paste = (e.clipboardData || window.clipboardData).getData('text');
|
||||
if (!/^\d+$/.test(paste)) {
|
||||
e.preventDefault();
|
||||
const digits = paste.replace(/\D/g, '');
|
||||
if (digits && formApi) {
|
||||
formApi.setValue('user_id', digits);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const datePresets = DATE_RANGE_PRESETS.map((preset) => ({
|
||||
text: t(preset.text),
|
||||
start: preset.start(),
|
||||
end: preset.end(),
|
||||
}));
|
||||
|
||||
const statusOptions = (
|
||||
<>
|
||||
<Form.Select.Option value=''>{t('全部状态')}</Form.Select.Option>
|
||||
<Form.Select.Option value='SUBMITTED'>{t('队列中')}</Form.Select.Option>
|
||||
<Form.Select.Option value='QUEUED'>{t('排队中')}</Form.Select.Option>
|
||||
<Form.Select.Option value='IN_PROGRESS'>{t('执行中')}</Form.Select.Option>
|
||||
<Form.Select.Option value='SUCCESS'>{t('成功')}</Form.Select.Option>
|
||||
<Form.Select.Option value='FAILURE'>{t('失败')}</Form.Select.Option>
|
||||
<Form.Select.Option value='NOT_START'>{t('未启动')}</Form.Select.Option>
|
||||
<Form.Select.Option value='UNKNOWN'>{t('未知')}</Form.Select.Option>
|
||||
</>
|
||||
);
|
||||
|
||||
const actionOptions = (
|
||||
<>
|
||||
<Form.Select.Option value=''>{t('全部类型')}</Form.Select.Option>
|
||||
<Form.Select.Option value='MUSIC'>{t('生成音乐')}</Form.Select.Option>
|
||||
<Form.Select.Option value='LYRICS'>{t('生成歌词')}</Form.Select.Option>
|
||||
<Form.Select.Option value={IMAGE_ACTION_GENERATE}>
|
||||
{t('文生图')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value={IMAGE_ACTION_EDIT}>
|
||||
{t('图像编辑')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value={TASK_ACTION_GENERATE}>
|
||||
{t('图生视频')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value={TASK_ACTION_TEXT_GENERATE}>
|
||||
{t('文生视频')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value={TASK_ACTION_FIRST_TAIL_GENERATE}>
|
||||
{t('首尾生视频')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value={TASK_ACTION_REFERENCE_GENERATE}>
|
||||
{t('参照生视频')}
|
||||
</Form.Select.Option>
|
||||
</>
|
||||
);
|
||||
|
||||
// 个人端使用记录:原型为带字段标签的五列筛选卡,重置/搜索位于右下;列设置移至表格卡片标题栏
|
||||
if (usageRecordMode) {
|
||||
return (
|
||||
<Form
|
||||
initValues={formInitValues}
|
||||
getFormApi={(api) => setFormApi(api)}
|
||||
onSubmit={refresh}
|
||||
allowEmpty={true}
|
||||
autoComplete='off'
|
||||
layout='vertical'
|
||||
trigger='change'
|
||||
stopValidateWithError={false}
|
||||
className='usage-record-filter-form'
|
||||
>
|
||||
<div className='usage-record-filter-grid'>
|
||||
<Form.DatePicker
|
||||
field='dateRange'
|
||||
label={t('时间范围')}
|
||||
className='usage-record-filter-wide'
|
||||
type='dateTimeRange'
|
||||
placeholder={[t('开始时间'), t('结束时间')]}
|
||||
showClear
|
||||
presets={datePresets}
|
||||
/>
|
||||
<Form.Input
|
||||
field='task_id'
|
||||
label={t('任务 ID')}
|
||||
placeholder={t('请输入任务 ID')}
|
||||
showClear
|
||||
/>
|
||||
<Form.Select
|
||||
field='status'
|
||||
label={t('状态')}
|
||||
placeholder={t('全部状态')}
|
||||
showClear
|
||||
>
|
||||
{statusOptions}
|
||||
</Form.Select>
|
||||
<Form.Select
|
||||
field='action'
|
||||
label={t('类型')}
|
||||
placeholder={t('全部类型')}
|
||||
showClear
|
||||
>
|
||||
{actionOptions}
|
||||
</Form.Select>
|
||||
{isAdminUser && (
|
||||
<Form.Input
|
||||
field='channel_id'
|
||||
label={t('渠道 ID')}
|
||||
placeholder={t('请输入渠道 ID')}
|
||||
showClear
|
||||
/>
|
||||
)}
|
||||
{isAdminUser && (
|
||||
<Form.Input
|
||||
field='user_id'
|
||||
label={t('用户 ID')}
|
||||
placeholder={t('请输入用户 ID')}
|
||||
showClear
|
||||
inputMode='numeric'
|
||||
onKeyDown={digitsOnlyKeyDown}
|
||||
onPaste={digitsOnlyPaste}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className='usage-record-filter-actions'>
|
||||
<Button onClick={resetFilters}>{t('重置')}</Button>
|
||||
<Button
|
||||
type='primary'
|
||||
htmlType='submit'
|
||||
loading={loading}
|
||||
icon={<Search size={14} />}
|
||||
>
|
||||
{t('搜索')}
|
||||
</Button>
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Form
|
||||
initValues={formInitValues}
|
||||
@@ -83,7 +254,6 @@ const TaskLogsFilters = ({
|
||||
layout='vertical'
|
||||
trigger='change'
|
||||
stopValidateWithError={false}
|
||||
className={usageRecordMode ? 'usage-record-filter-form' : undefined}
|
||||
>
|
||||
<div className='flex flex-col gap-4'>
|
||||
{/* 筛选区域标题 */}
|
||||
@@ -112,11 +282,7 @@ const TaskLogsFilters = ({
|
||||
pure
|
||||
size='small'
|
||||
prefix={<InputPrefix icon={Calendar} />}
|
||||
presets={DATE_RANGE_PRESETS.map((preset) => ({
|
||||
text: t(preset.text),
|
||||
start: preset.start(),
|
||||
end: preset.end(),
|
||||
}))}
|
||||
presets={datePresets}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -150,30 +316,7 @@ const TaskLogsFilters = ({
|
||||
pure
|
||||
size='small'
|
||||
>
|
||||
<Form.Select.Option value=''>
|
||||
{t('全部状态')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value='SUBMITTED'>
|
||||
{t('队列中')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value='QUEUED'>
|
||||
{t('排队中')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value='IN_PROGRESS'>
|
||||
{t('执行中')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value='SUCCESS'>
|
||||
{t('成功')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value='FAILURE'>
|
||||
{t('失败')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value='NOT_START'>
|
||||
{t('未启动')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value='UNKNOWN'>
|
||||
{t('未知')}
|
||||
</Form.Select.Option>
|
||||
{statusOptions}
|
||||
</Form.Select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -191,33 +334,7 @@ const TaskLogsFilters = ({
|
||||
pure
|
||||
size='small'
|
||||
>
|
||||
<Form.Select.Option value=''>
|
||||
{t('全部类型')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value='MUSIC'>
|
||||
{t('生成音乐')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value='LYRICS'>
|
||||
{t('生成歌词')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value={IMAGE_ACTION_GENERATE}>
|
||||
{t('文生图')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value={IMAGE_ACTION_EDIT}>
|
||||
{t('图像编辑')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value={TASK_ACTION_GENERATE}>
|
||||
{t('图生视频')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value={TASK_ACTION_TEXT_GENERATE}>
|
||||
{t('文生视频')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value={TASK_ACTION_FIRST_TAIL_GENERATE}>
|
||||
{t('首尾生视频')}
|
||||
</Form.Select.Option>
|
||||
<Form.Select.Option value={TASK_ACTION_REFERENCE_GENERATE}>
|
||||
{t('参照生视频')}
|
||||
</Form.Select.Option>
|
||||
{actionOptions}
|
||||
</Form.Select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -252,42 +369,8 @@ const TaskLogsFilters = ({
|
||||
pure
|
||||
size='small'
|
||||
inputMode='numeric'
|
||||
onKeyDown={(e) => {
|
||||
if (
|
||||
[
|
||||
'Backspace',
|
||||
'Delete',
|
||||
'Tab',
|
||||
'Escape',
|
||||
'Enter',
|
||||
'ArrowLeft',
|
||||
'ArrowRight',
|
||||
'ArrowUp',
|
||||
'ArrowDown',
|
||||
'Home',
|
||||
'End',
|
||||
].includes(e.key)
|
||||
)
|
||||
return;
|
||||
if (
|
||||
(e.ctrlKey || e.metaKey) &&
|
||||
['a', 'c', 'v', 'x', 'z'].includes(e.key.toLowerCase())
|
||||
)
|
||||
return;
|
||||
if (!/^\d$/.test(e.key)) e.preventDefault();
|
||||
}}
|
||||
onPaste={(e) => {
|
||||
const paste = (
|
||||
e.clipboardData || window.clipboardData
|
||||
).getData('text');
|
||||
if (!/^\d+$/.test(paste)) {
|
||||
e.preventDefault();
|
||||
const digits = paste.replace(/\D/g, '');
|
||||
if (digits && formApi) {
|
||||
formApi.setValue('user_id', digits);
|
||||
}
|
||||
}
|
||||
}}
|
||||
onKeyDown={digitsOnlyKeyDown}
|
||||
onPaste={digitsOnlyPaste}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -305,7 +388,7 @@ const TaskLogsFilters = ({
|
||||
loading={loading}
|
||||
size='small'
|
||||
className={primaryButtonClass}
|
||||
style={usageRecordMode ? undefined : { color: '#ffffff' }}
|
||||
style={{ color: '#ffffff' }}
|
||||
icon={
|
||||
<SearchIcon
|
||||
className='w-3.5 h-3.5'
|
||||
@@ -319,19 +402,7 @@ const TaskLogsFilters = ({
|
||||
{/* 重置按钮 */}
|
||||
<Button
|
||||
type='tertiary'
|
||||
onClick={() => {
|
||||
if (formApi) {
|
||||
// 使用最新的"此刻"值重置,而不是 formApi.reset()(后者恢复挂载时的旧 dateRange,跨日 bug)
|
||||
const fresh =
|
||||
typeof getFreshInitValues === 'function'
|
||||
? getFreshInitValues()
|
||||
: formInitValues;
|
||||
formApi.setValues(fresh, { isOverride: true });
|
||||
setTimeout(() => {
|
||||
refresh();
|
||||
}, 100);
|
||||
}
|
||||
}}
|
||||
onClick={resetFilters}
|
||||
size='small'
|
||||
icon={<ResetIcon className='w-3.5 h-3.5' />}
|
||||
className={softButtonClass}
|
||||
|
||||
@@ -18,7 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
import { Empty } from '@douyinfe/semi-ui';
|
||||
import { Empty as AntEmpty } from 'antd';
|
||||
import { Empty } from '@/components/ui';
|
||||
import CardTable from '../../common/ui/CardTable';
|
||||
import {
|
||||
IllustrationNoResult,
|
||||
@@ -43,6 +44,7 @@ const TaskLogsTable = (taskLogsData) => {
|
||||
isAdminUser,
|
||||
t,
|
||||
COLUMN_KEYS,
|
||||
usageRecordMode = false,
|
||||
} = taskLogsData;
|
||||
|
||||
// Get all columns
|
||||
@@ -54,8 +56,17 @@ const TaskLogsTable = (taskLogsData) => {
|
||||
openContentModal,
|
||||
openVideoModal,
|
||||
isAdminUser,
|
||||
usageRecordMode,
|
||||
});
|
||||
}, [t, COLUMN_KEYS, copyText, openContentModal, openVideoModal, isAdminUser]);
|
||||
}, [
|
||||
t,
|
||||
COLUMN_KEYS,
|
||||
copyText,
|
||||
openContentModal,
|
||||
openVideoModal,
|
||||
isAdminUser,
|
||||
usageRecordMode,
|
||||
]);
|
||||
|
||||
// Filter columns based on visibility settings
|
||||
const getVisibleColumns = () => {
|
||||
@@ -79,27 +90,47 @@ const TaskLogsTable = (taskLogsData) => {
|
||||
rowKey='key'
|
||||
loading={loading}
|
||||
scroll={compactMode ? undefined : { x: 'max-content' }}
|
||||
className='rounded-xl overflow-hidden task-logs-table'
|
||||
className={
|
||||
usageRecordMode
|
||||
? 'task-logs-table usage-record-table'
|
||||
: 'rounded-xl overflow-hidden task-logs-table'
|
||||
}
|
||||
size='middle'
|
||||
empty={
|
||||
<div className='py-12'>
|
||||
<Empty
|
||||
image={<IllustrationNoResult style={{ width: 180, height: 180 }} />}
|
||||
darkModeImage={
|
||||
<IllustrationNoResultDark style={{ width: 180, height: 180 }} />
|
||||
}
|
||||
usageRecordMode ? (
|
||||
<AntEmpty
|
||||
image={AntEmpty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={
|
||||
<div className='flex flex-col items-center gap-2'>
|
||||
<span className='text-gray-500 dark:text-gray-400 text-sm'>
|
||||
{t('搜索无结果')}
|
||||
</span>
|
||||
<span className='text-gray-400 dark:text-gray-500 text-xs'>
|
||||
<>
|
||||
<div>{t('搜索无结果')}</div>
|
||||
<div className='usage-record-empty-hint'>
|
||||
{t('暂无任务记录')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className='py-12'>
|
||||
<Empty
|
||||
image={
|
||||
<IllustrationNoResult style={{ width: 180, height: 180 }} />
|
||||
}
|
||||
darkModeImage={
|
||||
<IllustrationNoResultDark style={{ width: 180, height: 180 }} />
|
||||
}
|
||||
description={
|
||||
<div className='flex flex-col items-center gap-2'>
|
||||
<span className='text-gray-500 dark:text-gray-400 text-sm'>
|
||||
{t('搜索无结果')}
|
||||
</span>
|
||||
<span className='text-gray-400 dark:text-gray-500 text-xs'>
|
||||
{t('暂无任务记录')}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
pagination={{
|
||||
currentPage: activePage,
|
||||
|
||||
@@ -17,10 +17,16 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { Card, Tag as AntTag } from 'antd';
|
||||
import { Clock, Download, Settings } from 'lucide-react';
|
||||
import { Button, Pagination, Tooltip } from '@/components/ui';
|
||||
import CardPro from '../../common/ui/CardPro';
|
||||
import TaskLogsTable from './TaskLogsTable';
|
||||
import TaskLogsActions from './TaskLogsActions';
|
||||
import TaskLogsActions, {
|
||||
exportTaskLogsPageCsv,
|
||||
useTaskPageStats,
|
||||
} from './TaskLogsActions';
|
||||
import TaskLogsFilters from './TaskLogsFilters';
|
||||
import ColumnSelectorModal from './modals/ColumnSelectorModal';
|
||||
import ContentModal from './modals/ContentModal';
|
||||
@@ -31,6 +37,102 @@ import { createCardProPagination } from '../../../helpers/utils';
|
||||
const TaskLogsPage = ({ usageRecordMode = false }) => {
|
||||
const taskLogsData = useTaskLogsData();
|
||||
const isMobile = useIsMobile();
|
||||
// 与 CardPro 一致:移动端默认收起筛选区,仅视图状态
|
||||
const [showMobileFilters, setShowMobileFilters] = useState(false);
|
||||
const pageStats = useTaskPageStats(taskLogsData.logs);
|
||||
|
||||
if (usageRecordMode) {
|
||||
const { t, logs, isAdminUser } = taskLogsData;
|
||||
return (
|
||||
<>
|
||||
<ColumnSelectorModal {...taskLogsData} />
|
||||
<ContentModal {...taskLogsData} isVideo={false} />
|
||||
{/* 视频预览弹窗 */}
|
||||
<ContentModal
|
||||
isModalOpen={taskLogsData.isVideoModalOpen}
|
||||
setIsModalOpen={taskLogsData.setIsVideoModalOpen}
|
||||
modalContent={taskLogsData.videoUrl}
|
||||
sourceUrl={taskLogsData.videoSourceUrl}
|
||||
isVideo={true}
|
||||
/>
|
||||
|
||||
<div className='usage-record-panels'>
|
||||
<TaskLogsActions {...taskLogsData} usageRecordMode />
|
||||
|
||||
<Card className='usage-record-card usage-record-filter-card'>
|
||||
{isMobile && (
|
||||
<Button
|
||||
block
|
||||
className='usage-record-mobile-toggle'
|
||||
onClick={() => setShowMobileFilters(!showMobileFilters)}
|
||||
>
|
||||
{showMobileFilters ? t('隐藏操作项') : t('显示操作项')}
|
||||
</Button>
|
||||
)}
|
||||
<div hidden={isMobile && !showMobileFilters}>
|
||||
<TaskLogsFilters {...taskLogsData} usageRecordMode />
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card className='usage-record-card usage-record-table-card'>
|
||||
<div className='usage-record-table-head'>
|
||||
<h3>{t('任务记录')}</h3>
|
||||
<div className='usage-record-table-actions'>
|
||||
{/* 只有真实存在进行中任务时才显示,避免误导 */}
|
||||
{pageStats.pendingCount > 0 && (
|
||||
<AntTag
|
||||
bordered={false}
|
||||
color='processing'
|
||||
icon={<Clock size={12} />}
|
||||
>
|
||||
{t('实时更新中')}
|
||||
</AntTag>
|
||||
)}
|
||||
{/* 导出当前页为 CSV,空列表时禁用避免生成只有表头的无用文件 */}
|
||||
<Button
|
||||
icon={<Download size={14} />}
|
||||
onClick={() => exportTaskLogsPageCsv(logs, isAdminUser, t)}
|
||||
disabled={!logs || logs.length === 0}
|
||||
>
|
||||
{t('导出本页')}
|
||||
</Button>
|
||||
<Tooltip content={t('列设置')}>
|
||||
<Button
|
||||
theme='borderless'
|
||||
aria-label={t('列设置')}
|
||||
icon={<Settings size={16} />}
|
||||
onClick={() => taskLogsData.setShowColumnSelector(true)}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
<TaskLogsTable
|
||||
{...taskLogsData}
|
||||
compactMode={false}
|
||||
usageRecordMode
|
||||
/>
|
||||
{taskLogsData.logCount > 0 && (
|
||||
<div className='usage-record-pagination'>
|
||||
<Pagination
|
||||
currentPage={taskLogsData.activePage}
|
||||
pageSize={taskLogsData.pageSize}
|
||||
total={taskLogsData.logCount}
|
||||
pageSizeOpts={[10, 20, 50, 100]}
|
||||
showSizeChanger
|
||||
onPageSizeChange={taskLogsData.handlePageSizeChange}
|
||||
onPageChange={taskLogsData.handlePageChange}
|
||||
preventPageChangeOnPageSizeChange={false}
|
||||
size='small'
|
||||
showQuickJumper={isMobile}
|
||||
showTotal={(total) => t('共 {{total}} 条', { total })}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='relative'>
|
||||
@@ -47,15 +149,8 @@ const TaskLogsPage = ({ usageRecordMode = false }) => {
|
||||
/>
|
||||
|
||||
{/* Modals */}
|
||||
<ColumnSelectorModal
|
||||
{...taskLogsData}
|
||||
usageRecordMode={usageRecordMode}
|
||||
/>
|
||||
<ContentModal
|
||||
{...taskLogsData}
|
||||
isVideo={false}
|
||||
usageRecordMode={usageRecordMode}
|
||||
/>
|
||||
<ColumnSelectorModal {...taskLogsData} />
|
||||
<ContentModal {...taskLogsData} isVideo={false} />
|
||||
{/* 视频预览弹窗 */}
|
||||
<ContentModal
|
||||
isModalOpen={taskLogsData.isVideoModalOpen}
|
||||
@@ -63,7 +158,6 @@ const TaskLogsPage = ({ usageRecordMode = false }) => {
|
||||
modalContent={taskLogsData.videoUrl}
|
||||
sourceUrl={taskLogsData.videoSourceUrl}
|
||||
isVideo={true}
|
||||
usageRecordMode={usageRecordMode}
|
||||
/>
|
||||
|
||||
{/* Main Content */}
|
||||
@@ -71,18 +165,9 @@ const TaskLogsPage = ({ usageRecordMode = false }) => {
|
||||
type='type2'
|
||||
className='!bg-transparent !border-0 !shadow-none relative'
|
||||
statsArea={
|
||||
<TaskLogsActions
|
||||
{...taskLogsData}
|
||||
logs={taskLogsData.logs}
|
||||
usageRecordMode={usageRecordMode}
|
||||
/>
|
||||
}
|
||||
searchArea={
|
||||
<TaskLogsFilters
|
||||
{...taskLogsData}
|
||||
usageRecordMode={usageRecordMode}
|
||||
/>
|
||||
<TaskLogsActions {...taskLogsData} logs={taskLogsData.logs} />
|
||||
}
|
||||
searchArea={<TaskLogsFilters {...taskLogsData} />}
|
||||
paginationArea={createCardProPagination({
|
||||
currentPage: taskLogsData.activePage,
|
||||
pageSize: taskLogsData.pageSize,
|
||||
@@ -103,7 +188,7 @@ const TaskLogsPage = ({ usageRecordMode = false }) => {
|
||||
<div className='relative app-card overflow-hidden'>
|
||||
<TaskLogsTable
|
||||
{...taskLogsData}
|
||||
compactMode={usageRecordMode ? false : taskLogsData.compactMode}
|
||||
compactMode={taskLogsData.compactMode}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,8 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Modal, Button, Checkbox } from '@douyinfe/semi-ui';
|
||||
import { Check, RefreshCcw, X } from 'lucide-react';
|
||||
import { Modal, Button, Checkbox } from '@/components/ui';
|
||||
import { getTaskLogsColumns } from '../TaskLogsColumnDefs';
|
||||
|
||||
const ColumnSelectorModal = ({
|
||||
@@ -33,7 +32,6 @@ const ColumnSelectorModal = ({
|
||||
isAdminUser,
|
||||
copyText,
|
||||
openContentModal,
|
||||
usageRecordMode = false,
|
||||
t,
|
||||
}) => {
|
||||
// Get all columns for display in selector
|
||||
@@ -62,48 +60,11 @@ const ColumnSelectorModal = ({
|
||||
onCancel={() => setShowColumnSelector(false)}
|
||||
footer={
|
||||
<div className='flex justify-end gap-2'>
|
||||
<Button
|
||||
size={usageRecordMode ? 'small' : undefined}
|
||||
icon={
|
||||
usageRecordMode ? (
|
||||
<RefreshCcw className='w-3.5 h-3.5' />
|
||||
) : undefined
|
||||
}
|
||||
onClick={() => initDefaultColumns()}
|
||||
className={
|
||||
usageRecordMode
|
||||
? 'usage-record-action-button usage-record-action-button-soft'
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{t('重置')}
|
||||
</Button>
|
||||
<Button
|
||||
size={usageRecordMode ? 'small' : undefined}
|
||||
icon={usageRecordMode ? <X className='w-3.5 h-3.5' /> : undefined}
|
||||
onClick={() => setShowColumnSelector(false)}
|
||||
className={
|
||||
usageRecordMode
|
||||
? 'usage-record-action-button usage-record-action-button-soft'
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<Button onClick={() => initDefaultColumns()}>{t('重置')}</Button>
|
||||
<Button onClick={() => setShowColumnSelector(false)}>
|
||||
{t('取消')}
|
||||
</Button>
|
||||
<Button
|
||||
size={usageRecordMode ? 'small' : undefined}
|
||||
icon={
|
||||
usageRecordMode ? (
|
||||
<Check className='w-3.5 h-3.5' style={{ color: '#fff' }} />
|
||||
) : undefined
|
||||
}
|
||||
onClick={() => setShowColumnSelector(false)}
|
||||
className={
|
||||
usageRecordMode
|
||||
? 'usage-record-action-button usage-record-action-button-primary'
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<Button onClick={() => setShowColumnSelector(false)}>
|
||||
{t('确定')}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -120,7 +81,7 @@ const ColumnSelectorModal = ({
|
||||
</div>
|
||||
<div
|
||||
className='flex flex-wrap max-h-96 overflow-y-auto rounded-lg p-4'
|
||||
style={{ border: '1px solid var(--semi-color-border)' }}
|
||||
style={{ border: '1px solid var(--ui-color-border)' }}
|
||||
>
|
||||
{allColumns.map((column) => {
|
||||
// Skip admin-only columns for non-admin users
|
||||
|
||||
@@ -18,9 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Modal, Button, Typography, Spin } from '@douyinfe/semi-ui';
|
||||
import { IconExternalOpen, IconCopy } from '@douyinfe/semi-icons';
|
||||
import { Check, Copy, ExternalLink, X } from 'lucide-react';
|
||||
import { Modal, Button, Typography, Spin } from '@/components/ui';
|
||||
import { IconExternalOpen, IconCopy } from '@/components/ui/icons';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const { Text } = Typography;
|
||||
@@ -32,7 +31,6 @@ const ContentModal = ({
|
||||
// 上游原始可分享 URL,用于"复制链接"/"新标签页打开";未传则回落到 modalContent
|
||||
sourceUrl,
|
||||
isVideo,
|
||||
usageRecordMode = false,
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const [videoError, setVideoError] = useState(false);
|
||||
@@ -96,38 +94,13 @@ const ContentModal = ({
|
||||
|
||||
<div style={{ marginTop: '20px' }}>
|
||||
<Button
|
||||
icon={
|
||||
usageRecordMode ? (
|
||||
<ExternalLink className='w-3.5 h-3.5' />
|
||||
) : (
|
||||
<IconExternalOpen />
|
||||
)
|
||||
}
|
||||
icon={<IconExternalOpen />}
|
||||
onClick={handleOpenInNewTab}
|
||||
style={{ marginRight: '8px' }}
|
||||
className={
|
||||
usageRecordMode
|
||||
? 'usage-record-action-button usage-record-action-button-soft'
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{t('在新标签页中打开')}
|
||||
</Button>
|
||||
<Button
|
||||
icon={
|
||||
usageRecordMode ? (
|
||||
<Copy className='w-3.5 h-3.5' />
|
||||
) : (
|
||||
<IconCopy />
|
||||
)
|
||||
}
|
||||
onClick={handleCopyUrl}
|
||||
className={
|
||||
usageRecordMode
|
||||
? 'usage-record-action-button usage-record-action-button-soft'
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<Button icon={<IconCopy />} onClick={handleCopyUrl}>
|
||||
{t('复制链接')}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -136,7 +109,7 @@ const ContentModal = ({
|
||||
style={{
|
||||
marginTop: '16px',
|
||||
padding: '8px',
|
||||
backgroundColor: '#f8f9fa',
|
||||
backgroundColor: 'var(--ui-color-fill-0)',
|
||||
borderRadius: '4px',
|
||||
}}
|
||||
>
|
||||
@@ -185,35 +158,13 @@ const ContentModal = ({
|
||||
justifyContent: 'flex-end',
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
size='small'
|
||||
icon={
|
||||
usageRecordMode ? <Copy className='w-3.5 h-3.5' /> : <IconCopy />
|
||||
}
|
||||
onClick={handleCopyUrl}
|
||||
className={
|
||||
usageRecordMode
|
||||
? 'usage-record-action-button usage-record-action-button-soft'
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<Button size='small' icon={<IconCopy />} onClick={handleCopyUrl}>
|
||||
{t('复制链接')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
icon={
|
||||
usageRecordMode ? (
|
||||
<ExternalLink className='w-3.5 h-3.5' />
|
||||
) : (
|
||||
<IconExternalOpen />
|
||||
)
|
||||
}
|
||||
icon={<IconExternalOpen />}
|
||||
onClick={handleOpenInNewTab}
|
||||
className={
|
||||
usageRecordMode
|
||||
? 'usage-record-action-button usage-record-action-button-soft'
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{t('在新标签页打开')}
|
||||
</Button>
|
||||
@@ -235,24 +186,6 @@ const ContentModal = ({
|
||||
padding: isVideo && videoError ? '0' : '24px',
|
||||
}}
|
||||
width={800}
|
||||
okButtonProps={
|
||||
usageRecordMode
|
||||
? {
|
||||
icon: <Check className='w-3.5 h-3.5' style={{ color: '#fff' }} />,
|
||||
className:
|
||||
'usage-record-action-button usage-record-action-button-primary',
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
cancelButtonProps={
|
||||
usageRecordMode
|
||||
? {
|
||||
icon: <X className='w-3.5 h-3.5' />,
|
||||
className:
|
||||
'usage-record-action-button usage-record-action-button-soft',
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{isVideo ? (
|
||||
renderVideoContent()
|
||||
|
||||
Reference in New Issue
Block a user