Skip to content

Commit c2ad9ef

Browse files
committed
improve settings
1 parent 606fd00 commit c2ad9ef

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

packages/devtool-extenstion/src/containers/Settings/index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const Settings = () => {
88
const [startDebugWhen, setStartDebugWhen] = useState("extensionLoad");
99
const [debugUseReducer, setDebugUseReducer] = useState(true);
1010
const [debugContext, setDebugContext] = useState(true);
11+
const [showSuccessMsg, setShowSuccessMsg] = useState(false);
1112

1213
const onChangeStartDebugWhen = (event) => {
1314
setStartDebugWhen(event.target.value);
@@ -45,7 +46,18 @@ const Settings = () => {
4546
debugContext,
4647
};
4748

48-
chrome.storage.local.set(settingstoSave);
49+
let timer = null;
50+
51+
if (timer) {
52+
clearTimeout(timer);
53+
}
54+
55+
chrome.storage.local.set(settingstoSave, () => {
56+
setShowSuccessMsg(true);
57+
timer = setTimeout(() => {
58+
setShowSuccessMsg(false);
59+
}, 3000);
60+
});
4961
};
5062

5163
return (
@@ -119,6 +131,9 @@ const Settings = () => {
119131
</div>
120132
</div>
121133
<div className="setting-footer">
134+
<div className="success-msg">
135+
{showSuccessMsg ? "Settings save successfully" : null}
136+
</div>
122137
<Button onClick={onClickSave}>Save</Button>
123138
</div>
124139
</div>

packages/devtool-extenstion/src/containers/Settings/index.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@
3939
}
4040
}
4141
.setting-footer {
42-
padding: 20px 0 10px 0;
42+
padding: 5px 0 10px 0;
4343
text-align: center;
44+
45+
.success-msg {
46+
color: var(--primary-color);
47+
padding-bottom: 10px;
48+
height: 20px;
49+
}
4450
}
4551
}

0 commit comments

Comments
 (0)