diff --git a/src/App.tsx b/src/App.tsx index c6d384e..852c06c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,9 +5,10 @@ import { shortcuts } from "@/global"; import { Mode, RenderedFunction } from "@/types"; import Utils from "@/utils/Utils"; import Storage from "@/utils/Storage"; +import Emitter from "@/utils/Emitter"; import { Axis } from "@/renderer/Graphics"; -import usePreloader from "@/hooks/usePreloader"; +// import usePreloader from "@/hooks/usePreloader"; // Layout import "katex/dist/katex.min.css"; @@ -31,10 +32,13 @@ const App: React.FC = () => { const [functionList, setFunctionList] = useState([]); const [axis, setAxisType] = useState(Axis.CARTESIAN); - usePreloader(new URL("@/workers/graphing.worker.ts", import.meta.url), "script"); - usePreloader(new URL("@/workers/calculating.worker.ts", import.meta.url), "script"); + // usePreloader(new URL("@/workers/graphing.worker.ts", import.meta.url), "script"); + // usePreloader(new URL("@/workers/calculating.worker.ts", import.meta.url), "script"); useEffect(() => { + // Default Mode + new Emitter().emit("switch-mode", new Storage().getItem("ca-mode", Mode.GENERAL) as Mode); + document.body.addEventListener("keydown", (e: KeyboardEvent) => { shortcuts.forEach((shortcut, key) => { if( @@ -74,7 +78,7 @@ const App: React.FC = () => {
- {!Utils.isMobile() && } +
diff --git a/src/components/navbar/index.tsx b/src/components/navbar/index.tsx index 79eb34a..883efd6 100644 --- a/src/components/navbar/index.tsx +++ b/src/components/navbar/index.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef } from "react"; +import React, { useRef } from "react"; import Toggle from "@nocp/toggle"; import ModeButton from "@/components/navbar/ModeButton"; @@ -8,7 +8,6 @@ import ConvertingDialog from "@/dialogs/ConvertingDialog"; import SeniorityDialog from "@/dialogs/SeniorityDialog"; import CurrencyDialog from "@/dialogs/CurrencyDialog"; -import Emitter from "@/utils/Emitter"; import Storage from "@/utils/Storage"; import useThemeDetector from "@/hooks/useThemeDetector"; import { Mode, Theme } from "@/types"; @@ -28,11 +27,6 @@ const Navbar: React.FC = () => { new Storage().setItem("ca-theme", isActive ? Theme.LIGHT : Theme.DARK); }; - useEffect(() => { - // default - new Emitter().emit("switch-mode", new Storage().getItem("ca-mode", Mode.GENERAL) as Mode); - }, []); - return ( <>