diff --git a/dashboard/package-lock.json b/dashboard/package-lock.json index d6ca904..95650f4 100644 --- a/dashboard/package-lock.json +++ b/dashboard/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@hugeicons/core-free-icons": "^4.1.4", "@hugeicons/react": "^1.1.6", + "@monaco-editor/react": "^4.7.0", "@radix-ui/react-avatar": "^1.1.11", "@radix-ui/react-checkbox": "^1.3.3", "@radix-ui/react-dialog": "^1.1.15", @@ -91,6 +92,7 @@ "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", @@ -883,6 +885,29 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@monaco-editor/loader": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@monaco-editor/loader/-/loader-1.7.0.tgz", + "integrity": "sha512-gIwR1HrJrrx+vfyOhYmCZ0/JcWqG5kbfG7+d3f/C1LXk2EvzAbHSg3MQ5lO2sMlo9izoAZ04shohfKLVT6crVA==", + "license": "MIT", + "dependencies": { + "state-local": "^1.0.6" + } + }, + "node_modules/@monaco-editor/react": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@monaco-editor/react/-/react-4.7.0.tgz", + "integrity": "sha512-cyzXQCtO47ydzxpQtCGSQGOC8Gk3ZUeBXFAxD+CWXYFo5OqZyZUonFl0DwUlTyAfRHntBfw2p3w4s9R6oe1eCA==", + "license": "MIT", + "dependencies": { + "@monaco-editor/loader": "^1.5.0" + }, + "peerDependencies": { + "monaco-editor": ">= 0.25.0 < 1", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -2888,9 +2913,6 @@ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2905,9 +2927,6 @@ "arm" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2922,9 +2941,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2939,9 +2955,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2956,9 +2969,6 @@ "loong64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2973,9 +2983,6 @@ "loong64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2990,9 +2997,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3007,9 +3011,6 @@ "ppc64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3024,9 +3025,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3041,9 +3039,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3058,9 +3053,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3075,9 +3067,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3092,9 +3081,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3243,6 +3229,7 @@ "integrity": "sha512-TCFSk8IZh+iLX1xtksoBVtdmgL+1IX0fC9BeU4QqFSuNdN/K+HUlhqOzEmSYYpZUVsLYcPqc9KX+60iDuninSQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "undici-types": ">=7.24.0 <7.24.7" } @@ -3251,8 +3238,9 @@ "version": "19.2.14", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", - "dev": true, + "devOptional": true, "license": "MIT", + "peer": true, "dependencies": { "csstype": "^3.2.2" } @@ -3261,12 +3249,20 @@ "version": "19.2.3", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", - "dev": true, + "devOptional": true, "license": "MIT", + "peer": true, "peerDependencies": { "@types/react": "^19.2.0" } }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "license": "MIT", + "optional": true + }, "node_modules/@vitejs/plugin-react": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", @@ -3428,6 +3424,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.10.12", "caniuse-lite": "^1.0.30001782", @@ -3589,7 +3586,7 @@ "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/debug": { @@ -3628,6 +3625,15 @@ "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", "license": "MIT" }, + "node_modules/dompurify": { + "version": "3.4.8", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.8.tgz", + "integrity": "sha512-yb1cEmaOum7wFvOCSQxyfgVlv5D47Rc30iZWoMpbDIWTnJ6grDDQyu2KFJzB2k7u0pMuJcQ1zphH//fFnw2tjQ==", + "license": "(MPL-2.0 OR Apache-2.0)", + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } + }, "node_modules/electron-to-chromium": { "version": "1.5.357", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.357.tgz", @@ -3981,6 +3987,18 @@ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, + "node_modules/marked": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-14.0.0.tgz", + "integrity": "sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ==", + "license": "MIT", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -4015,6 +4033,17 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/monaco-editor": { + "version": "0.56.0", + "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.56.0.tgz", + "integrity": "sha512-sXboRm3BeBeLm938eaiyLMe0OxzfXIlZvbv4ir/jVgQy1zDhWjgmny0WoN45fuDKhCCQsYMbBJrv/A6jd8aCUg==", + "license": "MIT", + "peer": true, + "dependencies": { + "dompurify": "3.4.8", + "marked": "14.0.0" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -4101,6 +4130,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -4145,6 +4175,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -4300,6 +4331,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.2.6.tgz", "integrity": "sha512-sfWGGfavi0xr8Pg0sVsyHMAOziVYKgPLNrS7ig+ivMNb3wbCBw3KxtflsGBAwD3gYQlE/AEZsTLgToRrSCjb0Q==", "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -4319,6 +4351,7 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.6.tgz", "integrity": "sha512-0prMI+hvBbPjsWnxDLxlCGyM8PN6UuWjEUCYmZhO67xIV9Xasa/r/vDnq+Xyq4Lo27g8QSbO5YzARu0D1Sps3g==", "license": "MIT", + "peer": true, "dependencies": { "scheduler": "^0.27.0" }, @@ -4616,6 +4649,12 @@ "node": ">=0.10.0" } }, + "node_modules/state-local": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/state-local/-/state-local-1.0.7.tgz", + "integrity": "sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w==", + "license": "MIT" + }, "node_modules/sucrase": { "version": "3.35.1", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", @@ -4665,6 +4704,7 @@ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.17.tgz", "integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==", "license": "MIT", + "peer": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", @@ -4882,6 +4922,7 @@ "integrity": "sha512-2N/55r4JDJ4gdrCvGgINMy+HH3iRpNIz8K6SFwVsA+JbQScLiC+clmAxBgwiSPgcG9U15QmvqCGWzMbqda5zGQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", diff --git a/dashboard/package.json b/dashboard/package.json index 61f872b..3f7f50b 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -11,6 +11,7 @@ "dependencies": { "@hugeicons/core-free-icons": "^4.1.4", "@hugeicons/react": "^1.1.6", + "@monaco-editor/react": "^4.7.0", "@radix-ui/react-avatar": "^1.1.11", "@radix-ui/react-checkbox": "^1.3.3", "@radix-ui/react-dialog": "^1.1.15", diff --git a/dashboard/public/logo.png b/dashboard/public/logo.png new file mode 100644 index 0000000..6dc0620 Binary files /dev/null and b/dashboard/public/logo.png differ diff --git a/dashboard/src/components/app-sidebar.tsx b/dashboard/src/components/app-sidebar.tsx index 74ea8c3..c3f1ff2 100644 --- a/dashboard/src/components/app-sidebar.tsx +++ b/dashboard/src/components/app-sidebar.tsx @@ -54,56 +54,41 @@ const mainNav: { permission?: string; }[] = [ { title: "Dashboard", url: "/", icon: DashboardSquare02Icon, end: true, permission: "overview" }, - { title: "Logs", url: "/logs", icon: ComputerTerminal01Icon, permission: "logs" }, - { title: "Settings", url: "/settings", icon: Settings02Icon, permission: "settings.view" }, - { title: "Addons", url: "/addons", icon: PackageIcon, permission: "settings.view" }, - { title: "Users", url: "/users", icon: UserMultiple02Icon, permission: "users.view" }, ]; const sections: { label: string; - items: { title: string; url: string; icon: IconSvgElement }[]; + items: { title: string; url: string; icon: IconSvgElement; permission?: string }[]; }[] = [ { - label: "Tickets & support", + label: "Configuration", items: [ - { - title: "Ticket system", - url: "/configs?file=ticket-panel", - icon: Ticket01Icon, - }, - { - title: "Bot config", - url: "/configs?file=supportbot", - icon: BotIcon, - }, - { title: "Transcripts", url: "/transcripts", icon: File02Icon }, + { title: "Bot Settings", url: "/configs?file=supportbot", icon: BotIcon }, + { title: "Commands", url: "/configs?file=commands", icon: CommandIcon }, + { title: "Messages", url: "/configs?file=messages", icon: Message01Icon }, ], }, { - label: "Community", + label: "Features", items: [ - { - title: "Messages", - url: "/configs?file=messages", - icon: Message01Icon, - }, - { - title: "AI assistant", - url: "/configs?file=supportbot-ai", - icon: AiBrain01Icon, - }, + { title: "Ticket System", url: "/configs?file=ticket-panel", icon: Ticket01Icon }, + { title: "AI Assistant", url: "/configs?file=supportbot-ai", icon: AiBrain01Icon }, + { title: "Transcripts", url: "/transcripts", icon: File02Icon, permission: "transcripts" }, ], }, { - label: "Server control", + label: "Management", items: [ - { title: "commands.yml", url: "/configs?file=commands", icon: CommandIcon }, - { - title: "Staff roles", - url: "/configs?file=supportbot", - icon: UserMultiple02Icon, - }, + { title: "Users", url: "/users", icon: UserMultiple02Icon, permission: "users.view" }, + { title: "Staff Roles", url: "/configs?file=supportbot", icon: UserMultiple02Icon }, + { title: "Console Logs", url: "/logs", icon: ComputerTerminal01Icon, permission: "logs" }, + ], + }, + { + label: "System", + items: [ + { title: "Addon Manager", url: "/addons", icon: PackageIcon, permission: "settings.view" }, + { title: "Dashboard Settings", url: "/settings", icon: Settings02Icon, permission: "settings.view" }, ], }, ]; @@ -140,16 +125,13 @@ export function AppSidebar() { .map((section) => ({ ...section, items: section.items.filter((item) => { + if (item.permission) { + return hasPermission(permissions, item.permission); + } const file = configFileFromUrl(item.url); if (file && item.url.includes("/configs")) { return canViewConfig(permissions, file); } - if (item.url === "/transcripts") { - return hasPermission(permissions, "transcripts"); - } - if (item.url === "/commands") { - return canViewConfig(permissions, "commands"); - } return true; }), })) @@ -236,7 +218,7 @@ export function AppSidebar() { {section.items.map((item) => { const file = configFileFromUrl(item.url); - const isActive = + const isConfigActive = Boolean(file) && activeFile === file && item.url.includes("/configs"); @@ -245,8 +227,8 @@ export function AppSidebar() { cn( + (isActive || isConfigActive) && "bg-sidebar-accent font-medium", )} > diff --git a/dashboard/src/components/config/config-visual-editor.tsx b/dashboard/src/components/config/config-visual-editor.tsx index 8c0fb35..b8eaf41 100644 --- a/dashboard/src/components/config/config-visual-editor.tsx +++ b/dashboard/src/components/config/config-visual-editor.tsx @@ -18,6 +18,7 @@ import { mergeSchemaWithData } from "@/lib/merge-config-schema"; import { useAuth } from "@/context/AuthContext"; import { notifyConfigSave } from "@/lib/notify-config-save"; import { Textarea } from "@/components/ui/textarea"; +import Editor from "@monaco-editor/react"; import { ConfigFieldInput } from "./config-field"; import { CommandsEditor } from "./commands-editor"; @@ -295,13 +296,22 @@ export function ConfigVisualEditor({ configFile }: ConfigVisualEditorProps) { or any option not in Visual mode. - -