
diff --git a/src/pages/shortcuts.jsx b/src/pages/shortcuts.jsx
new file mode 100644
index 0000000..1590693
--- /dev/null
+++ b/src/pages/shortcuts.jsx
@@ -0,0 +1,185 @@
+import React, { useEffect, useState } from "react";
+import logo_light from "../assets/logo_light_46.png";
+import logo_dark from "../assets/logo_dark_46.png";
+import { AutoComplete, Button } from "@douyinfe/semi-ui";
+import { IconSearch, IconSun, IconMoon } from "@douyinfe/semi-icons";
+
+const shortcuts = [
+ { shortcut: "CTRL+C", title: "Copy selected element", description: "" },
+ { shortcut: "CTRL+V", title: "Paste selected element", description: "" },
+ { shortcut: "CTRL+X", title: "Cut selected element", description: "" },
+ { shortcut: "CTRL+D", title: "Duplicate selected element", description: "" },
+ { shortcut: "DEL", title: "Delete selected element", description: "" },
+ { shortcut: "CTRL+E", title: "Edit selected element", description: "" },
+ {
+ shortcut: "CTRL+I",
+ title: "Import a diagram",
+ description: "Import a diagram by uploadng a valid json or dbb file.",
+ },
+ { shortcut: "CTRL+Z", title: "Undo" },
+ { shortcut: "CTRL+Y", title: "Redo" },
+ {
+ shortcut: "CTRL+SHIFT+M",
+ title: "Enable/disable strict mode",
+ description:
+ "Disabling strict mode entails that the diagram will not undergo error or inconsistency checks.",
+ },
+ {
+ shortcut: "CTRL+SHIFT+F",
+ title: "Enable/disable field summaries",
+ description:
+ "Disabling field summaries will prevent the display of details for each field in the table when hovered over.",
+ },
+ { shortcut: "CTRL+SHIFT+G", title: "Show/hide grid" },
+ {
+ shortcut: "CTRL+ALT+C",
+ title: "Copy as image",
+ description: "Save the canvas as an image to the clipboard.",
+ },
+ {
+ shortcut: "CTRL+R",
+ title: "Reset view",
+ description: "Resetting view will set diagram pan to (0, 0).",
+ },
+ { shortcut: "CTRL+UP / Wheel up", title: "Zoom in" },
+ { shortcut: "CTRL+DOWN / Wheel down", title: "Zoom out" },
+ { shortcut: "CTRL+H", title: "Open 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(() => {
+ const t = localStorage.getItem("theme");
+ setTheme(t);
+ if (t === "dark") {
+ const body = document.body;
+ if (body.hasAttribute("theme-mode")) {
+ body.setAttribute("theme-mode", "dark");
+ }
+ } else {
+ const body = document.body;
+ if (body.hasAttribute("theme-mode")) {
+ body.setAttribute("theme-mode", "light");
+ }
+ }
+ 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 (
+ <>
+
+
+

+
+ Keyboard shortcuts
+
+
+
+
+ ) : (
+
+ )
+ }
+ theme="borderless"
+ onClick={changeTheme}
+ >
+
+
}
+ placeholder="Search..."
+ data={filteredResult}
+ value={value}
+ onSearch={(v) => handleStringSearch(v)}
+ emptyContent={
+
No shortcuts found
+ }
+ onChange={(v) => setValue(v)}
+ onSelect={(v) => {}}
+ >
+
+
+
+
+
+
}
+ placeholder="Search..."
+ className="w-[80%]"
+ data={filteredResult}
+ value={value}
+ onSearch={(v) => handleStringSearch(v)}
+ emptyContent={
+
No shortcuts found
+ }
+ onChange={(v) => setValue(v)}
+ onSelect={(v) => {}}
+ >
+
+
+ {shortcuts.map((s, i) => (
+
+
+
{s.shortcut}
+
{s.title}
+
+ {s.description && (
+ <>
+
+
{s.description}
+ >
+ )}
+
+ ))}
+
+ >
+ );
+}
diff --git a/tailwind.config.js b/tailwind.config.js
index c0958ec..cc7f1e1 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -4,7 +4,15 @@ module.exports = {
"./src/**/*.{js,jsx,ts,tsx}",
],
theme: {
- extend: {},
+ screens: {
+ '3xl': {'max': '2047px'},
+ '2xl': {'max': '1535px'},
+ 'xl': {'max': '1279px'},
+ 'lg': {'max': '1023px'},
+ 'md': {'max': '767px'},
+ 'sm': {'max': '639px'}
+ },
+ extend: {}
},
plugins: [],
}