chore: improve compatibility for upgraded packages

This commit is contained in:
josc146
2023-03-19 12:03:04 +08:00
parent e38139bfe7
commit b7634f723e
4 changed files with 31 additions and 8 deletions
+4 -2
View File
@@ -19,6 +19,7 @@ import PropTypes from 'prop-types'
import { config as toolsConfig } from '../content-script/selection-tools'
import wechatpay from './donation/wechatpay.jpg'
import bugmeacoffee from './donation/bugmeacoffee.svg'
import { useWindowTheme } from '../hooks/use-window-theme.mjs'
function GeneralPart({ config, updateConfig }) {
const [balance, setBalance] = useState(null)
@@ -388,6 +389,7 @@ function Popup() {
const [config, setConfig] = useState(defaultConfig)
const [currentVersion, setCurrentVersion] = useState('')
const [latestVersion, setLatestVersion] = useState('')
const theme = useWindowTheme()
const updateConfig = (value) => {
setConfig({ ...config, ...value })
@@ -407,8 +409,8 @@ function Popup() {
}, [])
useEffect(() => {
document.documentElement.dataset.theme = config.themeMode
}, [config.themeMode])
document.documentElement.dataset.theme = config.themeMode === 'auto' ? theme : config.themeMode
}, [config.themeMode, theme])
return (
<div className="container">