chore: reset the primary color after logout
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { colorPrimary } from '@/config/theme';
|
||||
import { COLOR_PRIMARY } from '@/config/theme';
|
||||
import { atom } from 'jotai';
|
||||
import { atomWithStorage } from 'jotai/utils';
|
||||
|
||||
@@ -14,7 +14,7 @@ const defaultSettings: UserSettings = {
|
||||
theme: 'light',
|
||||
mode: 'auto',
|
||||
isDarkTheme: false,
|
||||
colorPrimary: colorPrimary,
|
||||
colorPrimary: COLOR_PRIMARY,
|
||||
collapsed: false
|
||||
};
|
||||
|
||||
@@ -47,7 +47,7 @@ export const userSettingsHelperAtom = atom(
|
||||
};
|
||||
set(userSettingsAtom, {
|
||||
...newSettings,
|
||||
colorPrimary: newSettings.colorPrimary || colorPrimary,
|
||||
colorPrimary: newSettings.colorPrimary || COLOR_PRIMARY,
|
||||
isDarkTheme: newSettings.theme === 'realDark'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
import { getDefaultStore } from 'jotai';
|
||||
|
||||
export const clearStorageUserSettings = () => {
|
||||
const savedSettings = JSON.parse(
|
||||
localStorage.getItem('userSettings') || '{}'
|
||||
);
|
||||
localStorage.setItem(
|
||||
'userSettings',
|
||||
JSON.stringify({
|
||||
...savedSettings,
|
||||
colorPrimary: undefined
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
export const clearAtomStorage = (atom: any) => {
|
||||
if (!atom) {
|
||||
return;
|
||||
|
||||
@@ -33,7 +33,7 @@ const Chart: React.FC<{
|
||||
};
|
||||
|
||||
const setOption = (options: ECOption) => {
|
||||
console.log('setOption', options);
|
||||
if (!chart.current) return;
|
||||
chart.current?.clear();
|
||||
chart.current?.setOption(options, {
|
||||
notMerge: true,
|
||||
@@ -107,8 +107,8 @@ const Chart: React.FC<{
|
||||
}
|
||||
|
||||
return () => {
|
||||
chart.current?.dispose();
|
||||
chart.current?.off('finished', handleOnFinished);
|
||||
chart.current?.dispose();
|
||||
};
|
||||
}, []);
|
||||
|
||||
@@ -128,13 +128,11 @@ const Chart: React.FC<{
|
||||
|
||||
if (container.current) {
|
||||
resizeObserver.current = new ResizeObserver(handleResize);
|
||||
|
||||
resizeObserver.current.observe(container.current);
|
||||
}
|
||||
return () => {
|
||||
if (container.current) {
|
||||
resizeObserver.current?.unobserve(container.current);
|
||||
}
|
||||
resizeObserver.current?.disconnect();
|
||||
resizeObserver.current = undefined;
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@ export default function useChartConfig() {
|
||||
const { useToken } = theme;
|
||||
const { token } = useToken();
|
||||
|
||||
console.log('token:', token);
|
||||
|
||||
const chartColorMap = useMemo(() => {
|
||||
return {
|
||||
titleColor: token.colorText,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { COLOR_PRIMARY } from './index';
|
||||
|
||||
export default {
|
||||
'root-entry-name': 'variable',
|
||||
cssVar: true,
|
||||
@@ -36,7 +38,7 @@ export default {
|
||||
iconMarginInlineEnd: 12,
|
||||
itemBorderRadius: 4,
|
||||
itemHeight: 32,
|
||||
itemSelectedColor: '#007BFF',
|
||||
itemSelectedColor: COLOR_PRIMARY,
|
||||
darkItemSelectedBg: '#141414',
|
||||
darkItemHoverBg: 'rgba(255, 255, 255, 0.03)',
|
||||
groupTitleColor: 'rgba(0,0,0,1)',
|
||||
@@ -78,7 +80,7 @@ export default {
|
||||
fontFamily:
|
||||
"Helvetica Neue, -apple-system, BlinkMacSystemFont, Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",
|
||||
colorText: '#ccc',
|
||||
colorPrimary: '#007BFF',
|
||||
colorPrimary: COLOR_PRIMARY,
|
||||
colorSuccess: '#48A77E',
|
||||
borderRadius: 4,
|
||||
borderRadiusSM: 2,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import dark from './dark';
|
||||
import light from './light';
|
||||
|
||||
export const colorPrimary = '#007BFF';
|
||||
export const COLOR_PRIMARY = '#007BFF';
|
||||
|
||||
export default {
|
||||
light,
|
||||
dark,
|
||||
colorPrimary: colorPrimary
|
||||
colorPrimary: COLOR_PRIMARY
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { COLOR_PRIMARY } from './index';
|
||||
|
||||
export default {
|
||||
'root-entry-name': 'variable',
|
||||
cssVar: true,
|
||||
@@ -35,7 +37,7 @@ export default {
|
||||
iconSize: 16,
|
||||
iconMarginInlineEnd: 12,
|
||||
itemBorderRadius: 4,
|
||||
itemSelectedColor: '#007BFF',
|
||||
itemSelectedColor: COLOR_PRIMARY,
|
||||
itemHeight: 32,
|
||||
groupTitleColor: 'rgba(0,0,0,1)',
|
||||
itemHoverColor: 'rgba(0,0,0,1)',
|
||||
@@ -76,7 +78,7 @@ export default {
|
||||
fontFamily:
|
||||
"Helvetica Neue, -apple-system, BlinkMacSystemFont, Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",
|
||||
colorText: 'rgba(0,0,0,1)',
|
||||
colorPrimary: '#007BFF',
|
||||
colorPrimary: COLOR_PRIMARY,
|
||||
colorSuccess: '#54cc98',
|
||||
colorBorder: '#d3d0d9',
|
||||
borderRadius: 4,
|
||||
|
||||
@@ -14,7 +14,6 @@ export default function useBodyScroll() {
|
||||
window.__GPUSTACK_BODY_SCROLLER__?.elements()?.scrollEventElement;
|
||||
|
||||
instanceRef.current = window.__GPUSTACK_BODY_SCROLLER__;
|
||||
console.log('bodyScroller', bodyScroller.current, instanceRef.current);
|
||||
};
|
||||
|
||||
const saveScrollHeight = React.useCallback(() => {
|
||||
|
||||
@@ -193,6 +193,22 @@ const options: BackendParameter[] = [
|
||||
{
|
||||
label: '--multi-token-prediction-tokens',
|
||||
value: '--multi-token-prediction-tokens'
|
||||
},
|
||||
{
|
||||
label: '--context-parallel-size',
|
||||
value: '--context-parallel-size'
|
||||
},
|
||||
{
|
||||
label: '--models',
|
||||
value: '--models'
|
||||
},
|
||||
{
|
||||
label: '--max-prefill-tokens',
|
||||
value: '--max-prefill-tokens'
|
||||
},
|
||||
{
|
||||
label: '--max-iter-times',
|
||||
value: '--max-iter-times'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { userAtom } from '@/atoms/user';
|
||||
import { clearAtomStorage } from '@/atoms/utils';
|
||||
import { clearAtomStorage, clearStorageUserSettings } from '@/atoms/utils';
|
||||
import { request } from '@umijs/max';
|
||||
import qs from 'query-string';
|
||||
|
||||
@@ -27,6 +27,7 @@ export const logout = async (userInfo?: any) => {
|
||||
await request(`${AUTH_API}/logout`, {
|
||||
method: 'POST'
|
||||
});
|
||||
clearStorageUserSettings();
|
||||
clearAtomStorage(userAtom);
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -30,8 +30,6 @@ const SettingsItem = styled.div`
|
||||
const Appearance: React.FC = () => {
|
||||
const { setTheme, userSettings } = useUserSettings();
|
||||
|
||||
console.log('userSettings', userSettings);
|
||||
|
||||
const intl = useIntl();
|
||||
const allLocals = getAllLocales();
|
||||
|
||||
@@ -57,8 +55,6 @@ const Appearance: React.FC = () => {
|
||||
setTheme(value);
|
||||
};
|
||||
|
||||
console.log('allLocals', allLocals);
|
||||
|
||||
const languageOptions = allLocals.map((locale) => ({
|
||||
value: locale,
|
||||
label: _.get(langConfigMap, [locale, 'label'])
|
||||
@@ -71,6 +67,7 @@ const Appearance: React.FC = () => {
|
||||
<span>{intl.formatMessage({ id: 'common.appearance.theme' })}</span>
|
||||
</span>
|
||||
<BaseSelect
|
||||
defaultValue={'light'}
|
||||
value={userSettings.mode}
|
||||
options={ThemeOptions}
|
||||
onChange={handleOnChange}
|
||||
|
||||
Reference in New Issue
Block a user