feat: 参考原型图 ui优化提交 个人端-用户中心 相关的页面
This commit is contained in:
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { Card, Table, Progress } from '@douyinfe/semi-ui';
|
||||
import { Card, Table, Progress } from '@/components/ui';
|
||||
import { renderQuota } from '../../helpers';
|
||||
|
||||
const ChannelConsumption = ({ data, title, icon, t }) => {
|
||||
|
||||
@@ -18,8 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Card, Table, Button } from '@douyinfe/semi-ui';
|
||||
import { IconDownload } from '@douyinfe/semi-icons';
|
||||
import { Card, Table, Button } from '@/components/ui';
|
||||
import { IconDownload } from '@/components/ui/icons';
|
||||
import { renderQuota } from '../../helpers';
|
||||
|
||||
const DailyStatsTable = ({ data, title, icon, t }) => {
|
||||
|
||||
@@ -29,12 +29,12 @@ import {
|
||||
Modal,
|
||||
Input,
|
||||
Typography,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
IconRefresh,
|
||||
IconAlertTriangle,
|
||||
IconShieldStroked,
|
||||
} from '@douyinfe/semi-icons';
|
||||
} from '@/components/ui/icons';
|
||||
import { renderQuota } from '../../helpers';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
import { Card } from '@douyinfe/semi-ui';
|
||||
import { Card } from '@/components/ui';
|
||||
import { VChart } from '@visactor/react-vchart';
|
||||
import { renderQuota } from '../../helpers';
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Card } from '@douyinfe/semi-ui';
|
||||
import { Card } from '@/components/ui';
|
||||
import {
|
||||
Users,
|
||||
UserPlus,
|
||||
|
||||
@@ -27,8 +27,8 @@ import {
|
||||
Typography,
|
||||
Space,
|
||||
Select,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import { IconRefresh } from '@douyinfe/semi-icons';
|
||||
} from '@/components/ui';
|
||||
import { IconRefresh } from '@/components/ui/icons';
|
||||
import { renderQuota } from '../../helpers';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
Banner,
|
||||
Button,
|
||||
Space,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import { renderQuota } from '../../helpers';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
import { Card } from '@douyinfe/semi-ui';
|
||||
import { Card } from '@/components/ui';
|
||||
import { VChart } from '@visactor/react-vchart';
|
||||
|
||||
// 支付渠道颜色映射:支付宝蓝色、微信绿色
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
import { Card } from '@douyinfe/semi-ui';
|
||||
import { Card } from '@/components/ui';
|
||||
import { VChart } from '@visactor/react-vchart';
|
||||
|
||||
const TrendCharts = ({ title, icon, data, type, t }) => {
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Card, Avatar, Progress } from '@douyinfe/semi-ui';
|
||||
import { Card, Avatar, Progress } from '@/components/ui';
|
||||
import { renderQuota } from '../../helpers';
|
||||
|
||||
const UserRanking = ({ data, title, icon, t }) => {
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useMemo, useState, useEffect, useCallback } from 'react';
|
||||
import { Card, Spin, Tag, Progress, Empty } from '@douyinfe/semi-ui';
|
||||
import { Card, Spin, Tag, Progress, Empty } from '@/components/ui';
|
||||
import { VChart } from '@visactor/react-vchart';
|
||||
import { API, showError } from '../../helpers';
|
||||
import {
|
||||
|
||||
@@ -17,7 +17,7 @@ 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 { Card, Table } from '@douyinfe/semi-ui';
|
||||
import { Card, Table } from '@/components/ui';
|
||||
import { renderQuota } from '../../helpers';
|
||||
|
||||
const UserTopupRanking = ({ data, title, icon, t }) => {
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
Tabs,
|
||||
Tag,
|
||||
Typography,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import { ClipboardList, Download } from 'lucide-react';
|
||||
import { ChangeText, OrgNameCell, ReasonTags, SectionCard } from './shared';
|
||||
import {
|
||||
@@ -154,8 +154,8 @@ const columnsFor = (tab, cny, t, atRisk) => {
|
||||
style={{
|
||||
color:
|
||||
v <= 3
|
||||
? 'var(--semi-color-danger)'
|
||||
: 'var(--semi-color-warning)',
|
||||
? 'var(--ui-color-danger)'
|
||||
: 'var(--ui-color-warning)',
|
||||
}}
|
||||
>
|
||||
{v < 1 ? t('不足 1 天') : `${v.toFixed(1)} ${t('天')}`}
|
||||
|
||||
Binary file not shown.
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Banner, Button, Card, Tag, Tooltip } from '@douyinfe/semi-ui';
|
||||
import { Banner, Button, Card, Tag, Tooltip } from '@/components/ui';
|
||||
import {
|
||||
AlertOctagon,
|
||||
AlertTriangle,
|
||||
@@ -124,10 +124,10 @@ export const ReportHeader = ({ report, onExport, t }) => {
|
||||
|
||||
// ─── 本期要点 ─────────────────────────────────────────────────────
|
||||
const FINDING_STYLE = {
|
||||
danger: { icon: AlertOctagon, color: 'var(--semi-color-danger)' },
|
||||
warning: { icon: AlertTriangle, color: 'var(--semi-color-warning)' },
|
||||
success: { icon: CheckCircle2, color: 'var(--semi-color-success)' },
|
||||
info: { icon: Info, color: 'var(--semi-color-primary)' },
|
||||
danger: { icon: AlertOctagon, color: 'var(--ui-color-danger)' },
|
||||
warning: { icon: AlertTriangle, color: 'var(--ui-color-warning)' },
|
||||
success: { icon: CheckCircle2, color: 'var(--ui-color-success)' },
|
||||
info: { icon: Info, color: 'var(--ui-color-primary)' },
|
||||
};
|
||||
|
||||
export const KeyFindings = ({ findings, onJump, t }) => (
|
||||
@@ -237,7 +237,7 @@ export const KpiGrid = ({ report, lists, cny, onJump, t }) => {
|
||||
</Tooltip>
|
||||
),
|
||||
tip: t('本月至今 + 近 7 个完整日的日均消耗 × 本月剩余天数;对比上月全月'),
|
||||
accent: 'var(--semi-color-tertiary)',
|
||||
accent: 'var(--ui-color-tertiary)',
|
||||
},
|
||||
{
|
||||
title: t('未来 30 天充值缺口'),
|
||||
@@ -246,8 +246,8 @@ export const KpiGrid = ({ report, lists, cny, onJump, t }) => {
|
||||
tip: t('按各企业近 7 日日均消耗覆盖 30 天所需金额,减去当前余额后累加'),
|
||||
accent:
|
||||
k.topup_gap_30d > 0
|
||||
? 'var(--semi-color-danger)'
|
||||
: 'var(--semi-color-success)',
|
||||
? 'var(--ui-color-danger)'
|
||||
: 'var(--ui-color-success)',
|
||||
onClick: () => onJump('renewal'),
|
||||
},
|
||||
{
|
||||
@@ -258,7 +258,7 @@ export const KpiGrid = ({ report, lists, cny, onJump, t }) => {
|
||||
? t('近 7 日无消耗')
|
||||
: t('按当前速度可支撑 {{days}} 天', { days: coverDays.toFixed(0) }),
|
||||
tip: t('全部企业主余额 + 赠送余额'),
|
||||
accent: 'var(--semi-color-success)',
|
||||
accent: 'var(--ui-color-success)',
|
||||
},
|
||||
{
|
||||
title: t('企业消耗占平台'),
|
||||
@@ -271,8 +271,8 @@ export const KpiGrid = ({ report, lists, cny, onJump, t }) => {
|
||||
style={{
|
||||
color:
|
||||
shareDelta >= 0
|
||||
? 'var(--semi-color-success)'
|
||||
: 'var(--semi-color-danger)',
|
||||
? 'var(--ui-color-success)'
|
||||
: 'var(--ui-color-danger)',
|
||||
}}
|
||||
>
|
||||
{shareDelta >= 0 ? '+' : ''}
|
||||
@@ -342,8 +342,8 @@ export const HealthSegments = ({ report, cny, activeSegment, onSelect, t }) => {
|
||||
style={{
|
||||
color:
|
||||
delta > 0
|
||||
? 'var(--semi-color-success)'
|
||||
: 'var(--semi-color-danger)',
|
||||
? 'var(--ui-color-success)'
|
||||
: 'var(--ui-color-danger)',
|
||||
}}
|
||||
>
|
||||
{delta > 0 ? '+' : '-'}
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
Table,
|
||||
Tag,
|
||||
Typography,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import { Download, Search, Table2, UserCog } from 'lucide-react';
|
||||
import { ChangeText, OrgNameCell, SectionCard } from './shared';
|
||||
import {
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import { Button, Card, Typography } from '@douyinfe/semi-ui';
|
||||
import { Button, Card, Typography } from '@/components/ui';
|
||||
import { ActionCenter, ACTION_TABS } from './ActionCenter';
|
||||
import {
|
||||
ChangeAttribution,
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Card, Tag, Tooltip } from '@douyinfe/semi-ui';
|
||||
import { Card, Tag, Tooltip } from '@/components/ui';
|
||||
import { TrendingDown, TrendingUp } from 'lucide-react';
|
||||
import { changeRate, ORG_STATUS, orgDisplayName, REASONS } from './utils';
|
||||
|
||||
@@ -81,7 +81,7 @@ export const ChangeText = ({ cur, prev, t, size = 'xs', showNew = true }) => {
|
||||
<span
|
||||
className={`inline-flex items-center gap-0.5 ${sizeClass} font-medium tabular-nums`}
|
||||
style={{
|
||||
color: up ? 'var(--semi-color-success)' : 'var(--semi-color-danger)',
|
||||
color: up ? 'var(--ui-color-success)' : 'var(--ui-color-danger)',
|
||||
}}
|
||||
>
|
||||
{up ? (
|
||||
@@ -109,7 +109,7 @@ export const KpiCard = ({
|
||||
bodyStyle={{ padding: '14px 16px' }}
|
||||
onClick={onClick}
|
||||
style={{
|
||||
borderLeft: `3px solid ${accent || 'var(--semi-color-primary)'}`,
|
||||
borderLeft: `3px solid ${accent || 'var(--ui-color-primary)'}`,
|
||||
}}
|
||||
>
|
||||
<div className='flex items-center gap-1 text-xs text-gray-500 dark:text-gray-400 mb-1'>
|
||||
|
||||
@@ -61,7 +61,9 @@ const AuthCardHeader = ({
|
||||
<h4 className='text-xl font-bold text-gray-800 dark:text-white tracking-tight mb-0.5'>
|
||||
{title}
|
||||
</h4>
|
||||
<p className='text-gray-500 dark:text-gray-400 text-xs'>{subtitle}</p>
|
||||
<p className='auth-card-subtitle text-gray-500 dark:text-gray-400 text-xs'>
|
||||
{subtitle}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Avatar } from '@douyinfe/semi-ui';
|
||||
import { Avatar } from '@/components/ui';
|
||||
import { MessageCircle, ScanLine } from 'lucide-react';
|
||||
import { API } from '../../helpers';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button } from 'antd';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@@ -28,7 +29,7 @@ import { useTranslation } from 'react-i18next';
|
||||
* active:当前页归属('personal' | 'enterprise'),高亮且不重复跳转。
|
||||
*
|
||||
* 浮于玻璃卡片之外、之上:自带玻璃壳(backdrop-blur + 半透白底 + ring/border),
|
||||
* 在背景上保持可读并与下方卡片呼应;激活态用品牌渐变强化「当前入口」的辨识度。
|
||||
* 在背景上保持可读并与下方卡片呼应;激活态沿用 Ant Design 主题主色。
|
||||
*/
|
||||
const AuthLoginTabs = ({ active = 'personal', mode = 'login' }) => {
|
||||
const { t } = useTranslation();
|
||||
@@ -47,25 +48,21 @@ const AuthLoginTabs = ({ active = 'personal', mode = 'login' }) => {
|
||||
];
|
||||
|
||||
return (
|
||||
<div className='relative z-20 flex p-1 gap-1 rounded-2xl backdrop-blur-2xl bg-white/45 dark:bg-neutral-900/55 ring-1 ring-white/50 dark:ring-white/[0.06] border border-white/30 dark:border-white/[0.05] shadow-[0_12px_32px_-16px_rgb(var(--brand-primary-rgb)/0.45)]'>
|
||||
<div className='auth-login-tabs relative z-20 flex p-1 gap-1 rounded-xl backdrop-blur-2xl bg-white/45 dark:bg-neutral-900/55 ring-1 ring-white/50 dark:ring-white/[0.06] border border-white/30 dark:border-white/[0.05]'>
|
||||
{tabs.map((tab) => {
|
||||
const isActive = tab.key === active;
|
||||
return (
|
||||
<button
|
||||
<Button
|
||||
key={tab.key}
|
||||
type='button'
|
||||
type={isActive ? 'primary' : 'text'}
|
||||
aria-pressed={isActive}
|
||||
onClick={() => {
|
||||
if (!isActive) navigate(tab.to);
|
||||
}}
|
||||
className={`flex-1 h-10 rounded-xl text-sm font-medium transition-all duration-200 ${
|
||||
isActive
|
||||
? 'bg-gradient-to-r from-brand-from to-brand-to text-white shadow-md shadow-brand/25'
|
||||
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-white/40 dark:hover:bg-white/[0.05]'
|
||||
}`}
|
||||
className='flex-1 font-medium'
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
</Button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
@@ -82,7 +82,7 @@ export const GlassCardStyles = () => (
|
||||
/* 认证页 Semi 输入框玻璃风格:容器挂 .auth-glass-form 后,四个认证页
|
||||
(登录/注册/企业登录/企业注册)的输入框共享同一套观感 ——
|
||||
半透白玻璃底 + 圆角、hover 提亮、聚焦品牌色边框 + 柔和光环、错误态沿用语义色 */
|
||||
.auth-glass-form .semi-input-wrapper {
|
||||
.auth-glass-form .ant-input-affix-wrapper {
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
border: 1px solid rgba(229, 231, 235, 0.8);
|
||||
border-radius: 0.75rem;
|
||||
@@ -93,64 +93,64 @@ export const GlassCardStyles = () => (
|
||||
background-color 0.2s ease,
|
||||
box-shadow 0.2s ease;
|
||||
}
|
||||
.auth-glass-form .semi-input-wrapper:hover {
|
||||
.auth-glass-form .ant-input-affix-wrapper:hover {
|
||||
background: rgba(255, 255, 255, 0.78);
|
||||
border-color: rgba(209, 213, 219, 1);
|
||||
}
|
||||
.auth-glass-form .semi-input-wrapper-focus,
|
||||
.auth-glass-form .semi-input-wrapper-focus:hover {
|
||||
.auth-glass-form .ant-input-affix-wrapper-focus,
|
||||
.auth-glass-form .ant-input-affix-wrapper-focus:hover {
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
border-color: rgb(var(--brand-primary-rgb));
|
||||
box-shadow: 0 0 0 3px rgb(var(--brand-primary-rgb) / 0.14);
|
||||
}
|
||||
.dark .auth-glass-form .semi-input-wrapper {
|
||||
.dark .auth-glass-form .ant-input-affix-wrapper {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
border-color: rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
.dark .auth-glass-form .semi-input-wrapper:hover {
|
||||
.dark .auth-glass-form .ant-input-affix-wrapper:hover {
|
||||
background: rgba(255, 255, 255, 0.09);
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
.dark .auth-glass-form .semi-input-wrapper-focus,
|
||||
.dark .auth-glass-form .semi-input-wrapper-focus:hover {
|
||||
.dark .auth-glass-form .ant-input-affix-wrapper-focus,
|
||||
.dark .auth-glass-form .ant-input-affix-wrapper-focus:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-color: rgb(var(--brand-primary-rgb));
|
||||
box-shadow: 0 0 0 3px rgb(var(--brand-primary-rgb) / 0.22);
|
||||
}
|
||||
/* 校验失败:边框与光环改用语义 danger 色,保持玻璃底不变 */
|
||||
.auth-glass-form .semi-input-wrapper-error,
|
||||
.auth-glass-form .semi-input-wrapper-error:hover,
|
||||
.auth-glass-form .semi-input-wrapper-error.semi-input-wrapper-focus {
|
||||
border-color: var(--semi-color-danger);
|
||||
.auth-glass-form .ant-input-affix-wrapper-error,
|
||||
.auth-glass-form .ant-input-affix-wrapper-error:hover,
|
||||
.auth-glass-form .ant-input-affix-wrapper-error.ant-input-affix-wrapper-focus {
|
||||
border-color: var(--ui-color-danger);
|
||||
box-shadow: none;
|
||||
}
|
||||
/* 前缀图标与内建功能钮(密码眼睛/清除)默认弱化;
|
||||
只针对这三处染色,避免误染 suffix 里自定义按钮(如「获取验证码」)的 loading 图标 */
|
||||
.auth-glass-form .semi-input-wrapper .semi-input-prefix .semi-icon,
|
||||
.auth-glass-form .semi-input-wrapper .semi-input-clearbtn .semi-icon,
|
||||
.auth-glass-form .semi-input-wrapper .semi-input-modebtn .semi-icon {
|
||||
.auth-glass-form .ant-input-affix-wrapper .ant-input-prefix .anticon,
|
||||
.auth-glass-form .ant-input-affix-wrapper .ant-input-clearbtn .anticon,
|
||||
.auth-glass-form .ant-input-affix-wrapper .ant-input-modebtn .anticon {
|
||||
color: rgba(156, 163, 175, 1);
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
.dark .auth-glass-form .semi-input-wrapper .semi-input-prefix .semi-icon,
|
||||
.dark .auth-glass-form .semi-input-wrapper .semi-input-clearbtn .semi-icon,
|
||||
.dark .auth-glass-form .semi-input-wrapper .semi-input-modebtn .semi-icon {
|
||||
.dark .auth-glass-form .ant-input-affix-wrapper .ant-input-prefix .anticon,
|
||||
.dark .auth-glass-form .ant-input-affix-wrapper .ant-input-clearbtn .anticon,
|
||||
.dark .auth-glass-form .ant-input-affix-wrapper .ant-input-modebtn .anticon {
|
||||
color: rgba(107, 114, 128, 1);
|
||||
}
|
||||
/* 密码眼睛/清除按钮 hover 加深,给出可点击反馈 */
|
||||
.auth-glass-form .semi-input-wrapper .semi-input-clearbtn:hover .semi-icon,
|
||||
.auth-glass-form .semi-input-wrapper .semi-input-modebtn:hover .semi-icon {
|
||||
.auth-glass-form .ant-input-affix-wrapper .ant-input-clearbtn:hover .anticon,
|
||||
.auth-glass-form .ant-input-affix-wrapper .ant-input-modebtn:hover .anticon {
|
||||
color: rgba(75, 85, 99, 1);
|
||||
}
|
||||
.dark .auth-glass-form .semi-input-wrapper .semi-input-clearbtn:hover .semi-icon,
|
||||
.dark .auth-glass-form .semi-input-wrapper .semi-input-modebtn:hover .semi-icon {
|
||||
.dark .auth-glass-form .ant-input-affix-wrapper .ant-input-clearbtn:hover .anticon,
|
||||
.dark .auth-glass-form .ant-input-affix-wrapper .ant-input-modebtn:hover .anticon {
|
||||
color: rgba(209, 213, 219, 1);
|
||||
}
|
||||
/* 聚焦时前缀图标点亮为品牌色,给出清晰的焦点反馈 */
|
||||
.auth-glass-form .semi-input-wrapper-focus .semi-input-prefix .semi-icon {
|
||||
.auth-glass-form .ant-input-affix-wrapper-focus .ant-input-prefix .anticon {
|
||||
color: rgb(var(--brand-primary-rgb));
|
||||
}
|
||||
.dark .auth-glass-form .semi-input::placeholder {
|
||||
.dark .auth-glass-form .ant-input::placeholder {
|
||||
color: rgba(255, 255, 255, 0.35);
|
||||
}
|
||||
/* 移动端降级 backdrop-filter,减轻 GPU 负担 */
|
||||
@@ -220,10 +220,10 @@ const GlassCard = ({
|
||||
)}
|
||||
|
||||
{/* 顶部品牌渐变线 */}
|
||||
<div className='absolute top-0 left-0 right-0 h-0.5 bg-gradient-to-r from-brand-from via-brand-via to-brand-to opacity-90' />
|
||||
<div className='login-card-top-accent absolute top-0 left-0 right-0 h-0.5 bg-gradient-to-r from-brand-from via-brand-via to-brand-to opacity-90' />
|
||||
|
||||
{/* 顶部 1px 白色反光 - 紧贴品牌线下方 */}
|
||||
<div className='absolute top-0.5 left-[15%] right-[15%] h-px bg-gradient-to-r from-transparent via-white/90 dark:via-white/40 to-transparent pointer-events-none' />
|
||||
<div className='login-card-top-reflection absolute top-0.5 left-[15%] right-[15%] h-px bg-gradient-to-r from-transparent via-white/90 dark:via-white/40 to-transparent pointer-events-none' />
|
||||
|
||||
{children}
|
||||
</div>
|
||||
|
||||
@@ -48,16 +48,16 @@ import {
|
||||
isPasskeySupported,
|
||||
} from '../../helpers';
|
||||
import Turnstile from 'react-turnstile';
|
||||
import { Button, Checkbox, Form, Icon, Modal } from '@douyinfe/semi-ui';
|
||||
import { Button, Checkbox, Form, Icon, Modal } from '@/components/ui';
|
||||
|
||||
import Text from '@douyinfe/semi-ui/lib/es/typography/text';
|
||||
import { Text } from '@/components/ui';
|
||||
|
||||
import {
|
||||
IconGithubLogo,
|
||||
IconMail,
|
||||
IconLock,
|
||||
IconKey,
|
||||
} from '@douyinfe/semi-icons';
|
||||
} from '@/components/ui/icons';
|
||||
import OIDCIcon from '../common/logo/OIDCIcon';
|
||||
import WeChatIcon from '../common/logo/WeChatIcon';
|
||||
import LinuxDoIcon from '../common/logo/LinuxDoIcon';
|
||||
@@ -846,15 +846,13 @@ const LoginForm = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<style>{`
|
||||
.login-compact-form .semi-form-field { margin-bottom: 0; }
|
||||
.login-compact-form .semi-form-field-username { padding-bottom: 4px; }
|
||||
.login-compact-form .semi-form-field-password { padding-top: 4px; }
|
||||
`}</style>
|
||||
<Form className='login-compact-form auth-glass-form'>
|
||||
{/* 用户名输入框 —— 玻璃观感统一由 .auth-glass-form(GlassCard 内置样式)驱动 */}
|
||||
<Form className='auth-login-form' onSubmit={handleSubmit}>
|
||||
<Form.Input
|
||||
field='username'
|
||||
className='auth-login-required-field'
|
||||
rules={[{ required: true, message: t('请输入用户名或邮箱') }]}
|
||||
required
|
||||
aria-required='true'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('用户名/邮箱')}
|
||||
@@ -862,7 +860,7 @@ const LoginForm = () => {
|
||||
}
|
||||
placeholder={t('请输入用户名或邮箱')}
|
||||
name='username'
|
||||
size='large'
|
||||
size='default'
|
||||
autoComplete='username'
|
||||
onChange={(value) => handleChange('username', value)}
|
||||
prefix={<IconMail size='small' />}
|
||||
@@ -871,6 +869,10 @@ const LoginForm = () => {
|
||||
{/* 密码输入框 */}
|
||||
<Form.Input
|
||||
field='password'
|
||||
className='auth-login-required-field'
|
||||
rules={[{ required: true, message: t('请输入密码') }]}
|
||||
required
|
||||
aria-required='true'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('密码')}
|
||||
@@ -879,7 +881,7 @@ const LoginForm = () => {
|
||||
placeholder={t('请输入密码')}
|
||||
name='password'
|
||||
mode='password'
|
||||
size='large'
|
||||
size='default'
|
||||
autoComplete='current-password'
|
||||
onChange={(value) => handleChange('password', value)}
|
||||
prefix={<IconLock size='small' />}
|
||||
@@ -921,40 +923,28 @@ const LoginForm = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className='space-y-1.5 pt-3'>
|
||||
<div className='auth-login-actions'>
|
||||
{/* 登录按钮 */}
|
||||
<button
|
||||
type='submit'
|
||||
onClick={handleSubmit}
|
||||
<Button
|
||||
theme='solid'
|
||||
htmlType='submit'
|
||||
loading={loginLoading}
|
||||
block
|
||||
disabled={
|
||||
loginLoading ||
|
||||
((hasUserAgreement || hasPrivacyPolicy) && !agreedToTerms)
|
||||
}
|
||||
className='group relative w-full h-10 flex items-center justify-center gap-2 bg-gradient-to-r from-brand-from to-brand-to hover:from-brand-from hover:to-brand-to disabled:from-gray-400 disabled:to-gray-500 text-white rounded-xl shadow-md shadow-brand/25 dark:shadow-brand/15 hover:shadow-lg hover:shadow-brand/30 hover:-translate-y-0.5 active:translate-y-0 transition-all duration-200 disabled:cursor-not-allowed disabled:hover:translate-y-0 overflow-hidden'
|
||||
className='auth-login-submit'
|
||||
>
|
||||
{/* 闪光效果 */}
|
||||
<div className='absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-500' />
|
||||
|
||||
{loginLoading ? (
|
||||
<div className='w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin' />
|
||||
) : (
|
||||
<>
|
||||
<span className='relative z-10 font-semibold'>
|
||||
{t('登 录')}
|
||||
</span>
|
||||
<ArrowRight
|
||||
size={16}
|
||||
className='relative z-10 group-hover:translate-x-1 transition-transform'
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
<span className='font-semibold'>{t('登 录')}</span>
|
||||
<ArrowRight size={16} />
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
theme='borderless'
|
||||
type='tertiary'
|
||||
size='small'
|
||||
className='w-full !text-gray-500 hover:!text-brand-deep dark:!text-gray-500 dark:hover:!text-brand-from !text-xs'
|
||||
className='auth-login-forgot'
|
||||
onClick={handleResetPasswordClick}
|
||||
>
|
||||
{t('忘记密码?')}
|
||||
@@ -991,7 +981,7 @@ const LoginForm = () => {
|
||||
)}
|
||||
|
||||
{!status.self_use_mode_enabled && (
|
||||
<div className='mt-3 text-center'>
|
||||
<div className='auth-login-register text-center'>
|
||||
<Text className='text-gray-500 dark:text-gray-400 text-xs'>
|
||||
{t('没有账户?')}{' '}
|
||||
<Link
|
||||
@@ -1234,7 +1224,7 @@ const LoginForm = () => {
|
||||
|
||||
return (
|
||||
<div
|
||||
className='relative overflow-hidden flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8'
|
||||
className='auth-login-page relative overflow-hidden flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8'
|
||||
// 抵扣 PageLayout 跑马灯占位高度,保证占位+容器恰为一屏,避免幽灵滚动
|
||||
style={{ minHeight: 'calc(100vh - var(--content-top-offset, 0px))' }}
|
||||
>
|
||||
|
||||
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button, Toast, Banner } from '@douyinfe/semi-ui';
|
||||
import { Button, Toast, Banner } from '@/components/ui';
|
||||
import { Copy } from 'lucide-react';
|
||||
import { copy as copyText } from '../../helpers/utils';
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ import {
|
||||
getSystemName,
|
||||
} from '../../helpers';
|
||||
import { useSearchParams, Link } from 'react-router-dom';
|
||||
import { Button, Card, Form, Typography, Banner } from '@douyinfe/semi-ui';
|
||||
import { IconMail, IconLock, IconCopy } from '@douyinfe/semi-icons';
|
||||
import { Button, Card, Form, Typography, Banner } from '@/components/ui';
|
||||
import { IconMail, IconLock, IconCopy } from '@/components/ui/icons';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
|
||||
@@ -27,8 +27,8 @@ import {
|
||||
getSystemName,
|
||||
} from '../../helpers';
|
||||
import Turnstile from 'react-turnstile';
|
||||
import { Button, Card, Form, Typography } from '@douyinfe/semi-ui';
|
||||
import { IconMail } from '@douyinfe/semi-icons';
|
||||
import { Button, Card, Form, Typography } from '@/components/ui';
|
||||
import { IconMail } from '@/components/ui/icons';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
|
||||
@@ -42,16 +42,16 @@ import {
|
||||
onWeChatOpenOAuthClicked,
|
||||
} from '../../helpers';
|
||||
import Turnstile from 'react-turnstile';
|
||||
import { Button, Checkbox, Form, Icon, Modal } from '@douyinfe/semi-ui';
|
||||
import { Button, Checkbox, Form, Icon, Modal } from '@/components/ui';
|
||||
|
||||
import Text from '@douyinfe/semi-ui/lib/es/typography/text';
|
||||
import { Text } from '@/components/ui';
|
||||
import {
|
||||
IconGithubLogo,
|
||||
IconMail,
|
||||
IconUser,
|
||||
IconLock,
|
||||
IconKey,
|
||||
} from '@douyinfe/semi-icons';
|
||||
} from '@/components/ui/icons';
|
||||
import OIDCIcon from '../common/logo/OIDCIcon';
|
||||
import LinuxDoIcon from '../common/logo/LinuxDoIcon';
|
||||
import WeChatIcon from '../common/logo/WeChatIcon';
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
Divider,
|
||||
Form,
|
||||
Typography,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { Modal } from '@douyinfe/semi-ui';
|
||||
import { Modal } from '@/components/ui';
|
||||
import { X, Shield, Scale, ScrollText, ExternalLink } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import DocumentRenderer from './index';
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Avatar } from '@douyinfe/semi-ui';
|
||||
import { Avatar } from '@/components/ui';
|
||||
import { Bot as FastGPT, Image as Jimeng } from 'lucide-react';
|
||||
import OpenAI from '@lobehub/icons/es/OpenAI';
|
||||
import Claude from '@lobehub/icons/es/Claude';
|
||||
|
||||
@@ -39,7 +39,7 @@ runInNewContext(code, {
|
||||
exports: module.exports,
|
||||
require(name) {
|
||||
if (name === 'react') return React;
|
||||
if (name === '@douyinfe/semi-ui') return { Avatar: 'avatar' };
|
||||
if (name === '@/components/ui') return { Avatar: 'avatar' };
|
||||
if (name === 'lucide-react') return { Bot: Mono, Image: Mono };
|
||||
assert.ok(name.startsWith('@lobehub/icons/es/'), name);
|
||||
return Object.assign(Mono, { Color, Avatar });
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
Empty,
|
||||
Tag,
|
||||
Tooltip,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import { Lock } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useModelSelector } from '../../hooks/models/useModelSelector';
|
||||
|
||||
@@ -51,6 +51,7 @@ export default function PageBackground({
|
||||
const pulse = animate ? 'animate-pulse motion-reduce:animate-none' : '';
|
||||
return (
|
||||
<div
|
||||
data-page-background
|
||||
className={`absolute inset-0 overflow-hidden pointer-events-none ${className}`}
|
||||
aria-hidden='true'
|
||||
>
|
||||
|
||||
@@ -31,7 +31,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
* steps[].done 传布尔值即启用进度跟踪,不传则渲染为纯阅读步骤。
|
||||
*/
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { Button, SideSheet } from '@douyinfe/semi-ui';
|
||||
import { Button, SideSheet } from '@/components/ui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
BookOpenText,
|
||||
|
||||
@@ -6,21 +6,21 @@
|
||||
--pg-ink: var(--text-primary);
|
||||
--pg-muted: var(--text-secondary);
|
||||
--pg-line: var(--border-subtle);
|
||||
--pg-accent: var(--semi-color-primary);
|
||||
--pg-accent-deep: var(--semi-color-primary-active, var(--semi-color-primary));
|
||||
--pg-tint: color-mix(in srgb, var(--semi-color-primary) 8%, transparent);
|
||||
--pg-accent: var(--ui-color-primary);
|
||||
--pg-accent-deep: var(--ui-color-primary-active, var(--ui-color-primary));
|
||||
--pg-tint: color-mix(in srgb, var(--ui-color-primary) 8%, transparent);
|
||||
--pg-tint-strong: color-mix(
|
||||
in srgb,
|
||||
var(--semi-color-primary) 14%,
|
||||
var(--ui-color-primary) 14%,
|
||||
transparent
|
||||
);
|
||||
--pg-tint-line: color-mix(
|
||||
in srgb,
|
||||
var(--semi-color-primary) 28%,
|
||||
var(--ui-color-primary) 28%,
|
||||
transparent
|
||||
);
|
||||
--pg-ok: var(--semi-color-success);
|
||||
--pg-ok-tint: color-mix(in srgb, var(--semi-color-success) 14%, transparent);
|
||||
--pg-ok: var(--ui-color-success);
|
||||
--pg-ok-tint: color-mix(in srgb, var(--ui-color-success) 14%, transparent);
|
||||
}
|
||||
|
||||
/* ===== 进度胶囊 ===== */
|
||||
@@ -34,7 +34,7 @@
|
||||
border-radius: 999px;
|
||||
background: color-mix(
|
||||
in srgb,
|
||||
var(--semi-color-primary) 4%,
|
||||
var(--ui-color-primary) 4%,
|
||||
var(--surface-card)
|
||||
);
|
||||
color: var(--pg-ink);
|
||||
@@ -56,7 +56,7 @@
|
||||
.page-guide-step-head:focus-visible,
|
||||
.page-guide-step-cta:focus-visible {
|
||||
outline: 2px solid
|
||||
color-mix(in srgb, var(--semi-color-primary) 55%, transparent);
|
||||
color-mix(in srgb, var(--ui-color-primary) 55%, transparent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
@@ -109,28 +109,8 @@
|
||||
}
|
||||
|
||||
/* ===== 抽屉 ===== */
|
||||
.page-guide-drawer .semi-sidesheet-inner {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.page-guide-drawer .semi-sidesheet-body {
|
||||
padding: 14px 22px 20px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
/* 抽屉滚动条:复用品牌滚动条 token(同 app-scrollbar 的取色来源) */
|
||||
.page-guide-drawer .semi-sidesheet-body::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.page-guide-drawer .semi-sidesheet-body::-webkit-scrollbar-thumb {
|
||||
border-radius: 999px;
|
||||
background: var(--brand-scroll);
|
||||
}
|
||||
|
||||
.page-guide-drawer .semi-sidesheet-body::-webkit-scrollbar-thumb:hover {
|
||||
background: var(--brand-scroll-hover);
|
||||
}
|
||||
|
||||
.page-guide-head {
|
||||
display: flex;
|
||||
@@ -184,7 +164,7 @@
|
||||
border-color: var(--pg-tint-line);
|
||||
background: color-mix(
|
||||
in srgb,
|
||||
var(--semi-color-primary) 5%,
|
||||
var(--ui-color-primary) 5%,
|
||||
var(--surface-card)
|
||||
);
|
||||
}
|
||||
@@ -226,7 +206,7 @@
|
||||
.page-guide-step.is-next .page-guide-step-ic {
|
||||
border-color: transparent;
|
||||
background: var(--pg-accent);
|
||||
color: var(--semi-color-white, var(--surface-card));
|
||||
color: var(--ui-color-white, var(--surface-card));
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -368,7 +348,7 @@
|
||||
}
|
||||
30% {
|
||||
box-shadow: 0 0 0 4px
|
||||
color-mix(in srgb, var(--semi-color-primary) 45%, transparent);
|
||||
color-mix(in srgb, var(--ui-color-primary) 45%, transparent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Breadcrumb } from 'antd';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const pageTitles = {
|
||||
'/user-center/key-management': '密钥管理',
|
||||
'/user-center/dashboard': '数据看板',
|
||||
'/user-center/usage-record': '使用记录',
|
||||
'/user-center/service-dashboard': '服务监控',
|
||||
'/user-center/topup': '在线充值',
|
||||
'/user-center/settings': '个人设置',
|
||||
'/user-center/invite': '邀请有奖',
|
||||
'/user-center/invoice': '发票管理',
|
||||
'/user-center/weyai-download': '下载 WeyAi 桌面端',
|
||||
};
|
||||
|
||||
export default function UserCenterBreadcrumb() {
|
||||
const { pathname } = useLocation();
|
||||
const { t } = useTranslation();
|
||||
const title = pageTitles[pathname.replace(/\/$/, '')];
|
||||
if (!title) return null;
|
||||
return (
|
||||
<Breadcrumb
|
||||
className='ui-dashboard-breadcrumb ui-user-center-breadcrumb'
|
||||
items={[{ title: t('用户中心') }, { title: t(title) }]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import UserCenterBreadcrumb from './UserCenterBreadcrumb';
|
||||
|
||||
/**
|
||||
* 个人端子页面统一标题区:面包屑 + 28px 标题 + 14px 副标题(+ 可选右侧操作)。
|
||||
* 几何与配色见 src/styles/user-center.css,来源为原型图.zip 中的
|
||||
* 使用记录、在线充值、个人设置截图。只负责呈现,不承载业务状态。
|
||||
*/
|
||||
export default function UserCenterPageHeader({
|
||||
title,
|
||||
subtitle,
|
||||
extra,
|
||||
breadcrumb,
|
||||
className = '',
|
||||
}) {
|
||||
return (
|
||||
<header className={`uc-page-header ${className}`.trim()}>
|
||||
{breadcrumb === undefined ? <UserCenterBreadcrumb /> : breadcrumb}
|
||||
<div className='uc-page-header-main'>
|
||||
<div className='uc-page-header-text'>
|
||||
<h1 className='uc-page-title'>{title}</h1>
|
||||
{subtitle ? <p className='uc-page-subtitle'>{subtitle}</p> : null}
|
||||
</div>
|
||||
{extra ? <div className='uc-page-header-extra'>{extra}</div> : null}
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button, Modal } from '@douyinfe/semi-ui';
|
||||
import { Button, Modal } from '@/components/ui';
|
||||
import { useSecureVerification } from '../../../hooks/common/useSecureVerification';
|
||||
import { createApiCalls } from '../../../services/secureVerification';
|
||||
import SecureVerificationModal from '../modals/SecureVerificationModal';
|
||||
|
||||
@@ -76,7 +76,7 @@ export const IllustrationNoResult = ({ style = {} }) => (
|
||||
y1='70'
|
||||
x2='105'
|
||||
y2='100'
|
||||
stroke='var(--semi-color-danger)'
|
||||
stroke='var(--ui-color-danger)'
|
||||
strokeWidth='4'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
@@ -85,7 +85,7 @@ export const IllustrationNoResult = ({ style = {} }) => (
|
||||
y1='70'
|
||||
x2='75'
|
||||
y2='100'
|
||||
stroke='var(--semi-color-danger)'
|
||||
stroke='var(--ui-color-danger)'
|
||||
strokeWidth='4'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
@@ -186,7 +186,7 @@ export const IllustrationNoResultDark = ({ style = {} }) => (
|
||||
y1='70'
|
||||
x2='105'
|
||||
y2='100'
|
||||
stroke='var(--semi-color-danger)'
|
||||
stroke='var(--ui-color-danger)'
|
||||
strokeWidth='4'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
@@ -195,7 +195,7 @@ export const IllustrationNoResultDark = ({ style = {} }) => (
|
||||
y1='70'
|
||||
x2='75'
|
||||
y2='100'
|
||||
stroke='var(--semi-color-danger)'
|
||||
stroke='var(--ui-color-danger)'
|
||||
strokeWidth='4'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
@@ -237,12 +237,12 @@ export const IllustrationNotFound = ({ style = {} }) => (
|
||||
>
|
||||
<defs>
|
||||
<linearGradient id='notFoundGrad1' x1='0%' y1='0%' x2='100%' y2='100%'>
|
||||
<stop offset='0%' stopColor='var(--semi-color-warning)' />
|
||||
<stop offset='100%' stopColor='var(--semi-color-danger)' />
|
||||
<stop offset='0%' stopColor='var(--ui-color-warning)' />
|
||||
<stop offset='100%' stopColor='var(--ui-color-danger)' />
|
||||
</linearGradient>
|
||||
<linearGradient id='notFoundGrad2' x1='0%' y1='0%' x2='100%' y2='100%'>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--semi-color-warning) 15%, #fff)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--semi-color-danger) 25%, #fff)' />
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-warning) 15%, #fff)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--ui-color-danger) 25%, #fff)' />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
{/* 背景 */}
|
||||
@@ -280,7 +280,7 @@ export const IllustrationNotFound = ({ style = {} }) => (
|
||||
{/* 装饰星星 */}
|
||||
<path
|
||||
d='M40 40 L42 48 L50 50 L42 52 L40 60 L38 52 L30 50 L38 48 Z'
|
||||
fill='var(--semi-color-warning)'
|
||||
fill='var(--ui-color-warning)'
|
||||
opacity='0.6'
|
||||
>
|
||||
<animate
|
||||
@@ -292,7 +292,7 @@ export const IllustrationNotFound = ({ style = {} }) => (
|
||||
</path>
|
||||
<path
|
||||
d='M160 60 L161.5 66 L168 68 L161.5 70 L160 76 L158.5 70 L152 68 L158.5 66 Z'
|
||||
fill='var(--semi-color-danger)'
|
||||
fill='var(--ui-color-danger)'
|
||||
opacity='0.5'
|
||||
>
|
||||
<animate
|
||||
@@ -320,8 +320,8 @@ export const IllustrationNotFoundDark = ({ style = {} }) => (
|
||||
x2='100%'
|
||||
y2='100%'
|
||||
>
|
||||
<stop offset='0%' stopColor='var(--semi-color-warning)' />
|
||||
<stop offset='100%' stopColor='var(--semi-color-danger)' />
|
||||
<stop offset='0%' stopColor='var(--ui-color-warning)' />
|
||||
<stop offset='100%' stopColor='var(--ui-color-danger)' />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id='notFoundGradDark2'
|
||||
@@ -330,8 +330,8 @@ export const IllustrationNotFoundDark = ({ style = {} }) => (
|
||||
x2='100%'
|
||||
y2='100%'
|
||||
>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--semi-color-warning) 30%, #000)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--semi-color-danger) 30%, #000)' />
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-warning) 30%, #000)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--ui-color-danger) 30%, #000)' />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<circle
|
||||
@@ -370,7 +370,7 @@ export const IllustrationNotFoundDark = ({ style = {} }) => (
|
||||
</text>
|
||||
<path
|
||||
d='M40 40 L42 48 L50 50 L42 52 L40 60 L38 52 L30 50 L38 48 Z'
|
||||
fill='var(--semi-color-warning)'
|
||||
fill='var(--ui-color-warning)'
|
||||
opacity='0.7'
|
||||
>
|
||||
<animate
|
||||
@@ -382,7 +382,7 @@ export const IllustrationNotFoundDark = ({ style = {} }) => (
|
||||
</path>
|
||||
<path
|
||||
d='M160 60 L161.5 66 L168 68 L161.5 70 L160 76 L158.5 70 L152 68 L158.5 66 Z'
|
||||
fill='var(--semi-color-danger)'
|
||||
fill='var(--ui-color-danger)'
|
||||
opacity='0.6'
|
||||
>
|
||||
<animate
|
||||
@@ -405,7 +405,7 @@ export const IllustrationNoAccess = ({ style = {} }) => (
|
||||
>
|
||||
<defs>
|
||||
<linearGradient id='noAccessGrad1' x1='0%' y1='0%' x2='100%' y2='100%'>
|
||||
<stop offset='0%' stopColor='var(--semi-color-danger)' />
|
||||
<stop offset='0%' stopColor='var(--ui-color-danger)' />
|
||||
<stop offset='100%' stopColor='var(--brand-gradient-via)' />
|
||||
</linearGradient>
|
||||
<linearGradient id='noAccessGrad2' x1='0%' y1='0%' x2='100%' y2='100%'>
|
||||
@@ -436,7 +436,7 @@ export const IllustrationNoAccess = ({ style = {} }) => (
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
{/* 装饰 */}
|
||||
<circle cx='45' cy='70' r='4' fill='var(--semi-color-danger)' opacity='0.4'>
|
||||
<circle cx='45' cy='70' r='4' fill='var(--ui-color-danger)' opacity='0.4'>
|
||||
<animate
|
||||
attributeName='r'
|
||||
values='4;6;4'
|
||||
@@ -470,7 +470,7 @@ export const IllustrationNoAccessDark = ({ style = {} }) => (
|
||||
x2='100%'
|
||||
y2='100%'
|
||||
>
|
||||
<stop offset='0%' stopColor='var(--semi-color-danger)' />
|
||||
<stop offset='0%' stopColor='var(--ui-color-danger)' />
|
||||
<stop offset='100%' stopColor='var(--brand-gradient-to)' />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
@@ -480,7 +480,7 @@ export const IllustrationNoAccessDark = ({ style = {} }) => (
|
||||
x2='100%'
|
||||
y2='100%'
|
||||
>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--semi-color-danger) 30%, #000)' />
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-danger) 30%, #000)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--brand-gradient-via) 25%, #000)' />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
@@ -508,7 +508,7 @@ export const IllustrationNoAccessDark = ({ style = {} }) => (
|
||||
fill='none'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
<circle cx='45' cy='70' r='4' fill='var(--semi-color-danger)' opacity='0.5'>
|
||||
<circle cx='45' cy='70' r='4' fill='var(--ui-color-danger)' opacity='0.5'>
|
||||
<animate
|
||||
attributeName='r'
|
||||
values='4;6;4'
|
||||
@@ -537,11 +537,11 @@ export const IllustrationConstruction = ({ style = {} }) => (
|
||||
>
|
||||
<defs>
|
||||
<linearGradient id='constructGrad1' x1='0%' y1='0%' x2='100%' y2='100%'>
|
||||
<stop offset='0%' stopColor='var(--semi-color-success)' />
|
||||
<stop offset='0%' stopColor='var(--ui-color-success)' />
|
||||
<stop offset='100%' stopColor='var(--accent-teal)' />
|
||||
</linearGradient>
|
||||
<linearGradient id='constructGrad2' x1='0%' y1='0%' x2='100%' y2='100%'>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--semi-color-success) 15%, #fff)' />
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-success) 15%, #fff)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--accent-teal) 15%, #fff)' />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
@@ -626,7 +626,7 @@ export const IllustrationConstruction = ({ style = {} }) => (
|
||||
opacity='0.7'
|
||||
/>
|
||||
{/* 装饰 */}
|
||||
<circle cx='150' cy='50' r='4' fill='var(--semi-color-success)' opacity='0.5'>
|
||||
<circle cx='150' cy='50' r='4' fill='var(--ui-color-success)' opacity='0.5'>
|
||||
<animate
|
||||
attributeName='opacity'
|
||||
values='0.5;1;0.5'
|
||||
@@ -660,7 +660,7 @@ export const IllustrationConstructionDark = ({ style = {} }) => (
|
||||
x2='100%'
|
||||
y2='100%'
|
||||
>
|
||||
<stop offset='0%' stopColor='var(--semi-color-success)' />
|
||||
<stop offset='0%' stopColor='var(--ui-color-success)' />
|
||||
<stop offset='100%' stopColor='var(--accent-teal)' />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
@@ -670,7 +670,7 @@ export const IllustrationConstructionDark = ({ style = {} }) => (
|
||||
x2='100%'
|
||||
y2='100%'
|
||||
>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--semi-color-success) 25%, #000)' />
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-success) 25%, #000)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--accent-teal) 25%, #000)' />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
@@ -750,7 +750,7 @@ export const IllustrationConstructionDark = ({ style = {} }) => (
|
||||
fill='url(#constructGradDark1)'
|
||||
opacity='0.7'
|
||||
/>
|
||||
<circle cx='150' cy='50' r='4' fill='var(--semi-color-success)' opacity='0.6'>
|
||||
<circle cx='150' cy='50' r='4' fill='var(--ui-color-success)' opacity='0.6'>
|
||||
<animate
|
||||
attributeName='opacity'
|
||||
values='0.6;1;0.6'
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Icon } from '@douyinfe/semi-ui';
|
||||
import { Icon } from '@/components/ui';
|
||||
|
||||
const LinuxDoIcon = (props) => {
|
||||
function CustomIcon() {
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Icon } from '@douyinfe/semi-ui';
|
||||
import { Icon } from '@/components/ui';
|
||||
|
||||
const OIDCIcon = (props) => {
|
||||
function CustomIcon() {
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Icon } from '@douyinfe/semi-ui';
|
||||
import { Icon } from '@/components/ui';
|
||||
|
||||
const WeChatIcon = () => {
|
||||
function CustomIcon() {
|
||||
|
||||
@@ -36,9 +36,9 @@ import {
|
||||
import React from 'react';
|
||||
import { useDebouncedCallback } from 'use-debounce';
|
||||
import clsx from 'clsx';
|
||||
import { Button, Tooltip, Toast } from '@douyinfe/semi-ui';
|
||||
import { Button, Tooltip, Toast } from '@/components/ui';
|
||||
import { copy, rehypeSplitWordsIntoSpans } from '../../../helpers';
|
||||
import { IconCopy } from '@douyinfe/semi-icons';
|
||||
import { IconCopy } from '@/components/ui/icons';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import ImagePreviewModal from '../../playground/ImagePreviewModal';
|
||||
|
||||
@@ -131,9 +131,9 @@ export function Mermaid(props) {
|
||||
cursor: 'pointer',
|
||||
overflow: 'auto',
|
||||
padding: '12px',
|
||||
border: '1px solid var(--semi-color-border)',
|
||||
border: '1px solid var(--ui-color-border)',
|
||||
borderRadius: '8px',
|
||||
backgroundColor: 'var(--semi-color-bg-1)',
|
||||
backgroundColor: 'var(--ui-color-bg-1)',
|
||||
margin: '12px 0',
|
||||
position: 'relative',
|
||||
minHeight: isLoading ? '100px' : 'auto',
|
||||
@@ -150,7 +150,7 @@ export function Mermaid(props) {
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
color: 'var(--semi-color-text-2)',
|
||||
color: 'var(--ui-color-text-2)',
|
||||
fontSize: '12px',
|
||||
}}
|
||||
>
|
||||
@@ -158,8 +158,8 @@ export function Mermaid(props) {
|
||||
style={{
|
||||
width: '14px',
|
||||
height: '14px',
|
||||
border: '2px solid var(--semi-color-border)',
|
||||
borderTop: '2px solid var(--semi-color-primary)',
|
||||
border: '2px solid var(--ui-color-border)',
|
||||
borderTop: '2px solid var(--ui-color-primary)',
|
||||
borderRadius: '50%',
|
||||
animation: 'spin 1s linear infinite',
|
||||
}}
|
||||
@@ -229,8 +229,8 @@ export function PreCode(props) {
|
||||
ref={ref}
|
||||
style={{
|
||||
position: 'relative',
|
||||
backgroundColor: 'var(--semi-color-fill-0)',
|
||||
border: '1px solid var(--semi-color-border)',
|
||||
backgroundColor: 'var(--ui-color-fill-0)',
|
||||
border: '1px solid var(--ui-color-border)',
|
||||
borderRadius: '6px',
|
||||
padding: '12px',
|
||||
margin: '12px 0',
|
||||
@@ -274,10 +274,10 @@ export function PreCode(props) {
|
||||
}}
|
||||
style={{
|
||||
padding: '4px',
|
||||
backgroundColor: 'var(--semi-color-bg-2)',
|
||||
backgroundColor: 'var(--ui-color-bg-2)',
|
||||
borderRadius: '4px',
|
||||
cursor: 'pointer',
|
||||
border: '1px solid var(--semi-color-border)',
|
||||
border: '1px solid var(--ui-color-border)',
|
||||
boxShadow: '0 1px 2px rgba(0, 0, 0, 0.1)',
|
||||
}}
|
||||
/>
|
||||
@@ -291,18 +291,18 @@ export function PreCode(props) {
|
||||
{htmlCode.length > 0 && (
|
||||
<div
|
||||
style={{
|
||||
border: '1px solid var(--semi-color-border)',
|
||||
border: '1px solid var(--ui-color-border)',
|
||||
borderRadius: '8px',
|
||||
padding: '16px',
|
||||
margin: '12px 0',
|
||||
backgroundColor: 'var(--semi-color-bg-1)',
|
||||
backgroundColor: 'var(--ui-color-bg-1)',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
marginBottom: '8px',
|
||||
fontSize: '12px',
|
||||
color: 'var(--semi-color-text-2)',
|
||||
color: 'var(--ui-color-text-2)',
|
||||
}}
|
||||
>
|
||||
HTML预览:
|
||||
@@ -380,7 +380,7 @@ function CustomCode(props) {
|
||||
overflowY: 'hidden',
|
||||
display: 'block',
|
||||
padding: '8px 12px',
|
||||
backgroundColor: 'var(--semi-color-fill-0)',
|
||||
backgroundColor: 'var(--ui-color-fill-0)',
|
||||
borderRadius: '4px',
|
||||
fontSize: '13px',
|
||||
lineHeight: '1.4',
|
||||
@@ -511,7 +511,7 @@ function MarkdownContentImpl(props) {
|
||||
style={{
|
||||
color: isUserMessage
|
||||
? '#87CEEB'
|
||||
: 'var(--semi-color-primary)',
|
||||
: 'var(--ui-color-primary)',
|
||||
textDecoration: 'none',
|
||||
}}
|
||||
onMouseEnter={(e) => {
|
||||
@@ -530,7 +530,7 @@ function MarkdownContentImpl(props) {
|
||||
fontSize: '24px',
|
||||
fontWeight: 'bold',
|
||||
margin: '20px 0 12px 0',
|
||||
color: isUserMessage ? 'white' : 'var(--semi-color-text-0)',
|
||||
color: isUserMessage ? 'white' : 'var(--ui-color-text-0)',
|
||||
}}
|
||||
/>
|
||||
),
|
||||
@@ -541,7 +541,7 @@ function MarkdownContentImpl(props) {
|
||||
fontSize: '20px',
|
||||
fontWeight: 'bold',
|
||||
margin: '18px 0 10px 0',
|
||||
color: isUserMessage ? 'white' : 'var(--semi-color-text-0)',
|
||||
color: isUserMessage ? 'white' : 'var(--ui-color-text-0)',
|
||||
}}
|
||||
/>
|
||||
),
|
||||
@@ -552,7 +552,7 @@ function MarkdownContentImpl(props) {
|
||||
fontSize: '18px',
|
||||
fontWeight: 'bold',
|
||||
margin: '16px 0 8px 0',
|
||||
color: isUserMessage ? 'white' : 'var(--semi-color-text-0)',
|
||||
color: isUserMessage ? 'white' : 'var(--ui-color-text-0)',
|
||||
}}
|
||||
/>
|
||||
),
|
||||
@@ -563,7 +563,7 @@ function MarkdownContentImpl(props) {
|
||||
fontSize: '16px',
|
||||
fontWeight: 'bold',
|
||||
margin: '14px 0 6px 0',
|
||||
color: isUserMessage ? 'white' : 'var(--semi-color-text-0)',
|
||||
color: isUserMessage ? 'white' : 'var(--ui-color-text-0)',
|
||||
}}
|
||||
/>
|
||||
),
|
||||
@@ -574,7 +574,7 @@ function MarkdownContentImpl(props) {
|
||||
fontSize: '14px',
|
||||
fontWeight: 'bold',
|
||||
margin: '12px 0 4px 0',
|
||||
color: isUserMessage ? 'white' : 'var(--semi-color-text-0)',
|
||||
color: isUserMessage ? 'white' : 'var(--ui-color-text-0)',
|
||||
}}
|
||||
/>
|
||||
),
|
||||
@@ -585,7 +585,7 @@ function MarkdownContentImpl(props) {
|
||||
fontSize: '13px',
|
||||
fontWeight: 'bold',
|
||||
margin: '10px 0 4px 0',
|
||||
color: isUserMessage ? 'white' : 'var(--semi-color-text-0)',
|
||||
color: isUserMessage ? 'white' : 'var(--ui-color-text-0)',
|
||||
}}
|
||||
/>
|
||||
),
|
||||
@@ -595,12 +595,12 @@ function MarkdownContentImpl(props) {
|
||||
style={{
|
||||
borderLeft: isUserMessage
|
||||
? '4px solid rgba(255, 255, 255, 0.5)'
|
||||
: '4px solid var(--semi-color-primary)',
|
||||
: '4px solid var(--ui-color-primary)',
|
||||
paddingLeft: '16px',
|
||||
margin: '12px 0',
|
||||
backgroundColor: isUserMessage
|
||||
? 'rgba(255, 255, 255, 0.1)'
|
||||
: 'var(--semi-color-fill-0)',
|
||||
: 'var(--ui-color-fill-0)',
|
||||
padding: '8px 16px',
|
||||
borderRadius: '0 4px 4px 0',
|
||||
fontStyle: 'italic',
|
||||
@@ -647,7 +647,7 @@ function MarkdownContentImpl(props) {
|
||||
borderCollapse: 'collapse',
|
||||
border: isUserMessage
|
||||
? '1px solid rgba(255, 255, 255, 0.3)'
|
||||
: '1px solid var(--semi-color-border)',
|
||||
: '1px solid var(--ui-color-border)',
|
||||
borderRadius: '6px',
|
||||
overflow: 'hidden',
|
||||
}}
|
||||
@@ -661,10 +661,10 @@ function MarkdownContentImpl(props) {
|
||||
padding: '8px 12px',
|
||||
backgroundColor: isUserMessage
|
||||
? 'rgba(255, 255, 255, 0.2)'
|
||||
: 'var(--semi-color-fill-1)',
|
||||
: 'var(--ui-color-fill-1)',
|
||||
border: isUserMessage
|
||||
? '1px solid rgba(255, 255, 255, 0.3)'
|
||||
: '1px solid var(--semi-color-border)',
|
||||
: '1px solid var(--ui-color-border)',
|
||||
fontWeight: 'bold',
|
||||
textAlign: 'left',
|
||||
color: isUserMessage ? 'white' : 'inherit',
|
||||
@@ -678,7 +678,7 @@ function MarkdownContentImpl(props) {
|
||||
padding: '8px 12px',
|
||||
border: isUserMessage
|
||||
? '1px solid rgba(255, 255, 255, 0.3)'
|
||||
: '1px solid var(--semi-color-border)',
|
||||
: '1px solid var(--ui-color-border)',
|
||||
color: isUserMessage ? 'white' : 'inherit',
|
||||
}}
|
||||
/>
|
||||
@@ -727,7 +727,7 @@ export function MarkdownRenderer(props) {
|
||||
fontSize: `${fontSize}px`,
|
||||
fontFamily: fontFamily,
|
||||
lineHeight: '1.6',
|
||||
color: 'var(--semi-color-text-0)',
|
||||
color: 'var(--ui-color-text-0)',
|
||||
...style,
|
||||
}}
|
||||
dir='auto'
|
||||
@@ -740,15 +740,15 @@ export function MarkdownRenderer(props) {
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
padding: '16px',
|
||||
color: 'var(--semi-color-text-2)',
|
||||
color: 'var(--ui-color-text-2)',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
width: '16px',
|
||||
height: '16px',
|
||||
border: '2px solid var(--semi-color-border)',
|
||||
borderTop: '2px solid var(--semi-color-primary)',
|
||||
border: '2px solid var(--ui-color-border)',
|
||||
borderTop: '2px solid var(--ui-color-primary)',
|
||||
borderRadius: '50%',
|
||||
animation: 'spin 1s linear infinite',
|
||||
}}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
.markdown-body {
|
||||
font-family: inherit;
|
||||
line-height: 1.6;
|
||||
color: var(--semi-color-text-0);
|
||||
color: var(--ui-color-text-0);
|
||||
overflow-wrap: break-word;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
@@ -92,26 +92,24 @@
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* 代码高亮主题 - 适配Semi Design */
|
||||
.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
color: var(--semi-color-text-0);
|
||||
color: var(--ui-color-text-0);
|
||||
}
|
||||
|
||||
.hljs-comment,
|
||||
.hljs-quote {
|
||||
color: var(--semi-color-text-2);
|
||||
color: var(--ui-color-text-2);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
.hljs-selector-tag,
|
||||
.hljs-subst {
|
||||
color: var(--semi-color-primary);
|
||||
color: var(--ui-color-primary);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -120,18 +118,18 @@
|
||||
.hljs-variable,
|
||||
.hljs-template-variable,
|
||||
.hljs-tag .hljs-attr {
|
||||
color: var(--semi-color-warning);
|
||||
color: var(--ui-color-warning);
|
||||
}
|
||||
|
||||
.hljs-string,
|
||||
.hljs-doctag {
|
||||
color: var(--semi-color-success);
|
||||
color: var(--ui-color-success);
|
||||
}
|
||||
|
||||
.hljs-title,
|
||||
.hljs-section,
|
||||
.hljs-selector-id {
|
||||
color: var(--semi-color-primary);
|
||||
color: var(--ui-color-primary);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -141,42 +139,42 @@
|
||||
|
||||
.hljs-type,
|
||||
.hljs-class .hljs-title {
|
||||
color: var(--semi-color-info);
|
||||
color: var(--ui-color-info);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-tag,
|
||||
.hljs-name,
|
||||
.hljs-attribute {
|
||||
color: var(--semi-color-primary);
|
||||
color: var(--ui-color-primary);
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.hljs-regexp,
|
||||
.hljs-link {
|
||||
color: var(--semi-color-tertiary);
|
||||
color: var(--ui-color-tertiary);
|
||||
}
|
||||
|
||||
.hljs-symbol,
|
||||
.hljs-bullet {
|
||||
color: var(--semi-color-warning);
|
||||
color: var(--ui-color-warning);
|
||||
}
|
||||
|
||||
.hljs-built_in,
|
||||
.hljs-builtin-name {
|
||||
color: var(--semi-color-info);
|
||||
color: var(--ui-color-info);
|
||||
}
|
||||
|
||||
.hljs-meta {
|
||||
color: var(--semi-color-text-2);
|
||||
color: var(--ui-color-text-2);
|
||||
}
|
||||
|
||||
.hljs-deletion {
|
||||
background: var(--semi-color-danger-light-default);
|
||||
background: var(--ui-color-danger-light-default);
|
||||
}
|
||||
|
||||
.hljs-addition {
|
||||
background: var(--semi-color-success-light-default);
|
||||
background: var(--ui-color-success-light-default);
|
||||
}
|
||||
|
||||
.hljs-emphasis {
|
||||
@@ -205,7 +203,7 @@ pre {
|
||||
}
|
||||
|
||||
pre:hover {
|
||||
border-color: var(--semi-color-primary) !important;
|
||||
border-color: var(--ui-color-primary) !important;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
@@ -230,17 +228,6 @@ pre:hover .copy-code-button {
|
||||
}
|
||||
|
||||
/* 确保按钮可点击 */
|
||||
.copy-code-button .semi-button {
|
||||
pointer-events: auto !important;
|
||||
cursor: pointer !important;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.copy-code-button .semi-button:hover {
|
||||
background-color: var(--semi-color-fill-1) !important;
|
||||
border-color: var(--semi-color-primary) !important;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
/* ===== 服务大盘描述区域表格增强样式 ===== */
|
||||
.service-dashboard-description .markdown-body table {
|
||||
@@ -438,17 +425,17 @@ pre:hover .copy-code-button {
|
||||
left: -8px;
|
||||
top: -8px;
|
||||
font-size: 24px;
|
||||
color: var(--semi-color-primary);
|
||||
color: var(--ui-color-primary);
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
/* 列表样式增强 */
|
||||
.markdown-body ul li::marker {
|
||||
color: var(--semi-color-primary);
|
||||
color: var(--ui-color-primary);
|
||||
}
|
||||
|
||||
.markdown-body ol li::marker {
|
||||
color: var(--semi-color-primary);
|
||||
color: var(--ui-color-primary);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -459,7 +446,7 @@ pre:hover .copy-code-button {
|
||||
background: linear-gradient(
|
||||
to right,
|
||||
transparent,
|
||||
var(--semi-color-border),
|
||||
var(--ui-color-border),
|
||||
transparent
|
||||
);
|
||||
margin: 24px 0;
|
||||
@@ -476,12 +463,12 @@ pre:hover .copy-code-button {
|
||||
|
||||
/* 内联代码样式 */
|
||||
.markdown-body code:not(pre code) {
|
||||
background-color: var(--semi-color-fill-1);
|
||||
background-color: var(--ui-color-fill-1);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-size: 0.9em;
|
||||
color: var(--semi-color-primary);
|
||||
border: 1px solid var(--semi-color-border);
|
||||
color: var(--ui-color-primary);
|
||||
border: 1px solid var(--ui-color-border);
|
||||
}
|
||||
|
||||
/* 标题锚点样式 */
|
||||
@@ -507,11 +494,11 @@ pre:hover .copy-code-button {
|
||||
|
||||
/* 键盘按键样式 */
|
||||
.markdown-body kbd {
|
||||
background-color: var(--semi-color-fill-0);
|
||||
border: 1px solid var(--semi-color-border);
|
||||
background-color: var(--ui-color-fill-0);
|
||||
border: 1px solid var(--ui-color-border);
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 1px 0 var(--semi-color-border);
|
||||
color: var(--semi-color-text-0);
|
||||
box-shadow: 0 1px 0 var(--ui-color-border);
|
||||
color: var(--ui-color-text-0);
|
||||
display: inline-block;
|
||||
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
|
||||
font-size: 0.85em;
|
||||
@@ -523,7 +510,7 @@ pre:hover .copy-code-button {
|
||||
|
||||
/* 详情折叠样式 */
|
||||
.markdown-body details {
|
||||
border: 1px solid var(--semi-color-border);
|
||||
border: 1px solid var(--ui-color-border);
|
||||
border-radius: 6px;
|
||||
padding: 12px;
|
||||
margin: 12px 0;
|
||||
@@ -532,17 +519,17 @@ pre:hover .copy-code-button {
|
||||
.markdown-body summary {
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
color: var(--semi-color-primary);
|
||||
color: var(--ui-color-primary);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.markdown-body summary:hover {
|
||||
color: var(--semi-color-primary-hover);
|
||||
color: var(--ui-color-primary-hover);
|
||||
}
|
||||
|
||||
/* 脚注样式 */
|
||||
.markdown-body .footnote-ref {
|
||||
color: var(--semi-color-primary);
|
||||
color: var(--ui-color-primary);
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -553,32 +540,32 @@ pre:hover .copy-code-button {
|
||||
|
||||
/* 警告块样式 */
|
||||
.markdown-body .warning {
|
||||
background-color: var(--semi-color-warning-light-default);
|
||||
border-left: 4px solid var(--semi-color-warning);
|
||||
background-color: var(--ui-color-warning-light-default);
|
||||
border-left: 4px solid var(--ui-color-warning);
|
||||
padding: 12px 16px;
|
||||
margin: 12px 0;
|
||||
border-radius: 0 6px 6px 0;
|
||||
}
|
||||
|
||||
.markdown-body .info {
|
||||
background-color: var(--semi-color-info-light-default);
|
||||
border-left: 4px solid var(--semi-color-info);
|
||||
background-color: var(--ui-color-info-light-default);
|
||||
border-left: 4px solid var(--ui-color-info);
|
||||
padding: 12px 16px;
|
||||
margin: 12px 0;
|
||||
border-radius: 0 6px 6px 0;
|
||||
}
|
||||
|
||||
.markdown-body .success {
|
||||
background-color: var(--semi-color-success-light-default);
|
||||
border-left: 4px solid var(--semi-color-success);
|
||||
background-color: var(--ui-color-success-light-default);
|
||||
border-left: 4px solid var(--ui-color-success);
|
||||
padding: 12px 16px;
|
||||
margin: 12px 0;
|
||||
border-radius: 0 6px 6px 0;
|
||||
}
|
||||
|
||||
.markdown-body .danger {
|
||||
background-color: var(--semi-color-danger-light-default);
|
||||
border-left: 4px solid var(--semi-color-danger);
|
||||
background-color: var(--ui-color-danger-light-default);
|
||||
border-left: 4px solid var(--ui-color-danger);
|
||||
padding: 12px 16px;
|
||||
margin: 12px 0;
|
||||
border-radius: 0 6px 6px 0;
|
||||
|
||||
@@ -17,7 +17,7 @@ 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 { Modal, Button, Typography } from '@douyinfe/semi-ui';
|
||||
import { Modal, Button, Typography } from '@/components/ui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
Gift,
|
||||
@@ -168,12 +168,12 @@ const NewUserGiftModal = ({ visible, onClose, quota }) => {
|
||||
</div>
|
||||
|
||||
<style jsx='true'>{`
|
||||
.new-user-gift-modal .semi-modal-content {
|
||||
.new-user-gift-modal .ant-modal-content {
|
||||
border-radius: 20px;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
}
|
||||
.new-user-gift-modal .semi-modal-body {
|
||||
.new-user-gift-modal .ant-modal-body {
|
||||
padding: 0;
|
||||
}
|
||||
`}</style>
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
Typography,
|
||||
Tabs,
|
||||
TabPane,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
|
||||
/**
|
||||
* 通用安全验证模态框组件
|
||||
@@ -249,14 +249,14 @@ const SecureVerificationModal = ({
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
borderRadius: '50%',
|
||||
background: 'var(--semi-color-primary-light-default)',
|
||||
background: 'var(--ui-color-primary-light-default)',
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
style={{
|
||||
width: 28,
|
||||
height: 28,
|
||||
color: 'var(--semi-color-primary)',
|
||||
color: 'var(--ui-color-primary)',
|
||||
}}
|
||||
fill='currentColor'
|
||||
viewBox='0 0 20 20'
|
||||
|
||||
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Modal, Button, Input, Typography } from '@douyinfe/semi-ui';
|
||||
import { Modal, Button, Input, Typography } from '@/components/ui';
|
||||
|
||||
/**
|
||||
* 可复用的两步验证模态框组件
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
Radio,
|
||||
Button,
|
||||
Typography,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
@@ -337,65 +337,6 @@ const UserSurveyModal = ({ visible, onClose, onSuccess }) => {
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style jsx='true'>{`
|
||||
.user-survey-modal .semi-modal-content {
|
||||
border-radius: 20px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.survey-radio-group .semi-radio {
|
||||
margin-bottom: 8px;
|
||||
padding: 12px 16px;
|
||||
border-radius: 12px;
|
||||
border: 2px solid transparent;
|
||||
background: rgba(249, 250, 251, 0.8);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.dark .survey-radio-group .semi-radio {
|
||||
background: rgba(31, 41, 55, 0.5);
|
||||
}
|
||||
|
||||
.survey-radio-group .semi-radio:hover {
|
||||
background: rgba(243, 244, 246, 1);
|
||||
border-color: color-mix(in srgb, var(--brand-primary) 30%, transparent);
|
||||
}
|
||||
|
||||
.dark .survey-radio-group .semi-radio:hover {
|
||||
background: rgba(55, 65, 81, 0.8);
|
||||
border-color: color-mix(in srgb, var(--brand-primary) 40%, transparent);
|
||||
}
|
||||
|
||||
.survey-radio-group .semi-radio.semi-radio-checked {
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
color-mix(in srgb, var(--brand-primary) 10%, transparent) 0%,
|
||||
color-mix(in srgb, var(--brand-gradient-via) 10%, transparent) 100%
|
||||
);
|
||||
border-color: color-mix(in srgb, var(--brand-primary) 50%, transparent);
|
||||
}
|
||||
|
||||
.dark .survey-radio-group .semi-radio.semi-radio-checked {
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
color-mix(in srgb, var(--brand-primary) 20%, transparent) 0%,
|
||||
color-mix(in srgb, var(--brand-gradient-via) 20%, transparent) 100%
|
||||
);
|
||||
border-color: color-mix(in srgb, var(--brand-primary) 60%, transparent);
|
||||
}
|
||||
|
||||
.survey-radio-group .semi-radio .semi-radio-inner-display {
|
||||
border-color: #d1d5db;
|
||||
}
|
||||
|
||||
.survey-radio-group
|
||||
.semi-radio.semi-radio-checked
|
||||
.semi-radio-inner-display {
|
||||
border-color: var(--brand-primary);
|
||||
background: var(--brand-primary);
|
||||
}
|
||||
`}</style>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -18,10 +18,10 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { Card, Divider, Button } from '@douyinfe/semi-ui';
|
||||
import { Card, Divider, Button } from '@/components/ui';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useIsMobile } from '../../../hooks/common/useIsMobile';
|
||||
import { IconEyeOpened, IconEyeClosed } from '@douyinfe/semi-icons';
|
||||
import { IconEyeOpened, IconEyeClosed } from '@/components/ui/icons';
|
||||
|
||||
/**
|
||||
* CardPro 高级卡片组件
|
||||
@@ -147,7 +147,7 @@ const CardPro = ({
|
||||
return (
|
||||
<div
|
||||
className={`flex w-full pt-4 border-t ${isMobile ? 'justify-center' : 'justify-between items-center'}`}
|
||||
style={{ borderColor: 'var(--semi-color-border)' }}
|
||||
style={{ borderColor: 'var(--ui-color-border)' }}
|
||||
>
|
||||
{paginationArea}
|
||||
</div>
|
||||
|
||||
@@ -28,8 +28,8 @@ import {
|
||||
Empty,
|
||||
Button,
|
||||
Collapsible,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import { IconChevronDown, IconChevronUp } from '@douyinfe/semi-icons';
|
||||
} from '@/components/ui';
|
||||
import { IconChevronDown, IconChevronUp } from '@/components/ui/icons';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useIsMobile } from '../../../hooks/common/useIsMobile';
|
||||
import { useMinimumLoadingTime } from '../../../hooks/common/useMinimumLoadingTime';
|
||||
@@ -37,7 +37,7 @@ import { useMinimumLoadingTime } from '../../../hooks/common/useMinimumLoadingTi
|
||||
/**
|
||||
* CardTable 响应式表格组件
|
||||
*
|
||||
* 在桌面端渲染 Semi-UI 的 Table 组件,在移动端则将每一行数据渲染成 Card 形式。
|
||||
* 在桌面端渲染 Ant Design Table,在移动端则将每一行数据渲染成 Card 形式。
|
||||
* 该组件与 Table 组件的大部分 API 保持一致,只需将原 Table 换成 CardTable 即可。
|
||||
*/
|
||||
const CardTable = ({
|
||||
@@ -143,7 +143,7 @@ const CardTable = ({
|
||||
<div
|
||||
key={idx}
|
||||
className='flex justify-between items-center py-1 border-b last:border-b-0 border-dashed'
|
||||
style={{ borderColor: 'var(--semi-color-border)' }}
|
||||
style={{ borderColor: 'var(--ui-color-border)' }}
|
||||
>
|
||||
<Skeleton.Title style={{ width: 80, height: 14 }} />
|
||||
<Skeleton.Title
|
||||
@@ -197,7 +197,7 @@ const CardTable = ({
|
||||
{selectionEnabled && (
|
||||
<div
|
||||
className='flex items-center pb-1 mb-1 border-b border-dashed'
|
||||
style={{ borderColor: 'var(--semi-color-border)' }}
|
||||
style={{ borderColor: 'var(--ui-color-border)' }}
|
||||
>
|
||||
<Checkbox
|
||||
checked={selectedKeys.includes(rowKeyVal)}
|
||||
@@ -237,7 +237,7 @@ const CardTable = ({
|
||||
<div
|
||||
key={col.key || colIdx}
|
||||
className='flex justify-between items-start py-1 border-b last:border-b-0 border-dashed'
|
||||
style={{ borderColor: 'var(--semi-color-border)' }}
|
||||
style={{ borderColor: 'var(--ui-color-border)' }}
|
||||
>
|
||||
<span className='font-medium text-gray-600 mr-2 whitespace-nowrap select-none'>
|
||||
{title}
|
||||
@@ -288,7 +288,7 @@ const CardTable = ({
|
||||
return (
|
||||
<div className='flex flex-col gap-2'>
|
||||
{selectionEnabled && selectableKeys.length > 0 && (
|
||||
<div className='flex items-center justify-between px-3 py-2 rounded-xl bg-semi-color-fill-0'>
|
||||
<div className='flex items-center justify-between px-3 py-2 rounded-xl bg-ui-color-fill-0'>
|
||||
<Checkbox
|
||||
checked={allSelected}
|
||||
indeterminate={!allSelected && selectedKeys.length > 0}
|
||||
|
||||
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Card, Button, Typography, Tag } from '@douyinfe/semi-ui';
|
||||
import { Card, Button, Typography, Tag } from '@/components/ui';
|
||||
import { copy, showSuccess } from '../../../helpers';
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 PropTypes from 'prop-types';
|
||||
import { useIsMobile } from '../../../hooks/common/useIsMobile';
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ import {
|
||||
Col,
|
||||
Divider,
|
||||
Tooltip,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import { IconPlus, IconDelete, IconAlertTriangle } from '@douyinfe/semi-icons';
|
||||
} from '@/components/ui';
|
||||
import { IconPlus, IconDelete, IconAlertTriangle } from '@/components/ui/icons';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
@@ -463,8 +463,8 @@ const JSONEditor = ({
|
||||
className='absolute right-2 top-1/2 transform -translate-y-1/2'
|
||||
style={{
|
||||
color: isLastDuplicate
|
||||
? 'var(--semi-color-danger)'
|
||||
: 'var(--semi-color-warning)',
|
||||
? 'var(--ui-color-danger)'
|
||||
: 'var(--ui-color-warning)',
|
||||
fontSize: '14px',
|
||||
}}
|
||||
/>
|
||||
@@ -568,7 +568,7 @@ const JSONEditor = ({
|
||||
<Tooltip content={t('重复的键名')}>
|
||||
<IconAlertTriangle
|
||||
className='absolute right-2 top-1/2 transform -translate-y-1/2'
|
||||
style={{ color: 'var(--semi-color-warning)', fontSize: '14px' }}
|
||||
style={{ color: 'var(--ui-color-warning)', fontSize: '14px' }}
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { InputNumber, withField } from '@douyinfe/semi-ui';
|
||||
import { InputNumber, withField } from '@/components/ui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { getQuotaPerUnit } from '../../../helpers';
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Space, Tag, Typography, Popover } from '@douyinfe/semi-ui';
|
||||
import { Space, Tag, Typography, Popover } from '@/components/ui';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
.rich-text-editor {
|
||||
border: 1px solid var(--semi-color-border);
|
||||
border: 1px solid var(--ui-color-border);
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
background: var(--semi-color-bg-2);
|
||||
background: var(--ui-color-bg-2);
|
||||
}
|
||||
.rich-text-editor.is-invalid {
|
||||
border-color: var(--semi-color-danger);
|
||||
border-color: var(--ui-color-danger);
|
||||
}
|
||||
.rich-text-editor:focus-within {
|
||||
border-color: var(--semi-color-primary);
|
||||
border-color: var(--ui-color-primary);
|
||||
}
|
||||
.rich-text-toolbar {
|
||||
display: flex;
|
||||
@@ -16,8 +16,8 @@
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 8px;
|
||||
border-bottom: 1px solid var(--semi-color-border);
|
||||
background: var(--semi-color-fill-0);
|
||||
border-bottom: 1px solid var(--ui-color-border);
|
||||
background: var(--ui-color-fill-0);
|
||||
}
|
||||
.rich-text-toolbar button,
|
||||
.rich-text-toolbar select {
|
||||
@@ -30,7 +30,7 @@
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
background: transparent;
|
||||
color: var(--semi-color-text-1);
|
||||
color: var(--ui-color-text-1);
|
||||
cursor: pointer;
|
||||
}
|
||||
.rich-text-toolbar select {
|
||||
@@ -39,12 +39,12 @@
|
||||
}
|
||||
.rich-text-toolbar button:hover,
|
||||
.rich-text-toolbar button[aria-pressed='true'] {
|
||||
background: var(--semi-color-primary-light-default);
|
||||
color: var(--semi-color-primary);
|
||||
background: var(--ui-color-primary-light-default);
|
||||
color: var(--ui-color-primary);
|
||||
}
|
||||
.rich-text-toolbar button:focus-visible,
|
||||
.rich-text-toolbar select:focus-visible {
|
||||
outline: 2px solid var(--semi-color-primary);
|
||||
outline: 2px solid var(--ui-color-primary);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
.rich-text-toolbar button:disabled {
|
||||
@@ -56,14 +56,14 @@
|
||||
padding: 16px;
|
||||
outline: none;
|
||||
line-height: 1.9;
|
||||
color: var(--semi-color-text-0);
|
||||
color: var(--ui-color-text-0);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.rich-text-content .ql-editor > * + * {
|
||||
margin-top: 12px;
|
||||
}
|
||||
.rich-text-content .ql-editor.ql-blank::before {
|
||||
color: var(--semi-color-text-2);
|
||||
color: var(--ui-color-text-2);
|
||||
font-style: normal;
|
||||
pointer-events: none;
|
||||
white-space: pre-wrap;
|
||||
@@ -84,20 +84,20 @@
|
||||
padding-left: 0;
|
||||
}
|
||||
.rich-text-content blockquote {
|
||||
border-left: 3px solid var(--semi-color-border);
|
||||
border-left: 3px solid var(--ui-color-border);
|
||||
padding-left: 16px;
|
||||
color: var(--semi-color-text-2);
|
||||
color: var(--ui-color-text-2);
|
||||
}
|
||||
.rich-text-content img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.rich-text-count {
|
||||
border-top: 1px solid var(--semi-color-border);
|
||||
border-top: 1px solid var(--ui-color-border);
|
||||
padding: 4px 12px;
|
||||
text-align: right;
|
||||
font-size: 12px;
|
||||
color: var(--semi-color-text-2);
|
||||
color: var(--ui-color-text-2);
|
||||
}
|
||||
|
||||
.rich-text-content.ql-container,
|
||||
@@ -106,11 +106,11 @@
|
||||
font-size: 14px;
|
||||
}
|
||||
.rich-text-editor.is-invalid:focus-within {
|
||||
border-color: var(--semi-color-danger);
|
||||
border-color: var(--ui-color-danger);
|
||||
}
|
||||
.rich-text-toolbar select option {
|
||||
background: var(--semi-color-bg-2);
|
||||
color: var(--semi-color-text-0);
|
||||
background: var(--ui-color-bg-2);
|
||||
color: var(--ui-color-text-0);
|
||||
}
|
||||
.rich-text-content .ql-editor img {
|
||||
display: inline-block;
|
||||
@@ -119,7 +119,7 @@
|
||||
.rich-text-image-error {
|
||||
padding: 8px 12px;
|
||||
font-size: 12px;
|
||||
color: var(--semi-color-danger);
|
||||
border-top: 1px solid var(--semi-color-border);
|
||||
color: var(--ui-color-danger);
|
||||
border-top: 1px solid var(--ui-color-border);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ import {
|
||||
Checkbox,
|
||||
Skeleton,
|
||||
Tooltip,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import { IconChevronDown, IconChevronUp } from '@douyinfe/semi-icons';
|
||||
} from '@/components/ui';
|
||||
import { IconChevronDown, IconChevronUp } from '@/components/ui/icons';
|
||||
|
||||
/**
|
||||
* 通用可选择按钮组组件
|
||||
@@ -127,7 +127,7 @@ const SelectableButtonGroup = ({
|
||||
fontWeight: 400,
|
||||
cursor: 'pointer',
|
||||
fontSize: '12px',
|
||||
color: 'var(--semi-color-text-2)',
|
||||
color: 'var(--ui-color-text-2)',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
@@ -146,8 +146,8 @@ const SelectableButtonGroup = ({
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-start',
|
||||
border: '1px solid var(--semi-color-border)',
|
||||
borderRadius: 'var(--semi-border-radius-medium)',
|
||||
border: '1px solid var(--ui-color-border)',
|
||||
borderRadius: 'var(--ui-border-radius-medium)',
|
||||
padding: '0 12px',
|
||||
gap: '6px',
|
||||
}}
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Avatar, Button } from '@douyinfe/semi-ui';
|
||||
import { Avatar, Button } from '@/components/ui';
|
||||
import {
|
||||
MessageCircle,
|
||||
Sparkles,
|
||||
|
||||
@@ -23,39 +23,26 @@ import {
|
||||
Spin,
|
||||
Empty,
|
||||
Button,
|
||||
Typography,
|
||||
Tooltip,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import {
|
||||
MessageCircle,
|
||||
X,
|
||||
ChevronRight,
|
||||
Users,
|
||||
RefreshCw,
|
||||
Headphones,
|
||||
QrCode,
|
||||
Sparkles,
|
||||
MessageSquareMore,
|
||||
} from 'lucide-react';
|
||||
Divider,
|
||||
theme,
|
||||
} from 'antd';
|
||||
import { X, RefreshCw, Headphones } from 'lucide-react';
|
||||
import { API } from '../../helpers';
|
||||
import { getServerURL } from '../../helpers/config';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import './styles.css';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
// 本地存储 key
|
||||
const COLLAPSED_STORAGE_KEY = 'cs-collapsed';
|
||||
// 在线客服列表停留时的轮询间隔
|
||||
const ONLINE_POLL_INTERVAL = 15000;
|
||||
|
||||
// 页面内“联系客服”入口派发的可取消事件;客服启用时由本组件 preventDefault 并打开面板。
|
||||
export const CUSTOMER_SERVICE_OPEN_EVENT = 'customer-service:open';
|
||||
|
||||
const CustomerServiceFloat = () => {
|
||||
const { t } = useTranslation();
|
||||
const { token } = theme.useToken();
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [isCollapsed, setIsCollapsed] = useState(() => {
|
||||
// 从本地存储读取收起状态
|
||||
return localStorage.getItem(COLLAPSED_STORAGE_KEY) === 'true';
|
||||
});
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [currentAgent, setCurrentAgent] = useState(null);
|
||||
const [agentList, setAgentList] = useState([]);
|
||||
@@ -91,20 +78,8 @@ const CustomerServiceFloat = () => {
|
||||
API.post(path).catch(() => {});
|
||||
}, []);
|
||||
|
||||
// 切换收起状态
|
||||
const toggleCollapse = (e) => {
|
||||
e.stopPropagation();
|
||||
const newState = !isCollapsed;
|
||||
setIsCollapsed(newState);
|
||||
localStorage.setItem(COLLAPSED_STORAGE_KEY, String(newState));
|
||||
};
|
||||
|
||||
// 展开并打开面板
|
||||
// 打开客服面板;不再读取或提供边缘收起状态。
|
||||
const handleExpand = () => {
|
||||
if (isCollapsed) {
|
||||
setIsCollapsed(false);
|
||||
localStorage.setItem(COLLAPSED_STORAGE_KEY, 'false');
|
||||
}
|
||||
setIsOpen(true);
|
||||
};
|
||||
|
||||
@@ -124,6 +99,18 @@ const CustomerServiceFloat = () => {
|
||||
fetchConfig();
|
||||
}, [fetchConfig]);
|
||||
|
||||
// 页面内入口(如密钥管理“联系客服”)与悬浮按钮共用同一打开逻辑。
|
||||
useEffect(() => {
|
||||
if (!config.enabled) return undefined;
|
||||
const onOpenRequest = (event) => {
|
||||
event.preventDefault();
|
||||
setIsOpen(true);
|
||||
};
|
||||
window.addEventListener(CUSTOMER_SERVICE_OPEN_EVENT, onOpenRequest);
|
||||
return () =>
|
||||
window.removeEventListener(CUSTOMER_SERVICE_OPEN_EVENT, onOpenRequest);
|
||||
}, [config.enabled]);
|
||||
|
||||
// 获取分配的客服(会让后端 current_sessions +1)
|
||||
const fetchAllocatedAgent = useCallback(async () => {
|
||||
setLoading(true);
|
||||
@@ -249,14 +236,10 @@ const CustomerServiceFloat = () => {
|
||||
const statusMap = {
|
||||
1: { text: t('在线'), color: 'green' },
|
||||
2: { text: t('忙碌'), color: 'orange' },
|
||||
0: { text: t('离线'), color: 'grey' },
|
||||
0: { text: t('离线'), color: 'default' },
|
||||
};
|
||||
const s = statusMap[status] || statusMap[0];
|
||||
return (
|
||||
<Tag color={s.color} size='small'>
|
||||
{s.text}
|
||||
</Tag>
|
||||
);
|
||||
return <Tag color={s.color}>{s.text}</Tag>;
|
||||
};
|
||||
|
||||
// 如果没有启用客服,不显示
|
||||
@@ -268,241 +251,163 @@ const CustomerServiceFloat = () => {
|
||||
const hasContact = hasQrcode || currentAgent?.wecom_url;
|
||||
|
||||
return (
|
||||
<div className='customer-service-container' ref={containerRef}>
|
||||
{/* 移动端遮罩:点击关闭(桌面端通过点击外部关闭,遮罩隐藏不挡操作) */}
|
||||
<div
|
||||
className='customer-service-container'
|
||||
ref={containerRef}
|
||||
style={{
|
||||
'--cs-surface': token.colorBgContainer,
|
||||
'--cs-text': token.colorText,
|
||||
'--cs-muted': token.colorTextSecondary,
|
||||
'--cs-border': token.colorBorderSecondary,
|
||||
'--cs-fill': token.colorFillQuaternary,
|
||||
'--cs-hover': token.colorFillTertiary,
|
||||
'--cs-primary': token.colorPrimary,
|
||||
'--cs-primary-bg': token.colorPrimaryBg,
|
||||
'--cs-primary-border': token.colorPrimaryBorder,
|
||||
'--cs-primary-text': token.colorPrimaryText,
|
||||
'--cs-mask': token.colorBgMask,
|
||||
'--cs-shadow': token.boxShadowSecondary,
|
||||
}}
|
||||
>
|
||||
{isOpen && (
|
||||
<div className='cs-backdrop' onClick={handleClose} aria-hidden='true' />
|
||||
)}
|
||||
|
||||
{/* 收起状态 - 边缘小标签 */}
|
||||
{!isOpen && isCollapsed && (
|
||||
<Tooltip content={t('联系客服')} position='left'>
|
||||
<button
|
||||
className='cs-collapsed-tab'
|
||||
onClick={handleExpand}
|
||||
<div className='cs-float-wrapper'>
|
||||
<Tooltip title={isOpen ? t('关闭客服') : t('联系客服')}>
|
||||
<Button
|
||||
type='primary'
|
||||
shape='circle'
|
||||
className='cs-float-button'
|
||||
onClick={isOpen ? handleClose : handleExpand}
|
||||
ref={triggerRef}
|
||||
aria-label={t('联系客服')}
|
||||
>
|
||||
<div className='cs-collapsed-icon'>
|
||||
<MessageSquareMore size={18} strokeWidth={2.5} />
|
||||
</div>
|
||||
<div className='cs-collapsed-indicator' />
|
||||
</button>
|
||||
aria-label={isOpen ? t('关闭客服') : t('联系客服')}
|
||||
icon={
|
||||
isOpen ? (
|
||||
<X size={22} strokeWidth={1.5} />
|
||||
) : (
|
||||
<Headphones size={22} strokeWidth={1.5} />
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
{/* 展开状态的浮动按钮 - 精美客服图标 */}
|
||||
{!isOpen && !isCollapsed && (
|
||||
<div className='cs-float-wrapper'>
|
||||
<button
|
||||
className='cs-float-button cs-has-pulse'
|
||||
onClick={handleExpand}
|
||||
ref={triggerRef}
|
||||
aria-label={t('联系客服')}
|
||||
>
|
||||
{/* 装饰性光环 */}
|
||||
<div className='cs-glow-ring' />
|
||||
<div className='cs-glow-ring cs-glow-ring-2' />
|
||||
|
||||
{/* 主图标 */}
|
||||
<div className='cs-icon-wrapper'>
|
||||
<Headphones size={26} strokeWidth={2} />
|
||||
</div>
|
||||
|
||||
{/* 在线状态指示器 */}
|
||||
<div className='cs-online-indicator'>
|
||||
<div className='cs-online-dot' />
|
||||
</div>
|
||||
|
||||
{/* 悬浮文字提示 */}
|
||||
<div className='cs-float-label'>
|
||||
<span>{t('在线客服')}</span>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
{/* 收起按钮 */}
|
||||
<button
|
||||
className='cs-collapse-btn'
|
||||
onClick={toggleCollapse}
|
||||
title={t('收起')}
|
||||
aria-label={t('收起')}
|
||||
>
|
||||
<ChevronRight size={14} />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 展开的客服面板 */}
|
||||
</div>
|
||||
<div
|
||||
className={`cs-panel ${isOpen ? 'cs-panel-open' : ''}`}
|
||||
role='dialog'
|
||||
aria-label={t('在线客服')}
|
||||
aria-hidden={!isOpen}
|
||||
/* 关闭时让面板内子元素(关闭按钮等)从 Tab 序列与可达性树中移除,
|
||||
避免键盘焦点跑进屏幕外的隐藏面板(也消除 aria-hidden 含焦点元素的告警) */
|
||||
inert={!isOpen ? '' : undefined}
|
||||
tabIndex={-1}
|
||||
ref={panelRef}
|
||||
>
|
||||
{/* 头部 - 渐变背景 */}
|
||||
<div className='cs-panel-header'>
|
||||
<div className='cs-header-content'>
|
||||
<div className='cs-header-icon'>
|
||||
<Headphones size={20} />
|
||||
</div>
|
||||
<div className='cs-header-text'>
|
||||
<span className='cs-header-title'>{t('在线客服')}</span>
|
||||
<span className='cs-header-subtitle'>{t('随时为您服务')}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span className='cs-header-title'>{t('在线客服')}</span>
|
||||
<div className='cs-panel-actions'>
|
||||
{currentAgent && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<Users size={14} />}
|
||||
onClick={switchAgent}
|
||||
style={{
|
||||
color: 'white',
|
||||
background: 'rgba(255,255,255,0.2)',
|
||||
borderRadius: '10px',
|
||||
}}
|
||||
>
|
||||
{currentAgent && !showAgentList && (
|
||||
<Button type='text' size='small' onClick={switchAgent}>
|
||||
{t('切换')}
|
||||
</Button>
|
||||
)}
|
||||
<button
|
||||
<Button
|
||||
type='text'
|
||||
className='cs-close-btn'
|
||||
onClick={handleClose}
|
||||
aria-label={t('关闭')}
|
||||
>
|
||||
<X size={18} />
|
||||
</button>
|
||||
icon={<X size={16} strokeWidth={1.5} />}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 内容区 */}
|
||||
<div className='cs-panel-content'>
|
||||
{loading ? (
|
||||
<div className='cs-loading'>
|
||||
<Spin size='large' />
|
||||
<p className='cs-loading-text'>{t('正在为您分配客服...')}</p>
|
||||
<p>{t('正在为您分配客服...')}</p>
|
||||
</div>
|
||||
) : error ? (
|
||||
<div className='cs-error'>
|
||||
<Empty title={t('暂无可用客服')} description={error} />
|
||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={error} />
|
||||
<Button
|
||||
icon={<RefreshCw size={14} />}
|
||||
onClick={fetchAllocatedAgent}
|
||||
style={{ marginTop: 16 }}
|
||||
>
|
||||
{t('重新获取')}
|
||||
</Button>
|
||||
</div>
|
||||
) : showAgentList ? (
|
||||
/* 客服选择列表 */
|
||||
<div className='cs-agent-list'>
|
||||
<p className='cs-list-title'>{t('请选择客服')}</p>
|
||||
{agentList.length === 0 ? (
|
||||
<Empty description={t('暂无在线客服')} />
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={t('暂无在线客服')}
|
||||
/>
|
||||
) : (
|
||||
agentList.map((agent) => (
|
||||
<div
|
||||
<Button
|
||||
key={agent.id}
|
||||
className='cs-agent-item'
|
||||
onClick={() => selectAgent(agent)}
|
||||
>
|
||||
<Avatar
|
||||
src={agent.avatar}
|
||||
size='small'
|
||||
style={{ marginRight: 12, backgroundColor: '#87d068' }}
|
||||
>
|
||||
<Avatar src={agent.avatar} size={32}>
|
||||
{agent.name?.[0]}
|
||||
</Avatar>
|
||||
<div className='cs-agent-info'>
|
||||
<span className='cs-agent-name'>{agent.name}</span>
|
||||
{getStatusTag(agent.status)}
|
||||
</div>
|
||||
<span className='cs-agent-name'>{agent.name}</span>
|
||||
{getStatusTag(agent.status)}
|
||||
<span className='cs-agent-busy'>
|
||||
{agent.current_sessions}/{agent.max_sessions}
|
||||
</span>
|
||||
</div>
|
||||
</Button>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
) : currentAgent ? (
|
||||
/* 客服聊天界面 */
|
||||
<div className='cs-chat-container'>
|
||||
{/* 当前客服信息 */}
|
||||
<div className='cs-current-agent'>
|
||||
<Avatar
|
||||
src={currentAgent.avatar}
|
||||
size='small'
|
||||
style={{ backgroundColor: '#87d068' }}
|
||||
>
|
||||
<Avatar src={currentAgent.avatar} size={32}>
|
||||
{currentAgent.name?.[0]}
|
||||
</Avatar>
|
||||
<span style={{ marginLeft: 8 }}>{currentAgent.name}</span>
|
||||
<span className='cs-agent-name'>{currentAgent.name}</span>
|
||||
{getStatusTag(currentAgent.status)}
|
||||
</div>
|
||||
|
||||
{/* 客服内容 */}
|
||||
{hasContact ? (
|
||||
<div className='cs-contact-container'>
|
||||
{/* 二维码区域 */}
|
||||
{hasQrcode && (
|
||||
<div className='cs-qrcode'>
|
||||
<div className='cs-qrcode-label'>
|
||||
<QrCode size={16} />
|
||||
<span>{t('扫码联系客服')}</span>
|
||||
<p className='cs-qrcode-label'>{t('扫码联系客服')}</p>
|
||||
<div className='cs-qrcode-frame'>
|
||||
<img
|
||||
src={currentAgent.qrcode_url}
|
||||
alt={t('客服二维码')}
|
||||
className='cs-qrcode-img'
|
||||
onError={() => setQrcodeError(true)}
|
||||
/>
|
||||
</div>
|
||||
<img
|
||||
src={currentAgent.qrcode_url}
|
||||
alt={t('客服二维码')}
|
||||
className='cs-qrcode-img'
|
||||
onError={() => setQrcodeError(true)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 跳转按钮区域 */}
|
||||
{currentAgent.wecom_url && (
|
||||
<div className='cs-wecom-link'>
|
||||
{hasQrcode && (
|
||||
<div className='cs-divider'>
|
||||
<span>{t('或')}</span>
|
||||
</div>
|
||||
)}
|
||||
<button
|
||||
{hasQrcode && <Divider plain>{t('或')}</Divider>}
|
||||
<Button
|
||||
type='primary'
|
||||
className='cs-wecom-btn'
|
||||
onClick={() =>
|
||||
window.open(currentAgent.wecom_url, '_blank')
|
||||
}
|
||||
>
|
||||
<MessageCircle size={18} />
|
||||
{t('打开微信客服')}
|
||||
<Sparkles size={14} />
|
||||
</button>
|
||||
<Text
|
||||
type='tertiary'
|
||||
size='small'
|
||||
style={{ marginTop: 12, opacity: 0.7 }}
|
||||
>
|
||||
{t('点击后将跳转至微信')}
|
||||
</Text>
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className='cs-no-contact'>
|
||||
<Empty
|
||||
description={
|
||||
qrcodeError
|
||||
? t('二维码加载失败,请稍后重试')
|
||||
: t('客服信息配置不完整')
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={
|
||||
qrcodeError
|
||||
? t('二维码加载失败,请稍后重试')
|
||||
: t('客服信息配置不完整')
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Card, Tag, Timeline, Empty } from '@douyinfe/semi-ui';
|
||||
import { Card, Tag, Timeline, Empty } from '@/components/ui';
|
||||
import { Bell } from 'lucide-react';
|
||||
import { marked } from 'marked';
|
||||
import {
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Card, Avatar, Tag, Divider, Empty } from '@douyinfe/semi-ui';
|
||||
import { Card, Avatar, Tag, Divider, Empty } from '@/components/ui';
|
||||
import { Server, Gauge, ExternalLink } from 'lucide-react';
|
||||
import {
|
||||
IllustrationConstruction,
|
||||
@@ -88,7 +88,7 @@ const ApiInfoPanel = ({
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className='!text-semi-color-primary break-all cursor-pointer hover:underline mb-1'
|
||||
className='!text-ui-color-primary break-all cursor-pointer hover:underline mb-1'
|
||||
onClick={() => handleCopyUrl(api.url)}
|
||||
>
|
||||
{api.url}
|
||||
|
||||
@@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
import { Card } from 'antd';
|
||||
import { AreaChart, Trophy } from 'lucide-react';
|
||||
import { VChart } from '@visactor/react-vchart';
|
||||
import { useIsMobile } from '../../hooks/common/useIsMobile';
|
||||
@@ -48,6 +49,7 @@ const toMobileSpec = (spec) => {
|
||||
|
||||
const next = {
|
||||
...spec,
|
||||
background: 'transparent',
|
||||
// 图内标题在手机端隐藏,信息由卡片头部承担
|
||||
title: { ...(spec.title || {}), visible: false },
|
||||
padding: { top: 4, right: 8, bottom: 4, left: 4 },
|
||||
@@ -222,7 +224,10 @@ const ChartsPanel = ({
|
||||
|
||||
const specs = useMemo(() => {
|
||||
if (!isMobile) {
|
||||
return { consume: spec_line, pie: spec_pie };
|
||||
return {
|
||||
consume: { ...spec_line, background: 'transparent' },
|
||||
pie: { ...spec_pie, background: 'transparent' },
|
||||
};
|
||||
}
|
||||
return {
|
||||
consume: toMobileSpec(
|
||||
@@ -256,82 +261,28 @@ const ChartsPanel = ({
|
||||
const chartOption = isMobile ? MOBILE_CHART_CONFIG : CHART_CONFIG;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`flex flex-col flex-1 min-h-0 ${hasApiInfoPanel ? 'lg:col-span-3' : ''}`}
|
||||
>
|
||||
<div className='grid grid-cols-1 xl:grid-cols-2 gap-4 flex-1 min-h-0'>
|
||||
{CHARTS.map((chart) => {
|
||||
const Icon = chart.icon;
|
||||
return (
|
||||
<div key={chart.key} className='relative flex flex-col min-h-0'>
|
||||
{/* 装饰渐变光晕 */}
|
||||
<div
|
||||
className={`pointer-events-none absolute -inset-1 bg-gradient-to-br ${chart.glow} rounded-3xl blur-xl opacity-60`}
|
||||
/>
|
||||
|
||||
<div
|
||||
className={`relative flex-1 flex flex-col min-h-0 bg-white dark:bg-neutral-900/90 backdrop-blur-sm rounded-2xl border border-gray-100 dark:border-neutral-800 shadow-[0_2px_12px_-2px_rgba(0,0,0,0.06)] dark:shadow-[0_2px_12px_-2px_rgba(0,0,0,0.4)] overflow-hidden`}
|
||||
>
|
||||
{/* 顶部高光条 */}
|
||||
<div
|
||||
className={`pointer-events-none absolute top-0 left-0 right-0 h-px bg-gradient-to-r ${chart.gradient} opacity-60`}
|
||||
/>
|
||||
|
||||
{/* 图表标题 + 副标题 + 类型徽章 */}
|
||||
<div className='relative flex items-center justify-between gap-3 px-4 pt-3.5 pb-2.5 shrink-0'>
|
||||
<div className='flex items-center gap-2.5 min-w-0'>
|
||||
<div
|
||||
className={`w-8 h-8 shrink-0 rounded-lg bg-gradient-to-br ${chart.gradient} flex items-center justify-center shadow-md`}
|
||||
>
|
||||
<Icon size={14} className='text-white' />
|
||||
</div>
|
||||
<div className='min-w-0'>
|
||||
<h3 className='font-semibold text-gray-900 dark:text-white text-[13px] tracking-wide leading-tight'>
|
||||
{t(chart.label)}
|
||||
</h3>
|
||||
{/* 手机端图内标题被隐藏,这里改显示「总计」,其余尺寸仍显示副标题 */}
|
||||
<p className='text-[10px] text-gray-400 dark:text-gray-500 leading-tight mt-0.5 truncate'>
|
||||
{isMobile && totals[chart.key]
|
||||
? totals[chart.key]
|
||||
: t(chart.sublabel)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<span
|
||||
className={`shrink-0 inline-flex items-center px-2 py-0.5 rounded-md text-[10px] font-semibold border ${chart.badge}`}
|
||||
>
|
||||
{t(chart.badgeText)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* 分隔线 */}
|
||||
<div className='mx-4 h-px bg-gradient-to-r from-transparent via-gray-200/60 to-transparent dark:via-gray-700/40 shrink-0' />
|
||||
|
||||
{/* 图表区域 - flex-1 撑满剩余高度,min-h 兜底防止过矮 */}
|
||||
<div className='relative flex-1 min-h-[300px] sm:min-h-[320px] p-1.5 sm:p-3 overflow-hidden'>
|
||||
{/* 网格装饰 */}
|
||||
<div
|
||||
className='pointer-events-none absolute inset-0 opacity-[0.025] dark:opacity-[0.05]'
|
||||
style={{
|
||||
backgroundImage: `
|
||||
linear-gradient(rgba(100, 100, 100, 0.5) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(100, 100, 100, 0.5) 1px, transparent 1px)
|
||||
`,
|
||||
backgroundSize: '36px 36px',
|
||||
}}
|
||||
/>
|
||||
<div className='relative h-full'>
|
||||
{/* 注意是 options 复数:react-vchart 的 notSpecKeys 里只认 'options',
|
||||
写成 option 会被当成普通 prop 丢弃(原来的 option={CHART_CONFIG}
|
||||
一直是失效的),移动端 mobile-browser 触屏 tooltip 也就一直没生效 */}
|
||||
<VChart spec={specs[chart.key]} options={chartOption} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div className='ui-dashboard-charts'>
|
||||
{CHARTS.map((chart) => (
|
||||
<Card
|
||||
key={chart.key}
|
||||
title={
|
||||
<span className='ui-chart-title'>
|
||||
<span className='ui-chart-icon' aria-hidden='true'>
|
||||
<AreaChart size={17} />
|
||||
</span>
|
||||
{t(chart.label)}
|
||||
</span>
|
||||
}
|
||||
extra={<span className='ui-field-help'>{t(chart.badgeText)}</span>}
|
||||
>
|
||||
{isMobile && totals[chart.key] && (
|
||||
<p className='ui-field-help'>{totals[chart.key]}</p>
|
||||
)}
|
||||
<div className='ui-chart-canvas'>
|
||||
<VChart spec={specs[chart.key]} options={chartOption} />
|
||||
</div>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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 { RefreshCw, Search } from 'lucide-react';
|
||||
|
||||
const DashboardHeader = ({
|
||||
|
||||
@@ -18,9 +18,9 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Card, Collapse, Empty } from '@douyinfe/semi-ui';
|
||||
import { Card, Collapse, Empty } from '@/components/ui';
|
||||
import { HelpCircle } from 'lucide-react';
|
||||
import { IconPlus, IconMinus } from '@douyinfe/semi-icons';
|
||||
import { IconPlus, IconMinus } from '@/components/ui/icons';
|
||||
import { marked } from 'marked';
|
||||
import {
|
||||
IllustrationConstruction,
|
||||
|
||||
@@ -18,251 +18,85 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Skeleton } from '@douyinfe/semi-ui';
|
||||
import { Card, Skeleton } from 'antd';
|
||||
import { VChart } from '@visactor/react-vchart';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ArrowUpRight, Wallet, TrendingUp, Zap, Clock } from 'lucide-react';
|
||||
import {
|
||||
Wallet,
|
||||
ChartColumnIncreasing,
|
||||
Activity,
|
||||
NotebookText,
|
||||
} from 'lucide-react';
|
||||
|
||||
// 卡片调色板 —— 4 张指标卡用同一蓝色家族的冷色渐进(青→天蓝→蓝→靛),
|
||||
// 贴合云平台克制专业的观感;既能区分 4 张卡,又不像四色那样"花"。
|
||||
// 卡片本体为实底白(dark 实底深灰),强调色仅用于图标 / 顶部高光条 / 角落光斑 / 角标,
|
||||
// 既不透出页面 bg-glow 背景(解决"发灰"),又靠冷蓝 accent 提供层次。
|
||||
const CARD_PALETTES = [
|
||||
{
|
||||
// 账户 / 钱包 —— 青(cyan)
|
||||
iconBg: 'from-cyan-500 to-sky-600',
|
||||
iconShadow: 'shadow-cyan-500/25',
|
||||
glow: 'from-cyan-400/25 to-sky-300/5',
|
||||
bar: 'from-cyan-400 to-sky-500',
|
||||
badge: 'bg-cyan-50 text-cyan-600 dark:bg-cyan-500/15 dark:text-cyan-400',
|
||||
},
|
||||
{
|
||||
// 使用统计 —— 天蓝(sky)
|
||||
iconBg: 'from-sky-500 to-blue-600',
|
||||
iconShadow: 'shadow-sky-500/25',
|
||||
glow: 'from-sky-400/25 to-blue-300/5',
|
||||
bar: 'from-sky-400 to-blue-500',
|
||||
badge: 'bg-sky-50 text-sky-600 dark:bg-sky-500/15 dark:text-sky-400',
|
||||
},
|
||||
{
|
||||
// Token 消耗 —— 蓝(blue)
|
||||
iconBg: 'from-blue-500 to-indigo-600',
|
||||
iconShadow: 'shadow-blue-500/25',
|
||||
glow: 'from-blue-400/25 to-indigo-300/5',
|
||||
bar: 'from-blue-400 to-indigo-500',
|
||||
badge: 'bg-blue-50 text-blue-600 dark:bg-blue-500/15 dark:text-blue-400',
|
||||
},
|
||||
{
|
||||
// 性能指标 —— 靛(indigo)
|
||||
iconBg: 'from-indigo-500 to-violet-600',
|
||||
iconShadow: 'shadow-indigo-500/25',
|
||||
glow: 'from-indigo-400/25 to-violet-300/5',
|
||||
bar: 'from-indigo-400 to-violet-500',
|
||||
badge:
|
||||
'bg-indigo-50 text-indigo-600 dark:bg-indigo-500/15 dark:text-indigo-400',
|
||||
},
|
||||
];
|
||||
|
||||
// 分组图标映射
|
||||
const GROUP_ICONS = {
|
||||
0: Wallet, // 账户数据
|
||||
1: TrendingUp, // 使用统计
|
||||
2: Zap, // Token 消耗
|
||||
3: Clock, // 性能指标
|
||||
};
|
||||
const metricIcons = [Wallet, ChartColumnIncreasing, Activity, NotebookText];
|
||||
|
||||
const StatsCards = ({
|
||||
groupedStatsData,
|
||||
loading,
|
||||
getTrendSpec,
|
||||
CARD_PROPS,
|
||||
CHART_CONFIG,
|
||||
}) => {
|
||||
const _navigate = useNavigate();
|
||||
const { t: _t } = useTranslation();
|
||||
const gridColsClass =
|
||||
groupedStatsData.length >= 4 ? 'xl:grid-cols-4' : 'xl:grid-cols-3';
|
||||
|
||||
const renderValue = (item) => (
|
||||
<Skeleton
|
||||
loading={!!loading}
|
||||
active
|
||||
paragraph={false}
|
||||
title={{ width: 80 }}
|
||||
>
|
||||
{item.value}
|
||||
</Skeleton>
|
||||
);
|
||||
return (
|
||||
<div className={`grid grid-cols-1 md:grid-cols-2 ${gridColsClass} gap-4`}>
|
||||
{groupedStatsData.map((group, idx) => {
|
||||
const palette = CARD_PALETTES[idx % CARD_PALETTES.length];
|
||||
const GroupIcon = GROUP_ICONS[idx] || Wallet;
|
||||
const isTwoColumnLayout = group.layout === 'two-column';
|
||||
|
||||
return (
|
||||
<div
|
||||
key={idx}
|
||||
className={`group/card relative overflow-hidden rounded-2xl bg-white dark:bg-neutral-900/90 border border-gray-100 dark:border-neutral-800 shadow-[0_2px_12px_-2px_rgba(0,0,0,0.06)] dark:shadow-[0_2px_12px_-2px_rgba(0,0,0,0.4)] hover:shadow-[0_12px_28px_-6px_rgba(0,0,0,0.12)] hover:-translate-y-0.5 transition-all duration-300 ease-out`}
|
||||
>
|
||||
{/* 装饰性渐变光斑 */}
|
||||
<div
|
||||
className={`pointer-events-none absolute -top-12 -right-12 w-36 h-36 bg-gradient-to-br ${palette.glow} rounded-full blur-2xl group-hover/card:scale-110 transition-transform duration-500`}
|
||||
/>
|
||||
{/* 顶部高光条 */}
|
||||
<div
|
||||
className={`pointer-events-none absolute top-0 left-0 right-0 h-px bg-gradient-to-r ${palette.bar} opacity-60`}
|
||||
/>
|
||||
{/* 微点阵纹理 - 强化卡片质感 */}
|
||||
<div
|
||||
className='pointer-events-none absolute inset-0 opacity-[0.025] dark:opacity-[0.04]'
|
||||
style={{
|
||||
backgroundImage:
|
||||
'radial-gradient(circle, currentColor 0.5px, transparent 0.5px)',
|
||||
backgroundSize: '12px 12px',
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* 卡片头部 - 标题 + 角标编号 */}
|
||||
<div className='relative px-4 pt-3.5 pb-2.5 flex items-center justify-between'>
|
||||
<div className='flex items-center gap-2.5'>
|
||||
<div
|
||||
className={`relative w-9 h-9 rounded-xl bg-gradient-to-br ${palette.iconBg} flex items-center justify-center shadow-md ${palette.iconShadow} group-hover/card:scale-105 transition-transform duration-300`}
|
||||
>
|
||||
<GroupIcon size={16} className='text-white' />
|
||||
<div className='absolute inset-0 rounded-xl bg-gradient-to-t from-white/0 via-white/0 to-white/30' />
|
||||
</div>
|
||||
<h3 className='font-semibold text-gray-900 dark:text-white text-[13px] tracking-wide'>
|
||||
{group.title}
|
||||
</h3>
|
||||
</div>
|
||||
{/* 序号角标 - 弱化的装饰编号 */}
|
||||
<span
|
||||
className={`text-[10px] font-bold tracking-widest tabular-nums ${palette.badge} px-1.5 py-0.5 rounded-md opacity-70`}
|
||||
>
|
||||
{String(idx + 1).padStart(2, '0')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* 分隔线 - 渐变细线 */}
|
||||
<div className='mx-4 h-px bg-gradient-to-r from-transparent via-gray-200/60 to-transparent dark:via-gray-700/40' />
|
||||
|
||||
{/* 卡片内容 - 紧凑布局
|
||||
- two-column 模式:4 项 2×2 紧凑网格(Token 消耗)
|
||||
- 默认模式:2 项 左标题 + 右大数字 的两端对齐,把右侧留白用数值填满 */}
|
||||
<div
|
||||
className={`relative px-3 py-2.5 ${
|
||||
isTwoColumnLayout ? 'grid grid-cols-2 gap-2' : 'space-y-1'
|
||||
}`}
|
||||
<div className='ui-dashboard-stats'>
|
||||
<div className='ui-dashboard-metrics'>
|
||||
{groupedStatsData
|
||||
.slice(0, 2)
|
||||
.flatMap((group) => group.items)
|
||||
.map((item, index) => (
|
||||
<Card
|
||||
key={index}
|
||||
className='ui-metric'
|
||||
onClick={item.onClick}
|
||||
hoverable={!!item.onClick}
|
||||
>
|
||||
{group.items.map((item, itemIdx) => {
|
||||
// 趋势图仅在 item 显式提供 trendData 且非空时渲染
|
||||
const hasTrend =
|
||||
Array.isArray(item.trendData) && item.trendData.length > 0;
|
||||
|
||||
if (isTwoColumnLayout) {
|
||||
// ========== Token 消耗 - 紧凑卡片样式 ==========
|
||||
return (
|
||||
<div
|
||||
key={itemIdx}
|
||||
className={`group relative flex min-w-0 items-center gap-2.5 px-2 py-2 rounded-xl transition-all ${
|
||||
item.onClick ? 'cursor-pointer' : ''
|
||||
} hover:bg-white/60 dark:hover:bg-white/[0.04]`}
|
||||
onClick={item.onClick}
|
||||
>
|
||||
<div
|
||||
className='w-8 h-8 shrink-0 rounded-lg flex items-center justify-center text-[13px]'
|
||||
style={{
|
||||
backgroundColor: `var(--semi-color-${item.avatarColor}-light-default)`,
|
||||
color: `var(--semi-color-${item.avatarColor})`,
|
||||
}}
|
||||
>
|
||||
{item.icon}
|
||||
</div>
|
||||
<div className='min-w-0'>
|
||||
<div className='truncate text-[11px] text-gray-500 dark:text-gray-400 leading-tight mb-0.5'>
|
||||
{item.title}
|
||||
</div>
|
||||
<div className='truncate text-[15px] font-extrabold text-gray-900 dark:text-white leading-tight tabular-nums tracking-tight'>
|
||||
<Skeleton
|
||||
loading={loading}
|
||||
active
|
||||
placeholder={
|
||||
<Skeleton.Paragraph
|
||||
active
|
||||
rows={1}
|
||||
style={{ width: '60px', height: '18px' }}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{item.value}
|
||||
</Skeleton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// ========== 账户/使用统计/性能指标 - 单列 hero 行 ==========
|
||||
// 左:小图标 + 小标题;右:大数字(吃掉之前的留白)
|
||||
return (
|
||||
<div
|
||||
key={itemIdx}
|
||||
className={`group relative flex items-center justify-between gap-3 px-2.5 py-2.5 rounded-xl transition-all ${
|
||||
item.onClick ? 'cursor-pointer' : ''
|
||||
} hover:bg-white/60 dark:hover:bg-white/[0.04]`}
|
||||
onClick={item.onClick}
|
||||
>
|
||||
{/* 左侧:图标 + 标题 */}
|
||||
<div className='flex min-w-0 items-center gap-2.5'>
|
||||
<div
|
||||
className='w-7 h-7 shrink-0 rounded-lg flex items-center justify-center text-[12px]'
|
||||
style={{
|
||||
backgroundColor: `var(--semi-color-${item.avatarColor}-light-default)`,
|
||||
color: `var(--semi-color-${item.avatarColor})`,
|
||||
}}
|
||||
>
|
||||
{item.icon}
|
||||
</div>
|
||||
<span className='truncate text-[12px] text-gray-500 dark:text-gray-400'>
|
||||
{item.title}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* 右侧:大数字 + 可选趋势图(仅当显式提供) */}
|
||||
<div className='flex items-center gap-3 min-w-0'>
|
||||
{hasTrend && (
|
||||
<div className='w-14 h-6 opacity-70 group-hover:opacity-100 transition-opacity'>
|
||||
<VChart
|
||||
spec={getTrendSpec(item.trendData, item.trendColor)}
|
||||
option={CHART_CONFIG}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<div className='truncate text-right text-lg font-extrabold text-gray-900 dark:text-white leading-none tabular-nums tracking-tight'>
|
||||
<Skeleton
|
||||
loading={loading}
|
||||
active
|
||||
placeholder={
|
||||
<Skeleton.Paragraph
|
||||
active
|
||||
rows={1}
|
||||
style={{ width: '80px', height: '20px' }}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{item.value}
|
||||
</Skeleton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 悬停箭头 */}
|
||||
{item.onClick && (
|
||||
<ArrowUpRight
|
||||
size={12}
|
||||
className='absolute right-1.5 top-1.5 text-gray-300 dark:text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity'
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<span className='ui-metric-icon' aria-hidden='true'>
|
||||
{React.createElement(metricIcons[index] || Activity, {
|
||||
size: 22,
|
||||
})}
|
||||
</span>
|
||||
<div className='min-w-0'>
|
||||
<div className='ui-metric-label'>{item.title}</div>
|
||||
<div className='ui-metric-value'>{renderValue(item)}</div>
|
||||
</div>
|
||||
{Array.isArray(item.trendData) && item.trendData.length > 0 && (
|
||||
<div className='ui-metric-trend'>
|
||||
<VChart
|
||||
spec={getTrendSpec(item.trendData, item.trendColor)}
|
||||
option={CHART_CONFIG}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
<div className='ui-dashboard-details'>
|
||||
{groupedStatsData.slice(2).map((group, index) => (
|
||||
<Card key={index} title={group.title}>
|
||||
<div className='ui-dashboard-detail-items'>
|
||||
{group.items.map((item, itemIndex) => (
|
||||
<div
|
||||
key={itemIndex}
|
||||
onClick={item.onClick}
|
||||
className={item.onClick ? 'cursor-pointer' : ''}
|
||||
>
|
||||
<div className='ui-metric-label'>{item.title}</div>
|
||||
<div className='ui-detail-value'>{renderValue(item)}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default StatsCards;
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
TabPane,
|
||||
Tag,
|
||||
Empty,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import { Gauge, RefreshCw } from 'lucide-react';
|
||||
import {
|
||||
IllustrationConstruction,
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useRef } from 'react';
|
||||
import { Modal, Form, Button } from '@douyinfe/semi-ui';
|
||||
import { Modal, Form, Button } from '@/components/ui';
|
||||
import { Filter, Calendar, Clock, User, Search, X } from 'lucide-react';
|
||||
|
||||
const SearchModal = ({
|
||||
@@ -138,7 +138,7 @@ const SearchModal = ({
|
||||
name='start_timestamp'
|
||||
onChange={(value) => handleInputChange(value, 'start_timestamp')}
|
||||
style={{ width: '100%' }}
|
||||
className='[&_.semi-input-wrapper]:!rounded-lg [&_.semi-input]:!text-sm'
|
||||
className='[&_.ant-input-affix-wrapper]:!rounded-lg [&_.ant-input]:!text-sm'
|
||||
/>
|
||||
</FormFieldWrapper>
|
||||
|
||||
@@ -156,7 +156,7 @@ const SearchModal = ({
|
||||
name='end_timestamp'
|
||||
onChange={(value) => handleInputChange(value, 'end_timestamp')}
|
||||
style={{ width: '100%' }}
|
||||
className='[&_.semi-input-wrapper]:!rounded-lg [&_.semi-input]:!text-sm'
|
||||
className='[&_.ant-input-affix-wrapper]:!rounded-lg [&_.ant-input]:!text-sm'
|
||||
/>
|
||||
</FormFieldWrapper>
|
||||
</div>
|
||||
@@ -186,7 +186,7 @@ const SearchModal = ({
|
||||
handleInputChange(value, 'data_export_default_time')
|
||||
}
|
||||
style={{ width: '100%' }}
|
||||
className='[&_.semi-select]:!rounded-lg'
|
||||
className='[&_.ant-select]:!rounded-lg'
|
||||
/>
|
||||
</FormFieldWrapper>
|
||||
|
||||
@@ -204,7 +204,7 @@ const SearchModal = ({
|
||||
name='username'
|
||||
onChange={(value) => handleInputChange(value, 'username')}
|
||||
style={{ width: '100%' }}
|
||||
className='[&_.semi-input-wrapper]:!rounded-lg'
|
||||
className='[&_.ant-input-affix-wrapper]:!rounded-lg'
|
||||
/>
|
||||
</FormFieldWrapper>
|
||||
)}
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
Switch,
|
||||
Typography,
|
||||
Alert,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
PlusCircle,
|
||||
Zap,
|
||||
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
Popconfirm,
|
||||
Dropdown,
|
||||
Badge,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
History,
|
||||
Search,
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
Card,
|
||||
Empty,
|
||||
Space,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
Loading3,
|
||||
AlertCircle,
|
||||
|
||||
@@ -18,12 +18,15 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useContext, useMemo, useRef, useState, useEffect } from 'react';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
import { Megaphone } from 'lucide-react';
|
||||
import { Megaphone, X } from 'lucide-react';
|
||||
import { Button } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useMarquee } from '../../hooks/common/useMarquee';
|
||||
|
||||
const Marquee = () => {
|
||||
const { t } = useTranslation();
|
||||
const [statusState] = useContext(StatusContext);
|
||||
const { visible, dismiss } = useMarquee();
|
||||
const marqueeContent = statusState?.status?.marquee_content || '';
|
||||
const containerRef = useRef(null);
|
||||
const measureRef = useRef(null);
|
||||
@@ -80,7 +83,7 @@ const Marquee = () => {
|
||||
};
|
||||
}, [displayText]);
|
||||
|
||||
if (!displayText) return null;
|
||||
if (!displayText || !visible) return null;
|
||||
|
||||
return (
|
||||
<div className='marquee-bar relative w-full overflow-hidden z-[99]'>
|
||||
@@ -90,13 +93,10 @@ const Marquee = () => {
|
||||
<div className='flex items-center h-10 px-5'>
|
||||
{/* 左侧图标 - 固定不动 */}
|
||||
<div className='flex-shrink-0 flex items-center gap-2 mr-4 z-10'>
|
||||
<div
|
||||
className='flex items-center justify-center w-6 h-6 rounded-full bg-white/20 dark:bg-white/10 backdrop-blur-sm'
|
||||
style={{ boxShadow: '0 0 8px rgba(255,255,255,0.2)' }}
|
||||
>
|
||||
<Megaphone size={13} className='text-white drop-shadow-sm' />
|
||||
<div className='marquee-icon flex items-center justify-center w-6 h-6'>
|
||||
<Megaphone size={13} />
|
||||
</div>
|
||||
<span className='text-[13px] font-semibold text-white hidden sm:inline tracking-wider drop-shadow-sm'>
|
||||
<span className='text-[13px] font-semibold hidden sm:inline'>
|
||||
{t('公告')}
|
||||
</span>
|
||||
</div>
|
||||
@@ -106,7 +106,7 @@ const Marquee = () => {
|
||||
{/* 隐藏的测量元素 - 用于获取文本自然宽度,不受动态 padding 影响 */}
|
||||
<span
|
||||
ref={measureRef}
|
||||
className='invisible absolute whitespace-nowrap text-[14px] font-medium tracking-wide'
|
||||
className='marquee-measure invisible absolute whitespace-nowrap text-[14px] font-medium tracking-wide'
|
||||
style={{ top: -9999, left: -9999 }}
|
||||
aria-hidden='true'
|
||||
>
|
||||
@@ -139,6 +139,15 @@ const Marquee = () => {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Button
|
||||
type='text'
|
||||
size='small'
|
||||
className='marquee-close flex-shrink-0 ml-4 z-10'
|
||||
aria-label={t('关闭')}
|
||||
icon={<X size={14} aria-hidden />}
|
||||
onClick={dismiss}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 底部发光线 */}
|
||||
|
||||
@@ -19,23 +19,24 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React, { useEffect, useState, useContext, useMemo } from 'react';
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Card,
|
||||
Checkbox,
|
||||
Modal,
|
||||
} from '@douyinfe/semi-ui';
|
||||
Segmented,
|
||||
Spin,
|
||||
Tag,
|
||||
theme,
|
||||
} from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API, showError, getRelativeTime } from '../../helpers';
|
||||
import { marked } from 'marked';
|
||||
|
||||
import { StatusContext } from '../../context/Status';
|
||||
import {
|
||||
Bell,
|
||||
Megaphone,
|
||||
Sparkles,
|
||||
X,
|
||||
CalendarClock,
|
||||
Volume2,
|
||||
Clock,
|
||||
ChevronRight,
|
||||
} from 'lucide-react';
|
||||
import { Bell, Volume1 } from 'lucide-react';
|
||||
import './notice-modal.css';
|
||||
|
||||
const EMPTY_ANNOUNCEMENTS = [];
|
||||
|
||||
const NoticeModal = ({
|
||||
visible,
|
||||
@@ -45,14 +46,14 @@ const NoticeModal = ({
|
||||
unreadKeys = [],
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const { token } = theme.useToken();
|
||||
const [noticeContent, setNoticeContent] = useState('');
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [activeTab, setActiveTab] = useState(defaultTab);
|
||||
|
||||
const [dismissToday, setDismissToday] = useState(true);
|
||||
const [statusState] = useContext(StatusContext);
|
||||
|
||||
const announcements = statusState?.status?.announcements || [];
|
||||
|
||||
const announcements =
|
||||
statusState?.status?.announcements || EMPTY_ANNOUNCEMENTS;
|
||||
const unreadSet = useMemo(() => new Set(unreadKeys), [unreadKeys]);
|
||||
|
||||
const getKeyForItem = (item) =>
|
||||
@@ -114,321 +115,145 @@ const NoticeModal = ({
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
setActiveTab(defaultTab);
|
||||
setDismissToday(true);
|
||||
}
|
||||
}, [defaultTab, visible]);
|
||||
|
||||
const renderMarkdownNotice = () => {
|
||||
if (loading) {
|
||||
return (
|
||||
<div className='py-20 flex flex-col items-center justify-center'>
|
||||
<div className='relative'>
|
||||
<div className='w-16 h-16 border-4 border-brand/10 dark:border-brand-deep rounded-full' />
|
||||
<div className='absolute inset-0 w-16 h-16 border-4 border-transparent border-t-brand rounded-full animate-spin' />
|
||||
<div
|
||||
className='absolute inset-2 w-12 h-12 border-4 border-transparent border-t-brand-via rounded-full animate-spin'
|
||||
style={{
|
||||
animationDirection: 'reverse',
|
||||
animationDuration: '0.8s',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<span className='mt-4 text-gray-500 dark:text-gray-400 font-medium'>
|
||||
{t('加载中...')}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!noticeContent) {
|
||||
return (
|
||||
<div className='py-16 flex flex-col items-center justify-center'>
|
||||
<div className='relative'>
|
||||
<div className='w-24 h-24 bg-gradient-to-br from-brand-from/5 to-brand-to/5 dark:from-brand-from/30 dark:to-brand-to/30 rounded-3xl flex items-center justify-center shadow-inner'>
|
||||
<Bell
|
||||
size={40}
|
||||
className='text-brand-from dark:text-brand-deep'
|
||||
/>
|
||||
</div>
|
||||
<div className='absolute -bottom-1 -right-1 w-8 h-8 bg-gradient-to-br from-emerald-400 to-teal-500 rounded-xl flex items-center justify-center shadow-lg'>
|
||||
<Sparkles size={16} className='text-white' />
|
||||
</div>
|
||||
</div>
|
||||
<span className='mt-5 text-gray-700 dark:text-gray-300 text-lg font-semibold'>
|
||||
{t('暂无公告')}
|
||||
</span>
|
||||
<span className='text-gray-400 dark:text-gray-500 text-sm mt-1'>
|
||||
{t('一切正常,稍后再来看看吧')}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='notice-content-scroll max-h-[50vh] overflow-y-auto pr-2 custom-scrollbar'>
|
||||
<div className='p-4 bg-gray-50/80 dark:bg-gray-800/60 rounded-xl border border-gray-200/60 dark:border-gray-700/40'>
|
||||
<div
|
||||
dangerouslySetInnerHTML={{ __html: noticeContent }}
|
||||
className='prose prose-sm dark:prose-invert max-w-none
|
||||
prose-headings:text-gray-900 dark:prose-headings:text-gray-50 prose-headings:font-bold
|
||||
prose-h1:text-xl prose-h2:text-lg prose-h3:text-base
|
||||
prose-p:text-gray-600 dark:prose-p:text-gray-300 prose-p:leading-relaxed
|
||||
prose-a:text-brand-deep dark:prose-a:text-brand-from prose-a:no-underline hover:prose-a:underline prose-a:font-medium
|
||||
prose-strong:text-gray-800 dark:prose-strong:text-gray-100
|
||||
prose-code:bg-gray-100 dark:prose-code:bg-gray-800 prose-code:text-gray-700 dark:prose-code:text-gray-300 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded-md prose-code:text-xs
|
||||
prose-pre:bg-gray-900 dark:prose-pre:bg-gray-950 prose-pre:text-gray-100 prose-pre:rounded-xl
|
||||
prose-img:rounded-xl
|
||||
prose-ul:space-y-1 prose-ol:space-y-1
|
||||
prose-li:text-gray-600 dark:prose-li:text-gray-300'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const getTypeConfig = (type) => {
|
||||
const configs = {
|
||||
success: {
|
||||
bg: 'bg-emerald-50 dark:bg-emerald-900/20',
|
||||
border: 'border-emerald-200 dark:border-emerald-800',
|
||||
dot: 'bg-emerald-500',
|
||||
tag: 'green',
|
||||
},
|
||||
warning: {
|
||||
bg: 'bg-amber-50 dark:bg-amber-900/20',
|
||||
border: 'border-amber-200 dark:border-amber-800',
|
||||
dot: 'bg-amber-500',
|
||||
tag: 'orange',
|
||||
},
|
||||
error: {
|
||||
bg: 'bg-red-50 dark:bg-red-900/20',
|
||||
border: 'border-red-200 dark:border-red-800',
|
||||
dot: 'bg-red-500',
|
||||
tag: 'red',
|
||||
},
|
||||
ongoing: {
|
||||
bg: 'bg-blue-50 dark:bg-blue-900/20',
|
||||
border: 'border-blue-200 dark:border-blue-800',
|
||||
dot: 'bg-blue-500',
|
||||
tag: 'blue',
|
||||
},
|
||||
default: {
|
||||
bg: 'bg-gray-50 dark:bg-gray-800/50',
|
||||
border: 'border-gray-200 dark:border-gray-700',
|
||||
dot: 'bg-brand',
|
||||
tag: 'violet',
|
||||
},
|
||||
};
|
||||
return configs[type] || configs.default;
|
||||
};
|
||||
|
||||
const renderAnnouncementTimeline = () => {
|
||||
if (processedAnnouncements.length === 0) {
|
||||
return (
|
||||
<div className='py-16 flex flex-col items-center justify-center'>
|
||||
<div className='relative'>
|
||||
<div className='w-24 h-24 bg-gradient-to-br from-emerald-50 to-teal-50 dark:from-emerald-900/30 dark:to-teal-900/30 rounded-3xl flex items-center justify-center shadow-inner'>
|
||||
<Megaphone
|
||||
size={40}
|
||||
className='text-emerald-300 dark:text-emerald-600'
|
||||
/>
|
||||
</div>
|
||||
<div className='absolute -bottom-1 -right-1 w-8 h-8 bg-gradient-to-br from-emerald-400 to-teal-500 rounded-xl flex items-center justify-center shadow-lg'>
|
||||
<Sparkles size={16} className='text-white' />
|
||||
</div>
|
||||
</div>
|
||||
<span className='mt-5 text-gray-700 dark:text-gray-300 text-lg font-semibold'>
|
||||
{t('暂无系统公告')}
|
||||
</span>
|
||||
<span className='text-gray-400 dark:text-gray-500 text-sm mt-1'>
|
||||
{t('一切正常运行中')}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='max-h-[50vh] overflow-y-auto pr-2 custom-scrollbar space-y-3'>
|
||||
{processedAnnouncements.map((item, idx) => {
|
||||
const htmlContent = marked.parse(item.content || '');
|
||||
const htmlExtra = item.extra ? marked.parse(item.extra) : '';
|
||||
const typeConfig = getTypeConfig(item.type);
|
||||
|
||||
return (
|
||||
<div
|
||||
key={idx}
|
||||
className={`group relative rounded-xl border ${typeConfig.bg} ${typeConfig.border} p-4 transition-all duration-200 hover:shadow-md ${item.isUnread ? 'ring-1 ring-brand/30 ring-offset-1 ring-offset-white dark:ring-offset-gray-900' : ''}`}
|
||||
>
|
||||
{/* 未读标记 */}
|
||||
{item.isUnread && (
|
||||
<div className='absolute -top-1.5 -right-1.5'>
|
||||
<span className='relative flex h-4 w-4'>
|
||||
<span className='animate-ping absolute inline-flex h-full w-full rounded-full bg-brand-from opacity-60'></span>
|
||||
<span className='relative inline-flex rounded-full h-4 w-4 bg-gradient-to-r from-brand-from to-brand-to items-center justify-center'>
|
||||
<span className='text-[8px] text-white font-bold'>N</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 时间和类型标签 */}
|
||||
<div className='flex items-center justify-between mb-2.5'>
|
||||
<div className='flex items-center gap-2'>
|
||||
<div
|
||||
className={`w-2 h-2 rounded-full ${typeConfig.dot} flex-shrink-0`}
|
||||
/>
|
||||
<div className='flex items-center gap-1.5 text-xs'>
|
||||
<span className='font-medium text-gray-700 dark:text-gray-300'>
|
||||
{item.relative}
|
||||
</span>
|
||||
<span className='text-gray-300 dark:text-gray-600'>·</span>
|
||||
<span className='text-gray-400 dark:text-gray-500 flex items-center gap-1'>
|
||||
<CalendarClock size={10} />
|
||||
{item.time}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{item.isUnread && (
|
||||
<span className='px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider rounded-md bg-brand/10 dark:bg-brand/20 text-brand-deep dark:text-brand-from'>
|
||||
NEW
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 公告内容 */}
|
||||
<div
|
||||
className='prose prose-sm dark:prose-invert max-w-none
|
||||
prose-p:text-gray-600 dark:prose-p:text-gray-300 prose-p:my-1 prose-p:leading-relaxed
|
||||
prose-a:text-brand-deep dark:prose-a:text-brand-from prose-a:font-medium prose-a:no-underline hover:prose-a:underline
|
||||
prose-strong:text-gray-800 dark:prose-strong:text-gray-100
|
||||
prose-code:bg-gray-100 dark:prose-code:bg-gray-800 prose-code:text-gray-700 dark:prose-code:text-gray-300 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded prose-code:text-xs'
|
||||
dangerouslySetInnerHTML={{ __html: htmlContent }}
|
||||
/>
|
||||
|
||||
{/* 额外信息 */}
|
||||
{item.extra && (
|
||||
<div
|
||||
className='mt-2.5 pt-2.5 border-t border-gray-200/60 dark:border-gray-700/40 text-xs text-gray-500 dark:text-gray-400'
|
||||
dangerouslySetInnerHTML={{ __html: htmlExtra }}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
const unreadCount = processedAnnouncements.filter(
|
||||
(item) => item.isUnread,
|
||||
).length;
|
||||
const typeColors = {
|
||||
success: 'success',
|
||||
warning: 'warning',
|
||||
error: 'error',
|
||||
ongoing: 'processing',
|
||||
default: 'default',
|
||||
};
|
||||
|
||||
const renderBody = () => {
|
||||
if (activeTab === 'inApp') {
|
||||
return renderMarkdownNotice();
|
||||
if (loading) {
|
||||
return (
|
||||
<div className='nm-empty'>
|
||||
<Spin tip={t('加载中...')}>
|
||||
<div className='nm-spin-placeholder' />
|
||||
</Spin>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (!noticeContent) {
|
||||
return <div className='nm-empty'>{t('暂无公告')}</div>;
|
||||
}
|
||||
return (
|
||||
<div className='nm-notice-scroll' tabIndex={0} aria-label={t('通知')}>
|
||||
<div
|
||||
className='nm-markdown'
|
||||
dangerouslySetInnerHTML={{ __html: noticeContent }}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return renderAnnouncementTimeline();
|
||||
if (processedAnnouncements.length === 0) {
|
||||
return <div className='nm-empty'>{t('暂无系统公告')}</div>;
|
||||
}
|
||||
return (
|
||||
<div
|
||||
className='nm-announcement-scroll'
|
||||
tabIndex={0}
|
||||
aria-label={t('系统公告')}
|
||||
>
|
||||
{processedAnnouncements.map((item, idx) => (
|
||||
<Card key={idx} size='small'>
|
||||
<div className='nm-announcement-meta'>
|
||||
<span>
|
||||
<Badge status={typeColors[item.type] || 'default'} />{' '}
|
||||
{item.relative} · {item.time}
|
||||
</span>
|
||||
{item.isUnread && (
|
||||
<Tag color={typeColors[item.type] || 'default'}>NEW</Tag>
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
className='nm-markdown'
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: marked.parse(item.content || ''),
|
||||
}}
|
||||
/>
|
||||
{item.extra && (
|
||||
<div
|
||||
className='nm-announcement-extra nm-markdown'
|
||||
dangerouslySetInnerHTML={{ __html: marked.parse(item.extra) }}
|
||||
/>
|
||||
)}
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={null}
|
||||
visible={visible}
|
||||
title={t('系统公告')}
|
||||
open={visible}
|
||||
onCancel={onClose}
|
||||
footer={null}
|
||||
closable={false}
|
||||
size={isMobile ? 'full-width' : 'large'}
|
||||
className='notice-modal-enhanced'
|
||||
bodyStyle={{ padding: 0 }}
|
||||
width={isMobile ? 'calc(100% - 32px)' : 860}
|
||||
className='notice-modal'
|
||||
rootClassName='notice-modal-root'
|
||||
styles={{
|
||||
mask: {
|
||||
background: `color-mix(in srgb, ${token.colorBgMask} 70%, transparent)`,
|
||||
},
|
||||
}}
|
||||
style={{
|
||||
'--nm-surface': token.colorBgContainer,
|
||||
'--nm-text': token.colorText,
|
||||
'--nm-muted': token.colorTextSecondary,
|
||||
'--nm-border': token.colorBorderSecondary,
|
||||
'--nm-fill': token.colorFillQuaternary,
|
||||
'--nm-tab-bg': token.colorBgLayout,
|
||||
'--nm-primary': token.colorPrimary,
|
||||
}}
|
||||
maskClosable={true}
|
||||
>
|
||||
<div className='relative overflow-hidden'>
|
||||
{/* 背景装饰 */}
|
||||
<div className='absolute inset-0 pointer-events-none overflow-hidden'>
|
||||
<div className='absolute -top-24 -right-24 w-48 h-48 bg-gradient-to-br from-brand-from/[0.08] to-brand-to/[0.08] dark:from-brand-from/15 dark:to-brand-to/15 rounded-full blur-3xl' />
|
||||
<div className='absolute -bottom-24 -left-24 w-48 h-48 bg-gradient-to-br from-pink-500/[0.08] to-rose-500/[0.08] dark:from-pink-500/15 dark:to-rose-500/15 rounded-full blur-3xl' />
|
||||
</div>
|
||||
|
||||
{/* 头部区域 */}
|
||||
<div className='relative px-6 pt-6 pb-4'>
|
||||
{/* 关闭按钮 */}
|
||||
<button
|
||||
onClick={onClose}
|
||||
className='absolute top-4 right-4 p-2 rounded-full bg-gray-100/80 dark:bg-gray-700/80 hover:bg-gray-200 dark:hover:bg-gray-600 transition-all duration-200 z-10 backdrop-blur-sm hover:scale-105 active:scale-95'
|
||||
aria-label='Close'
|
||||
footer={
|
||||
<div className='nm-footer'>
|
||||
<Checkbox
|
||||
checked={dismissToday}
|
||||
onChange={(event) => setDismissToday(event.target.checked)}
|
||||
>
|
||||
<X size={16} className='text-gray-500 dark:text-gray-400' />
|
||||
</button>
|
||||
|
||||
{/* 标题 */}
|
||||
<div className='flex items-center gap-3 mb-5'>
|
||||
<div className='relative'>
|
||||
<div className='p-2.5 bg-gradient-to-br from-brand-from to-brand-to rounded-xl shadow-lg shadow-brand/20 dark:shadow-brand/30'>
|
||||
<Volume2 size={22} className='text-white' />
|
||||
</div>
|
||||
<div className='absolute -top-1 -right-1 w-2.5 h-2.5 bg-rose-500 rounded-full animate-pulse ring-2 ring-white dark:ring-gray-900' />
|
||||
</div>
|
||||
<div>
|
||||
<h2 className='text-lg font-bold text-gray-900 dark:text-gray-50 flex items-center gap-2'>
|
||||
{t('今日不再提示')}
|
||||
</Checkbox>
|
||||
<Button
|
||||
type='primary'
|
||||
onClick={dismissToday ? handleCloseTodayNotice : onClose}
|
||||
>
|
||||
{t('我知道了')}
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Segmented
|
||||
block
|
||||
value={activeTab}
|
||||
onChange={setActiveTab}
|
||||
options={[
|
||||
{
|
||||
value: 'inApp',
|
||||
label: t('通知'),
|
||||
icon: <Bell size={14} strokeWidth={1.5} aria-hidden />,
|
||||
},
|
||||
{
|
||||
value: 'system',
|
||||
label: (
|
||||
<span className='nm-system-label'>
|
||||
{t('系统公告')}
|
||||
<Sparkles size={14} className='text-amber-500' />
|
||||
</h2>
|
||||
<p className='text-xs text-gray-500 dark:text-gray-400 mt-0.5'>
|
||||
{t('了解最新动态和通知')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Tab 切换器 */}
|
||||
<div className='flex gap-1.5 p-1 bg-gray-100/80 dark:bg-gray-800/80 rounded-xl backdrop-blur-sm'>
|
||||
<button
|
||||
onClick={() => setActiveTab('inApp')}
|
||||
className={`flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 ${
|
||||
activeTab === 'inApp'
|
||||
? 'bg-white dark:bg-gray-700 text-brand-deep dark:text-brand-from shadow-sm ring-1 ring-black/5 dark:ring-white/10'
|
||||
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-white/50 dark:hover:bg-gray-700/50'
|
||||
}`}
|
||||
>
|
||||
<Bell size={15} />
|
||||
{t('通知')}
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setActiveTab('system')}
|
||||
className={`flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 ${
|
||||
activeTab === 'system'
|
||||
? 'bg-white dark:bg-gray-700 text-brand-deep dark:text-brand-from shadow-sm ring-1 ring-black/5 dark:ring-white/10'
|
||||
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-white/50 dark:hover:bg-gray-700/50'
|
||||
}`}
|
||||
>
|
||||
<Megaphone size={15} />
|
||||
{t('系统公告')}
|
||||
{processedAnnouncements.filter((a) => a.isUnread).length > 0 && (
|
||||
<span className='px-1.5 py-0.5 text-[10px] font-semibold bg-rose-500 text-white rounded-full min-w-[18px] text-center leading-tight'>
|
||||
{processedAnnouncements.filter((a) => a.isUnread).length}
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 内容区域 */}
|
||||
<div className='relative px-6 pb-2'>{renderBody()}</div>
|
||||
|
||||
{/* 底部按钮区域 */}
|
||||
<div className='relative px-6 py-4 border-t border-gray-200/60 dark:border-gray-700/60'>
|
||||
<div className='flex items-center justify-between'>
|
||||
<button
|
||||
onClick={handleCloseTodayNotice}
|
||||
className='flex items-center gap-1.5 px-3 py-2 text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 transition-colors rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800'
|
||||
>
|
||||
<Clock size={13} />
|
||||
{t('今日不再提示')}
|
||||
</button>
|
||||
<button
|
||||
onClick={onClose}
|
||||
className='flex items-center gap-1.5 px-5 py-2 bg-gradient-to-r from-brand-from to-brand-to hover:from-brand-from hover:to-brand-to text-white text-sm font-medium rounded-xl shadow-md shadow-brand/20 dark:shadow-brand/30 transition-all duration-200 hover:shadow-lg hover:shadow-brand/25 hover:-translate-y-0.5 active:translate-y-0'
|
||||
>
|
||||
{t('我知道了')}
|
||||
<ChevronRight size={14} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Badge count={unreadCount} size='small' />
|
||||
</span>
|
||||
),
|
||||
icon: <Volume1 size={14} strokeWidth={1.5} aria-hidden />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<div className='nm-body'>{renderBody()}</div>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -17,9 +17,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { Layout } from '@douyinfe/semi-ui';
|
||||
import { Layout } from '@/components/ui';
|
||||
import App from '../../App';
|
||||
import { ToastContainer } from 'react-toastify';
|
||||
import React, {
|
||||
useContext,
|
||||
useEffect,
|
||||
@@ -58,6 +57,7 @@ const CustomerServiceFloat = lazy(() => import('../customer-service'));
|
||||
|
||||
// 跑马灯公告组件
|
||||
import Marquee from './Marquee';
|
||||
import { useMarquee } from '../../hooks/common/useMarquee';
|
||||
|
||||
const { Sider, Content, Header } = Layout;
|
||||
|
||||
@@ -78,7 +78,7 @@ const printConsoleWelcome = (status) => {
|
||||
|
||||
const PageLayout = () => {
|
||||
const [userState, userDispatch] = useContext(UserContext);
|
||||
const [statusState, statusDispatch] = useContext(StatusContext);
|
||||
const [, statusDispatch] = useContext(StatusContext);
|
||||
const isMobile = useIsMobile();
|
||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||
const { i18n } = useTranslation();
|
||||
@@ -127,19 +127,17 @@ const PageLayout = () => {
|
||||
const disableOuterScroll =
|
||||
isExperienceCenter || isUserCenter || isHomePage || isOrgPage;
|
||||
|
||||
// 需要显示可见滚动条的页面(覆盖 semi-layout 默认隐藏滚动条的行为)。
|
||||
// 需要显示可见滚动条的页面(覆盖 ant-layout 默认隐藏滚动条的行为)。
|
||||
// 认证页也纳入:内容确实超出视口时(小屏/长表单)用主题色滚动条明示,而不是隐形滚动导致卡片"莫名移动"。
|
||||
const isKeyManagement = location.pathname === '/key-management';
|
||||
const isKeyManagement = location.pathname === '/user-center/key-management';
|
||||
const showVisibleScrollbar = isKeyManagement || isAuthPage;
|
||||
|
||||
// 跑马灯公告是否存在(用于动态计算头部总高度)。
|
||||
// 认证页(登录/注册/企业登录/企业注册)不展示:用户尚未进入平台,公告是面向平台内用户的信息。
|
||||
const hasMarquee =
|
||||
!hideHeader &&
|
||||
!isAuthPage &&
|
||||
!!statusState?.status?.marquee_content?.trim();
|
||||
const marqueeHeight = hasMarquee ? 40 : 0; // h-10 = 40px
|
||||
const headerBarHeight = isMobile ? 56 : 64; // h-14(56px) on mobile, h-16(64px) on desktop
|
||||
const { visible: marqueeVisible } = useMarquee();
|
||||
const hasMarquee = !hideHeader && !isAuthPage && marqueeVisible;
|
||||
const marqueeHeight = hasMarquee ? 35 : 0;
|
||||
const headerBarHeight = isMobile ? 56 : 72;
|
||||
const totalHeaderHeight = headerBarHeight + marqueeHeight;
|
||||
|
||||
// 滚动容器引用
|
||||
@@ -344,6 +342,13 @@ const PageLayout = () => {
|
||||
>
|
||||
{!hideHeader && (
|
||||
<Header
|
||||
className={
|
||||
isAuthPage
|
||||
? ['/org/login', '/login'].includes(location.pathname)
|
||||
? 'login-layout-header'
|
||||
: 'auth-layout-header'
|
||||
: undefined
|
||||
}
|
||||
style={{
|
||||
padding: 0,
|
||||
height: 'auto',
|
||||
@@ -460,7 +465,6 @@ const PageLayout = () => {
|
||||
</Content>
|
||||
</Layout>
|
||||
</Layout>
|
||||
<ToastContainer />
|
||||
<Suspense fallback={null}>
|
||||
<CustomerServiceFloat />
|
||||
</Suspense>
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
import SkeletonWrapper from './components/SkeletonWrapper';
|
||||
import { CLOUD_BRAIN_UI_ENABLED } from '../../config/cloudBrainUi';
|
||||
|
||||
import { Nav, Divider, Button } from '@douyinfe/semi-ui';
|
||||
import { Nav, Divider, Button } from '@/components/ui';
|
||||
|
||||
const routerMap = {
|
||||
home: '/',
|
||||
@@ -457,7 +457,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
|
||||
}, [persistedCollapsed, forceExpanded]);
|
||||
|
||||
// 选中高亮颜色(统一)
|
||||
const SELECTED_COLOR = 'var(--semi-color-primary)';
|
||||
const SELECTED_COLOR = 'var(--ui-color-primary)';
|
||||
|
||||
// 渲染自定义菜单项
|
||||
const renderNavItem = (item) => {
|
||||
@@ -546,7 +546,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
|
||||
width: forceExpanded
|
||||
? 'var(--sidebar-width)'
|
||||
: 'var(--sidebar-current-width)',
|
||||
background: 'var(--semi-color-bg-0)',
|
||||
background: 'var(--ui-color-bg-0)',
|
||||
}}
|
||||
>
|
||||
<SkeletonWrapper
|
||||
@@ -664,7 +664,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
|
||||
<ChevronLeft
|
||||
size={16}
|
||||
strokeWidth={2.5}
|
||||
color='var(--semi-color-text-2)'
|
||||
color='var(--ui-color-text-2)'
|
||||
style={{
|
||||
transform: collapsed ? 'rotate(180deg)' : 'rotate(0deg)',
|
||||
}}
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Skeleton } from '@douyinfe/semi-ui';
|
||||
import { Skeleton } from '@/components/ui';
|
||||
|
||||
const SkeletonWrapper = ({
|
||||
loading = false,
|
||||
@@ -64,7 +64,7 @@ const SkeletonWrapper = ({
|
||||
const renderUserAreaSkeleton = () => {
|
||||
return (
|
||||
<div
|
||||
className={`flex items-center p-1 rounded-full bg-semi-color-fill-0 dark:bg-semi-color-fill-1 ${className}`}
|
||||
className={`flex items-center p-1 rounded-full bg-ui-color-fill-0 dark:bg-ui-color-fill-1 ${className}`}
|
||||
>
|
||||
<Skeleton
|
||||
loading={true}
|
||||
|
||||
@@ -19,9 +19,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React, { useState, useContext } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Button } from '@douyinfe/semi-ui';
|
||||
import { IconCreditCard } from '@douyinfe/semi-icons';
|
||||
import { Share2, BookOpen, MonitorDown } from 'lucide-react';
|
||||
import { Button as AntButton, Divider, Tooltip } from 'antd';
|
||||
import { Share2, BookOpen, Download, Wallet } from 'lucide-react';
|
||||
import NewYearButton from './NewYearButton';
|
||||
import NotificationButton from './NotificationButton';
|
||||
import ThemeToggle from './ThemeToggle';
|
||||
@@ -141,72 +140,58 @@ const ActionButtons = ({
|
||||
isActionVisible('theme') ||
|
||||
languageSwitchEnabled;
|
||||
|
||||
// 进入用户区前是否需要分隔线(任一侧有按钮即显示)
|
||||
const hasHeaderActions = hasPrimaryActions || hasUtilityActions;
|
||||
const actionIcon = (Icon) => <Icon size={16} strokeWidth={1.5} aria-hidden />;
|
||||
|
||||
return (
|
||||
<div className='flex items-center shrink-0 gap-0.5 sm:gap-2 md:gap-3'>
|
||||
<div className='ui-header-actions flex items-center shrink-0'>
|
||||
{/* Tutorial Button - 新手教程按钮 (桌面端显示) */}
|
||||
{isLoggedIn && isButtonVisible('tutorial') && (
|
||||
<Link to='/tutorial' className='hidden sm:block'>
|
||||
<Button
|
||||
theme='light'
|
||||
type='primary'
|
||||
icon={<BookOpen size={15} />}
|
||||
className='group/btn hover:!bg-brand/10 dark:hover:!bg-brand/20 !text-brand-deep dark:!text-brand-from !border !border-brand/30 dark:!border-brand/25 hover:!border-brand/50 !rounded-full !px-3.5 !h-8 !transition-all !duration-200 !shadow-sm hover:!shadow-md hover:!shadow-brand/20 hover:!-translate-y-0.5 active:!translate-y-0'
|
||||
style={{ background: 'var(--semi-color-primary-light-default)' }}
|
||||
>
|
||||
{!isMobile && <span className='font-medium'>{t('新手教程')}</span>}
|
||||
</Button>
|
||||
<AntButton icon={actionIcon(BookOpen)}>
|
||||
{!isMobile && t('新手教程')}
|
||||
</AntButton>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{/* Promotion Button - 推广按钮 (桌面端显示) */}
|
||||
{isLoggedIn && isButtonVisible('pricing') && (
|
||||
<Button
|
||||
theme='light'
|
||||
type='primary'
|
||||
icon={<Share2 size={15} />}
|
||||
className='hidden sm:!inline-flex hover:!bg-brand/10 dark:hover:!bg-brand/20 !text-brand-deep dark:!text-brand-from !border !border-brand/30 dark:!border-brand/25 hover:!border-brand/50 !rounded-full !px-3.5 !h-8 !transition-all !duration-200 !shadow-sm hover:!shadow-md hover:!shadow-brand/20 hover:!-translate-y-0.5 active:!translate-y-0'
|
||||
style={{ background: 'var(--semi-color-primary-light-default)' }}
|
||||
<AntButton
|
||||
icon={actionIcon(Share2)}
|
||||
className='hidden sm:!inline-flex'
|
||||
onClick={() => setPromotionVisible(true)}
|
||||
>
|
||||
{!isMobile && <span className='font-medium'>{t('推广')}</span>}
|
||||
</Button>
|
||||
{!isMobile && t('推广')}
|
||||
</AntButton>
|
||||
)}
|
||||
|
||||
{/* WeyAi 桌面端下载 - 有 WeyAi 访问权限且下载页已开放时显示 (桌面端显示) */}
|
||||
{showWeyAiDownload && (
|
||||
<Link
|
||||
to='/weyai/download'
|
||||
className='hidden sm:block'
|
||||
aria-label={t('下载 WeyAi 桌面端')}
|
||||
>
|
||||
<Button
|
||||
theme='light'
|
||||
type='primary'
|
||||
icon={<MonitorDown size={15} />}
|
||||
className='group/btn hover:!bg-brand/10 dark:hover:!bg-brand/20 !text-brand-deep dark:!text-brand-from !border !border-brand/30 dark:!border-brand/25 hover:!border-brand/50 !rounded-full !px-3.5 !h-8 !transition-all !duration-200 !shadow-sm hover:!shadow-md hover:!shadow-brand/20 hover:!-translate-y-0.5 active:!translate-y-0'
|
||||
style={{ background: 'var(--semi-color-primary-light-default)' }}
|
||||
<Tooltip title={t('下载 WeyAi')}>
|
||||
<Link
|
||||
to='/weyai/download'
|
||||
className='hidden sm:block'
|
||||
aria-label={t('下载 WeyAi 桌面端')}
|
||||
>
|
||||
{!isMobile && (
|
||||
<span className='font-medium'>{t('下载 WeyAi')}</span>
|
||||
)}
|
||||
</Button>
|
||||
</Link>
|
||||
<AntButton
|
||||
type='text'
|
||||
className='ui-header-download'
|
||||
icon={actionIcon(Download)}
|
||||
>
|
||||
{!isMobile && t('下载 WeyAi')}
|
||||
</AntButton>
|
||||
</Link>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
{/* Recharge Button - 充值按钮 (primary CTA) */}
|
||||
{/* Recharge Button - 充值按钮 */}
|
||||
{isButtonVisible('recharge') && (
|
||||
<Link to='/recharge'>
|
||||
<Button
|
||||
theme='solid'
|
||||
type='primary'
|
||||
icon={<IconCreditCard />}
|
||||
className='!bg-gradient-to-r !from-brand !to-brand-deep dark:!from-brand dark:!to-brand-deep !text-white !border-none !rounded-full !px-3 sm:!px-4 !h-7 sm:!h-8 !font-semibold !transition-all !duration-200 !shadow-md !shadow-brand/30 hover:!shadow-lg hover:!shadow-brand/45 hover:!-translate-y-0.5 active:!translate-y-0 active:!scale-[0.98]'
|
||||
<AntButton
|
||||
icon={actionIcon(Wallet)}
|
||||
aria-label={isMobile ? t('充值') : undefined}
|
||||
>
|
||||
{!isMobile && <span className='font-medium'>{t('充值')}</span>}
|
||||
</Button>
|
||||
{!isMobile && t('充值')}
|
||||
</AntButton>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
@@ -215,15 +200,20 @@ const ActionButtons = ({
|
||||
onClose={() => setPromotionVisible(false)}
|
||||
/>
|
||||
|
||||
{/* Divider */}
|
||||
{/* Divider:原型仅在主操作与工具按钮之间保留一条竖线 */}
|
||||
{hasPrimaryActions && hasUtilityActions && (
|
||||
<div className='hidden md:block w-px h-6 bg-gradient-to-b from-transparent via-gray-300 dark:via-neutral-600 to-transparent mx-1' />
|
||||
<Divider type='vertical' className='ui-header-actions-divider' />
|
||||
)}
|
||||
|
||||
{isActionVisible('newYear') && (
|
||||
<NewYearButton isNewYear={isNewYear} t={t} />
|
||||
)}
|
||||
|
||||
{isActionVisible('theme') && (
|
||||
<ThemeToggle theme={theme} onThemeToggle={onThemeToggle} t={t} />
|
||||
)}
|
||||
|
||||
{/* 系统公告:原型位于主题与语言之间 */}
|
||||
{isActionVisible('notifications') && (
|
||||
<NotificationButton
|
||||
unreadCount={unreadCount}
|
||||
@@ -232,10 +222,6 @@ const ActionButtons = ({
|
||||
/>
|
||||
)}
|
||||
|
||||
{isActionVisible('theme') && (
|
||||
<ThemeToggle theme={theme} onThemeToggle={onThemeToggle} t={t} />
|
||||
)}
|
||||
|
||||
{languageSwitchEnabled && (
|
||||
<LanguageSelector
|
||||
currentLang={currentLang}
|
||||
@@ -244,11 +230,6 @@ const ActionButtons = ({
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Divider before user area(认证页 UserArea 通常为空,不渲染悬空分隔线) */}
|
||||
{hasHeaderActions && !isAuthPage && (
|
||||
<div className='hidden md:block w-px h-6 bg-gradient-to-b from-transparent via-gray-300 dark:via-neutral-600 to-transparent mx-1' />
|
||||
)}
|
||||
|
||||
<UserArea
|
||||
userState={userState}
|
||||
isLoading={isLoading}
|
||||
@@ -257,6 +238,7 @@ const ActionButtons = ({
|
||||
headerNavModules={headerNavModules}
|
||||
rightActions={headerNavModules?.rightActions}
|
||||
sidebarModulesAdmin={sidebarModulesAdmin}
|
||||
isOrgUser={isOrgUser}
|
||||
logout={logout}
|
||||
navigate={navigate}
|
||||
t={t}
|
||||
|
||||
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Typography, Tag } from '@douyinfe/semi-ui';
|
||||
import { Tag } from '@/components/ui';
|
||||
import SkeletonWrapper from '../components/SkeletonWrapper';
|
||||
|
||||
const HeaderLogo = ({
|
||||
@@ -38,41 +38,34 @@ const HeaderLogo = ({
|
||||
}
|
||||
|
||||
return (
|
||||
<Link to='/' className='group flex items-center gap-2'>
|
||||
<div className='relative w-8 h-8 md:w-8 md:h-8'>
|
||||
<Link to='/' className='ui-header-logo group flex items-center'>
|
||||
<div className='ui-header-logo-mark relative'>
|
||||
<SkeletonWrapper loading={isLoading || !logoLoaded} type='image' />
|
||||
<img
|
||||
src={logo}
|
||||
alt='logo'
|
||||
className={`absolute inset-0 w-full h-full transition-all duration-200 group-hover:scale-110 rounded-full ${!isLoading && logoLoaded ? 'opacity-100' : 'opacity-0'}`}
|
||||
className={`absolute inset-0 w-full h-full object-contain ${!isLoading && logoLoaded ? 'opacity-100' : 'opacity-0'}`}
|
||||
/>
|
||||
</div>
|
||||
<div className='hidden md:flex items-center gap-2'>
|
||||
<div className='flex items-center gap-2'>
|
||||
<SkeletonWrapper
|
||||
loading={isLoading}
|
||||
type='title'
|
||||
width={120}
|
||||
height={24}
|
||||
<div className='hidden md:flex items-center gap-2 min-w-0'>
|
||||
<SkeletonWrapper
|
||||
loading={isLoading}
|
||||
type='title'
|
||||
width={120}
|
||||
height={24}
|
||||
>
|
||||
<span className='ui-header-brand-name'>{systemName}</span>
|
||||
</SkeletonWrapper>
|
||||
{(isSelfUseMode || isDemoSiteMode) && !isLoading && (
|
||||
<Tag
|
||||
color={isSelfUseMode ? 'purple' : 'blue'}
|
||||
className='text-xs px-1.5 py-0.5 rounded whitespace-nowrap shadow-sm'
|
||||
size='small'
|
||||
shape='circle'
|
||||
>
|
||||
<Typography.Title
|
||||
heading={4}
|
||||
className='!text-lg !font-semibold !mb-0'
|
||||
>
|
||||
{systemName}
|
||||
</Typography.Title>
|
||||
</SkeletonWrapper>
|
||||
{(isSelfUseMode || isDemoSiteMode) && !isLoading && (
|
||||
<Tag
|
||||
color={isSelfUseMode ? 'purple' : 'blue'}
|
||||
className='text-xs px-1.5 py-0.5 rounded whitespace-nowrap shadow-sm'
|
||||
size='small'
|
||||
shape='circle'
|
||||
>
|
||||
{isSelfUseMode ? t('自用模式') : t('演示站点')}
|
||||
</Tag>
|
||||
)}
|
||||
</div>
|
||||
{isSelfUseMode ? t('自用模式') : t('演示站点')}
|
||||
</Tag>
|
||||
)}
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
|
||||
@@ -18,10 +18,10 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Button, Dropdown } from '@douyinfe/semi-ui';
|
||||
import { Button as AntButton } from 'antd';
|
||||
import { Dropdown } from '@/components/ui';
|
||||
import { Globe } from 'lucide-react';
|
||||
import { CN, GB, JP, KR, TH, VN } from 'country-flag-icons/react/3x2';
|
||||
import { useActualTheme } from '../../../context/Theme';
|
||||
import { normalizeLanguage } from '../../../i18n/language';
|
||||
import { orderEnabledLanguages } from '../../../i18n/catalog';
|
||||
import {
|
||||
@@ -36,10 +36,6 @@ const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
|
||||
// i18n.language 可能带地区码(如 zh-CN / en-US),高亮判断先归一化;
|
||||
// 繁体靠地区码区分,不能简单取主语言
|
||||
const lang = normalizeLanguage(currentLang);
|
||||
// 与 ThemeToggle 同规范:图标颜色随实际主题动态取色(Semi 暗色由
|
||||
// body[theme-mode] 驱动,Tailwind dark: 类在此不可靠),菜单样式走
|
||||
// semi-color token 天然亮暗自适应
|
||||
const actualTheme = useActualTheme();
|
||||
|
||||
// 首访时后台判定可能晚于顶栏首次渲染:结果写入缓存后重新读取启用语言,
|
||||
// 避免列出后台已停用的语言
|
||||
@@ -54,8 +50,8 @@ const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
|
||||
const getItemClassName = (isSelected) =>
|
||||
`!flex !items-center !gap-2 !px-3 !py-1.5 !text-sm ${
|
||||
isSelected
|
||||
? '!bg-semi-color-primary-light-default !font-semibold'
|
||||
: 'hover:!bg-semi-color-fill-1'
|
||||
? '!bg-ui-color-primary-light-default !font-semibold'
|
||||
: 'hover:!bg-ui-color-fill-1'
|
||||
}`;
|
||||
|
||||
// 展示哪些语言、按什么顺序由后台「语言与地区」配置决定(经 /api/i18n/locale 缓存下发)
|
||||
@@ -82,21 +78,12 @@ const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
|
||||
</Dropdown.Menu>
|
||||
}
|
||||
>
|
||||
<span className='inline-flex'>
|
||||
<Button
|
||||
icon={<Globe size={20} />}
|
||||
aria-label={t('common.changeLanguage')}
|
||||
theme='borderless'
|
||||
type='tertiary'
|
||||
className='!w-8 !h-8 sm:!w-9 sm:!h-9 !flex !items-center !justify-center hover:!bg-brand/10 dark:hover:!bg-brand/15 hover:!text-brand-deep dark:hover:!text-brand-from !rounded-full !transition-all !duration-200 hover:!scale-[1.08] active:!scale-95'
|
||||
style={{
|
||||
color:
|
||||
actualTheme === 'dark'
|
||||
? 'rgba(243,244,246,0.9)'
|
||||
: 'rgba(75,85,99,1)',
|
||||
}}
|
||||
/>
|
||||
</span>
|
||||
<AntButton
|
||||
type='text'
|
||||
icon={<Globe size={16} strokeWidth={1.5} aria-hidden />}
|
||||
aria-label={t('common.changeLanguage')}
|
||||
className='ui-header-icon-action'
|
||||
/>
|
||||
</Dropdown>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -18,8 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button } from '@douyinfe/semi-ui';
|
||||
import { IconClose, IconMenu } from '@douyinfe/semi-icons';
|
||||
import { Button } from '@/components/ui';
|
||||
import { IconClose, IconMenu } from '@/components/ui/icons';
|
||||
|
||||
const MobileMenuButton = ({
|
||||
isConsoleRoute,
|
||||
|
||||
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { Button, Dropdown } from '@douyinfe/semi-ui';
|
||||
import { Button, Dropdown } from '@/components/ui';
|
||||
import { Compass, ExternalLink } from 'lucide-react';
|
||||
|
||||
/**
|
||||
@@ -141,7 +141,7 @@ const MobileNavMenu = ({ mainNavLinks, userState, t }) => {
|
||||
aria-haspopup='menu'
|
||||
aria-expanded={visible}
|
||||
icon={<Compass size={16} />}
|
||||
className='!ml-1 !px-2 !h-8 max-w-[9rem] !rounded-xl !text-current hover:!bg-brand/10 dark:hover:!bg-brand/15 hover:!text-brand-deep dark:hover:!text-brand-from !transition-all !duration-200 active:!scale-95 [&_.semi-button-content]:min-w-0'
|
||||
className='!ml-1 !px-2 !h-8 max-w-[9rem] !rounded-xl !text-current hover:!bg-brand/10 dark:hover:!bg-brand/15 hover:!text-brand-deep dark:hover:!text-brand-from !transition-all !duration-200 active:!scale-95 [&_.ant-btn-content]:min-w-0'
|
||||
>
|
||||
<span className='ml-1 text-[13px] font-semibold truncate'>
|
||||
{activeItem ? activeItem.text : t('导航')}
|
||||
|
||||
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { Dropdown } from '@douyinfe/semi-ui';
|
||||
import { Dropdown } from '@/components/ui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import SkeletonWrapper from '../components/SkeletonWrapper';
|
||||
|
||||
@@ -29,11 +29,10 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
|
||||
|
||||
const renderNavLinks = () => {
|
||||
const baseClasses =
|
||||
'nav-item-enhanced flex-shrink-0 flex items-center gap-1.5 font-semibold rounded-xl transition-all duration-300 ease-out relative overflow-hidden group';
|
||||
'ui-header-nav-item flex-shrink-0 flex items-center gap-1.5 font-medium relative';
|
||||
const defaultClasses = 'text-gray-600 dark:text-neutral-300';
|
||||
const hoverClasses = 'hover:text-brand-deep dark:hover:text-brand-from';
|
||||
const activeClasses =
|
||||
'text-brand-deep dark:text-brand-from bg-brand/5 dark:bg-brand-deep/30';
|
||||
const activeClasses = 'text-brand-deep dark:text-brand-from';
|
||||
const spacingClasses = isMobile ? 'px-2 py-1 text-sm' : 'px-4 py-2';
|
||||
|
||||
// Match on full path segments so /market doesn't light up on /market-detail
|
||||
@@ -65,11 +64,6 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
|
||||
isActive = isPathActive(link.activePrefix || targetPath);
|
||||
}
|
||||
|
||||
// Hover background effect component
|
||||
const hoverBg = (
|
||||
<span className='absolute inset-0 bg-gradient-to-r from-brand-from/10 via-brand-via/5 to-brand-to/10 dark:from-brand-from/40 dark:via-brand-via/30 dark:to-brand-to/40 opacity-0 group-hover:opacity-100 transition-opacity duration-300 rounded-xl' />
|
||||
);
|
||||
|
||||
const finalClasses = `${baseClasses} ${spacingClasses} ${isActive ? `nav-item-active ${activeClasses}` : `${defaultClasses} ${hoverClasses}`}`;
|
||||
|
||||
if (link.items && link.items.length > 0) {
|
||||
@@ -79,12 +73,9 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
|
||||
trigger={'hover'}
|
||||
position={'bottomLeft'}
|
||||
render={
|
||||
<Dropdown.Menu className='!rounded-xl !border !border-gray-100 dark:!border-neutral-800 !shadow-xl !shadow-gray-200/50 dark:!shadow-black/30 !backdrop-blur-xl !bg-white/95 dark:!bg-neutral-900/95'>
|
||||
<Dropdown.Menu>
|
||||
{link.items.map((subItem) => (
|
||||
<Dropdown.Item
|
||||
key={subItem.itemKey}
|
||||
className='!rounded-lg !mx-1 !my-0.5 hover:!bg-brand/5 dark:hover:!bg-brand-deep/30 transition-colors'
|
||||
>
|
||||
<Dropdown.Item key={subItem.itemKey}>
|
||||
<Link
|
||||
to={subItem.to}
|
||||
className='block w-full py-0.5 text-gray-700 dark:text-neutral-200 hover:text-brand-deep dark:hover:text-brand-from transition-colors'
|
||||
@@ -98,7 +89,6 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
|
||||
}
|
||||
>
|
||||
<div className={`${finalClasses} cursor-pointer`}>
|
||||
{hoverBg}
|
||||
{linkContent}
|
||||
{/* Dropdown arrow */}
|
||||
<svg
|
||||
@@ -128,7 +118,6 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
|
||||
rel='noopener noreferrer'
|
||||
className={`${baseClasses} ${spacingClasses} ${defaultClasses} ${hoverClasses}`}
|
||||
>
|
||||
{hoverBg}
|
||||
{linkContent}
|
||||
{/* External link icon */}
|
||||
<svg
|
||||
@@ -155,7 +144,6 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
|
||||
className={finalClasses}
|
||||
aria-current={isActive ? 'page' : undefined}
|
||||
>
|
||||
{hoverBg}
|
||||
{linkContent}
|
||||
</Link>
|
||||
);
|
||||
@@ -165,7 +153,7 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
|
||||
return (
|
||||
<nav
|
||||
aria-label={t('主导航')}
|
||||
className='flex flex-1 items-center gap-1 lg:gap-2 mx-1 sm:mx-3 md:mx-6 overflow-x-auto whitespace-nowrap scrollbar-hide min-w-0'
|
||||
className='ui-header-navigation flex flex-1 items-center gap-1 lg:gap-2 mx-1 sm:mx-3 md:mx-6 overflow-x-auto whitespace-nowrap scrollbar-hide min-w-0'
|
||||
>
|
||||
<SkeletonWrapper
|
||||
loading={isLoading}
|
||||
|
||||
@@ -18,7 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button, Dropdown } from '@douyinfe/semi-ui';
|
||||
import { Button as AntButton } from 'antd';
|
||||
import { Dropdown } from '@/components/ui';
|
||||
import fireworks from 'react-fireworks';
|
||||
|
||||
const NewYearButton = ({ isNewYear, t }) => {
|
||||
@@ -38,22 +39,21 @@ const NewYearButton = ({ isNewYear, t }) => {
|
||||
<Dropdown
|
||||
position='bottomRight'
|
||||
render={
|
||||
<Dropdown.Menu className='!bg-semi-color-bg-overlay !border-semi-color-border !shadow-lg !rounded-lg dark:!bg-gray-700 dark:!border-gray-600'>
|
||||
<Dropdown.Menu className='!bg-ui-color-bg-overlay !border-ui-color-border !shadow-lg !rounded-lg dark:!bg-gray-700 dark:!border-gray-600'>
|
||||
<Dropdown.Item
|
||||
onClick={handleNewYearClick}
|
||||
className='!text-semi-color-text-0 hover:!bg-semi-color-fill-1 dark:!text-gray-200 dark:hover:!bg-gray-600'
|
||||
className='!text-ui-color-text-0 hover:!bg-ui-color-fill-1 dark:!text-gray-200 dark:hover:!bg-gray-600'
|
||||
>
|
||||
{t('新年快乐')} 🎉
|
||||
</Dropdown.Item>
|
||||
</Dropdown.Menu>
|
||||
}
|
||||
>
|
||||
<Button
|
||||
theme='borderless'
|
||||
type='tertiary'
|
||||
<AntButton
|
||||
type='text'
|
||||
icon={<span className='text-xl'>🎉</span>}
|
||||
aria-label={t('新年快乐')}
|
||||
className='!w-8 !h-8 sm:!w-9 sm:!h-9 !flex !items-center !justify-center !text-current hover:!bg-brand/10 dark:hover:!bg-brand/15 !rounded-full !transition-all !duration-200 hover:!scale-[1.08] active:!scale-95'
|
||||
className='ui-header-icon-action'
|
||||
/>
|
||||
</Dropdown>
|
||||
);
|
||||
|
||||
@@ -18,64 +18,23 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button, Badge } from '@douyinfe/semi-ui';
|
||||
import { useActualTheme } from '../../../context/Theme';
|
||||
import { Badge, Button, Tooltip } from 'antd';
|
||||
import { Volume1 } from 'lucide-react';
|
||||
|
||||
// 自定义通知图标 — 圆角方形气泡 + 圆点指示
|
||||
const NoticeIcon = ({ size = 19, color = 'currentColor' }) => (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox='0 0 24 24'
|
||||
fill='none'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
>
|
||||
<rect
|
||||
x='3'
|
||||
y='4'
|
||||
width='18'
|
||||
height='14'
|
||||
rx='4'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
/>
|
||||
<circle cx='8.5' cy='11' r='1.25' fill={color} />
|
||||
<circle cx='12' cy='11' r='1.25' fill={color} />
|
||||
<circle cx='15.5' cy='11' r='1.25' fill={color} />
|
||||
<path
|
||||
d='M8 18l2.5-3h3L16 18'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
strokeLinejoin='round'
|
||||
/>
|
||||
</svg>
|
||||
// 系统公告入口:34px text 按钮、16px 喇叭图标。
|
||||
// 显隐(rightActions.notifications)、点击(打开 NoticeModal)与未读数均沿用原逻辑。
|
||||
const NotificationButton = ({ unreadCount, onNoticeOpen, t }) => (
|
||||
<Tooltip title={t('系统公告')}>
|
||||
<Badge count={unreadCount} overflowCount={99} size='small'>
|
||||
<Button
|
||||
type='text'
|
||||
className='ui-header-icon-action'
|
||||
aria-label={t('系统公告')}
|
||||
icon={<Volume1 size={16} strokeWidth={1.5} aria-hidden />}
|
||||
onClick={onNoticeOpen}
|
||||
/>
|
||||
</Badge>
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
const NotificationButton = ({ unreadCount, onNoticeOpen, t }) => {
|
||||
const actualTheme = useActualTheme();
|
||||
const isDark = actualTheme === 'dark';
|
||||
|
||||
const buttonProps = {
|
||||
icon: <NoticeIcon size={19} />,
|
||||
'aria-label': t('系统公告'),
|
||||
onClick: onNoticeOpen,
|
||||
theme: 'borderless',
|
||||
type: 'tertiary',
|
||||
className:
|
||||
'!w-8 !h-8 sm:!w-9 sm:!h-9 !flex !items-center !justify-center hover:!bg-brand/10 dark:hover:!bg-brand/15 hover:!text-brand-deep dark:hover:!text-brand-from !rounded-full !transition-all !duration-200 hover:!scale-[1.08] active:!scale-95',
|
||||
style: { color: isDark ? 'rgba(243,244,246,0.9)' : 'rgba(75,85,99,1)' },
|
||||
};
|
||||
|
||||
if (unreadCount > 0) {
|
||||
return (
|
||||
<Badge count={unreadCount} type='danger' overflowCount={99}>
|
||||
<Button {...buttonProps} />
|
||||
</Badge>
|
||||
);
|
||||
}
|
||||
|
||||
return <Button {...buttonProps} />;
|
||||
};
|
||||
|
||||
export default NotificationButton;
|
||||
|
||||
@@ -17,257 +17,26 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
import { Button, Dropdown } from '@douyinfe/semi-ui';
|
||||
import React from 'react';
|
||||
import { Button, Tooltip } from 'antd';
|
||||
import { Moon, Sun } from 'lucide-react';
|
||||
import { useActualTheme } from '../../../context/Theme';
|
||||
|
||||
// 自定义浅色图标 — 带光芒的太阳
|
||||
const LightIcon = ({ size = 18, color = 'currentColor' }) => (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox='0 0 24 24'
|
||||
fill='none'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
>
|
||||
<circle cx='12' cy='12' r='4.5' stroke={color} strokeWidth='1.7' />
|
||||
<line
|
||||
x1='12'
|
||||
y1='2.5'
|
||||
x2='12'
|
||||
y2='5'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
<line
|
||||
x1='12'
|
||||
y1='19'
|
||||
x2='12'
|
||||
y2='21.5'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
<line
|
||||
x1='21.5'
|
||||
y1='12'
|
||||
x2='19'
|
||||
y2='12'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
<line
|
||||
x1='5'
|
||||
y1='12'
|
||||
x2='2.5'
|
||||
y2='12'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
<line
|
||||
x1='18.7'
|
||||
y1='5.3'
|
||||
x2='16.9'
|
||||
y2='7.1'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
<line
|
||||
x1='7.1'
|
||||
y1='16.9'
|
||||
x2='5.3'
|
||||
y2='18.7'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
<line
|
||||
x1='18.7'
|
||||
y1='18.7'
|
||||
x2='16.9'
|
||||
y2='16.9'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
<line
|
||||
x1='7.1'
|
||||
y1='7.1'
|
||||
x2='5.3'
|
||||
y2='5.3'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
|
||||
// 自定义深色图标 — 带星星的弯月
|
||||
const DarkIcon = ({ size = 18, color = 'currentColor' }) => (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox='0 0 24 24'
|
||||
fill='none'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
>
|
||||
<path
|
||||
d='M20.5 13.5a8.5 8.5 0 01-10-10A8.5 8.5 0 1020.5 13.5z'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
strokeLinejoin='round'
|
||||
/>
|
||||
<circle cx='18' cy='5' r='0.8' fill={color} />
|
||||
<circle cx='20.5' cy='8' r='0.6' fill={color} />
|
||||
<circle cx='16' cy='3' r='0.5' fill={color} />
|
||||
</svg>
|
||||
);
|
||||
|
||||
// 自定义自动模式图标 — 半日半月
|
||||
const AutoIcon = ({ size = 18, color = 'currentColor' }) => (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox='0 0 24 24'
|
||||
fill='none'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
>
|
||||
<circle cx='12' cy='12' r='8.5' stroke={color} strokeWidth='1.7' />
|
||||
<path d='M12 3.5v17a8.5 8.5 0 000-17z' fill={color} fillOpacity='0.2' />
|
||||
<line
|
||||
x1='12'
|
||||
y1='1.5'
|
||||
x2='12'
|
||||
y2='3.5'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
<line
|
||||
x1='12'
|
||||
y1='20.5'
|
||||
x2='12'
|
||||
y2='22.5'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
<line
|
||||
x1='22.5'
|
||||
y1='12'
|
||||
x2='20.5'
|
||||
y2='12'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
<line
|
||||
x1='3.5'
|
||||
y1='12'
|
||||
x2='1.5'
|
||||
y2='12'
|
||||
stroke={color}
|
||||
strokeWidth='1.7'
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
|
||||
const ThemeToggle = ({ theme, onThemeToggle, t }) => {
|
||||
const actualTheme = useActualTheme();
|
||||
|
||||
const themeOptions = useMemo(
|
||||
() => [
|
||||
{
|
||||
key: 'light',
|
||||
icon: <LightIcon />,
|
||||
buttonIcon: <LightIcon />,
|
||||
label: t('浅色模式'),
|
||||
description: t('始终使用浅色主题'),
|
||||
},
|
||||
{
|
||||
key: 'dark',
|
||||
icon: <DarkIcon />,
|
||||
buttonIcon: <DarkIcon />,
|
||||
label: t('深色模式'),
|
||||
description: t('始终使用深色主题'),
|
||||
},
|
||||
{
|
||||
key: 'auto',
|
||||
icon: <AutoIcon />,
|
||||
buttonIcon: <AutoIcon />,
|
||||
label: t('自动模式'),
|
||||
description: t('跟随系统主题设置'),
|
||||
},
|
||||
],
|
||||
[t],
|
||||
);
|
||||
|
||||
const getItemClassName = (isSelected) =>
|
||||
isSelected
|
||||
? '!bg-semi-color-primary-light-default !font-semibold'
|
||||
: 'hover:!bg-semi-color-fill-1';
|
||||
|
||||
const currentButtonIcon = useMemo(() => {
|
||||
const currentOption = themeOptions.find((option) => option.key === theme);
|
||||
return currentOption?.buttonIcon || themeOptions[2].buttonIcon;
|
||||
}, [theme, themeOptions]);
|
||||
const ThemeToggle = ({ onThemeToggle, t }) => {
|
||||
const isDark = useActualTheme() === 'dark';
|
||||
const label = isDark ? t('切换至亮色主题') : t('切换至暗色主题');
|
||||
const Icon = isDark ? Sun : Moon;
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
position='bottomRight'
|
||||
render={
|
||||
<Dropdown.Menu>
|
||||
{themeOptions.map((option) => (
|
||||
<Dropdown.Item
|
||||
key={option.key}
|
||||
icon={option.icon}
|
||||
onClick={() => onThemeToggle(option.key)}
|
||||
className={getItemClassName(theme === option.key)}
|
||||
>
|
||||
<div className='flex flex-col'>
|
||||
<span>{option.label}</span>
|
||||
<span className='text-xs text-semi-color-text-2'>
|
||||
{option.description}
|
||||
</span>
|
||||
</div>
|
||||
</Dropdown.Item>
|
||||
))}
|
||||
|
||||
{theme === 'auto' && (
|
||||
<>
|
||||
<Dropdown.Divider />
|
||||
<div className='px-3 py-2 text-xs text-semi-color-text-2'>
|
||||
{t('当前跟随系统')}:
|
||||
{actualTheme === 'dark' ? t('深色') : t('浅色')}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</Dropdown.Menu>
|
||||
}
|
||||
>
|
||||
{/* Semi can resolve a DOM trigger directly without findDOMNode. */}
|
||||
<span className='inline-flex'>
|
||||
<Button
|
||||
icon={currentButtonIcon}
|
||||
aria-label={t('切换主题')}
|
||||
theme='borderless'
|
||||
type='tertiary'
|
||||
className='!w-8 !h-8 sm:!w-9 sm:!h-9 !flex !items-center !justify-center hover:!bg-brand/10 dark:hover:!bg-brand/15 hover:!text-brand-deep dark:hover:!text-brand-from !rounded-full !transition-all !duration-200 hover:!scale-[1.08] active:!scale-95'
|
||||
style={{
|
||||
color:
|
||||
actualTheme === 'dark'
|
||||
? 'rgba(243,244,246,0.9)'
|
||||
: 'rgba(75,85,99,1)',
|
||||
}}
|
||||
/>
|
||||
</span>
|
||||
</Dropdown>
|
||||
<Tooltip title={label}>
|
||||
<Button
|
||||
type='text'
|
||||
icon={<Icon size={16} strokeWidth={1.5} aria-hidden />}
|
||||
aria-label={t('切换主题')}
|
||||
className='ui-header-icon-action'
|
||||
onClick={() => onThemeToggle(isDark ? 'light' : 'dark')}
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -17,19 +17,30 @@ 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 { Link, useLocation } from 'react-router-dom';
|
||||
import { Avatar, Button, Dropdown, Typography } from '@douyinfe/semi-ui';
|
||||
import { ChevronDown, User, Key, LogOut } from 'lucide-react';
|
||||
import {
|
||||
getUserAvatarUrl,
|
||||
stringToColor,
|
||||
isAuthPagePath,
|
||||
} from '../../../helpers';
|
||||
import { Avatar, Button as AntButton, Dropdown as AntDropdown } from 'antd';
|
||||
import { Button } from '@/components/ui';
|
||||
import { ChevronDown, UserRound, KeyRound, LogOut } from 'lucide-react';
|
||||
import { getUserAvatarUrl, isAuthPagePath } from '../../../helpers';
|
||||
import SkeletonWrapper from '../components/SkeletonWrapper';
|
||||
import { useActualTheme } from '../../../context/Theme';
|
||||
import { isHeaderModuleEnabled } from '../../../constants/headerNavModules';
|
||||
|
||||
// 头像菜单项:图标框 + 标题 + 说明(原型 account-menu-label)
|
||||
const AccountMenuLabel = ({ icon, tone, title, description }) => (
|
||||
<div className='ui-account-menu-label'>
|
||||
<span className={`ui-account-menu-icon ui-account-menu-icon-${tone}`}>
|
||||
{icon}
|
||||
</span>
|
||||
<span>
|
||||
{title}
|
||||
<small>{description}</small>
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
|
||||
const MENU_ICON_PROPS = { size: 18, strokeWidth: 1.65, 'aria-hidden': true };
|
||||
|
||||
const UserArea = ({
|
||||
userState,
|
||||
isLoading,
|
||||
@@ -38,13 +49,13 @@ const UserArea = ({
|
||||
headerNavModules,
|
||||
rightActions = {},
|
||||
sidebarModulesAdmin = {},
|
||||
isOrgUser = false,
|
||||
logout,
|
||||
navigate,
|
||||
t,
|
||||
}) => {
|
||||
const location = useLocation();
|
||||
const actualTheme = useActualTheme();
|
||||
const isDark = actualTheme === 'dark';
|
||||
const [open, setOpen] = useState(false);
|
||||
const isActionVisible = (key) => rightActions?.[key] !== false;
|
||||
const hasHeaderModuleConfig =
|
||||
headerNavModules && Object.keys(headerNavModules).length > 0;
|
||||
@@ -73,271 +84,113 @@ const UserArea = ({
|
||||
if (userState.user) {
|
||||
const displayName = userState.user.display_name || userState.user.username;
|
||||
const avatarUrl = getUserAvatarUrl(userState.user);
|
||||
const avatarInitial = displayName[0].toUpperCase();
|
||||
|
||||
const showSettings =
|
||||
isActionVisible('userSettings') &&
|
||||
isTopNavModuleVisible('userCenter') &&
|
||||
isSidebarModuleVisible('userCenter', 'settings');
|
||||
// 「秘钥管理快捷入口」由 rightActions.keyManagement 单独控制(运营设置→顶栏管理)。
|
||||
// 个人用户的 /user-center/key-management 路由不依赖顶栏模块是否显示,故顶栏导航隐藏该模块时
|
||||
// 头像菜单仍保留入口;企业员工只有在其顶栏模块放开时路由才被放行,继续联动判断。
|
||||
const showKeyManagement =
|
||||
isActionVisible('keyManagement') &&
|
||||
(!isOrgUser || isTopNavModuleVisible('keyManagement'));
|
||||
|
||||
const items = [];
|
||||
if (showSettings) {
|
||||
items.push({
|
||||
key: 'settings',
|
||||
label: (
|
||||
<AccountMenuLabel
|
||||
tone='user'
|
||||
icon={<UserRound {...MENU_ICON_PROPS} />}
|
||||
title={t('个人设置')}
|
||||
description={t('管理账户信息')}
|
||||
/>
|
||||
),
|
||||
onClick: () => navigate('/user-center/settings'),
|
||||
});
|
||||
}
|
||||
if (showKeyManagement) {
|
||||
items.push({
|
||||
key: 'keys',
|
||||
label: (
|
||||
<AccountMenuLabel
|
||||
tone='key'
|
||||
icon={<KeyRound {...MENU_ICON_PROPS} />}
|
||||
title={t('密钥管理')}
|
||||
description={t('查看和管理 API 密钥')}
|
||||
/>
|
||||
),
|
||||
onClick: () => navigate('/user-center/key-management'),
|
||||
});
|
||||
}
|
||||
items.push({ key: 'account-divider', type: 'divider' });
|
||||
items.push({
|
||||
key: 'logout',
|
||||
label: (
|
||||
<AccountMenuLabel
|
||||
tone='logout'
|
||||
icon={<LogOut {...MENU_ICON_PROPS} />}
|
||||
title={t('退出登录')}
|
||||
description={t('安全退出账户')}
|
||||
/>
|
||||
),
|
||||
onClick: logout,
|
||||
});
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
trigger='hover'
|
||||
position='bottomRight'
|
||||
showTick
|
||||
render={
|
||||
<Dropdown.Menu
|
||||
className='!min-w-[180px] !p-2 !backdrop-blur-xl !border !shadow-xl !rounded-xl'
|
||||
style={{
|
||||
backgroundColor: isDark
|
||||
? 'rgba(31,41,55,0.95)'
|
||||
: 'rgba(255,255,255,0.95)',
|
||||
borderColor: isDark ? 'rgba(55,65,81,1)' : 'rgba(243,244,246,1)',
|
||||
boxShadow: isDark
|
||||
? '0 20px 25px -5px rgba(0,0,0,0.3)'
|
||||
: '0 20px 25px -5px rgba(0,0,0,0.05)',
|
||||
}}
|
||||
>
|
||||
{/* 用户信息头部 */}
|
||||
<div
|
||||
className='px-3 py-2 mb-2 border-b'
|
||||
style={{
|
||||
borderColor: isDark
|
||||
? 'rgba(55,65,81,1)'
|
||||
: 'rgba(243,244,246,1)',
|
||||
}}
|
||||
>
|
||||
<div className='flex items-center gap-3'>
|
||||
<Avatar
|
||||
size='small'
|
||||
src={avatarUrl}
|
||||
color={stringToColor(displayName)}
|
||||
className='!w-8 !h-8 !text-xs'
|
||||
>
|
||||
{displayName[0].toUpperCase()}
|
||||
</Avatar>
|
||||
<div>
|
||||
<div
|
||||
className='text-sm font-semibold'
|
||||
style={{
|
||||
color: isDark
|
||||
? 'rgba(243,244,246,0.9)'
|
||||
: 'rgba(31,41,55,1)',
|
||||
}}
|
||||
>
|
||||
{displayName}
|
||||
</div>
|
||||
<div
|
||||
className='text-xs'
|
||||
style={{
|
||||
color: isDark
|
||||
? 'rgba(107,114,128,1)'
|
||||
: 'rgba(156,163,175,1)',
|
||||
}}
|
||||
>
|
||||
{userState.user.email || t('已登录')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{isActionVisible('userSettings') &&
|
||||
isTopNavModuleVisible('userCenter') &&
|
||||
isSidebarModuleVisible('userCenter', 'settings') && (
|
||||
<Dropdown.Item
|
||||
onClick={() => {
|
||||
navigate('/user-center/settings');
|
||||
}}
|
||||
className='!px-3 !py-2.5 !rounded-lg !text-sm !transition-all !duration-200'
|
||||
style={{
|
||||
color: isDark ? 'rgba(229,231,235,1)' : 'rgba(55,65,81,1)',
|
||||
}}
|
||||
>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div
|
||||
className='w-8 h-8 rounded-lg flex items-center justify-center'
|
||||
style={{
|
||||
background: isDark
|
||||
? 'rgba(30,58,138,0.5)'
|
||||
: 'linear-gradient(to bottom right, rgba(219,234,254,1), rgba(224,231,255,1))',
|
||||
}}
|
||||
>
|
||||
<User
|
||||
size={16}
|
||||
style={{
|
||||
color: isDark
|
||||
? 'rgba(96,165,250,1)'
|
||||
: 'rgba(37,99,235,1)',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
className='font-medium'
|
||||
style={{
|
||||
color: isDark ? 'rgba(243,244,246,0.9)' : undefined,
|
||||
}}
|
||||
>
|
||||
{t('个人设置')}
|
||||
</div>
|
||||
<div
|
||||
className='text-xs'
|
||||
style={{
|
||||
color: isDark
|
||||
? 'rgba(107,114,128,1)'
|
||||
: 'rgba(156,163,175,1)',
|
||||
}}
|
||||
>
|
||||
{t('管理账户信息')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Dropdown.Item>
|
||||
)}
|
||||
|
||||
{isActionVisible('keyManagement') &&
|
||||
isTopNavModuleVisible('keyManagement') && (
|
||||
<Dropdown.Item
|
||||
onClick={() => {
|
||||
navigate('/key-management');
|
||||
}}
|
||||
className='!px-3 !py-2.5 !rounded-lg !text-sm !transition-all !duration-200'
|
||||
style={{
|
||||
color: isDark ? 'rgba(229,231,235,1)' : 'rgba(55,65,81,1)',
|
||||
}}
|
||||
>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div
|
||||
className='w-8 h-8 rounded-lg flex items-center justify-center'
|
||||
style={{
|
||||
background: isDark
|
||||
? 'rgba(120,53,15,0.5)'
|
||||
: 'linear-gradient(to bottom right, rgba(254,243,199,1), rgba(255,237,213,1))',
|
||||
}}
|
||||
>
|
||||
<Key
|
||||
size={16}
|
||||
style={{
|
||||
color: isDark
|
||||
? 'rgba(251,191,36,1)'
|
||||
: 'rgba(217,119,6,1)',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
className='font-medium'
|
||||
style={{
|
||||
color: isDark ? 'rgba(243,244,246,0.9)' : undefined,
|
||||
}}
|
||||
>
|
||||
{t('秘钥管理')}
|
||||
</div>
|
||||
<div
|
||||
className='text-xs'
|
||||
style={{
|
||||
color: isDark
|
||||
? 'rgba(107,114,128,1)'
|
||||
: 'rgba(156,163,175,1)',
|
||||
}}
|
||||
>
|
||||
{t('查看和管理API秘钥')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Dropdown.Item>
|
||||
)}
|
||||
|
||||
<div
|
||||
className='my-2 border-t'
|
||||
style={{
|
||||
borderColor: isDark
|
||||
? 'rgba(55,65,81,1)'
|
||||
: 'rgba(243,244,246,1)',
|
||||
}}
|
||||
/>
|
||||
|
||||
<Dropdown.Item
|
||||
onClick={logout}
|
||||
className='!px-3 !py-2.5 !rounded-lg !text-sm !transition-all !duration-200'
|
||||
style={{
|
||||
color: isDark ? 'rgba(229,231,235,1)' : 'rgba(55,65,81,1)',
|
||||
}}
|
||||
>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div
|
||||
className='w-8 h-8 rounded-lg flex items-center justify-center'
|
||||
style={{
|
||||
background: isDark
|
||||
? 'rgba(127,29,29,0.5)'
|
||||
: 'linear-gradient(to bottom right, rgba(254,226,226,1), rgba(255,228,230,1))',
|
||||
}}
|
||||
>
|
||||
<LogOut
|
||||
size={16}
|
||||
style={{
|
||||
color: isDark
|
||||
? 'rgba(248,113,113,1)'
|
||||
: 'rgba(220,38,38,1)',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
className='font-medium'
|
||||
style={{
|
||||
color: isDark ? 'rgba(243,244,246,0.9)' : undefined,
|
||||
}}
|
||||
>
|
||||
{t('退出登录')}
|
||||
</div>
|
||||
<div
|
||||
className='text-xs'
|
||||
style={{
|
||||
color: isDark
|
||||
? 'rgba(107,114,128,1)'
|
||||
: 'rgba(156,163,175,1)',
|
||||
}}
|
||||
>
|
||||
{t('安全退出账户')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Dropdown.Item>
|
||||
</Dropdown.Menu>
|
||||
}
|
||||
>
|
||||
<span className='inline-flex'>
|
||||
<Button
|
||||
theme='borderless'
|
||||
type='tertiary'
|
||||
className='flex items-center gap-2 !pl-1.5 !pr-2.5 !py-1.5 !h-10 !rounded-full hover:!bg-brand/10 dark:hover:!bg-brand/15 !bg-transparent !transition-all !duration-200 hover:!-translate-y-0.5 group'
|
||||
>
|
||||
<div className='relative'>
|
||||
<AntDropdown
|
||||
trigger={['hover']}
|
||||
placement='bottomRight'
|
||||
open={open}
|
||||
onOpenChange={setOpen}
|
||||
overlayClassName='ui-account-dropdown'
|
||||
menu={{ items, onClick: () => setOpen(false) }}
|
||||
popupRender={(menu) => (
|
||||
<div className='ui-account-panel'>
|
||||
<div className='ui-account-summary'>
|
||||
<Avatar
|
||||
size='small'
|
||||
shape='square'
|
||||
size={40}
|
||||
src={avatarUrl}
|
||||
color={stringToColor(displayName)}
|
||||
className='!w-7 !h-7 !text-xs ring-2 ring-white dark:ring-gray-800 group-hover:!ring-brand/40 dark:group-hover:!ring-brand/50 transition-all'
|
||||
className='ui-account-avatar'
|
||||
>
|
||||
{displayName[0].toUpperCase()}
|
||||
{avatarInitial}
|
||||
</Avatar>
|
||||
{/* 在线状态点 */}
|
||||
<span className='absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 bg-emerald-500 border-2 border-white dark:border-gray-800 rounded-full' />
|
||||
<div>
|
||||
<strong>{displayName}</strong>
|
||||
<span>{userState.user.email || t('已登录')}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span className='hidden md:flex flex-col items-start'>
|
||||
<Typography.Text
|
||||
className='!text-sm !font-medium !leading-none'
|
||||
style={{
|
||||
color: isDark ? 'rgba(243,244,246,0.9)' : 'rgba(55,65,81,1)',
|
||||
}}
|
||||
>
|
||||
{displayName}
|
||||
</Typography.Text>
|
||||
</span>
|
||||
<ChevronDown
|
||||
size={14}
|
||||
style={{
|
||||
color: isDark ? 'rgba(209,213,219,1)' : 'rgba(156,163,175,1)',
|
||||
}}
|
||||
className='group-hover:!opacity-80 transition-colors'
|
||||
/>
|
||||
</Button>
|
||||
</span>
|
||||
</Dropdown>
|
||||
{menu}
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
<AntButton
|
||||
type='text'
|
||||
className='ui-header-account'
|
||||
aria-haspopup='menu'
|
||||
aria-expanded={open}
|
||||
>
|
||||
<Avatar
|
||||
shape='square'
|
||||
size={38}
|
||||
src={avatarUrl}
|
||||
className='ui-account-avatar'
|
||||
>
|
||||
{avatarInitial}
|
||||
</Avatar>
|
||||
<span className='ui-header-account-name'>{displayName}</span>
|
||||
<ChevronDown
|
||||
size={10}
|
||||
strokeWidth={1.5}
|
||||
aria-hidden
|
||||
className={`ui-header-account-chevron${open ? ' is-open' : ''}`}
|
||||
/>
|
||||
</AntButton>
|
||||
</AntDropdown>
|
||||
);
|
||||
} else {
|
||||
if (isAuthPage) {
|
||||
@@ -356,7 +209,7 @@ const UserArea = ({
|
||||
let registerButtonClasses = `${commonSizingAndLayoutClass}`;
|
||||
|
||||
const loginButtonTextSpanClass =
|
||||
'!text-xs !text-semi-color-text-1 dark:!text-gray-300 !p-1.5';
|
||||
'!text-xs !text-ui-color-text-1 dark:!text-gray-300 !p-1.5';
|
||||
const registerButtonTextSpanClass = '!text-xs !text-white !p-1.5';
|
||||
|
||||
if (showRegisterButton) {
|
||||
|
||||
@@ -74,7 +74,7 @@ const HeaderBar = ({ onMobileMenuToggle, drawerOpen }) => {
|
||||
|
||||
const userRole = userState?.user?.role || 0;
|
||||
const userGroup = userState?.user?.group || 'default';
|
||||
const { mainNavLinks } = useNavigation(
|
||||
const { mainNavLinks: configuredNavLinks } = useNavigation(
|
||||
t,
|
||||
docsLink,
|
||||
headerNavModules,
|
||||
@@ -82,9 +82,12 @@ const HeaderBar = ({ onMobileMenuToggle, drawerOpen }) => {
|
||||
userGroup,
|
||||
{ showOrgEntry, orgEntryPath },
|
||||
);
|
||||
const mainNavLinks = configuredNavLinks.filter(
|
||||
(link) => link.itemKey !== 'keyManagement',
|
||||
);
|
||||
|
||||
return (
|
||||
<header className='text-semi-color-text-0 sticky top-0 z-50 transition-all duration-300 relative'>
|
||||
<header className='text-ui-color-text-0 sticky top-0 z-50 transition-all duration-300 relative'>
|
||||
{/* ===== BACKGROUND LAYERS ===== */}
|
||||
|
||||
{/* Main gradient background with glassmorphism */}
|
||||
@@ -116,12 +119,12 @@ const HeaderBar = ({ onMobileMenuToggle, drawerOpen }) => {
|
||||
unreadKeys={getUnreadKeys()}
|
||||
/>
|
||||
|
||||
<div className='relative w-full px-2 sm:px-3 md:px-4'>
|
||||
<div className='ui-topbar relative w-full'>
|
||||
{/* 高度断点必须用 md(768) 而非 sm(640):PageLayout 的 headerBarHeight 按
|
||||
MOBILE_BREAKPOINT=768 算 56/64,用 sm 会让 640~767px 区间实际 64px、
|
||||
而侧栏 top、抽屉遮罩 top 全按 56px 定位,差 8px。 */}
|
||||
<div className='flex items-center justify-between gap-1 md:gap-0 h-14 md:h-16'>
|
||||
<div className='flex items-center min-w-0 md:min-w-[auto]'>
|
||||
<div className='flex items-center justify-between gap-1 md:gap-0 h-14 md:h-[72px]'>
|
||||
<div className='ui-header-brand flex items-center min-w-0 md:min-w-[auto]'>
|
||||
<MobileMenuButton
|
||||
isConsoleRoute={isConsoleRoute}
|
||||
isMobile={isMobile}
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
.notice-modal-root .ant-modal-mask {
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
.notice-modal.ant-modal {
|
||||
top: 100px;
|
||||
max-width: calc(100vw - 32px);
|
||||
padding-bottom: 24px;
|
||||
color: var(--nm-text);
|
||||
}
|
||||
.notice-modal .ant-modal-content {
|
||||
padding: 20px 24px;
|
||||
background: var(--nm-surface);
|
||||
border-radius: 12px;
|
||||
}
|
||||
.notice-modal .ant-modal-header {
|
||||
margin-bottom: 16px;
|
||||
background: var(--nm-surface);
|
||||
}
|
||||
.notice-modal .ant-modal-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
line-height: 24px;
|
||||
}
|
||||
.notice-modal .ant-modal-close {
|
||||
top: 12px;
|
||||
inset-inline-end: 12px;
|
||||
}
|
||||
.notice-modal .ant-segmented {
|
||||
height: 48px;
|
||||
padding: 4px;
|
||||
border-radius: 10px;
|
||||
background: var(--nm-tab-bg);
|
||||
color: var(--nm-muted);
|
||||
}
|
||||
.notice-modal .ant-segmented-item-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 40px;
|
||||
line-height: 40px;
|
||||
}
|
||||
.notice-modal .ant-segmented-item-icon {
|
||||
display: inline-flex;
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
.notice-modal .ant-segmented-item-selected {
|
||||
color: var(--nm-primary);
|
||||
background: var(--nm-surface);
|
||||
box-shadow: inset 0 0 0 1px var(--nm-border);
|
||||
}
|
||||
.nm-system-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.nm-body {
|
||||
margin-top: 18px;
|
||||
}
|
||||
.nm-notice-scroll,
|
||||
.nm-announcement-scroll {
|
||||
max-height: min(470px, calc(100dvh - 300px));
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
.nm-notice-scroll {
|
||||
padding: 20px;
|
||||
border: 1px solid var(--nm-border);
|
||||
border-radius: 8px;
|
||||
}
|
||||
.nm-markdown {
|
||||
color: var(--nm-text);
|
||||
font-size: 14px;
|
||||
line-height: 25px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.nm-markdown > :first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
.nm-markdown > :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.nm-markdown p {
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
.nm-markdown h1,
|
||||
.nm-markdown h2,
|
||||
.nm-markdown h3,
|
||||
.nm-markdown h4 {
|
||||
margin: 20px 0 16px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
line-height: 24px;
|
||||
}
|
||||
.nm-markdown h4 {
|
||||
font-size: 14px;
|
||||
}
|
||||
.nm-markdown a {
|
||||
color: var(--nm-primary);
|
||||
}
|
||||
.nm-markdown ul,
|
||||
.nm-markdown ol {
|
||||
margin: 0 0 10px;
|
||||
padding-inline-start: 24px;
|
||||
}
|
||||
.nm-markdown ul {
|
||||
list-style: disc;
|
||||
}
|
||||
.nm-markdown ol {
|
||||
list-style: decimal;
|
||||
}
|
||||
.nm-markdown pre {
|
||||
overflow: auto;
|
||||
padding: 16px;
|
||||
background: var(--nm-fill);
|
||||
border-radius: 8px;
|
||||
}
|
||||
.nm-markdown img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.nm-markdown table {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
overflow-x: auto;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.nm-markdown td,
|
||||
.nm-markdown th {
|
||||
padding: 8px;
|
||||
border: 1px solid var(--nm-border);
|
||||
}
|
||||
.nm-empty {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: min(300px, calc(100dvh - 300px));
|
||||
min-height: 80px;
|
||||
color: var(--nm-muted);
|
||||
font-size: 16px;
|
||||
}
|
||||
.nm-spin-placeholder {
|
||||
width: 120px;
|
||||
height: 80px;
|
||||
}
|
||||
.nm-announcement-scroll {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
}
|
||||
.nm-announcement-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
color: var(--nm-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
.nm-announcement-extra {
|
||||
margin-top: 8px;
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid var(--nm-border);
|
||||
}
|
||||
.notice-modal .ant-modal-footer {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.nm-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
@media (max-width: 600px), (max-height: 650px) {
|
||||
.notice-modal.ant-modal {
|
||||
top: 24px;
|
||||
}
|
||||
.notice-modal .ant-modal-content {
|
||||
padding: 20px 16px;
|
||||
}
|
||||
.nm-notice-scroll,
|
||||
.nm-announcement-scroll {
|
||||
max-height: calc(100dvh - 248px);
|
||||
}
|
||||
.nm-notice-scroll {
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
@@ -24,50 +24,18 @@ import React, {
|
||||
useRef,
|
||||
useMemo,
|
||||
} from 'react';
|
||||
import {
|
||||
Modal,
|
||||
Table,
|
||||
Tag,
|
||||
Empty,
|
||||
Typography,
|
||||
Pagination,
|
||||
Toast,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import { Crown, Clock, CheckCircle, XCircle, Calendar } from 'lucide-react';
|
||||
import { Empty as AntEmpty, Tag as AntTag } from 'antd';
|
||||
import { Modal, Table, Typography, Pagination, Toast } from '@/components/ui';
|
||||
import { API, renderQuota } from '../../helpers';
|
||||
import {
|
||||
IllustrationNoResult,
|
||||
IllustrationNoResultDark,
|
||||
} from '../common/illustrations';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
// 会员状态配置
|
||||
// 会员状态配置(Ant Design 预设标签色)
|
||||
const STATUS_CONFIG = {
|
||||
active: {
|
||||
label: '生效中',
|
||||
type: 'success',
|
||||
icon: CheckCircle,
|
||||
color: 'text-emerald-500',
|
||||
},
|
||||
expired: {
|
||||
label: '已过期',
|
||||
type: 'default',
|
||||
icon: XCircle,
|
||||
color: 'text-gray-400',
|
||||
},
|
||||
pending: {
|
||||
label: '待生效',
|
||||
type: 'warning',
|
||||
icon: Clock,
|
||||
color: 'text-amber-500',
|
||||
},
|
||||
canceled: {
|
||||
label: '已取消',
|
||||
type: 'default',
|
||||
icon: XCircle,
|
||||
color: 'text-red-400',
|
||||
},
|
||||
active: { label: '生效中', color: 'success' },
|
||||
expired: { label: '已过期', color: undefined },
|
||||
pending: { label: '待生效', color: 'warning' },
|
||||
canceled: { label: '已取消', color: 'error' },
|
||||
};
|
||||
|
||||
// 方案类型映射
|
||||
@@ -83,7 +51,11 @@ const TIER_MAP = {
|
||||
pro: '重度版',
|
||||
};
|
||||
|
||||
const MembershipHistoryModal = ({ visible, onClose, t }) => {
|
||||
/**
|
||||
* 会员购买记录内容:数据加载、统计、表格与分页。
|
||||
* 弹窗与在线充值页“会员购买记录”页签共用;visible 为 true 时按原逻辑加载。
|
||||
*/
|
||||
export const MembershipHistoryContent = ({ visible, t, inline = false }) => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [memberships, setMemberships] = useState([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
@@ -181,13 +153,10 @@ const MembershipHistoryModal = ({ visible, onClose, t }) => {
|
||||
const renderStatusTag = (membership) => {
|
||||
const status = getMembershipStatus(membership);
|
||||
const config = STATUS_CONFIG[status] || STATUS_CONFIG.expired;
|
||||
const IconComponent = config.icon;
|
||||
|
||||
return (
|
||||
<div className={`flex items-center gap-1.5 ${config.color}`}>
|
||||
<IconComponent size={14} />
|
||||
<span className='text-xs font-medium'>{t(config.label)}</span>
|
||||
</div>
|
||||
<AntTag bordered={false} color={config.color}>
|
||||
{t(config.label)}
|
||||
</AntTag>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -200,19 +169,12 @@ const MembershipHistoryModal = ({ visible, onClose, t }) => {
|
||||
key: 'plan_name',
|
||||
width: 180,
|
||||
render: (text, record) => (
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className='w-8 h-8 rounded-lg bg-gradient-to-br from-brand-from to-brand-to flex items-center justify-center flex-shrink-0'>
|
||||
<Crown size={14} className='text-white' />
|
||||
</div>
|
||||
<div>
|
||||
<Text strong className='text-sm block'>
|
||||
{text || '-'}
|
||||
</Text>
|
||||
<Text className='text-xs text-gray-400'>
|
||||
{PLAN_TYPE_MAP[record.plan_type] || record.plan_type} ·{' '}
|
||||
{TIER_MAP[record.tier] || record.tier}
|
||||
</Text>
|
||||
</div>
|
||||
<div>
|
||||
<Text>{text || '-'}</Text>
|
||||
<Text type='tertiary' size='small' className='block'>
|
||||
{PLAN_TYPE_MAP[record.plan_type] || record.plan_type} ·{' '}
|
||||
{TIER_MAP[record.tier] || record.tier}
|
||||
</Text>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
@@ -221,11 +183,7 @@ const MembershipHistoryModal = ({ visible, onClose, t }) => {
|
||||
dataIndex: 'daily_quota',
|
||||
key: 'daily_quota',
|
||||
width: 120,
|
||||
render: (quota) => (
|
||||
<Text strong className='text-emerald-600 text-sm'>
|
||||
{renderQuota(quota)}
|
||||
</Text>
|
||||
),
|
||||
render: (quota) => renderQuota(quota),
|
||||
},
|
||||
{
|
||||
title: t('天数'),
|
||||
@@ -238,12 +196,7 @@ const MembershipHistoryModal = ({ visible, onClose, t }) => {
|
||||
record.end_date && record.start_date
|
||||
? Math.round((record.end_date - record.start_date) / 86400)
|
||||
: '-';
|
||||
return (
|
||||
<Tag color='blue' size='small'>
|
||||
{days}
|
||||
{t('天')}
|
||||
</Tag>
|
||||
);
|
||||
return `${days} ${t('天')}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -251,39 +204,21 @@ const MembershipHistoryModal = ({ visible, onClose, t }) => {
|
||||
dataIndex: 'price_paid',
|
||||
key: 'price_paid',
|
||||
width: 100,
|
||||
render: (price) => (
|
||||
<Text type='danger' className='text-sm'>
|
||||
¥{price?.toFixed(2) || '0.00'}
|
||||
</Text>
|
||||
),
|
||||
render: (price) => `¥${price?.toFixed(2) || '0.00'}`,
|
||||
},
|
||||
{
|
||||
title: t('生效日期'),
|
||||
dataIndex: 'start_date',
|
||||
key: 'start_date',
|
||||
width: 110,
|
||||
render: (date) => (
|
||||
<div className='flex items-center gap-1'>
|
||||
<Calendar size={12} className='text-gray-400' />
|
||||
<Text size='small' type='tertiary'>
|
||||
{formatDate(date)}
|
||||
</Text>
|
||||
</div>
|
||||
),
|
||||
render: (date) => formatDate(date),
|
||||
},
|
||||
{
|
||||
title: t('到期日期'),
|
||||
dataIndex: 'end_date',
|
||||
key: 'end_date',
|
||||
width: 110,
|
||||
render: (date) => (
|
||||
<div className='flex items-center gap-1'>
|
||||
<Calendar size={12} className='text-gray-400' />
|
||||
<Text size='small' type='tertiary'>
|
||||
{formatDate(date)}
|
||||
</Text>
|
||||
</div>
|
||||
),
|
||||
render: (date) => formatDate(date),
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
@@ -296,110 +231,94 @@ const MembershipHistoryModal = ({ visible, onClose, t }) => {
|
||||
dataIndex: 'created_at',
|
||||
key: 'created_at',
|
||||
width: 140,
|
||||
render: (time) => (
|
||||
<Text size='small' type='tertiary'>
|
||||
{formatDateTime(time)}
|
||||
</Text>
|
||||
),
|
||||
render: (time) => formatDateTime(time),
|
||||
},
|
||||
],
|
||||
[t, formatDate, formatDateTime],
|
||||
);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className='w-8 h-8 rounded-lg bg-gradient-to-br from-brand-from to-brand-to flex items-center justify-center'>
|
||||
<Crown size={16} className='text-white' />
|
||||
</div>
|
||||
<span>{t('会员购买记录')}</span>
|
||||
<div className={inline ? 'rc-member-history' : 'flex flex-col h-full'}>
|
||||
{/* 统计信息 */}
|
||||
{(inline || total > 0) && (
|
||||
<div
|
||||
className={inline ? 'rc-member-counts' : 'px-6 pt-4 rc-member-counts'}
|
||||
>
|
||||
{!inline && (
|
||||
<span>
|
||||
{t('总购买次数')}
|
||||
<strong>{total}</strong>
|
||||
</span>
|
||||
)}
|
||||
<span>
|
||||
{t('生效中')}
|
||||
<strong>{activeCount}</strong>
|
||||
</span>
|
||||
<span>
|
||||
{t('待生效')}
|
||||
<strong>{pendingCount}</strong>
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
visible={visible}
|
||||
onCancel={onClose}
|
||||
footer={null}
|
||||
width={1100}
|
||||
bodyStyle={{ padding: 0, maxHeight: '70vh' }}
|
||||
style={{ top: 40 }}
|
||||
>
|
||||
<div className='flex flex-col h-full'>
|
||||
{/* 统计信息 */}
|
||||
{total > 0 && (
|
||||
<div className='px-6 py-4 bg-gradient-to-r from-brand-from/5 to-brand-to/5 dark:from-brand-from/20 dark:to-brand-to/20 border-b border-gray-200 dark:border-gray-700'>
|
||||
<div className='flex items-center gap-6'>
|
||||
<div className='flex items-center gap-2'>
|
||||
<Text className='text-gray-500 text-sm'>
|
||||
{t('总购买次数')}:
|
||||
</Text>
|
||||
<Text strong className='text-lg text-brand-deep'>
|
||||
{total}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='flex items-center gap-2'>
|
||||
<Text className='text-gray-500 text-sm'>{t('生效中')}:</Text>
|
||||
<Text strong className='text-lg text-emerald-600'>
|
||||
{activeCount}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='flex items-center gap-2'>
|
||||
<Text className='text-gray-500 text-sm'>{t('待生效')}:</Text>
|
||||
<Text strong className='text-lg text-amber-600'>
|
||||
{pendingCount}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
)}
|
||||
|
||||
{/* 表格区域 */}
|
||||
<div className='flex-1 overflow-auto p-6'>
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={memberships}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
{/* 表格区域 */}
|
||||
<div className={inline ? undefined : 'flex-1 overflow-auto px-6 pb-4'}>
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={memberships}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
scroll={{ x: 'max-content' }}
|
||||
size='middle'
|
||||
pagination={false}
|
||||
empty={
|
||||
<AntEmpty
|
||||
image={AntEmpty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={t('暂无会员购买记录')}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 分页器 */}
|
||||
{total > 0 && (
|
||||
<div
|
||||
className={
|
||||
inline ? 'rc-history-pagination' : 'px-6 pb-4 rc-history-pagination'
|
||||
}
|
||||
>
|
||||
<Pagination
|
||||
total={total}
|
||||
currentPage={page}
|
||||
pageSize={pageSize}
|
||||
showSizeChanger
|
||||
pageSizeOpts={[10, 20, 50]}
|
||||
onPageChange={(p) => setPage(p)}
|
||||
onPageSizeChange={(size) => {
|
||||
setPageSize(size);
|
||||
setPage(1);
|
||||
}}
|
||||
size='small'
|
||||
pagination={false}
|
||||
empty={
|
||||
<Empty
|
||||
image={
|
||||
<IllustrationNoResult style={{ width: 100, height: 100 }} />
|
||||
}
|
||||
darkModeImage={
|
||||
<IllustrationNoResultDark
|
||||
style={{ width: 100, height: 100 }}
|
||||
/>
|
||||
}
|
||||
description={t('暂无会员购买记录')}
|
||||
style={{ padding: 40 }}
|
||||
/>
|
||||
}
|
||||
showTotal={(count) => t('共 {{total}} 条', { total: count })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 分页器 */}
|
||||
{total > 0 && (
|
||||
<div className='px-6 py-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-neutral-900'>
|
||||
<Pagination
|
||||
total={total}
|
||||
currentPage={page}
|
||||
pageSize={pageSize}
|
||||
showSizeChanger
|
||||
pageSizeOpts={[10, 20, 50]}
|
||||
onPageChange={(p) => setPage(p)}
|
||||
onPageSizeChange={(size) => {
|
||||
setPageSize(size);
|
||||
setPage(1);
|
||||
}}
|
||||
showTotal
|
||||
style={{ justifyContent: 'flex-end' }}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Modal>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const MembershipHistoryModal = ({ visible, onClose, t }) => (
|
||||
<Modal
|
||||
title={t('会员购买记录')}
|
||||
visible={visible}
|
||||
onCancel={onClose}
|
||||
footer={null}
|
||||
width={1100}
|
||||
bodyStyle={{ padding: 0, maxHeight: '70vh' }}
|
||||
style={{ top: 40 }}
|
||||
>
|
||||
<MembershipHistoryContent visible={visible} t={t} />
|
||||
</Modal>
|
||||
);
|
||||
|
||||
export default MembershipHistoryModal;
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
Toast,
|
||||
Tooltip,
|
||||
Popover,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
MessageSquare,
|
||||
Eye,
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useMemo, useCallback } from 'react';
|
||||
import { Button, Tooltip, Toast } from '@douyinfe/semi-ui';
|
||||
import { Button, Tooltip, Toast } from '@/components/ui';
|
||||
import { Copy, ChevronDown, ChevronUp } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { copy } from '../../helpers';
|
||||
@@ -74,7 +74,7 @@ const codeThemeStyles = {
|
||||
color: '#666',
|
||||
fontSize: '14px',
|
||||
fontStyle: 'italic',
|
||||
backgroundColor: 'var(--semi-color-fill-0)',
|
||||
backgroundColor: 'var(--ui-color-fill-0)',
|
||||
borderRadius: '8px',
|
||||
},
|
||||
performanceWarning: {
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useRef } from 'react';
|
||||
import { Button, Typography, Toast, Modal, Dropdown } from '@douyinfe/semi-ui';
|
||||
import { Button, Typography, Toast, Modal, Dropdown } from '@/components/ui';
|
||||
import { Download, Upload, RotateCcw, Settings2 } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useRef, useEffect, useCallback, useContext } from 'react';
|
||||
import { Toast, Tooltip, Modal } from '@douyinfe/semi-ui';
|
||||
import { Toast, Tooltip, Modal } from '@/components/ui';
|
||||
import {
|
||||
Globe,
|
||||
Paperclip,
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
Button,
|
||||
Switch,
|
||||
Banner,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import { Code, Edit, Check, X, AlertTriangle } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
TabPane,
|
||||
Button,
|
||||
Dropdown,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import { Code, Zap, Clock, X, Eye, Send } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import CodeViewer from './CodeViewer';
|
||||
@@ -61,8 +61,8 @@ const DebugPanel = ({
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
borderRadius: '100%',
|
||||
background: 'rgba(var(--semi-grey-1), 1)',
|
||||
color: 'var(--semi-color-text)',
|
||||
background: 'rgba(var(--ui-grey-1), 1)',
|
||||
color: 'var(--ui-color-text)',
|
||||
cursor: 'pointer',
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { Modal, Toast } from '@douyinfe/semi-ui';
|
||||
import { Modal, Toast } from '@/components/ui';
|
||||
import { Download, ExternalLink, X, FileText } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
|
||||
@@ -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 { Settings, Eye, EyeOff } from 'lucide-react';
|
||||
|
||||
const FloatingButtons = ({
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useCallback, useEffect } from 'react';
|
||||
import { Modal } from '@douyinfe/semi-ui';
|
||||
import { Modal } from '@/components/ui';
|
||||
import { Download, ZoomIn, ZoomOut, X, RotateCw } from 'lucide-react';
|
||||
|
||||
const ImagePreviewModal = ({ visible, imageUrl, onClose }) => {
|
||||
|
||||
@@ -18,8 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Input, Typography, Button, Switch } from '@douyinfe/semi-ui';
|
||||
import { IconFile } from '@douyinfe/semi-icons';
|
||||
import { Input, Typography, Button, Switch } from '@/components/ui';
|
||||
import { IconFile } from '@/components/ui/icons';
|
||||
import { Plus, X, Image } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
import { Modal } from '@douyinfe/semi-ui';
|
||||
import { Modal } from '@/components/ui';
|
||||
import { Keyboard } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user