diff --git a/public/robots.txt b/public/robots.txt index f09f128..5ebe41e 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -2,7 +2,6 @@ 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 65aebc6..3867171 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -3,7 +3,6 @@ import { useLayoutEffect } from "react"; 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 LandingPage from "./pages/LandingPage"; import SettingsContextProvider from "./context/SettingsContext"; @@ -33,14 +32,6 @@ export default function App() { } /> - - - - } - /> window.open("/shortcuts", "_blank"), + docs: { + function: () => window.open(`${socials.docs}`, "_blank"), shortcut: "Ctrl+H", }, + shortcuts: { + function: () => window.open(`${socials.docs}/shortcuts`, "_blank"), + }, ask_on_discord: { - function: () => window.open("https://discord.gg/BrjZgNrmR6", "_blank"), + function: () => window.open(socials.discord, "_blank"), }, report_bug: { function: () => window.open("/bug-report", "_blank"), @@ -1382,7 +1386,7 @@ export default function ControlPanel({ }); useHotkeys("ctrl+alt+c, meta+alt+c", copyAsImage, { preventDefault: true }); useHotkeys("ctrl+r, meta+r", resetView, { preventDefault: true }); - useHotkeys("ctrl+h, meta+h", () => window.open("/shortcuts", "_blank"), { + useHotkeys("ctrl+h, meta+h", () => window.open(socials.docs, "_blank"), { preventDefault: true, }); useHotkeys("ctrl+alt+w, meta+alt+w", fitWindow, { preventDefault: true }); diff --git a/src/components/Navbar.jsx b/src/components/Navbar.jsx index 6aae11f..8ef775d 100644 --- a/src/components/Navbar.jsx +++ b/src/components/Navbar.jsx @@ -3,6 +3,7 @@ import { Link } from "react-router-dom"; import logo from "../assets/logo_light_160.png"; import { SideSheet } from "@douyinfe/semi-ui"; import { IconMenu } from "@douyinfe/semi-icons"; +import { socials } from "../data/socials"; export default function Navbar() { const [openMenu, setOpenMenu] = useState(false); @@ -37,12 +38,18 @@ export default function Navbar() { > Templates + + Docs +
@@ -51,7 +58,7 @@ export default function Navbar() { @@ -60,7 +67,7 @@ export default function Navbar() { @@ -110,6 +117,12 @@ export default function Navbar() { Templates
+ + Docs + ); diff --git a/src/data/socials.js b/src/data/socials.js new file mode 100644 index 0000000..5eafc35 --- /dev/null +++ b/src/data/socials.js @@ -0,0 +1,6 @@ +export const socials = { + docs: "https://drawdb-io.github.io/docs", + discord: "https://discord.gg/BrjZgNrmR6", + twitter: "https://x.com/drawDB_", + github: "https://github.com/drawdb-io/drawdb", +}; diff --git a/src/i18n/locales/en.js b/src/i18n/locales/en.js index 81c903a..77fdbac 100644 --- a/src/i18n/locales/en.js +++ b/src/i18n/locales/en.js @@ -244,6 +244,7 @@ const en = { share_info: "* Sharing this link will not create a live real-time collaboration session.", show_relationship_labels: "Show relationship labels", + docs: "Docs", }, }; diff --git a/src/pages/BugReport.jsx b/src/pages/BugReport.jsx index 8d401e3..5c0c6fd 100644 --- a/src/pages/BugReport.jsx +++ b/src/pages/BugReport.jsx @@ -16,6 +16,7 @@ import { $generateHtmlFromNodes } from "@lexical/html"; import { CLEAR_EDITOR_COMMAND } from "lexical"; import axios from "axios"; import { Link } from "react-router-dom"; +import { socials } from "../data/socials"; function Form({ theme }) { const [editor] = useLexicalComposerContext(); @@ -247,10 +248,7 @@ export default function BugReport() { icon={} style={{ backgroundColor: "#239144", color: "white" }} onClick={() => { - window.open( - "https://github.com/drawdb-io/drawdb/issues", - "_self", - ); + window.open(`${socials.github}/issues`, "_self"); }} > Add an issue diff --git a/src/pages/LandingPage.jsx b/src/pages/LandingPage.jsx index 9936d02..958793f 100644 --- a/src/pages/LandingPage.jsx +++ b/src/pages/LandingPage.jsx @@ -16,6 +16,7 @@ import FadeIn from "../animations/FadeIn"; import axios from "axios"; import { languages } from "../i18n/i18n"; import { Tweet } from "react-tweet"; +import { socials } from "../data/socials"; function shortenNumber(number) { if (number < 1000) return number; @@ -255,7 +256,7 @@ export default function LandingPage() {
@@ -268,7 +269,7 @@ export default function LandingPage() { @@ -281,7 +282,7 @@ export default function LandingPage() { @@ -363,7 +364,10 @@ const features = [ content: (
Speed up development with keyboard shortuts. See all available shortcuts - + here . diff --git a/src/pages/NotFound.jsx b/src/pages/NotFound.jsx index d6e6c4d..53f199e 100644 --- a/src/pages/NotFound.jsx +++ b/src/pages/NotFound.jsx @@ -1,3 +1,5 @@ +import { socials } from "../data/socials"; + export default function NotFound() { return (
@@ -5,14 +7,16 @@ export default function NotFound() {

looking for something you couldn't find?

+ check out the{" "} + + docs + + ,{" "} shoot us an email {" "} or{" "} - + a message on discord

@@ -21,6 +25,12 @@ export default function NotFound() { * to create a relationship hold the blue dot of a field and drag it towards the field you want to connect it to

+ + see here +
); } diff --git a/src/pages/Shortcuts.jsx b/src/pages/Shortcuts.jsx deleted file mode 100644 index 7dd93a7..0000000 --- a/src/pages/Shortcuts.jsx +++ /dev/null @@ -1,143 +0,0 @@ -import { useEffect, useState } from "react"; -import logo_light from "../assets/logo_light_160.png"; -import logo_dark from "../assets/logo_dark_160.png"; -import { AutoComplete, Button } from "@douyinfe/semi-ui"; -import { IconSearch, IconSun, IconMoon } from "@douyinfe/semi-icons"; -import { Link } from "react-router-dom"; -import { shortcuts } from "../data/shortcuts"; - -export default function Shortcuts() { - const [theme, setTheme] = useState(""); - const [value, setValue] = useState(""); - const [filteredResult, setFilteredResult] = useState( - shortcuts.map((t) => { - return t.shortcut; - }) - ); - - const handleStringSearch = (value) => { - setFilteredResult( - shortcuts - .filter( - (i) => - i.shortcut.toLowerCase().includes(value.toLowerCase()) || - i.title.toLowerCase().includes(value.toLowerCase()) - ) - .map((i) => i.shortcut) - ); - }; - - useEffect(() => { - setTheme(localStorage.getItem("theme")); - document.title = "Shortcuts | drawDB"; - document.body.setAttribute("class", "theme"); - }, [setTheme]); - - const changeTheme = () => { - const body = document.body; - const t = body.getAttribute("theme-mode"); - if (t === "dark") { - if (body.hasAttribute("theme-mode")) { - body.setAttribute("theme-mode", "light"); - setTheme("light"); - } - } else { - if (body.hasAttribute("theme-mode")) { - body.setAttribute("theme-mode", "dark"); - setTheme("dark"); - } - } - }; - - return ( - <> -
-
- - logo - -
- Keyboard shortcuts -
-
-
-
-
-
-
- } - placeholder="Search..." - className="w-[80%]" - data={filteredResult} - value={value} - onSearch={(v) => handleStringSearch(v)} - emptyContent={ -
No shortcuts found
- } - onChange={(v) => setValue(v)} - onSelect={() => {}} - >
-
-
- {shortcuts.map((s, i) => ( -
-
-
{s.shortcut}
-
{s.title}
-
- {s.description && ( - <> -
-
{s.description}
- - )} -
- ))} -
-
-
- © 2024 drawDB - All right reserved. -
- - ); -}