You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by sh...@apache.org on 2024/01/17 03:58:58 UTC
(incubator-answer) branch feat/1.2.5/ui updated: fix: dark style optimization
This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch feat/1.2.5/ui
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
The following commit(s) were added to refs/heads/feat/1.2.5/ui by this push:
new 1ce1b12d fix: dark style optimization
1ce1b12d is described below
commit 1ce1b12d6cb301d58f8ed04e4795721fc03290b7
Author: shuai <li...@sifou.com>
AuthorDate: Wed Jan 17 11:58:46 2024 +0800
fix: dark style optimization
---
ui/src/common/color.scss | 5 +++++
ui/src/pages/Admin/Themes/index.tsx | 2 +-
ui/src/pages/Users/Login/index.tsx | 2 ++
ui/src/stores/loggedUserInfo.ts | 4 ----
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/ui/src/common/color.scss b/ui/src/common/color.scss
index 3b5feeea..496c19bc 100644
--- a/ui/src/common/color.scss
+++ b/ui/src/common/color.scss
@@ -53,4 +53,9 @@
color: #000 !important;
background-color: RGBA(255, 255, 255, var(--bs-bg-opacity, 1)) !important;
}
+ #sideNav {
+ .side-nav-right-line {
+ background-color: var(--bs-border-color);
+ }
+ }
}
diff --git a/ui/src/pages/Admin/Themes/index.tsx b/ui/src/pages/Admin/Themes/index.tsx
index 3f817712..990f5e54 100644
--- a/ui/src/pages/Admin/Themes/index.tsx
+++ b/ui/src/pages/Admin/Themes/index.tsx
@@ -48,7 +48,7 @@ const Index: FC = () => {
color_scheme: {
type: 'string',
title: t('color_scheme.label'),
- enum: ['setting', 'light', 'dark'],
+ enum: ['system', 'light', 'dark'],
enumNames: [
t('system_setting', { keyPrefix: 'btns' }),
t('light', { keyPrefix: 'btns' }),
diff --git a/ui/src/pages/Users/Login/index.tsx b/ui/src/pages/Users/Login/index.tsx
index 549808bd..bbb1f67f 100644
--- a/ui/src/pages/Users/Login/index.tsx
+++ b/ui/src/pages/Users/Login/index.tsx
@@ -32,6 +32,7 @@ import {
} from '@/stores';
import { floppyNavigation, guard, handleFormError, userCenter } from '@/utils';
import { login, UcAgent } from '@/services';
+import { setupAppTheme } from '@/utils/localize';
const Index: React.FC = () => {
const { t } = useTranslation('translation', { keyPrefix: 'login' });
@@ -116,6 +117,7 @@ const Index: React.FC = () => {
.then(async (res) => {
await passwordCaptcha.close();
updateUser(res);
+ setupAppTheme();
const userStat = guard.deriveLoginState();
if (userStat.isNotActivated) {
// inactive
diff --git a/ui/src/stores/loggedUserInfo.ts b/ui/src/stores/loggedUserInfo.ts
index 6b31606e..806c0993 100644
--- a/ui/src/stores/loggedUserInfo.ts
+++ b/ui/src/stores/loggedUserInfo.ts
@@ -22,7 +22,6 @@ import create from 'zustand';
import type { UserInfoRes } from '@/common/interface';
import Storage from '@/utils/storage';
import { LOGGED_TOKEN_STORAGE_KEY } from '@/common/constants';
-import { changeTheme } from '@/utils/common';
interface UserInfoStore {
user: UserInfoRes;
@@ -60,9 +59,6 @@ const loggedUserInfo = create<UserInfoStore>((set) => ({
}
if (!params?.color_scheme) {
params.color_scheme = 'default';
- changeTheme('default');
- } else {
- changeTheme(params.color_scheme);
}
set(() => {
Storage.set(LOGGED_TOKEN_STORAGE_KEY, params.access_token);