diff --git a/src/App.jsx b/src/App.jsx index bff1d1e..56e1f8b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,26 +1,34 @@ -import { BrowserRouter as Router, Routes, Route } from "react-router-dom"; +import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom"; import Editor from "./pages/Editor"; import Survey from "./pages/Survey"; import BugReport from "./pages/BugReport"; import Shortcuts from "./pages/Shortcuts"; import Templates from "./pages/Templates"; -import Home from "./pages/Home"; -import { CookiesProvider } from "react-cookie"; +import { useEffect } from "react"; +import LandingPage from "./pages/LandingPage"; + +const Wrapper = ({ children }) => { + const location = useLocation(); + useEffect(() => { + window.scroll(0, 0); + }, [location.pathname]); + return children; +}; function App() { return ( - - + + - } /> + } /> } /> } /> } /> } /> } /> - - + + ); } diff --git a/src/pages/Editor.jsx b/src/pages/Editor.jsx index 0737e73..4ef778c 100644 --- a/src/pages/Editor.jsx +++ b/src/pages/Editor.jsx @@ -571,7 +571,7 @@ export default function Editor() { useEffect(() => { document.title = "Editor | drawDB"; - const loadLatestDiagram = () => { + const loadLatestDiagram = async () => { db.diagrams .orderBy("lastModified") .last() @@ -595,7 +595,7 @@ export default function Editor() { }); }; - const loadDiagram = (id) => { + const loadDiagram = async (id) => { db.diagrams .get(id) .then((diagram) => { @@ -625,7 +625,7 @@ export default function Editor() { }); }; - const loadTemplate = (id) => { + const loadTemplate = async (id) => { db.templates .get(id) .then((diagram) => { diff --git a/src/pages/Survey.jsx b/src/pages/Survey.jsx index 31080e6..1eab49f 100644 --- a/src/pages/Survey.jsx +++ b/src/pages/Survey.jsx @@ -236,6 +236,8 @@ function SurveyForm({ theme }) { export default function Survey() { const [theme, setTheme] = useState(""); + useEffect(() => window.scroll(0, 0)); + useEffect(() => { const t = localStorage.getItem("theme"); setTheme(t); @@ -271,7 +273,7 @@ export default function Survey() { }; return ( - <> +
@@ -329,6 +331,6 @@ export default function Survey() {
© 2024 drawDB - All right reserved.
- +
); }