@nextsparkjs/core 0.1.0-beta.117 → 0.1.0-beta.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/devtools/DevtoolsSidebar.d.ts +4 -1
- package/dist/components/devtools/DevtoolsSidebar.d.ts.map +1 -1
- package/dist/components/devtools/DevtoolsSidebar.js +2 -2
- package/dist/components/superadmin/layouts/SuperadminSidebar.d.ts +4 -1
- package/dist/components/superadmin/layouts/SuperadminSidebar.d.ts.map +1 -1
- package/dist/components/superadmin/layouts/SuperadminSidebar.js +55 -2
- package/dist/components/ui/timezone-select.js +21 -21
- package/dist/lib/entities/schema-generator.d.ts.map +1 -1
- package/dist/lib/entities/schema-generator.js +4 -4
- package/dist/styles/classes.json +1 -1
- package/dist/templates/app/devtools/layout.tsx +3 -1
- package/dist/templates/app/superadmin/layout.tsx +3 -1
- package/dist/templates/app/superadmin/plugins/[plugin]/page.tsx +17 -0
- package/package.json +2 -2
- package/scripts/build/registry/generators/plugin-registry.mjs +12 -3
- package/templates/app/devtools/layout.tsx +3 -1
- package/templates/app/superadmin/layout.tsx +3 -1
- package/templates/app/superadmin/plugins/[plugin]/page.tsx +17 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PluginNavItem } from "../../types/plugin";
|
|
1
2
|
/**
|
|
2
3
|
* DevTools Sidebar Component
|
|
3
4
|
*
|
|
@@ -5,5 +6,7 @@
|
|
|
5
6
|
* Reads plugin navigation items from @nextsparkjs/registries automatically.
|
|
6
7
|
* Includes collapsible functionality and purple/violet branding.
|
|
7
8
|
*/
|
|
8
|
-
export declare function DevtoolsSidebar(
|
|
9
|
+
export declare function DevtoolsSidebar({ pluginItems: pluginItemsProp }?: {
|
|
10
|
+
pluginItems?: PluginNavItem[];
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
12
|
//# sourceMappingURL=DevtoolsSidebar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevtoolsSidebar.d.ts","sourceRoot":"","sources":["../../../src/components/devtools/DevtoolsSidebar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DevtoolsSidebar.d.ts","sourceRoot":"","sources":["../../../src/components/devtools/DevtoolsSidebar.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAcxD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAAE,WAAW,EAAE,eAAe,EAAE,GAAE;IAAE,WAAW,CAAC,EAAE,aAAa,EAAE,CAAA;CAAO,2CAqRvG"}
|
|
@@ -39,12 +39,12 @@ const PLUGIN_ICON_MAP = {
|
|
|
39
39
|
GitBranch,
|
|
40
40
|
Tag
|
|
41
41
|
};
|
|
42
|
-
function DevtoolsSidebar() {
|
|
42
|
+
function DevtoolsSidebar({ pluginItems: pluginItemsProp } = {}) {
|
|
43
43
|
const pathname = usePathname();
|
|
44
44
|
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
45
45
|
const t = useTranslations("devtools");
|
|
46
46
|
const tCommon = useTranslations("common");
|
|
47
|
-
const pluginItems = getPluginNavItems("devtools");
|
|
47
|
+
const pluginItems = pluginItemsProp ?? getPluginNavItems("devtools");
|
|
48
48
|
const sidebarItems = [
|
|
49
49
|
{
|
|
50
50
|
titleKey: "nav.home",
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { PluginNavItem } from "../../../types/plugin";
|
|
1
2
|
/**
|
|
2
3
|
* Superadmin Sidebar Component
|
|
3
4
|
*
|
|
4
5
|
* Specialized sidebar for super admin navigation within Superadmin Panel.
|
|
5
6
|
* Includes collapsible functionality and clear visual hierarchy.
|
|
6
7
|
*/
|
|
7
|
-
export declare function SuperadminSidebar(
|
|
8
|
+
export declare function SuperadminSidebar({ pluginItems: pluginItemsProp }?: {
|
|
9
|
+
pluginItems?: PluginNavItem[];
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
11
|
//# sourceMappingURL=SuperadminSidebar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperadminSidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/superadmin/layouts/SuperadminSidebar.tsx"],"names":[],"mappings":"AA+BA;;;;;GAKG;AACH,wBAAgB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"SuperadminSidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/superadmin/layouts/SuperadminSidebar.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAe3D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,WAAW,EAAE,eAAe,EAAE,GAAE;IAAE,WAAW,CAAC,EAAE,aAAa,EAAE,CAAA;CAAO,2CAgPzG"}
|
|
@@ -13,15 +13,38 @@ import {
|
|
|
13
13
|
ChevronLeft,
|
|
14
14
|
ChevronRight,
|
|
15
15
|
CreditCard,
|
|
16
|
-
FileText
|
|
16
|
+
FileText,
|
|
17
|
+
Puzzle,
|
|
18
|
+
Star,
|
|
19
|
+
Bell,
|
|
20
|
+
Globe,
|
|
21
|
+
Layers,
|
|
22
|
+
GitBranch,
|
|
23
|
+
LayoutGrid,
|
|
24
|
+
Tag,
|
|
25
|
+
Code
|
|
17
26
|
} from "lucide-react";
|
|
18
27
|
import { cn } from "../../../lib/utils/index.js";
|
|
19
28
|
import { Button } from "../../ui/button.js";
|
|
20
29
|
import { sel } from "../../../lib/test/index.js";
|
|
21
30
|
import { useState } from "react";
|
|
22
|
-
|
|
31
|
+
import { getPluginNavItems } from "@nextsparkjs/registries/plugin-registry.client";
|
|
32
|
+
const PLUGIN_ICON_MAP = {
|
|
33
|
+
Puzzle,
|
|
34
|
+
Settings,
|
|
35
|
+
Star,
|
|
36
|
+
Code,
|
|
37
|
+
LayoutGrid,
|
|
38
|
+
Bell,
|
|
39
|
+
Globe,
|
|
40
|
+
Layers,
|
|
41
|
+
GitBranch,
|
|
42
|
+
Tag
|
|
43
|
+
};
|
|
44
|
+
function SuperadminSidebar({ pluginItems: pluginItemsProp } = {}) {
|
|
23
45
|
const pathname = usePathname();
|
|
24
46
|
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
47
|
+
const pluginItems = pluginItemsProp ?? getPluginNavItems("superadmin");
|
|
25
48
|
const sidebarItems = [
|
|
26
49
|
{
|
|
27
50
|
title: "Dashboard",
|
|
@@ -155,6 +178,36 @@ function SuperadminSidebar() {
|
|
|
155
178
|
item.title
|
|
156
179
|
);
|
|
157
180
|
}) }),
|
|
181
|
+
pluginItems.length > 0 && /* @__PURE__ */ jsxs("div", { className: "px-3 pb-2 space-y-1", children: [
|
|
182
|
+
!isCollapsed && /* @__PURE__ */ jsx("p", { className: "px-3 py-1 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Plugins" }),
|
|
183
|
+
isCollapsed && /* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
184
|
+
pluginItems.map((item) => {
|
|
185
|
+
const IconComponent = PLUGIN_ICON_MAP[item.icon ?? ""] ?? Puzzle;
|
|
186
|
+
const isActive = pathname === item.href || pathname.startsWith(item.href + "/");
|
|
187
|
+
return /* @__PURE__ */ jsxs(
|
|
188
|
+
Link,
|
|
189
|
+
{
|
|
190
|
+
href: item.href,
|
|
191
|
+
"data-cy": `superadmin-plugin-nav-${item.href.split("/").pop()}`,
|
|
192
|
+
className: cn(
|
|
193
|
+
"flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",
|
|
194
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
195
|
+
isActive ? "bg-primary text-primary-foreground" : "text-foreground",
|
|
196
|
+
isCollapsed && "justify-center"
|
|
197
|
+
),
|
|
198
|
+
title: isCollapsed ? item.label : item.description,
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ jsx(IconComponent, { className: "h-5 w-5 flex-shrink-0" }),
|
|
201
|
+
!isCollapsed && /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
202
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: item.label }),
|
|
203
|
+
item.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: item.description })
|
|
204
|
+
] })
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
item.href
|
|
208
|
+
);
|
|
209
|
+
})
|
|
210
|
+
] }),
|
|
158
211
|
/* @__PURE__ */ jsxs("div", { className: "p-3 border-t border-border", children: [
|
|
159
212
|
/* @__PURE__ */ jsxs(
|
|
160
213
|
Link,
|
|
@@ -4,35 +4,35 @@ import { Globe } from "lucide-react";
|
|
|
4
4
|
import { Combobox } from "./combobox.js";
|
|
5
5
|
import { cn } from "../../lib/utils/index.js";
|
|
6
6
|
const timezones = [
|
|
7
|
-
{ value: "
|
|
8
|
-
{ value: "
|
|
9
|
-
{ value: "
|
|
10
|
-
{ value: "America/Chicago", label: "Chicago (GMT-6)", description: "Central Standard Time" },
|
|
11
|
-
{ value: "America/Denver", label: "Denver (GMT-7)", description: "Mountain Standard Time" },
|
|
12
|
-
{ value: "America/Mexico_City", label: "Mexico City (GMT-6)", description: "Central Standard Time" },
|
|
13
|
-
{ value: "America/Lima", label: "Lima (GMT-5)", description: "Peru Time" },
|
|
14
|
-
{ value: "America/Bogota", label: "Bogot\xE1 (GMT-5)", description: "Colombia Time" },
|
|
15
|
-
{ value: "America/Santiago", label: "Santiago (GMT-4)", description: "Chile Standard Time" },
|
|
16
|
-
{ value: "America/Caracas", label: "Caracas (GMT-4)", description: "Venezuela Time" },
|
|
17
|
-
{ value: "America/Sao_Paulo", label: "S\xE3o Paulo (GMT-3)", description: "Brasilia Time" },
|
|
18
|
-
{ value: "Europe/London", label: "London (GMT+0)", description: "Greenwich Mean Time" },
|
|
19
|
-
{ value: "Europe/Madrid", label: "Madrid (GMT+1)", description: "Central European Time" },
|
|
20
|
-
{ value: "Europe/Paris", label: "Paris (GMT+1)", description: "Central European Time" },
|
|
21
|
-
{ value: "Europe/Berlin", label: "Berlin (GMT+1)", description: "Central European Time" },
|
|
22
|
-
{ value: "Europe/Rome", label: "Rome (GMT+1)", description: "Central European Time" },
|
|
23
|
-
{ value: "Europe/Moscow", label: "Moscow (GMT+3)", description: "Moscow Standard Time" },
|
|
7
|
+
{ value: "Pacific/Auckland", label: "Auckland (GMT+12)", description: "New Zealand Standard Time" },
|
|
8
|
+
{ value: "Australia/Sydney", label: "Sydney (GMT+10)", description: "Australian Eastern Standard Time" },
|
|
9
|
+
{ value: "Australia/Melbourne", label: "Melbourne (GMT+10)", description: "Australian Eastern Standard Time" },
|
|
24
10
|
{ value: "Asia/Tokyo", label: "Tokyo (GMT+9)", description: "Japan Standard Time" },
|
|
25
11
|
{ value: "Asia/Shanghai", label: "Shanghai (GMT+8)", description: "China Standard Time" },
|
|
26
12
|
{ value: "Asia/Hong_Kong", label: "Hong Kong (GMT+8)", description: "Hong Kong Time" },
|
|
27
13
|
{ value: "Asia/Singapore", label: "Singapore (GMT+8)", description: "Singapore Standard Time" },
|
|
28
14
|
{ value: "Asia/Mumbai", label: "Mumbai (GMT+5:30)", description: "India Standard Time" },
|
|
29
15
|
{ value: "Asia/Dubai", label: "Dubai (GMT+4)", description: "Gulf Standard Time" },
|
|
30
|
-
{ value: "
|
|
31
|
-
{ value: "Australia/Melbourne", label: "Melbourne (GMT+10)", description: "Australian Eastern Standard Time" },
|
|
32
|
-
{ value: "Pacific/Auckland", label: "Auckland (GMT+12)", description: "New Zealand Standard Time" },
|
|
16
|
+
{ value: "Europe/Moscow", label: "Moscow (GMT+3)", description: "Moscow Standard Time" },
|
|
33
17
|
{ value: "Africa/Cairo", label: "Cairo (GMT+2)", description: "Eastern European Time" },
|
|
34
18
|
{ value: "Africa/Johannesburg", label: "Johannesburg (GMT+2)", description: "South Africa Standard Time" },
|
|
35
|
-
{ value: "
|
|
19
|
+
{ value: "Europe/Berlin", label: "Berlin (GMT+1)", description: "Central European Time" },
|
|
20
|
+
{ value: "Europe/Madrid", label: "Madrid (GMT+1)", description: "Central European Time" },
|
|
21
|
+
{ value: "Europe/Paris", label: "Paris (GMT+1)", description: "Central European Time" },
|
|
22
|
+
{ value: "Europe/Rome", label: "Rome (GMT+1)", description: "Central European Time" },
|
|
23
|
+
{ value: "UTC", label: "UTC (GMT+0)", description: "Coordinated Universal Time" },
|
|
24
|
+
{ value: "Europe/London", label: "London (GMT+0)", description: "Greenwich Mean Time" },
|
|
25
|
+
{ value: "America/Argentina/Buenos_Aires", label: "Buenos Aires (GMT-3)", description: "Argentina Standard Time" },
|
|
26
|
+
{ value: "America/Sao_Paulo", label: "S\xE3o Paulo (GMT-3)", description: "Brasilia Time" },
|
|
27
|
+
{ value: "America/Caracas", label: "Caracas (GMT-4)", description: "Venezuela Time" },
|
|
28
|
+
{ value: "America/Santiago", label: "Santiago (GMT-4)", description: "Chile Standard Time" },
|
|
29
|
+
{ value: "America/Bogota", label: "Bogot\xE1 (GMT-5)", description: "Colombia Time" },
|
|
30
|
+
{ value: "America/Lima", label: "Lima (GMT-5)", description: "Peru Time" },
|
|
31
|
+
{ value: "America/New_York", label: "New York (GMT-5)", description: "Eastern Standard Time" },
|
|
32
|
+
{ value: "America/Chicago", label: "Chicago (GMT-6)", description: "Central Standard Time" },
|
|
33
|
+
{ value: "America/Mexico_City", label: "Mexico City (GMT-6)", description: "Central Standard Time" },
|
|
34
|
+
{ value: "America/Denver", label: "Denver (GMT-7)", description: "Mountain Standard Time" },
|
|
35
|
+
{ value: "America/Los_Angeles", label: "Los Angeles (GMT-8)", description: "Pacific Standard Time" }
|
|
36
36
|
];
|
|
37
37
|
function TimezoneSelect({
|
|
38
38
|
value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-generator.d.ts","sourceRoot":"","sources":["../../../src/lib/entities/schema-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CA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AAC,MAAM,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAE1E;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GACrC;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAuCpE"}
|
|
@@ -106,7 +106,7 @@ function generateFieldSchema(field, customValidation, strict = true) {
|
|
|
106
106
|
});
|
|
107
107
|
return z.NEVER;
|
|
108
108
|
}
|
|
109
|
-
return null;
|
|
109
|
+
return field.defaultValue !== void 0 ? String(field.defaultValue) : null;
|
|
110
110
|
}
|
|
111
111
|
const strVal = typeof val === "number" ? String(val) : val;
|
|
112
112
|
return strict ? strVal.trim() : strVal;
|
|
@@ -673,12 +673,12 @@ function generateFieldSchema(field, customValidation, strict = true) {
|
|
|
673
673
|
console.warn(`Unknown field type: ${field.type} for field ${field.name}`);
|
|
674
674
|
schema = z.unknown();
|
|
675
675
|
}
|
|
676
|
-
if (field.defaultValue !== void 0) {
|
|
677
|
-
schema = schema.default(field.defaultValue);
|
|
678
|
-
}
|
|
679
676
|
if (!field.required) {
|
|
680
677
|
schema = schema.optional();
|
|
681
678
|
}
|
|
679
|
+
if (field.defaultValue !== void 0) {
|
|
680
|
+
schema = schema.default(field.defaultValue);
|
|
681
|
+
}
|
|
682
682
|
return schema;
|
|
683
683
|
}
|
|
684
684
|
function generateChildrenSchema(childEntities, strict) {
|
package/dist/styles/classes.json
CHANGED
|
@@ -2,6 +2,7 @@ import { DeveloperGuard } from "@nextsparkjs/core/components/app/guards/Develope
|
|
|
2
2
|
import { DevtoolsSidebar, DevtoolsMobileHeader } from "@nextsparkjs/core/components/devtools";
|
|
3
3
|
import { Metadata } from "next";
|
|
4
4
|
import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/core/lib/template-resolver'
|
|
5
|
+
import { getPluginNavItems } from '@nextsparkjs/registries/plugin-registry'
|
|
5
6
|
|
|
6
7
|
const defaultMetadata: Metadata = {
|
|
7
8
|
title: "DevTools",
|
|
@@ -27,12 +28,13 @@ interface DevLayoutProps {
|
|
|
27
28
|
* Uses purple/violet color scheme to differentiate from Admin Panel (red).
|
|
28
29
|
*/
|
|
29
30
|
function DevLayout({ children }: DevLayoutProps) {
|
|
31
|
+
const pluginNavItems = getPluginNavItems('devtools')
|
|
30
32
|
return (
|
|
31
33
|
<DeveloperGuard>
|
|
32
34
|
<div className="flex h-screen bg-background">
|
|
33
35
|
{/* Sidebar - Hidden on mobile, visible on desktop */}
|
|
34
36
|
<div className="hidden lg:block">
|
|
35
|
-
<DevtoolsSidebar />
|
|
37
|
+
<DevtoolsSidebar pluginItems={pluginNavItems} />
|
|
36
38
|
</div>
|
|
37
39
|
|
|
38
40
|
{/* Main content area */}
|
|
@@ -2,6 +2,7 @@ import { SuperAdminGuard } from "@nextsparkjs/core/components/app/guards/SuperAd
|
|
|
2
2
|
import { SuperadminSidebar } from "@nextsparkjs/core/components/superadmin/layouts/SuperadminSidebar";
|
|
3
3
|
import { Metadata } from "next";
|
|
4
4
|
import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/core/lib/template-resolver'
|
|
5
|
+
import { getPluginNavItems } from '@nextsparkjs/registries/plugin-registry'
|
|
5
6
|
|
|
6
7
|
const defaultMetadata: Metadata = {
|
|
7
8
|
title: "Super Admin | Super Admin Panel",
|
|
@@ -26,12 +27,13 @@ interface SuperadminLayoutProps {
|
|
|
26
27
|
* Includes responsive design for mobile and desktop.
|
|
27
28
|
*/
|
|
28
29
|
function SuperadminLayout({ children }: SuperadminLayoutProps) {
|
|
30
|
+
const pluginNavItems = getPluginNavItems('superadmin')
|
|
29
31
|
return (
|
|
30
32
|
<SuperAdminGuard>
|
|
31
33
|
<div className="flex h-screen bg-background" data-cy="superadmin-container">
|
|
32
34
|
{/* Sidebar - Hidden on mobile, visible on desktop */}
|
|
33
35
|
<div className="hidden lg:block">
|
|
34
|
-
<SuperadminSidebar />
|
|
36
|
+
<SuperadminSidebar pluginItems={pluginNavItems} />
|
|
35
37
|
</div>
|
|
36
38
|
|
|
37
39
|
{/* Main content area */}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { notFound } from 'next/navigation'
|
|
2
|
+
import { PLUGIN_SUPERADMIN_PAGES } from '@/.nextspark/registries/plugin-registry'
|
|
3
|
+
|
|
4
|
+
interface PluginPageProps {
|
|
5
|
+
params: Promise<{ plugin: string }>
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default async function PluginSuperadminPage({ params }: PluginPageProps) {
|
|
9
|
+
const { plugin } = await params
|
|
10
|
+
const PageComponent = PLUGIN_SUPERADMIN_PAGES[plugin]
|
|
11
|
+
|
|
12
|
+
if (!PageComponent) {
|
|
13
|
+
notFound()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return <PageComponent />
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextsparkjs/core",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.118",
|
|
4
4
|
"description": "NextSpark - The complete SaaS framework for Next.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "NextSpark <hello@nextspark.dev>",
|
|
@@ -454,7 +454,7 @@
|
|
|
454
454
|
"tailwind-merge": "^3.3.1",
|
|
455
455
|
"uuid": "^13.0.0",
|
|
456
456
|
"zod": "^4.1.5",
|
|
457
|
-
"@nextsparkjs/testing": "0.1.0-beta.
|
|
457
|
+
"@nextsparkjs/testing": "0.1.0-beta.118"
|
|
458
458
|
},
|
|
459
459
|
"scripts": {
|
|
460
460
|
"postinstall": "node scripts/postinstall.mjs || true",
|
|
@@ -27,7 +27,7 @@ export function generatePluginRegistry(plugins, config) {
|
|
|
27
27
|
const pagesServerImports = plugins
|
|
28
28
|
.filter(p => p.hasPagesServer)
|
|
29
29
|
.map(plugin =>
|
|
30
|
-
`import { devtoolsPage as ${plugin.name.replace(/-/g, '_')}DevtoolsPage } from '@/contents/plugins/${plugin.name}/plugin.pages.server'`
|
|
30
|
+
`import { devtoolsPage as ${plugin.name.replace(/-/g, '_')}DevtoolsPage, superadminPage as ${plugin.name.replace(/-/g, '_')}SuperadminPage } from '@/contents/plugins/${plugin.name}/plugin.pages.server'`
|
|
31
31
|
)
|
|
32
32
|
.join('\n')
|
|
33
33
|
|
|
@@ -153,6 +153,15 @@ export const PLUGIN_DEVTOOLS_PAGES: Record<string, any> = {
|
|
|
153
153
|
${plugins.filter(p => p.hasPagesServer).map(p => ` '${p.name}': ${p.name.replace(/-/g, '_')}DevtoolsPage,`).join('\n')}
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
// Maps plugin names to their superadmin page components.
|
|
157
|
+
// Used by app/superadmin/plugins/[plugin]/page.tsx to render plugin settings pages.
|
|
158
|
+
// Export 'superadminPage' from plugin.pages.server.ts to contribute a superadmin page.
|
|
159
|
+
|
|
160
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
161
|
+
export const PLUGIN_SUPERADMIN_PAGES: Record<string, any> = {
|
|
162
|
+
${plugins.filter(p => p.hasPagesServer).map(p => ` '${p.name}': ${p.name.replace(/-/g, '_')}SuperadminPage,`).join('\n')}
|
|
163
|
+
}
|
|
164
|
+
|
|
156
165
|
// ==================== Navigation Helpers ====================
|
|
157
166
|
/**
|
|
158
167
|
* Returns all nav items for a given area from all registered plugins.
|
|
@@ -218,8 +227,8 @@ export function generatePluginRegistryClient(plugins, config) {
|
|
|
218
227
|
settings: ${JSON.stringify(plugin.settings || [], null, 4).replace(/^/gm, ' ')},
|
|
219
228
|
hasMessages: ${plugin.hasMessages || false},
|
|
220
229
|
hasAssets: ${plugin.hasAssets || false},
|
|
221
|
-
navigation
|
|
222
|
-
}`
|
|
230
|
+
get navigation() { return ${plugin.exportName}?.navigation },
|
|
231
|
+
} as ClientPluginConfig`
|
|
223
232
|
}).join(',\n')
|
|
224
233
|
|
|
225
234
|
return `/**
|
|
@@ -2,6 +2,7 @@ import { DeveloperGuard } from "@nextsparkjs/core/components/app/guards/Develope
|
|
|
2
2
|
import { DevtoolsSidebar, DevtoolsMobileHeader } from "@nextsparkjs/core/components/devtools";
|
|
3
3
|
import { Metadata } from "next";
|
|
4
4
|
import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/core/lib/template-resolver'
|
|
5
|
+
import { getPluginNavItems } from '@nextsparkjs/registries/plugin-registry'
|
|
5
6
|
|
|
6
7
|
const defaultMetadata: Metadata = {
|
|
7
8
|
title: "DevTools",
|
|
@@ -27,12 +28,13 @@ interface DevLayoutProps {
|
|
|
27
28
|
* Uses purple/violet color scheme to differentiate from Admin Panel (red).
|
|
28
29
|
*/
|
|
29
30
|
function DevLayout({ children }: DevLayoutProps) {
|
|
31
|
+
const pluginNavItems = getPluginNavItems('devtools')
|
|
30
32
|
return (
|
|
31
33
|
<DeveloperGuard>
|
|
32
34
|
<div className="flex h-screen bg-background">
|
|
33
35
|
{/* Sidebar - Hidden on mobile, visible on desktop */}
|
|
34
36
|
<div className="hidden lg:block">
|
|
35
|
-
<DevtoolsSidebar />
|
|
37
|
+
<DevtoolsSidebar pluginItems={pluginNavItems} />
|
|
36
38
|
</div>
|
|
37
39
|
|
|
38
40
|
{/* Main content area */}
|
|
@@ -2,6 +2,7 @@ import { SuperAdminGuard } from "@nextsparkjs/core/components/app/guards/SuperAd
|
|
|
2
2
|
import { SuperadminSidebar } from "@nextsparkjs/core/components/superadmin/layouts/SuperadminSidebar";
|
|
3
3
|
import { Metadata } from "next";
|
|
4
4
|
import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/core/lib/template-resolver'
|
|
5
|
+
import { getPluginNavItems } from '@nextsparkjs/registries/plugin-registry'
|
|
5
6
|
|
|
6
7
|
const defaultMetadata: Metadata = {
|
|
7
8
|
title: "Super Admin | Super Admin Panel",
|
|
@@ -26,12 +27,13 @@ interface SuperadminLayoutProps {
|
|
|
26
27
|
* Includes responsive design for mobile and desktop.
|
|
27
28
|
*/
|
|
28
29
|
function SuperadminLayout({ children }: SuperadminLayoutProps) {
|
|
30
|
+
const pluginNavItems = getPluginNavItems('superadmin')
|
|
29
31
|
return (
|
|
30
32
|
<SuperAdminGuard>
|
|
31
33
|
<div className="flex h-screen bg-background" data-cy="superadmin-container">
|
|
32
34
|
{/* Sidebar - Hidden on mobile, visible on desktop */}
|
|
33
35
|
<div className="hidden lg:block">
|
|
34
|
-
<SuperadminSidebar />
|
|
36
|
+
<SuperadminSidebar pluginItems={pluginNavItems} />
|
|
35
37
|
</div>
|
|
36
38
|
|
|
37
39
|
{/* Main content area */}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { notFound } from 'next/navigation'
|
|
2
|
+
import { PLUGIN_SUPERADMIN_PAGES } from '@/.nextspark/registries/plugin-registry'
|
|
3
|
+
|
|
4
|
+
interface PluginPageProps {
|
|
5
|
+
params: Promise<{ plugin: string }>
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default async function PluginSuperadminPage({ params }: PluginPageProps) {
|
|
9
|
+
const { plugin } = await params
|
|
10
|
+
const PageComponent = PLUGIN_SUPERADMIN_PAGES[plugin]
|
|
11
|
+
|
|
12
|
+
if (!PageComponent) {
|
|
13
|
+
notFound()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return <PageComponent />
|
|
17
|
+
}
|