Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
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
Vũ Hoàng Anh
canifa_note
Commits
706b1b42
Unverified
Commit
706b1b42
authored
Nov 17, 2022
by
boojack
Committed by
GitHub
Nov 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add toast to system settings (#486)
parent
16905664
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
SystemSection.tsx
web/src/components/Settings/SystemSection.tsx
+23
-10
No files found.
web/src/components/Settings/SystemSection.tsx
View file @
706b1b42
...
...
@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
import
{
useTranslation
}
from
"react-i18next"
;
import
{
Button
,
Switch
,
Textarea
}
from
"@mui/joy"
;
import
*
as
api
from
"../../helpers/api"
;
import
toastHelper
from
"../Toast"
;
import
"../../less/settings/preferences-section.less"
;
interface
State
{
...
...
@@ -48,10 +49,16 @@ const SystemSection = () => {
};
const
handleSaveAdditionalStyle
=
async
()
=>
{
await
api
.
upsertSystemSetting
({
name
:
"additionalStyle"
,
value
:
JSON
.
stringify
(
state
.
additionalStyle
),
});
try
{
await
api
.
upsertSystemSetting
({
name
:
"additionalStyle"
,
value
:
JSON
.
stringify
(
state
.
additionalStyle
),
});
}
catch
(
error
)
{
console
.
error
(
error
);
return
;
}
toastHelper
.
success
(
"Succeed to update additional style"
);
};
const
handleAdditionalScriptChanged
=
(
value
:
string
)
=>
{
...
...
@@ -62,10 +69,16 @@ const SystemSection = () => {
};
const
handleSaveAdditionalScript
=
async
()
=>
{
await
api
.
upsertSystemSetting
({
name
:
"additionalScript"
,
value
:
JSON
.
stringify
(
state
.
additionalScript
),
});
try
{
await
api
.
upsertSystemSetting
({
name
:
"additionalScript"
,
value
:
JSON
.
stringify
(
state
.
additionalScript
),
});
}
catch
(
error
)
{
console
.
error
(
error
);
return
;
}
toastHelper
.
success
(
"Succeed to update additional script"
);
};
return
(
...
...
@@ -89,7 +102,7 @@ const SystemSection = () => {
}
}
minRows=
{
5
}
maxRows=
{
10
}
defaultV
alue=
{
state
.
additionalStyle
}
v
alue=
{
state
.
additionalStyle
}
onChange=
{
(
event
)
=>
handleAdditionalStyleChanged
(
event
.
target
.
value
)
}
/>
<
div
className=
"form-label selector mt-2"
>
...
...
@@ -106,7 +119,7 @@ const SystemSection = () => {
}
}
minRows=
{
5
}
maxRows=
{
10
}
defaultV
alue=
{
state
.
additionalScript
}
v
alue=
{
state
.
additionalScript
}
onChange=
{
(
event
)
=>
handleAdditionalScriptChanged
(
event
.
target
.
value
)
}
/>
</
div
>
...
...
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