feat: action success toast
This commit is contained in:
@@ -121,5 +121,8 @@
|
||||
},
|
||||
"totalNumberOfRules": {
|
||||
"message": "Total number of rules"
|
||||
},
|
||||
"updateSuccessful": {
|
||||
"message": "Update successful"
|
||||
}
|
||||
}
|
||||
@@ -121,5 +121,8 @@
|
||||
},
|
||||
"totalNumberOfRules": {
|
||||
"message": "规则总数"
|
||||
},
|
||||
"updateSuccessful": {
|
||||
"message": "更新成功"
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@
|
||||
"psl": "^1.9.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"react-hot-toast": "^2.4.1",
|
||||
"react-router-dom": "^6.20.1",
|
||||
"route-recognizer": "^0.3.4",
|
||||
"rss-parser": "^3.13.0",
|
||||
|
||||
Generated
+25
@@ -56,6 +56,9 @@ dependencies:
|
||||
react-dom:
|
||||
specifier: 18.2.0
|
||||
version: 18.2.0(react@18.2.0)
|
||||
react-hot-toast:
|
||||
specifier: ^2.4.1
|
||||
version: 2.4.1(csstype@3.1.3)(react-dom@18.2.0)(react@18.2.0)
|
||||
react-router-dom:
|
||||
specifier: ^6.20.1
|
||||
version: 6.20.1(react-dom@18.2.0)(react@18.2.0)
|
||||
@@ -4301,6 +4304,14 @@ packages:
|
||||
slash: 3.0.0
|
||||
dev: false
|
||||
|
||||
/goober@2.1.13(csstype@3.1.3):
|
||||
resolution: {integrity: sha512-jFj3BQeleOoy7t93E9rZ2de+ScC4lQICLwiAQmKMg9F6roKGaLSHoCDYKkWlSafg138jejvq/mTdvmnwDQgqoQ==}
|
||||
peerDependencies:
|
||||
csstype: ^3.0.10
|
||||
dependencies:
|
||||
csstype: 3.1.3
|
||||
dev: false
|
||||
|
||||
/gopd@1.0.1:
|
||||
resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==}
|
||||
dependencies:
|
||||
@@ -5843,6 +5854,20 @@ packages:
|
||||
resolution: {integrity: sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==}
|
||||
dev: false
|
||||
|
||||
/react-hot-toast@2.4.1(csstype@3.1.3)(react-dom@18.2.0)(react@18.2.0):
|
||||
resolution: {integrity: sha512-j8z+cQbWIM5LY37pR6uZR6D4LfseplqnuAO4co4u8917hBUvXlEqyP1ZzqVLcqoyUesZZv/ImreoCeHVDpE5pQ==}
|
||||
engines: {node: '>=10'}
|
||||
peerDependencies:
|
||||
react: '>=16'
|
||||
react-dom: '>=16'
|
||||
dependencies:
|
||||
goober: 2.1.13(csstype@3.1.3)
|
||||
react: 18.2.0
|
||||
react-dom: 18.2.0(react@18.2.0)
|
||||
transitivePeerDependencies:
|
||||
- csstype
|
||||
dev: false
|
||||
|
||||
/react-refresh@0.14.0:
|
||||
resolution: {integrity: sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
+4
-1
@@ -1,5 +1,6 @@
|
||||
import { Storage } from "@plasmohq/storage"
|
||||
import _ from 'lodash';
|
||||
import toast from "react-hot-toast"
|
||||
|
||||
const storage = new Storage()
|
||||
|
||||
@@ -57,5 +58,7 @@ export async function setConfig(config: Partial<typeof defaultConfig>) {
|
||||
if (config.rsshubDomain === defaultConfig.rsshubDomain) {
|
||||
config.rsshubAccessControl.enabled = defaultConfig.rsshubAccessControl.enabled;
|
||||
}
|
||||
return storage.set("config", config)
|
||||
await storage.set("config", config)
|
||||
toast.success("Saved")
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@ import { MemoryRouter } from "react-router-dom"
|
||||
import { Routing } from "~/options/routes"
|
||||
import "~/lib/style.css"
|
||||
import Siderbar from "./Siderbar"
|
||||
import { Toaster } from "react-hot-toast"
|
||||
|
||||
function Options() {
|
||||
return (
|
||||
<div className="max-w-screen-lg mx-auto text-base py-10">
|
||||
<Toaster />
|
||||
<MemoryRouter>
|
||||
<div className="flex space-x-20 h-full">
|
||||
<Siderbar />
|
||||
|
||||
@@ -17,6 +17,7 @@ import { parseRules, getRulesCount } from "~/lib/rules"
|
||||
import type { Rules as IRules } from "~/lib/types"
|
||||
import { sendToBackground } from "@plasmohq/messaging"
|
||||
import { Loader2 } from "lucide-react"
|
||||
import toast from "react-hot-toast"
|
||||
|
||||
function General() {
|
||||
const [config] = useStorage("config", (v) => _.merge({}, defaultConfig, v))
|
||||
@@ -102,7 +103,10 @@ function General() {
|
||||
setRulesUpdating(true)
|
||||
sendToBackground({
|
||||
name: "refreshRules"
|
||||
}).then((res) => setRulesUpdating(false))
|
||||
}).then((res) => {
|
||||
setRulesUpdating(false)
|
||||
toast.success(chrome.i18n.getMessage("updateSuccessful"))
|
||||
})
|
||||
}}
|
||||
>
|
||||
{rulesUpdating && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
|
||||
|
||||
Reference in New Issue
Block a user