feat: 参考原型图 ui优化提交 个人端-用户中心 相关的页面
This commit is contained in:
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Progress, Divider, Empty } from '@douyinfe/semi-ui';
|
||||
import { Progress, Divider, Empty } from '@/components/ui';
|
||||
import {
|
||||
IllustrationConstruction,
|
||||
IllustrationConstructionDark,
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ export function setStatusData(data) {
|
||||
}
|
||||
}
|
||||
|
||||
export const DEFAULT_LOGIN_REDIRECT = '/key-management';
|
||||
export const DEFAULT_LOGIN_REDIRECT = '/user-center/key-management';
|
||||
const USER_STORAGE_KEY = 'user';
|
||||
const POST_LOGIN_REDIRECT_KEY = 'post_login_redirect';
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import React, { lazy, Suspense } from 'react';
|
||||
import i18next from 'i18next';
|
||||
// React 18-compatible LobeHub icons lack these brands; use generic icons.
|
||||
import { Lock, Bot as FastGPT, Image as Jimeng } from 'lucide-react';
|
||||
import { Modal, Tag, Typography } from '@douyinfe/semi-ui';
|
||||
import { Modal, Tag, Typography } from '@/components/ui';
|
||||
import { copy, getCurrencySymbol, showSuccess } from './utils';
|
||||
import { visit } from 'unist-util-visit';
|
||||
import OpenAI from '@lobehub/icons/es/OpenAI/components/Mono';
|
||||
@@ -85,7 +85,7 @@ import {
|
||||
export function getLucideIcon(key, selected = false) {
|
||||
const size = 16;
|
||||
const strokeWidth = 2;
|
||||
const SELECTED_COLOR = 'var(--semi-color-primary)';
|
||||
const SELECTED_COLOR = 'var(--ui-color-primary)';
|
||||
const iconColor = selected ? SELECTED_COLOR : 'currentColor';
|
||||
const commonProps = {
|
||||
size,
|
||||
@@ -663,13 +663,13 @@ export const renderGroupOption = (item) => {
|
||||
alignItems: 'center',
|
||||
padding: '8px 16px',
|
||||
cursor: disabled ? 'not-allowed' : 'pointer',
|
||||
backgroundColor: focused ? 'var(--semi-color-fill-0)' : 'transparent',
|
||||
backgroundColor: focused ? 'var(--ui-color-fill-0)' : 'transparent',
|
||||
opacity: disabled ? 0.5 : 1,
|
||||
...(selected && {
|
||||
backgroundColor: 'var(--semi-color-primary-light-default)',
|
||||
backgroundColor: 'var(--ui-color-primary-light-default)',
|
||||
}),
|
||||
'&:hover': {
|
||||
backgroundColor: !disabled && 'var(--semi-color-fill-1)',
|
||||
backgroundColor: !disabled && 'var(--ui-color-fill-1)',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -724,10 +724,10 @@ export const renderModelOption = (item) => {
|
||||
alignItems: 'center',
|
||||
padding: '8px 16px',
|
||||
cursor: locked ? 'not-allowed' : 'pointer',
|
||||
backgroundColor: focused ? 'var(--semi-color-fill-0)' : 'transparent',
|
||||
backgroundColor: focused ? 'var(--ui-color-fill-0)' : 'transparent',
|
||||
opacity: locked ? 0.6 : 1,
|
||||
...(selected && {
|
||||
backgroundColor: 'var(--semi-color-primary-light-default)',
|
||||
backgroundColor: 'var(--ui-color-primary-light-default)',
|
||||
}),
|
||||
};
|
||||
|
||||
|
||||
+30
-30
@@ -27,8 +27,8 @@ const CACHE_KEY = 'theme-config';
|
||||
const PRESETS_CACHE_KEY = 'theme-presets';
|
||||
const STYLE_ID_LIGHT = 'theme-tokens-light';
|
||||
const STYLE_ID_DARK = 'theme-tokens-dark';
|
||||
const STYLE_ID_SEMI_LIGHT = 'theme-semi-light';
|
||||
const STYLE_ID_SEMI_DARK = 'theme-semi-dark';
|
||||
const STYLE_ID_CONTROLS_LIGHT = 'theme-controls-light';
|
||||
const STYLE_ID_CONTROLS_DARK = 'theme-controls-dark';
|
||||
// 下次启动时供 index.html 头部内联脚本同步注入,避免首屏 splash 用兜底色刷一遍再跳到品牌色。
|
||||
const CSS_CACHE_KEY = 'theme-css-cache';
|
||||
const STYLE_ID_PRESPLASH = 'theme-presplash';
|
||||
@@ -247,15 +247,15 @@ function doApply(config) {
|
||||
// 浅色选择器必须包含 body:Semi 把浅色主题变量声明在 body 上,CSS 变量继承取最近祖先,
|
||||
// 只注入 :root 会被 Semi 的 body 级默认值(蓝色)覆盖,表现为浅色模式下
|
||||
// Checkbox/Link 等原生 Semi 组件不跟随主题色(暗色注入 body[theme-mode=dark] 无此问题)。
|
||||
injectSemiVars(
|
||||
STYLE_ID_SEMI_LIGHT,
|
||||
injectControlVars(
|
||||
STYLE_ID_CONTROLS_LIGHT,
|
||||
':root, body',
|
||||
lightTokens['brand-primary'],
|
||||
false,
|
||||
lightTokens['accent-blue'],
|
||||
);
|
||||
injectSemiVars(
|
||||
STYLE_ID_SEMI_DARK,
|
||||
injectControlVars(
|
||||
STYLE_ID_CONTROLS_DARK,
|
||||
'html.dark, body[theme-mode="dark"]',
|
||||
darkTokens['brand-primary'],
|
||||
true,
|
||||
@@ -270,7 +270,7 @@ function doApply(config) {
|
||||
if (pre && pre.parentNode) pre.parentNode.removeChild(pre);
|
||||
|
||||
// 通知运行时读取 CSS 变量的消费方(如 vchart 图表的系列色)预设已切换。
|
||||
// Semi 明暗切换有 initVChartSemiTheme 的 watcher,但预设注入只改 CSS 变量,
|
||||
// Semi 明暗切换有 initVChartTheme 的 watcher,但预设注入只改 CSS 变量,
|
||||
// 不改 theme-mode,watcher 感知不到,必须靠这个事件补。
|
||||
try {
|
||||
window.dispatchEvent(new CustomEvent('theme-tokens-applied'));
|
||||
@@ -281,7 +281,7 @@ function doApply(config) {
|
||||
|
||||
function cachePresplashCSS() {
|
||||
try {
|
||||
const ids = [STYLE_ID_LIGHT, STYLE_ID_DARK, STYLE_ID_SEMI_LIGHT, STYLE_ID_SEMI_DARK];
|
||||
const ids = [STYLE_ID_LIGHT, STYLE_ID_DARK, STYLE_ID_CONTROLS_LIGHT, STYLE_ID_CONTROLS_DARK];
|
||||
const css = ids
|
||||
.map((id) => {
|
||||
const el = document.getElementById(id);
|
||||
@@ -304,7 +304,7 @@ function cachePresplashCSS() {
|
||||
*
|
||||
* isDark 决定 hover/active 是 darken 还是 lighten。
|
||||
*/
|
||||
function buildSemiRules(baseHex, isDark, infoHex) {
|
||||
function buildControlRules(baseHex, isDark, infoHex) {
|
||||
const base = colord(baseHex);
|
||||
const info = colord(infoHex || baseHex);
|
||||
const step = (c, n) =>
|
||||
@@ -319,34 +319,34 @@ function buildSemiRules(baseHex, isDark, infoHex) {
|
||||
|
||||
return {
|
||||
/* primary(7 个)—— 跟随 brand-primary */
|
||||
'semi-color-primary': baseHex,
|
||||
'semi-color-primary-hover': step(base, 0.05),
|
||||
'semi-color-primary-active': step(base, 0.1),
|
||||
'semi-color-primary-disabled': alphaSoft(base, 0.4),
|
||||
'semi-color-primary-light-default': alphaSoft(base, softDefault),
|
||||
'semi-color-primary-light-hover': alphaSoft(base, softHover),
|
||||
'semi-color-primary-light-active': alphaSoft(base, softActive),
|
||||
'ui-color-primary': baseHex,
|
||||
'ui-color-primary-hover': step(base, 0.05),
|
||||
'ui-color-primary-active': step(base, 0.1),
|
||||
'ui-color-primary-disabled': alphaSoft(base, 0.4),
|
||||
'ui-color-primary-light-default': alphaSoft(base, softDefault),
|
||||
'ui-color-primary-light-hover': alphaSoft(base, softHover),
|
||||
'ui-color-primary-light-active': alphaSoft(base, softActive),
|
||||
/* info(7 个)—— 跟随 accent-blue,保留"信息=蓝"语义 */
|
||||
'semi-color-info': infoHexNorm,
|
||||
'semi-color-info-hover': step(info, 0.05),
|
||||
'semi-color-info-active': step(info, 0.1),
|
||||
'semi-color-info-disabled': alphaSoft(info, 0.4),
|
||||
'semi-color-info-light-default': alphaSoft(info, softDefault),
|
||||
'semi-color-info-light-hover': alphaSoft(info, softHover),
|
||||
'semi-color-info-light-active': alphaSoft(info, softActive),
|
||||
'ui-color-info': infoHexNorm,
|
||||
'ui-color-info-hover': step(info, 0.05),
|
||||
'ui-color-info-active': step(info, 0.1),
|
||||
'ui-color-info-disabled': alphaSoft(info, 0.4),
|
||||
'ui-color-info-light-default': alphaSoft(info, softDefault),
|
||||
'ui-color-info-light-hover': alphaSoft(info, softHover),
|
||||
'ui-color-info-light-active': alphaSoft(info, softActive),
|
||||
/* link(4 个)—— 跟随 brand-primary */
|
||||
'semi-color-link': baseHex,
|
||||
'semi-color-link-hover': step(base, 0.05),
|
||||
'semi-color-link-active': step(base, 0.1),
|
||||
'semi-color-link-visited': baseHex,
|
||||
'ui-color-link': baseHex,
|
||||
'ui-color-link-hover': step(base, 0.05),
|
||||
'ui-color-link-active': step(base, 0.1),
|
||||
'ui-color-link-visited': baseHex,
|
||||
/* focus-border(1 个) */
|
||||
'semi-color-focus-border': baseHex,
|
||||
'ui-color-focus-border': baseHex,
|
||||
};
|
||||
}
|
||||
|
||||
function injectSemiVars(styleId, selector, baseHex, isDark, infoHex) {
|
||||
function injectControlVars(styleId, selector, baseHex, isDark, infoHex) {
|
||||
if (!baseHex) return;
|
||||
const rules = buildSemiRules(baseHex, isDark, infoHex);
|
||||
const rules = buildControlRules(baseHex, isDark, infoHex);
|
||||
injectTokens(styleId, selector, rules);
|
||||
}
|
||||
|
||||
|
||||
+9
-10
@@ -17,10 +17,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { Toast, Pagination } from '@douyinfe/semi-ui';
|
||||
import { Toast, Pagination } from '@/components/ui';
|
||||
import { toastConstants } from '../constants';
|
||||
import React from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
import i18next from 'i18next';
|
||||
import {
|
||||
THINK_TAG_REGEX,
|
||||
@@ -219,7 +218,7 @@ export function showInfo(message) {
|
||||
|
||||
export function showNotice(message, isHTML = false) {
|
||||
if (isHTML) {
|
||||
toast(<HTMLToastContent htmlContent={message} />, showNoticeOptions);
|
||||
Toast.info({ content: <HTMLToastContent htmlContent={message} />, duration: 0 });
|
||||
} else {
|
||||
Toast.info(message);
|
||||
}
|
||||
@@ -1016,7 +1015,7 @@ const renderOfficialStrike = (formattedPrice) => {
|
||||
// Tailwind 生成序中 no-underline 靠后会反杀删除线(同特异性后者胜)
|
||||
<del
|
||||
className='mr-1 line-through'
|
||||
style={{ color: 'var(--semi-color-text-3)', fontSize: '0.92em' }}
|
||||
style={{ color: 'var(--ui-color-text-3)', fontSize: '0.92em' }}
|
||||
>
|
||||
{formattedPrice}
|
||||
</del>
|
||||
@@ -1033,7 +1032,7 @@ export const getDiscountBadgeText = (priceData) => {
|
||||
export const formatPriceInfo = (priceData, t) => {
|
||||
if (priceData.isPerSecond || priceData.isPerImageResolution) {
|
||||
return (
|
||||
<span style={{ color: 'var(--semi-color-text-1)' }}>{t('模型价格')}</span>
|
||||
<span style={{ color: 'var(--ui-color-text-1)' }}>{t('模型价格')}</span>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1045,14 +1044,14 @@ export const formatPriceInfo = (priceData, t) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<span style={{ color: 'var(--semi-color-text-1)' }}>
|
||||
<span style={{ color: 'var(--ui-color-text-1)' }}>
|
||||
{t('输入')} {renderOfficialStrike(official?.inputPrice)}
|
||||
<span className={official?.inputPrice ? 'font-semibold' : ''}>
|
||||
{priceData.inputPrice}
|
||||
</span>
|
||||
/{priceData.unitLabel}
|
||||
</span>
|
||||
<span style={{ color: 'var(--semi-color-text-1)' }}>
|
||||
<span style={{ color: 'var(--ui-color-text-1)' }}>
|
||||
{t('输出')} {renderOfficialStrike(official?.completionPrice)}
|
||||
<span className={official?.completionPrice ? 'font-semibold' : ''}>
|
||||
{priceData.completionPrice}
|
||||
@@ -1060,7 +1059,7 @@ export const formatPriceInfo = (priceData, t) => {
|
||||
/{priceData.unitLabel}
|
||||
</span>
|
||||
{extraPrices.map((item) => (
|
||||
<span key={item.key} style={{ color: 'var(--semi-color-text-1)' }}>
|
||||
<span key={item.key} style={{ color: 'var(--ui-color-text-1)' }}>
|
||||
{t(item.labelKey)} {item.price}/{priceData.unitLabel}
|
||||
</span>
|
||||
))}
|
||||
@@ -1070,7 +1069,7 @@ export const formatPriceInfo = (priceData, t) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<span style={{ color: 'var(--semi-color-text-1)' }}>
|
||||
<span style={{ color: 'var(--ui-color-text-1)' }}>
|
||||
{t('模型价格')} {renderOfficialStrike(priceData.official?.price)}
|
||||
<span className={priceData.official?.price ? 'font-semibold' : ''}>
|
||||
{priceData.price}
|
||||
@@ -1107,7 +1106,7 @@ export const createCardProPagination = ({
|
||||
{!isMobile && (
|
||||
<span
|
||||
className='text-sm select-none'
|
||||
style={{ color: 'var(--semi-color-text-2)' }}
|
||||
style={{ color: 'var(--ui-color-text-2)' }}
|
||||
>
|
||||
{totalText}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user