From bac0704d3d321e1857ac2a67a9c8dd5dc218ba3d Mon Sep 17 00:00:00 2001 From: Gabe Yuan Date: Sun, 12 May 2024 20:24:40 +0800 Subject: [PATCH] feat: download and upload settings --- src/views/Options/Setting.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/views/Options/Setting.js b/src/views/Options/Setting.js index 977d4cd..4a0f3b9 100644 --- a/src/views/Options/Setting.js +++ b/src/views/Options/Setting.js @@ -31,6 +31,8 @@ import ShortcutInput from "./ShortcutInput"; import { useFab } from "../../hooks/Fab"; import { sendBgMsg } from "../../libs/msg"; import { kissLog } from "../../libs/log"; +import UploadButton from "./UploadButton"; +import DownloadButton from "./DownloadButton"; function ShortcutItem({ action, label }) { const { shortcut, setShortcut } = useShortcut(action); @@ -92,6 +94,14 @@ export default function Settings() { } }; + const handleImport = async (data) => { + try { + await updateSetting(JSON.parse(data)); + } catch (err) { + kissLog(err, "import setting"); + } + }; + const { uiLang, minLength, @@ -109,6 +119,21 @@ export default function Settings() { return ( + + + JSON.stringify(setting, null, 2)} + text={i18n("export")} + fileName={`kiss-setting_${Date.now()}.json`} + /> + + {i18n("ui_lang")}