mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-05 19:24:39 +00:00
improve loading performance of settings UI
This commit is contained in:
+1
-1
@@ -56,7 +56,7 @@
|
||||
"npm-run-all": "^4.1.5",
|
||||
"preact": "^10.20.0",
|
||||
"react": "^18.2.0",
|
||||
"react-best-gradient-color-picker": "^3.0.5",
|
||||
"react-best-gradient-color-picker": "3.0.5",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.22.0",
|
||||
"rimraf": "^5.0.5",
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import Browser from "webextension-polyfill";
|
||||
|
||||
console.log('hi');
|
||||
|
||||
(async () => {
|
||||
const result = await Browser.storage.local.get();
|
||||
if (result.DarkMode) {
|
||||
document.body.classList.add('dark');
|
||||
}
|
||||
})();
|
||||
@@ -11,7 +11,6 @@ const useSettingsState = ({ settingsState, setSettingsState }: SettingsProps) =>
|
||||
if (RanOnce) return;
|
||||
RanOnce = true;
|
||||
|
||||
// get the current settings state
|
||||
// @ts-expect-error - TODO: Fix this
|
||||
browser.storage.local.get().then((result: MainConfig) => {
|
||||
setSettingsState({
|
||||
@@ -27,10 +26,6 @@ const useSettingsState = ({ settingsState, setSettingsState }: SettingsProps) =>
|
||||
transparencyEffects: result.transparencyEffects,
|
||||
theme: result.theme
|
||||
});
|
||||
|
||||
if (result.DarkMode) {
|
||||
document.body.classList.add('dark');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -4,11 +4,23 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>BetterSEQTA+ Settings</title>
|
||||
<style>
|
||||
body {
|
||||
padding: 0;
|
||||
width: 384px;
|
||||
height: 600px;
|
||||
}
|
||||
|
||||
body.dark {
|
||||
background-color: rgb(39 39 42);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="width: 384px; height: 600px;">
|
||||
<body>
|
||||
<div id="ExtensionPopup">
|
||||
</div>
|
||||
<script type="module" src="./main.tsx"></script>
|
||||
<script type="module" src="./dark.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -8,8 +8,10 @@ import font from '../resources/fonts/IconFamily.woff'
|
||||
|
||||
import * as Sentry from "@sentry/react";
|
||||
|
||||
browser.storage.local.get([ "telemetry" ]).then((telemetry) => {
|
||||
if (telemetry.telemetry === true)
|
||||
browser.storage.local.get().then(({ telemetry, DarkMode }) => {
|
||||
if (DarkMode) document.body.classList.add('dark');
|
||||
|
||||
if (telemetry === true)
|
||||
Sentry.init({
|
||||
dsn: "https://4bc7197431b170218e15daba4095d08b@o4506347383291904.ingest.sentry.io/4506347394105344",
|
||||
integrations: [
|
||||
|
||||
Reference in New Issue
Block a user