Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
d35656cf
Unverified
Commit
d35656cf
authored
Dec 06, 2023
by
Zzm0809
Committed by
GitHub
Dec 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bug][web] fix theme bug (#2610)
* fix-theme-bug * Spotless Apply * fix-theme-bug --------- Co-authored-by:
Zzm0809
<
Zzm0809@users.noreply.github.com
>
parent
8cd0a647
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
12 deletions
+17
-12
index.tsx
dinky-web/src/components/CustomEditor/CodeShow/index.tsx
+2
-2
index.tsx
dinky-web/src/pages/Other/Login/index.tsx
+4
-1
data.ts
dinky-web/src/types/Public/data.ts
+2
-4
function.tsx
dinky-web/src/utils/function.tsx
+9
-5
No files found.
dinky-web/src/components/CustomEditor/CodeShow/index.tsx
View file @
d35656cf
...
@@ -29,7 +29,7 @@ import { EditorLanguage } from 'monaco-editor/esm/metadata';
...
@@ -29,7 +29,7 @@ import { EditorLanguage } from 'monaco-editor/esm/metadata';
import
FullscreenBtn
from
'@/components/CustomEditor/FullscreenBtn'
;
import
FullscreenBtn
from
'@/components/CustomEditor/FullscreenBtn'
;
import
{
handleInitEditorAndLanguageOnBeforeMount
}
from
'@/components/CustomEditor/function'
;
import
{
handleInitEditorAndLanguageOnBeforeMount
}
from
'@/components/CustomEditor/function'
;
import
{
Editor
,
Monaco
}
from
'@monaco-editor/react'
;
import
{
Editor
,
Monaco
}
from
'@monaco-editor/react'
;
import
{
CSSProperties
,
memo
,
useRef
,
useState
}
from
'react'
;
import
{
CSSProperties
,
useRef
,
useState
}
from
'react'
;
export
type
CodeShowFormProps
=
{
export
type
CodeShowFormProps
=
{
height
?:
string
|
number
;
height
?:
string
|
number
;
...
@@ -264,4 +264,4 @@ const CodeShow = (props: CodeShowFormProps) => {
...
@@ -264,4 +264,4 @@ const CodeShow = (props: CodeShowFormProps) => {
);
);
};
};
export
default
memo
(
CodeShow
)
;
export
default
CodeShow
;
dinky-web/src/pages/Other/Login/index.tsx
View file @
d35656cf
...
@@ -25,7 +25,7 @@ import { chooseTenantSubmit, login, queryDataByParams } from '@/services/Busines
...
@@ -25,7 +25,7 @@ import { chooseTenantSubmit, login, queryDataByParams } from '@/services/Busines
import
{
API
}
from
'@/services/data'
;
import
{
API
}
from
'@/services/data'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
UserBaseInfo
}
from
'@/types/AuthCenter/data'
;
import
{
UserBaseInfo
}
from
'@/types/AuthCenter/data'
;
import
{
set
TenantStorageAndCookie
}
from
'@/utils/function'
;
import
{
set
LocalThemeToStorage
,
setTenantStorageAndCookie
}
from
'@/utils/function'
;
import
{
useLocalStorage
}
from
'@/utils/hook/useLocalStorage'
;
import
{
useLocalStorage
}
from
'@/utils/hook/useLocalStorage'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
ErrorMessage
,
SuccessMessageAsync
}
from
'@/utils/messages'
;
import
{
ErrorMessage
,
SuccessMessageAsync
}
from
'@/utils/messages'
;
...
@@ -84,12 +84,15 @@ const Login: React.FC = () => {
...
@@ -84,12 +84,15 @@ const Login: React.FC = () => {
const
handleChooseTenant
=
async
(
chooseTenantResult
:
API
.
Result
)
=>
{
const
handleChooseTenant
=
async
(
chooseTenantResult
:
API
.
Result
)
=>
{
if
(
chooseTenantResult
.
code
===
0
)
{
if
(
chooseTenantResult
.
code
===
0
)
{
await
SuccessMessageAsync
(
await
SuccessMessageAsync
(
l
(
'login.chooseTenantSuccess'
,
''
,
{
l
(
'login.chooseTenantSuccess'
,
''
,
{
msg
:
chooseTenantResult
.
msg
,
msg
:
chooseTenantResult
.
msg
,
tenantCode
:
chooseTenantResult
.
data
.
tenantCode
tenantCode
:
chooseTenantResult
.
data
.
tenantCode
})
})
);
);
// 补偿设置,设置主题色
setLocalThemeToStorage
();
/**
/**
* After the selection is complete, refresh all user information
* After the selection is complete, refresh all user information
*/
*/
...
...
dinky-web/src/types/Public/data.ts
View file @
d35656cf
...
@@ -27,10 +27,8 @@ export const THEME = {
...
@@ -27,10 +27,8 @@ export const THEME = {
* MonacoEditor of CodeEdit's theme
* MonacoEditor of CodeEdit's theme
*/
*/
export
const
CODE_EDIT_THEME
=
{
export
const
CODE_EDIT_THEME
=
{
VS
:
'vs'
,
LIGHT
:
'light'
,
DARK
:
'vs-dark'
,
DARK
:
'vs-dark'
HC_BLACK
:
'hc-black'
,
VS_CUSTOME
:
'vs-custom'
};
};
export
const
MonacoEditorOptions
=
{
export
const
MonacoEditorOptions
=
{
...
...
dinky-web/src/utils/function.tsx
View file @
d35656cf
...
@@ -122,7 +122,11 @@ export function parseJsonStr(jsonStr: string) {
...
@@ -122,7 +122,11 @@ export function parseJsonStr(jsonStr: string) {
* get theme by localStorage's theme
* get theme by localStorage's theme
*/
*/
export
function
getLocalTheme
():
string
{
export
function
getLocalTheme
():
string
{
return
localStorage
.
getItem
(
THEME
.
NAV_THEME
)
??
THEME
.
dark
;
return
localStorage
.
getItem
(
THEME
.
NAV_THEME
)
??
THEME
.
light
;
}
export
function
setLocalThemeToStorage
(
defaultTheme
?:
string
)
{
localStorage
.
setItem
(
THEME
.
NAV_THEME
,
defaultTheme
??
getLocalTheme
())
;
}
}
/**
/**
...
@@ -248,12 +252,12 @@ export function convertCodeEditTheme(editorInstance?: Monaco['editor']) {
...
@@ -248,12 +252,12 @@ export function convertCodeEditTheme(editorInstance?: Monaco['editor']) {
editorInstance
=
editor
;
editorInstance
=
editor
;
}
}
if
(
editorInstance
===
undefined
)
{
if
(
editorInstance
===
undefined
)
{
return
CODE_EDIT_THEME
.
VS
;
return
CODE_EDIT_THEME
.
LIGHT
;
}
else
{
}
else
{
/**
/**
* 定义亮色 覆盖vs主题,增加扩展规则
* 定义亮色 覆盖vs主题,增加扩展规则
*/
*/
editorInstance
?.
defineTheme
?.(
CODE_EDIT_THEME
.
VS
,
{
editorInstance
?.
defineTheme
?.(
CODE_EDIT_THEME
.
LIGHT
,
{
base
:
'vs'
,
// 指定基础主题 , 可选值: 'vs', 'vs-dark', 'hc-black' , base theme
base
:
'vs'
,
// 指定基础主题 , 可选值: 'vs', 'vs-dark', 'hc-black' , base theme
inherit
:
true
,
// 是否继承主题配置
inherit
:
true
,
// 是否继承主题配置
rules
:
[
rules
:
[
...
@@ -296,9 +300,9 @@ export function convertCodeEditTheme(editorInstance?: Monaco['editor']) {
...
@@ -296,9 +300,9 @@ export function convertCodeEditTheme(editorInstance?: Monaco['editor']) {
case
THEME
.
dark
:
case
THEME
.
dark
:
return
CODE_EDIT_THEME
.
DARK
;
return
CODE_EDIT_THEME
.
DARK
;
case
THEME
.
light
:
case
THEME
.
light
:
return
CODE_EDIT_THEME
.
VS
;
return
CODE_EDIT_THEME
.
LIGHT
;
default
:
default
:
return
CODE_EDIT_THEME
.
VS
;
return
CODE_EDIT_THEME
.
LIGHT
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment