Dashboard 1.0
This commit is contained in:
1 parent
51ffafeeda
commit
24ccc179a6
12 files changed
+384
-206
No files matched your search
Generated
+83
-42
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
@@ -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() {
|
||||
<SidebarMenu>
|
||||
{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() {
|
||||
<SidebarMenuButton asChild tooltip={item.title}>
|
||||
<NavLink
|
||||
to={item.url}
|
||||
className={cn(
|
||||
isActive && "bg-sidebar-accent font-medium",
|
||||
className={({ isActive }) => cn(
|
||||
(isActive || isConfigActive) && "bg-sidebar-accent font-medium",
|
||||
)}
|
||||
>
|
||||
<Icon icon={item.icon} size={18} />
|
||||
|
||||
@@ -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.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Textarea
|
||||
<CardContent className="h-[min(520px,60vh)] overflow-hidden rounded-b-xl border-t border-border p-0">
|
||||
<Editor
|
||||
height="100%"
|
||||
language="yaml"
|
||||
theme="vs-dark"
|
||||
value={rawYaml}
|
||||
disabled={readOnly}
|
||||
onChange={(e) => setRawYaml(e.target.value)}
|
||||
className="min-h-[min(520px,60vh)] font-mono text-xs leading-relaxed"
|
||||
spellCheck={false}
|
||||
onChange={(value) => setRawYaml(value || "")}
|
||||
options={{
|
||||
readOnly: readOnly,
|
||||
minimap: { enabled: false },
|
||||
fontSize: 13,
|
||||
wordWrap: "on",
|
||||
scrollBeyondLastLine: false,
|
||||
padding: { top: 16 },
|
||||
tabSize: 2,
|
||||
}}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -107,85 +107,15 @@ export default function Configs() {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 lg:grid-cols-[220px_1fr]">
|
||||
<Card className="h-fit border-border bg-card">
|
||||
<CardHeader className="pb-2">
|
||||
<CardTitle className="text-sm font-medium text-muted-foreground">
|
||||
Configuration files
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="p-0">
|
||||
<ScrollArea className="h-[min(400px,50vh)]">
|
||||
<ul className="space-y-3 p-2">
|
||||
{allowedMainFiles.length > 0 ? (
|
||||
<li>
|
||||
<p className="px-3 pb-1 text-[10px] font-semibold uppercase tracking-widest text-muted-foreground/80">
|
||||
Core
|
||||
</p>
|
||||
<ul className="space-y-0.5">
|
||||
{allowedMainFiles.map((file) => (
|
||||
<li key={file}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => selectFile(file)}
|
||||
className={cn(
|
||||
"w-full rounded-lg px-3 py-2.5 text-left text-sm transition-colors",
|
||||
file === active
|
||||
? "bg-primary/15 font-medium text-primary"
|
||||
: "text-muted-foreground hover:bg-secondary hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
{file}.yml
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</li>
|
||||
) : null}
|
||||
|
||||
{allowedAddonFiles.length > 0 ? (
|
||||
<li>
|
||||
<p className="px-3 pb-1 text-[10px] font-semibold uppercase tracking-widest text-muted-foreground/80">
|
||||
Addons
|
||||
</p>
|
||||
<ul className="space-y-0.5">
|
||||
{allowedAddonFiles.map((file) => {
|
||||
const key = addonConfigFileParam(file);
|
||||
return (
|
||||
<li key={file}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => selectFile(key)}
|
||||
className={cn(
|
||||
"w-full rounded-lg px-3 py-2.5 text-left text-sm transition-colors",
|
||||
key === active
|
||||
? "bg-primary/15 font-medium text-primary"
|
||||
: "text-muted-foreground hover:bg-secondary hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
{file}
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</li>
|
||||
) : null}
|
||||
</ul>
|
||||
</ScrollArea>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<div className="min-w-0">
|
||||
{isAddonActive && activeAddonFilename ? (
|
||||
<AddonConfigEditor
|
||||
key={activeAddonFilename}
|
||||
filename={activeAddonFilename}
|
||||
/>
|
||||
) : (
|
||||
<ConfigVisualEditor key={active} configFile={active} />
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-6">
|
||||
{isAddonActive && activeAddonFilename ? (
|
||||
<AddonConfigEditor
|
||||
key={activeAddonFilename}
|
||||
filename={activeAddonFilename}
|
||||
/>
|
||||
) : (
|
||||
<ConfigVisualEditor key={active} configFile={active} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { useMemo } from "react";
|
||||
import { BotIcon } from "@hugeicons/core-free-icons";
|
||||
import { Navigate, useSearchParams } from "react-router-dom";
|
||||
import { Icon } from "@/components/icon";
|
||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
@@ -42,48 +40,53 @@ export default function Login() {
|
||||
if (!loading && isAuthenticated) return <Navigate to="/" replace />;
|
||||
|
||||
return (
|
||||
<div className="flex min-h-svh items-center justify-center bg-background p-4">
|
||||
<Card className="w-full max-w-md border-border bg-card">
|
||||
<CardHeader className="space-y-4">
|
||||
<div className="flex items-center gap-3">
|
||||
{branding.hasFavicon && branding.faviconUrl ? (
|
||||
<img
|
||||
src={`${branding.faviconUrl}${branding.updatedAt ? `?v=${branding.updatedAt}` : ""}`}
|
||||
alt=""
|
||||
className="size-11 rounded-xl object-contain"
|
||||
/>
|
||||
) : (
|
||||
<div className="flex size-11 items-center justify-center rounded-xl bg-primary text-primary-foreground">
|
||||
<Icon icon={BotIcon} size={22} />
|
||||
</div>
|
||||
)}
|
||||
<div>
|
||||
<CardTitle className="text-xl">{branding.title}</CardTitle>
|
||||
<CardDescription>Sign in to your dashboard</CardDescription>
|
||||
</div>
|
||||
<div className="relative flex min-h-svh items-center justify-center bg-[#0c0c10] p-4 overflow-hidden">
|
||||
<Card className="relative z-10 w-full max-w-md overflow-hidden rounded-3xl border border-white/10 bg-card/30 p-2 shadow-2xl backdrop-blur-2xl">
|
||||
<div className="absolute inset-0 bg-gradient-to-br from-white/5 to-transparent pointer-events-none"></div>
|
||||
<CardHeader className="space-y-6 pt-10 pb-4 text-center">
|
||||
<div className="mx-auto flex size-28 items-center justify-center overflow-hidden rounded-3xl bg-white/5 p-4 shadow-inner ring-1 ring-white/10 transition-transform duration-500 hover:scale-105">
|
||||
<img
|
||||
src="/logo.png"
|
||||
alt="SupportBot Logo"
|
||||
className="h-full w-full object-contain drop-shadow-xl"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<CardTitle className="bg-gradient-to-br from-white to-white/50 bg-clip-text text-3xl font-extrabold tracking-tight text-transparent">
|
||||
{branding.title || "SupportBot"}
|
||||
</CardTitle>
|
||||
<CardDescription className="mt-2 text-base font-medium text-white/50">
|
||||
Sign in to your dashboard
|
||||
</CardDescription>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Sign in with Discord. Your application credentials and allowed user
|
||||
IDs are configured in{" "}
|
||||
<code className="rounded-md bg-secondary px-1.5 py-0.5 text-xs text-foreground">
|
||||
Configs/api.yml
|
||||
</code>
|
||||
.
|
||||
</p>
|
||||
<CardContent className="space-y-6 pb-10">
|
||||
<div className="text-center space-y-1">
|
||||
<p className="text-sm font-medium text-white/50">
|
||||
Securely authenticate using your Discord account.
|
||||
</p>
|
||||
<p className="text-xs text-white/30">
|
||||
Credentials are configured in <code className="rounded bg-white/5 px-1 py-0.5 text-white/40">Configs/api.yml</code>
|
||||
</p>
|
||||
</div>
|
||||
{error ? (
|
||||
<Alert variant="destructive">
|
||||
<AlertDescription>{error}</AlertDescription>
|
||||
<Alert variant="destructive" className="border-red-500/50 bg-red-500/10 text-red-200 backdrop-blur-md">
|
||||
<AlertDescription className="font-medium">{error}</AlertDescription>
|
||||
</Alert>
|
||||
) : null}
|
||||
<Button
|
||||
type="button"
|
||||
className="w-full"
|
||||
className="group relative w-full overflow-hidden rounded-2xl bg-primary px-8 py-6 text-base font-bold text-primary-foreground shadow-[0_0_20px_rgba(var(--primary),0.3)] transition-all duration-300 hover:scale-[1.02] hover:shadow-[0_0_30px_rgba(var(--primary),0.5)] active:scale-95"
|
||||
disabled={loading}
|
||||
onClick={loginWithDiscord}
|
||||
>
|
||||
{loading ? "Checking session…" : "Continue with Discord"}
|
||||
<div className="absolute inset-0 translate-x-[-100%] bg-gradient-to-r from-transparent via-white/20 to-transparent transition-transform duration-1000 group-hover:translate-x-[100%]"></div>
|
||||
<span className="relative flex items-center justify-center gap-2">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 127.14 96.36" fill="currentColor">
|
||||
<path d="M107.7,8.07A105.15,105.15,0,0,0,81.47,0a72.06,72.06,0,0,0-3.36,6.83A97.68,97.68,0,0,0,49,6.83,72.37,72.37,0,0,0,45.64,0,105.89,105.89,0,0,0,19.39,8.09C2.79,32.65-1.71,56.6.54,80.21h0A105.73,105.73,0,0,0,32.71,96.36,77.7,77.7,0,0,0,39.6,85.25a68.42,68.42,0,0,1-10.85-5.18c.91-.66,1.8-1.34,2.66-2a75.57,75.57,0,0,0,64.32,0c.87.71,1.76,1.39,2.66,2a68.68,68.68,0,0,1-10.87,5.19,77,77,0,0,0,6.89,11.1,105.25,105.25,0,0,0,32.19-16.14c2.64-27.38-4.51-51.11-19.32-72.15ZM42.68,68.22c-5.28,0-9.66-4.9-9.66-10.89s4.29-10.89,9.66-10.89c5.41,0,9.75,4.9,9.66,10.89C52.34,63.32,48.09,68.22,42.68,68.22Zm41.76,0c-5.28,0-9.66-4.9-9.66-10.89s4.29-10.89,9.66-10.89c5.41,0,9.75,4.9,9.66,10.89C84.44,63.32,80.19,68.22,84.44,68.22Z"/>
|
||||
</svg>
|
||||
{loading ? "Authenticating..." : "Continue with Discord"}
|
||||
</span>
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -11,7 +11,7 @@ export default defineConfig({
|
||||
},
|
||||
base: "/",
|
||||
build: {
|
||||
outDir: path.resolve(__dirname, "../public/dashboard"),
|
||||
outDir: path.resolve(__dirname, "../../SupportBot/public/dashboard"),
|
||||
emptyOutDir: true,
|
||||
},
|
||||
server: {
|
||||
|
||||
Reference in new issue
Block a user