mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-05-03 22:24:38 +00:00
🎨 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:
@@ -36,20 +36,22 @@ const MjLogsActions = ({
|
||||
const showSkeleton = useMinimumLoadingTime(loading);
|
||||
|
||||
const placeholder = (
|
||||
<div className="flex items-center mb-2 md:mb-0">
|
||||
<IconEyeOpened className="mr-2" />
|
||||
<div className='flex items-center mb-2 md:mb-0'>
|
||||
<IconEyeOpened className='mr-2' />
|
||||
<Skeleton.Title style={{ width: 300, height: 21, borderRadius: 6 }} />
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col md:flex-row justify-between items-start md:items-center gap-2 w-full">
|
||||
<div className='flex flex-col md:flex-row justify-between items-start md:items-center gap-2 w-full'>
|
||||
<Skeleton loading={showSkeleton} active placeholder={placeholder}>
|
||||
<div className="flex items-center mb-2 md:mb-0">
|
||||
<IconEyeOpened className="mr-2" />
|
||||
<div className='flex items-center mb-2 md:mb-0'>
|
||||
<IconEyeOpened className='mr-2' />
|
||||
<Text>
|
||||
{isAdminUser && showBanner
|
||||
? t('当前未开启Midjourney回调,部分项目可能无法获得绘图结果,可在运营设置中开启。')
|
||||
? t(
|
||||
'当前未开启Midjourney回调,部分项目可能无法获得绘图结果,可在运营设置中开启。',
|
||||
)
|
||||
: t('Midjourney 任务记录')}
|
||||
</Text>
|
||||
</div>
|
||||
@@ -64,4 +66,4 @@ const MjLogsActions = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default MjLogsActions;
|
||||
export default MjLogsActions;
|
||||
|
||||
@@ -18,12 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {
|
||||
Button,
|
||||
Progress,
|
||||
Tag,
|
||||
Typography
|
||||
} from '@douyinfe/semi-ui';
|
||||
import { Button, Progress, Tag, Typography } from '@douyinfe/semi-ui';
|
||||
import {
|
||||
Palette,
|
||||
ZoomIn,
|
||||
@@ -49,7 +44,7 @@ import {
|
||||
Loader,
|
||||
AlertCircle,
|
||||
Hash,
|
||||
Video
|
||||
Video,
|
||||
} from 'lucide-react';
|
||||
|
||||
const colors = [
|
||||
@@ -153,7 +148,11 @@ function renderType(type, t) {
|
||||
);
|
||||
case 'INPAINT':
|
||||
return (
|
||||
<Tag color='violet' shape='circle' prefixIcon={<PaintBucket size={14} />}>
|
||||
<Tag
|
||||
color='violet'
|
||||
shape='circle'
|
||||
prefixIcon={<PaintBucket size={14} />}
|
||||
>
|
||||
{t('局部重绘-提交')}
|
||||
</Tag>
|
||||
);
|
||||
@@ -177,7 +176,11 @@ function renderType(type, t) {
|
||||
);
|
||||
case 'SWAP_FACE':
|
||||
return (
|
||||
<Tag color='light-green' shape='circle' prefixIcon={<UserCheck size={14} />}>
|
||||
<Tag
|
||||
color='light-green'
|
||||
shape='circle'
|
||||
prefixIcon={<UserCheck size={14} />}
|
||||
>
|
||||
{t('换脸')}
|
||||
</Tag>
|
||||
);
|
||||
@@ -194,7 +197,11 @@ function renderCode(code, t) {
|
||||
switch (code) {
|
||||
case 1:
|
||||
return (
|
||||
<Tag color='green' shape='circle' prefixIcon={<CheckCircle size={14} />}>
|
||||
<Tag
|
||||
color='green'
|
||||
shape='circle'
|
||||
prefixIcon={<CheckCircle size={14} />}
|
||||
>
|
||||
{t('已提交')}
|
||||
</Tag>
|
||||
);
|
||||
@@ -229,7 +236,11 @@ function 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>
|
||||
);
|
||||
@@ -259,7 +270,11 @@ function renderStatus(type, t) {
|
||||
);
|
||||
case 'MODAL':
|
||||
return (
|
||||
<Tag color='yellow' shape='circle' prefixIcon={<AlertCircle size={14} />}>
|
||||
<Tag
|
||||
color='yellow'
|
||||
shape='circle'
|
||||
prefixIcon={<AlertCircle size={14} />}
|
||||
>
|
||||
{t('窗口等待')}
|
||||
</Tag>
|
||||
);
|
||||
@@ -415,7 +430,7 @@ export const getMjLogsColumns = ({
|
||||
}
|
||||
return (
|
||||
<Button
|
||||
size="small"
|
||||
size='small'
|
||||
onClick={() => {
|
||||
openImageModal(text);
|
||||
}}
|
||||
@@ -493,4 +508,4 @@ export const getMjLogsColumns = ({
|
||||
},
|
||||
},
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -37,23 +37,23 @@ const MjLogsFilters = ({
|
||||
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 MjLogsFilters = ({
|
||||
placeholder={t('任务 ID')}
|
||||
showClear
|
||||
pure
|
||||
size="small"
|
||||
size='small'
|
||||
/>
|
||||
|
||||
{/* 渠道 ID - 仅管理员可见 */}
|
||||
@@ -75,20 +75,20 @@ const MjLogsFilters = ({
|
||||
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>
|
||||
@@ -102,14 +102,14 @@ const MjLogsFilters = ({
|
||||
}, 100);
|
||||
}
|
||||
}}
|
||||
size="small"
|
||||
size='small'
|
||||
>
|
||||
{t('重置')}
|
||||
</Button>
|
||||
<Button
|
||||
type='tertiary'
|
||||
onClick={() => setShowColumnSelector(true)}
|
||||
size="small"
|
||||
size='small'
|
||||
>
|
||||
{t('列设置')}
|
||||
</Button>
|
||||
@@ -120,4 +120,4 @@ const MjLogsFilters = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default MjLogsFilters;
|
||||
export default MjLogsFilters;
|
||||
|
||||
@@ -55,14 +55,7 @@ const MjLogsTable = (mjLogsData) => {
|
||||
openImageModal,
|
||||
isAdminUser,
|
||||
});
|
||||
}, [
|
||||
t,
|
||||
COLUMN_KEYS,
|
||||
copyText,
|
||||
openContentModal,
|
||||
openImageModal,
|
||||
isAdminUser,
|
||||
]);
|
||||
}, [t, COLUMN_KEYS, copyText, openContentModal, openImageModal, isAdminUser]);
|
||||
|
||||
// Filter columns based on visibility settings
|
||||
const getVisibleColumns = () => {
|
||||
@@ -86,13 +79,11 @@ const MjLogsTable = (mjLogsData) => {
|
||||
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 MjLogsTable = (mjLogsData) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default MjLogsTable;
|
||||
export default MjLogsTable;
|
||||
|
||||
@@ -41,7 +41,7 @@ const MjLogsPage = () => {
|
||||
|
||||
<Layout>
|
||||
<CardPro
|
||||
type="type2"
|
||||
type='type2'
|
||||
statsArea={<MjLogsActions {...mjLogsData} />}
|
||||
searchArea={<MjLogsFilters {...mjLogsData} />}
|
||||
paginationArea={createCardProPagination({
|
||||
@@ -62,4 +62,4 @@ const MjLogsPage = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default MjLogsPage;
|
||||
export default MjLogsPage;
|
||||
|
||||
@@ -51,10 +51,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>
|
||||
@@ -77,7 +75,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) => {
|
||||
@@ -91,7 +89,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) =>
|
||||
@@ -108,4 +106,4 @@ const ColumnSelectorModal = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default ColumnSelectorModal;
|
||||
export default ColumnSelectorModal;
|
||||
|
||||
@@ -52,4 +52,4 @@ const ContentModal = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default ContentModal;
|
||||
export default ContentModal;
|
||||
|
||||
Reference in New Issue
Block a user