From 1576b3fb96a2d160e6a9c6883723a93296d0fc7f Mon Sep 17 00:00:00 2001 From: 1ilit Date: Sat, 6 Apr 2024 05:19:13 +0300 Subject: [PATCH] Add robots.txt --- public/robots.txt | 8 +++ src/App.jsx | 66 ++++++++++---------- src/components/EditorHeader/ControlPanel.jsx | 2 +- src/pages/LandingPage.jsx | 2 +- 4 files changed, 42 insertions(+), 36 deletions(-) create mode 100644 public/robots.txt diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..f09f128 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,8 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Allow: / +Allow: /editor +Allow: /shortcuts +Allow: /templates +Disallow: /bug-report +Disallow: /survey \ No newline at end of file diff --git a/src/App.jsx b/src/App.jsx index d972c1f..346cbb5 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -9,38 +9,7 @@ import LandingPage from "./pages/LandingPage"; import SettingsContextProvider from "./context/SettingsContext"; import useSettings from "./hooks/useSettings"; -function ThemedPage({ children }) { - const { setSettings } = useSettings(); - - useLayoutEffect(() => { - const theme = localStorage.getItem("theme"); - if (theme === "dark") { - setSettings((prev) => ({ ...prev, mode: "dark" })); - const body = document.body; - if (body.hasAttribute("theme-mode")) { - body.setAttribute("theme-mode", "dark"); - } - } else { - setSettings((prev) => ({ ...prev, mode: "light" })); - const body = document.body; - if (body.hasAttribute("theme-mode")) { - body.setAttribute("theme-mode", "light"); - } - } - }, [setSettings]); - - return children; -} - -function RestoreScroll() { - const location = useLocation(); - useEffect(() => { - window.scroll(0, 0); - }, [location.pathname]); - return null; -} - -function App() { +export default function App() { return ( @@ -72,7 +41,7 @@ function App() { } /> @@ -86,4 +55,33 @@ function App() { ); } -export default App; +function ThemedPage({ children }) { + const { setSettings } = useSettings(); + + useLayoutEffect(() => { + const theme = localStorage.getItem("theme"); + if (theme === "dark") { + setSettings((prev) => ({ ...prev, mode: "dark" })); + const body = document.body; + if (body.hasAttribute("theme-mode")) { + body.setAttribute("theme-mode", "dark"); + } + } else { + setSettings((prev) => ({ ...prev, mode: "light" })); + const body = document.body; + if (body.hasAttribute("theme-mode")) { + body.setAttribute("theme-mode", "light"); + } + } + }, [setSettings]); + + return children; +} + +function RestoreScroll() { + const location = useLocation(); + useEffect(() => { + window.scroll(0, 0); + }, [location.pathname]); + return null; +} diff --git a/src/components/EditorHeader/ControlPanel.jsx b/src/components/EditorHeader/ControlPanel.jsx index 7ab8388..e2f4b14 100644 --- a/src/components/EditorHeader/ControlPanel.jsx +++ b/src/components/EditorHeader/ControlPanel.jsx @@ -1214,7 +1214,7 @@ export default function ControlPanel({ function: () => window.open("https://discord.gg/8y7XUfcqR8", "_blank"), }, "Report a bug": { - function: () => window.open("/bug_report", "_blank"), + function: () => window.open("/bug-report", "_blank"), }, "Give feedback": { function: () => window.open("/survey", "_blank"), diff --git a/src/pages/LandingPage.jsx b/src/pages/LandingPage.jsx index 2097b47..4c59ef4 100644 --- a/src/pages/LandingPage.jsx +++ b/src/pages/LandingPage.jsx @@ -216,7 +216,7 @@ export default function LandingPage() {
Report a bug