🎨 chore(web): apply ESLint and Prettier auto-fixes (baseline)

- Ran: bun run eslint:fix && bun run lint:fix
- Inserted AGPL license header via eslint-plugin-header
- Enforced no-multiple-empty-lines and other lint rules
- Formatted code using Prettier v3 (@so1ve/prettier-config)
- No functional changes; formatting-only baseline across JS/JSX files
This commit is contained in:
t0ng7u
2025-08-30 21:15:10 +08:00
parent 41cf516ec5
commit 0d57b1acd4
274 changed files with 11025 additions and 7659 deletions

View File

@@ -24,15 +24,11 @@ import CompactModeToggle from '../../common/ui/CompactModeToggle';
const { Text } = Typography;
const TaskLogsActions = ({
compactMode,
setCompactMode,
t,
}) => {
const TaskLogsActions = ({ compactMode, setCompactMode, t }) => {
return (
<div className="flex flex-col md:flex-row justify-between items-start md:items-center gap-2 w-full">
<div className="flex items-center text-orange-500 mb-2 md:mb-0">
<IconEyeOpened className="mr-2" />
<div className='flex flex-col md:flex-row justify-between items-start md:items-center gap-2 w-full'>
<div className='flex items-center text-orange-500 mb-2 md:mb-0'>
<IconEyeOpened className='mr-2' />
<Text>{t('任务记录')}</Text>
</div>
<CompactModeToggle
@@ -44,4 +40,4 @@ const TaskLogsActions = ({
);
};
export default TaskLogsActions;
export default TaskLogsActions;

View File

@@ -18,11 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/
import React from 'react';
import {
Progress,
Tag,
Typography
} from '@douyinfe/semi-ui';
import { Progress, Tag, Typography } from '@douyinfe/semi-ui';
import {
Music,
FileText,
@@ -36,9 +32,12 @@ import {
List,
Hash,
Video,
Sparkles
Sparkles,
} from 'lucide-react';
import { TASK_ACTION_GENERATE, TASK_ACTION_TEXT_GENERATE } from '../../../constants/common.constant';
import {
TASK_ACTION_GENERATE,
TASK_ACTION_TEXT_GENERATE,
} from '../../../constants/common.constant';
import { CHANNEL_OPTIONS } from '../../../constants/channel.constants';
const colors = [
@@ -122,7 +121,9 @@ const renderType = (type, t) => {
};
const renderPlatform = (platform, t) => {
let option = CHANNEL_OPTIONS.find(opt => String(opt.value) === String(platform));
let option = CHANNEL_OPTIONS.find(
(opt) => String(opt.value) === String(platform),
);
if (option) {
return (
<Tag color={option.color} shape='circle' prefixIcon={<Video size={14} />}>
@@ -150,7 +151,11 @@ const renderStatus = (type, t) => {
switch (type) {
case 'SUCCESS':
return (
<Tag color='green' shape='circle' prefixIcon={<CheckCircle size={14} />}>
<Tag
color='green'
shape='circle'
prefixIcon={<CheckCircle size={14} />}
>
{t('成功')}
</Tag>
);
@@ -310,23 +315,21 @@ export const getTaskLogsColumns = ({
render: (text, record, index) => {
return (
<div>
{
isNaN(text?.replace('%', '')) ? (
text || '-'
) : (
<Progress
stroke={
record.status === 'FAILURE'
? 'var(--semi-color-warning)'
: null
}
percent={text ? parseInt(text.replace('%', '')) : 0}
showInfo={true}
aria-label='task progress'
style={{ minWidth: '160px' }}
/>
)
}
{isNaN(text?.replace('%', '')) ? (
text || '-'
) : (
<Progress
stroke={
record.status === 'FAILURE'
? 'var(--semi-color-warning)'
: null
}
percent={text ? parseInt(text.replace('%', '')) : 0}
showInfo={true}
aria-label='task progress'
style={{ minWidth: '160px' }}
/>
)}
</div>
);
},
@@ -338,14 +341,16 @@ export const getTaskLogsColumns = ({
fixed: 'right',
render: (text, record, index) => {
// 仅当为视频生成任务且成功,且 fail_reason 是 URL 时显示可点击链接
const isVideoTask = record.action === TASK_ACTION_GENERATE || record.action === TASK_ACTION_TEXT_GENERATE;
const isVideoTask =
record.action === TASK_ACTION_GENERATE ||
record.action === TASK_ACTION_TEXT_GENERATE;
const isSuccess = record.status === 'SUCCESS';
const isUrl = typeof text === 'string' && /^https?:\/\//.test(text);
if (isSuccess && isVideoTask && isUrl) {
return (
<a
href="#"
onClick={e => {
href='#'
onClick={(e) => {
e.preventDefault();
openVideoModal(text);
}}
@@ -371,4 +376,4 @@ export const getTaskLogsColumns = ({
},
},
];
};
};

View File

@@ -37,23 +37,23 @@ const TaskLogsFilters = ({
getFormApi={(api) => setFormApi(api)}
onSubmit={refresh}
allowEmpty={true}
autoComplete="off"
layout="vertical"
trigger="change"
autoComplete='off'
layout='vertical'
trigger='change'
stopValidateWithError={false}
>
<div className="flex flex-col gap-2">
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2">
<div className='flex flex-col gap-2'>
<div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2'>
{/* 时间选择器 */}
<div className="col-span-1 lg:col-span-2">
<div className='col-span-1 lg:col-span-2'>
<Form.DatePicker
field='dateRange'
className="w-full"
className='w-full'
type='dateTimeRange'
placeholder={[t('开始时间'), t('结束时间')]}
showClear
pure
size="small"
size='small'
/>
</div>
@@ -64,7 +64,7 @@ const TaskLogsFilters = ({
placeholder={t('任务 ID')}
showClear
pure
size="small"
size='small'
/>
{/* 渠道 ID - 仅管理员可见 */}
@@ -75,20 +75,20 @@ const TaskLogsFilters = ({
placeholder={t('渠道 ID')}
showClear
pure
size="small"
size='small'
/>
)}
</div>
{/* 操作按钮区域 */}
<div className="flex justify-between items-center">
<div className='flex justify-between items-center'>
<div></div>
<div className="flex gap-2">
<div className='flex gap-2'>
<Button
type='tertiary'
htmlType='submit'
loading={loading}
size="small"
size='small'
>
{t('查询')}
</Button>
@@ -103,14 +103,14 @@ const TaskLogsFilters = ({
}, 100);
}
}}
size="small"
size='small'
>
{t('重置')}
</Button>
<Button
type='tertiary'
onClick={() => setShowColumnSelector(true)}
size="small"
size='small'
>
{t('列设置')}
</Button>
@@ -121,4 +121,4 @@ const TaskLogsFilters = ({
);
};
export default TaskLogsFilters;
export default TaskLogsFilters;

View File

@@ -55,14 +55,7 @@ const TaskLogsTable = (taskLogsData) => {
openVideoModal,
isAdminUser,
});
}, [
t,
COLUMN_KEYS,
copyText,
openContentModal,
openVideoModal,
isAdminUser,
]);
}, [t, COLUMN_KEYS, copyText, openContentModal, openVideoModal, isAdminUser]);
// Filter columns based on visibility settings
const getVisibleColumns = () => {
@@ -86,13 +79,11 @@ const TaskLogsTable = (taskLogsData) => {
rowKey='key'
loading={loading}
scroll={compactMode ? undefined : { x: 'max-content' }}
className="rounded-xl overflow-hidden"
size="middle"
className='rounded-xl overflow-hidden'
size='middle'
empty={
<Empty
image={
<IllustrationNoResult style={{ width: 150, height: 150 }} />
}
image={<IllustrationNoResult style={{ width: 150, height: 150 }} />}
darkModeImage={
<IllustrationNoResultDark style={{ width: 150, height: 150 }} />
}
@@ -114,4 +105,4 @@ const TaskLogsTable = (taskLogsData) => {
);
};
export default TaskLogsTable;
export default TaskLogsTable;

View File

@@ -48,7 +48,7 @@ const TaskLogsPage = () => {
<Layout>
<CardPro
type="type2"
type='type2'
statsArea={<TaskLogsActions {...taskLogsData} />}
searchArea={<TaskLogsFilters {...taskLogsData} />}
paginationArea={createCardProPagination({
@@ -69,4 +69,4 @@ const TaskLogsPage = () => {
);
};
export default TaskLogsPage;
export default TaskLogsPage;

View File

@@ -49,10 +49,8 @@ const ColumnSelectorModal = ({
visible={showColumnSelector}
onCancel={() => setShowColumnSelector(false)}
footer={
<div className="flex justify-end">
<Button onClick={() => initDefaultColumns()}>
{t('重置')}
</Button>
<div className='flex justify-end'>
<Button onClick={() => initDefaultColumns()}>{t('重置')}</Button>
<Button onClick={() => setShowColumnSelector(false)}>
{t('取消')}
</Button>
@@ -75,7 +73,7 @@ const ColumnSelectorModal = ({
</Checkbox>
</div>
<div
className="flex flex-wrap max-h-96 overflow-y-auto rounded-lg p-4"
className='flex flex-wrap max-h-96 overflow-y-auto rounded-lg p-4'
style={{ border: '1px solid var(--semi-color-border)' }}
>
{allColumns.map((column) => {
@@ -85,7 +83,7 @@ const ColumnSelectorModal = ({
}
return (
<div key={column.key} className="w-1/2 mb-4 pr-2">
<div key={column.key} className='w-1/2 mb-4 pr-2'>
<Checkbox
checked={!!visibleColumns[column.key]}
onChange={(e) =>
@@ -102,4 +100,4 @@ const ColumnSelectorModal = ({
);
};
export default ColumnSelectorModal;
export default ColumnSelectorModal;

View File

@@ -44,4 +44,4 @@ const ContentModal = ({
);
};
export default ContentModal;
export default ContentModal;