Skip to content

Commit

Permalink
feat: add clear all setting
Browse files Browse the repository at this point in the history
  • Loading branch information
zenghongtu committed May 16, 2019
1 parent 7b38963 commit 7da7db3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/renderer/pages/Setting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { ENABLE_HOTKEY } from '../../../constants';
import { UploadChangeParam } from 'antd/lib/upload';
import { SketchPicker, BlockPicker } from 'react-color';
import { getLinkCSS, updateTheme } from '@/utils/theme';
const confirm = Modal.confirm;

const fnMap = {
changePlayState: '暂停 / 播放',
Expand Down Expand Up @@ -329,6 +330,17 @@ export default function() {
setTheme({ ...theme, [colorName]: color });
};

const handleResetAllSetting = () => {
confirm({
title: '确定清除所有设置?',
onOk() {
localStorage.clear();
settings.clear();
message.success('清除完毕,请重启程序!👻');
},
});
};

return (
<div className={styles.wrap}>
<h2>设置</h2>
Expand Down Expand Up @@ -392,6 +404,11 @@ export default function() {
</div>
</Form.Item>

<Form.Item label='重置'>
<Button type='danger' onClick={handleResetAllSetting}>
重置所有设置
</Button>
</Form.Item>
{modalVisible && (
<SetShortcutModal
onChangeVisible={setModalVisible}
Expand Down

0 comments on commit 7da7db3

Please sign in to comment.