mirror of
https://github.com/drawdb-io/drawdb
synced 2024-11-21 06:49:20 +00:00
Add robots.txt
This commit is contained in:
parent
c5cdcba459
commit
1576b3fb96
8
public/robots.txt
Normal file
8
public/robots.txt
Normal file
@ -0,0 +1,8 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Allow: /
|
||||
Allow: /editor
|
||||
Allow: /shortcuts
|
||||
Allow: /templates
|
||||
Disallow: /bug-report
|
||||
Disallow: /survey
|
66
src/App.jsx
66
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 (
|
||||
<SettingsContextProvider>
|
||||
<BrowserRouter>
|
||||
@ -72,7 +41,7 @@ function App() {
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/bug_report"
|
||||
path="/bug-report"
|
||||
element={
|
||||
<ThemedPage>
|
||||
<BugReport />
|
||||
@ -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;
|
||||
}
|
||||
|
@ -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"),
|
||||
|
@ -216,7 +216,7 @@ export default function LandingPage() {
|
||||
<i className="bi bi-arrow-right"></i>
|
||||
</Link>
|
||||
<Link
|
||||
to="/bug_report"
|
||||
to="/bug-report"
|
||||
className="sm:mt-2 w-full flex items-center gap-2 font-semibold justify-center bg-white shadow-lg px-9 py-2 rounded border border-zinc-200 hover:bg-zinc-100 transition-all duration-300"
|
||||
>
|
||||
<div>Report a bug</div>
|
||||
|
Loading…
Reference in New Issue
Block a user