代码提交

This commit is contained in:
董宏凯 committed 2026-07-24 10:33:28 +08:00
1 parent f49def09ea
commit 45df500a9c
55 files changed
+3390 -461

No files matched your search

+36 -5
View File
@@ -8,9 +8,10 @@ import React, {
import { useTheme as useNextTheme } from 'next-themes';
import { useAppearanceSettings } from '@/core/system-settings/hooks';
import { isPositionRoundtableStandaloneMode } from '@/position-roundtable/demo/position-roundtable-demo-config';
// 主题类型
export type ThemeType = 'dark' | 'light' | 'lightblue' | 'lightgreen';
export type ThemeType = 'dark' | 'light' | 'lightblue' | 'lightgreen' | 'iceblue';
// 主题配置
export interface ThemeConfig {
@@ -126,6 +127,30 @@ const themes: Record<ThemeType, ThemeConfig> = {
overlay: 'black/30',
},
},
iceblue: {
type: 'iceblue',
name: '冰川蓝主题',
colors: {
background: 'sky-50',
backgroundSecondary: 'sky-100',
text: 'slate-800',
textSecondary: 'slate-600',
// The CSS --primary token is exactly #9BCEF1. Darker blues are used
// only for readable text, hover and focus states.
primary: 'sky-200',
primaryHover: 'sky-300',
border: 'sky-200',
accent: 'sky-200',
success: 'emerald-600',
warning: 'amber-600',
error: 'red-600',
card: 'white',
cardHover: 'sky-50',
input: 'white',
inputBorder: 'sky-200',
overlay: 'slate-900/30',
},
},
};
const STORAGE_KEY = 'strategy-theme';
@@ -144,6 +169,7 @@ function readPersistedTheme(): ThemeType {
if (saved === 'dark') return 'dark';
if (saved === 'lightblue') return 'lightblue';
if (saved === 'lightgreen') return 'lightgreen';
if (saved === 'iceblue') return 'iceblue';
return 'light';
}
@@ -184,7 +210,9 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children }) => {
// a theme yet, this value drives the rendered theme — and re-syncs on
// every mount so an admin change propagates without users clearing
// localStorage by hand.
const { data: appearance } = useAppearanceSettings();
const { data: appearance } = useAppearanceSettings({
enabled: !isPositionRoundtableStandaloneMode(),
});
useEffect(() => {
setMounted(true);
@@ -203,7 +231,8 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children }) => {
current !== 'light' &&
current !== 'dark' &&
current !== 'lightblue' &&
current !== 'lightgreen'
current !== 'lightgreen' &&
current !== 'iceblue'
) {
// Garbage value — wipe it so the boot-sync below can take over.
localStorage.removeItem(STORAGE_KEY);
@@ -242,7 +271,9 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children }) => {
? 'lightblue'
: effectiveTheme === 'lightgreen'
? 'lightgreen'
: 'light'
: effectiveTheme === 'iceblue'
? 'iceblue'
: 'light'
: readPersistedTheme();
useEffect(() => {
@@ -260,7 +291,7 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children }) => {
root.removeAttribute('theme-mode');
root.classList.remove('dark');
if (theme === 'lightblue' || theme === 'lightgreen') {
if (theme === 'lightblue' || theme === 'lightgreen' || theme === 'iceblue') {
root.setAttribute('data-theme', theme);
} else {
root.removeAttribute('data-theme');