Skip to content

Commit 1e6aeca

Browse files
authored
Add documentation links (#343)
1 parent 4ac039f commit 1e6aeca

File tree

10 files changed

+55
-172
lines changed

10 files changed

+55
-172
lines changed

public/robots.txt

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
User-agent: *
33
Allow: /
44
Allow: /editor
5-
Allow: /shortcuts
65
Allow: /templates
76
Disallow: /bug-report
87
Disallow: /survey

src/App.jsx

-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useLayoutEffect } from "react";
33
import Editor from "./pages/Editor";
44
import Survey from "./pages/Survey";
55
import BugReport from "./pages/BugReport";
6-
import Shortcuts from "./pages/Shortcuts";
76
import Templates from "./pages/Templates";
87
import LandingPage from "./pages/LandingPage";
98
import SettingsContextProvider from "./context/SettingsContext";
@@ -33,14 +32,6 @@ export default function App() {
3332
</ThemedPage>
3433
}
3534
/>
36-
<Route
37-
path="/shortcuts"
38-
element={
39-
<ThemedPage>
40-
<Shortcuts />
41-
</ThemedPage>
42-
}
43-
/>
4435
<Route
4536
path="/bug-report"
4637
element={

src/components/EditorHeader/ControlPanel.jsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ import { jsonToMermaid } from "../../utils/exportAs/mermaid";
7373
import { isRtl } from "../../i18n/utils/rtl";
7474
import { jsonToDocumentation } from "../../utils/exportAs/documentation";
7575
import { IdContext } from "../Workspace";
76+
import { socials } from "../../data/socials";
7677

7778
export default function ControlPanel({
7879
diagramId,
@@ -1341,12 +1342,15 @@ export default function ControlPanel({
13411342
},
13421343
},
13431344
help: {
1344-
shortcuts: {
1345-
function: () => window.open("/shortcuts", "_blank"),
1345+
docs: {
1346+
function: () => window.open(`${socials.docs}`, "_blank"),
13461347
shortcut: "Ctrl+H",
13471348
},
1349+
shortcuts: {
1350+
function: () => window.open(`${socials.docs}/shortcuts`, "_blank"),
1351+
},
13481352
ask_on_discord: {
1349-
function: () => window.open("https://discord.gg/BrjZgNrmR6", "_blank"),
1353+
function: () => window.open(socials.discord, "_blank"),
13501354
},
13511355
report_bug: {
13521356
function: () => window.open("/bug-report", "_blank"),
@@ -1382,7 +1386,7 @@ export default function ControlPanel({
13821386
});
13831387
useHotkeys("ctrl+alt+c, meta+alt+c", copyAsImage, { preventDefault: true });
13841388
useHotkeys("ctrl+r, meta+r", resetView, { preventDefault: true });
1385-
useHotkeys("ctrl+h, meta+h", () => window.open("/shortcuts", "_blank"), {
1389+
useHotkeys("ctrl+h, meta+h", () => window.open(socials.docs, "_blank"), {
13861390
preventDefault: true,
13871391
});
13881392
useHotkeys("ctrl+alt+w, meta+alt+w", fitWindow, { preventDefault: true });

src/components/Navbar.jsx

+16-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Link } from "react-router-dom";
33
import logo from "../assets/logo_light_160.png";
44
import { SideSheet } from "@douyinfe/semi-ui";
55
import { IconMenu } from "@douyinfe/semi-icons";
6+
import { socials } from "../data/socials";
67

78
export default function Navbar() {
89
const [openMenu, setOpenMenu] = useState(false);
@@ -37,12 +38,18 @@ export default function Navbar() {
3738
>
3839
Templates
3940
</Link>
41+
<Link
42+
to={socials.docs}
43+
className="text-lg font-semibold hover:text-sky-800 transition-colors duration-300"
44+
>
45+
Docs
46+
</Link>
4047
</div>
4148
<div className="md:hidden block space-x-3 ms-12">
4249
<a
4350
title="Jump to Github"
4451
className="px-2 py-2 hover:opacity-60 transition-all duration-300 rounded-full text-2xl"
45-
href="https://github.com/drawdb-io/drawdb"
52+
href={socials.github}
4653
target="_blank"
4754
rel="noreferrer"
4855
>
@@ -51,7 +58,7 @@ export default function Navbar() {
5158
<a
5259
title="Follow us on X"
5360
className="px-2 py-2 hover:opacity-60 transition-all duration-300 rounded-full text-2xl"
54-
href="https://x.com/drawDB_"
61+
href={socials.twitter}
5562
target="_blank"
5663
rel="noreferrer"
5764
>
@@ -60,7 +67,7 @@ export default function Navbar() {
6067
<a
6168
title="Join the community on Discord"
6269
className="px-2 py-2 hover:opacity-60 transition-all duration-300 rounded-full text-2xl"
63-
href="https://discord.gg/BrjZgNrmR6"
70+
href={socials.discord}
6471
target="_blank"
6572
rel="noreferrer"
6673
>
@@ -110,6 +117,12 @@ export default function Navbar() {
110117
Templates
111118
</Link>
112119
<hr />
120+
<Link
121+
to={socials.docs}
122+
className="hover:bg-zinc-100 block p-3 text-base font-semibold"
123+
>
124+
Docs
125+
</Link>
113126
</SideSheet>
114127
</>
115128
);

src/data/socials.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const socials = {
2+
docs: "https://drawdb-io.github.io/docs",
3+
discord: "https://discord.gg/BrjZgNrmR6",
4+
twitter: "https://x.com/drawDB_",
5+
github: "https://github.com/drawdb-io/drawdb",
6+
};

src/i18n/locales/en.js

+1
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ const en = {
244244
share_info:
245245
"* Sharing this link will not create a live real-time collaboration session.",
246246
show_relationship_labels: "Show relationship labels",
247+
docs: "Docs",
247248
},
248249
};
249250

src/pages/BugReport.jsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { $generateHtmlFromNodes } from "@lexical/html";
1616
import { CLEAR_EDITOR_COMMAND } from "lexical";
1717
import axios from "axios";
1818
import { Link } from "react-router-dom";
19+
import { socials } from "../data/socials";
1920

2021
function Form({ theme }) {
2122
const [editor] = useLexicalComposerContext();
@@ -247,10 +248,7 @@ export default function BugReport() {
247248
icon={<IconGithubLogo />}
248249
style={{ backgroundColor: "#239144", color: "white" }}
249250
onClick={() => {
250-
window.open(
251-
"https://github.com/drawdb-io/drawdb/issues",
252-
"_self",
253-
);
251+
window.open(`${socials.github}/issues`, "_self");
254252
}}
255253
>
256254
Add an issue

src/pages/LandingPage.jsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import FadeIn from "../animations/FadeIn";
1616
import axios from "axios";
1717
import { languages } from "../i18n/i18n";
1818
import { Tweet } from "react-tweet";
19+
import { socials } from "../data/socials";
1920

2021
function shortenNumber(number) {
2122
if (number < 1000) return number;
@@ -255,7 +256,7 @@ export default function LandingPage() {
255256
<div className="md:block md:space-y-3 flex gap-3 justify-center">
256257
<a
257258
className="inline-block"
258-
href="https://github.com/drawdb-io/drawdb"
259+
href={socials.github}
259260
target="_blank"
260261
rel="noreferrer"
261262
>
@@ -268,7 +269,7 @@ export default function LandingPage() {
268269
</a>
269270
<a
270271
className="inline-block"
271-
href="https://discord.gg/BrjZgNrmR6"
272+
href={socials.discord}
272273
target="_blank"
273274
rel="noreferrer"
274275
>
@@ -281,7 +282,7 @@ export default function LandingPage() {
281282
</a>
282283
<a
283284
className="inline-block"
284-
href="https://x.com/drawdb_"
285+
href={socials.twitter}
285286
target="_blank"
286287
rel="noreferrer"
287288
>
@@ -363,7 +364,10 @@ const features = [
363364
content: (
364365
<div>
365366
Speed up development with keyboard shortuts. See all available shortcuts
366-
<Link to="/shortcuts" className="ms-1.5 text-blue-500 hover:underline">
367+
<Link
368+
to={`${socials.docs}/shortcuts`}
369+
className="ms-1.5 text-blue-500 hover:underline"
370+
>
367371
here
368372
</Link>
369373
.

src/pages/NotFound.jsx

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1+
import { socials } from "../data/socials";
2+
13
export default function NotFound() {
24
return (
35
<div className="p-3 space-y-2">
46
<p>hey there!</p>
57

68
<p>looking for something you couldn&apos;t find?</p>
79
<p>
10+
check out the{" "}
11+
<a className="text-blue-600" href={socials.docs}>
12+
docs
13+
</a>
14+
,{" "}
815
<a className="text-blue-600" href="mailto:[email protected]">
916
shoot us an email
1017
</a>{" "}
1118
or{" "}
12-
<a
13-
className="text-blue-600"
14-
href="https://discord.gg/BrjZgNrmR6"
15-
>
19+
<a className="text-blue-600" href={socials.discord}>
1620
a message on discord
1721
</a>
1822
</p>
@@ -21,6 +25,12 @@ export default function NotFound() {
2125
* to create a relationship hold the blue dot of a field and drag it
2226
towards the field you want to connect it to
2327
</p>
28+
<a
29+
className="text-blue-600"
30+
href={`${socials.docs}/create-diagram#relationships`}
31+
>
32+
see here
33+
</a>
2434
</div>
2535
);
2636
}

src/pages/Shortcuts.jsx

-143
This file was deleted.

0 commit comments

Comments
 (0)