@nextsparkjs/core 0.1.0-beta.27 → 0.1.0-beta.28
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/docs/docs-sidebar.d.ts +6 -0
- package/dist/components/docs/docs-sidebar.d.ts.map +1 -1
- package/dist/components/docs/docs-sidebar.js +86 -264
- package/dist/components/docs/index.d.ts +1 -0
- package/dist/components/docs/index.d.ts.map +1 -1
- package/dist/components/docs/index.js +3 -1
- package/dist/components/docs/superadmin-docs-sidebar.d.ts +7 -0
- package/dist/components/docs/superadmin-docs-sidebar.d.ts.map +1 -0
- package/dist/components/docs/superadmin-docs-sidebar.js +122 -0
- package/dist/components/superadmin/layouts/SuperadminSidebar.d.ts.map +1 -1
- package/dist/components/superadmin/layouts/SuperadminSidebar.js +9 -1
- package/dist/lib/config/types.d.ts +14 -19
- package/dist/lib/config/types.d.ts.map +1 -1
- package/dist/styles/classes.json +2 -3
- package/dist/styles/ui.css +1 -1
- package/dist/templates/contents/themes/starter/config/app.config.ts +14 -11
- package/dist/templates/contents/themes/starter/docs/superadmin/01-setup/01-configuration.md +31 -0
- package/dist/templates/contents/themes/starter/tests/cypress.config.ts +5 -5
- package/dist/templates/scripts/cy-tags.cjs +83 -0
- package/dist/types/docs.d.ts +11 -6
- package/dist/types/docs.d.ts.map +1 -1
- package/package.json +1 -1
- package/scripts/build/docs-registry.mjs +59 -135
- package/templates/contents/themes/starter/config/app.config.ts +14 -11
- package/templates/contents/themes/starter/docs/superadmin/01-setup/01-configuration.md +31 -0
- package/templates/contents/themes/starter/tests/cypress.config.ts +5 -5
- package/templates/scripts/cy-tags.cjs +83 -0
- /package/dist/templates/contents/themes/starter/docs/{01-overview → public/01-overview}/01-introduction.md +0 -0
- /package/dist/templates/contents/themes/starter/docs/{01-overview → public/01-overview}/02-customization.md +0 -0
- /package/templates/contents/themes/starter/docs/{01-overview → public/01-overview}/01-introduction.md +0 -0
- /package/templates/contents/themes/starter/docs/{01-overview → public/01-overview}/02-customization.md +0 -0
|
@@ -2,6 +2,12 @@ import type { DocSectionMeta } from '@nextsparkjs/registries/docs-registry';
|
|
|
2
2
|
interface DocsSidebarProps {
|
|
3
3
|
sections: DocSectionMeta[];
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* Simplified Docs Sidebar
|
|
7
|
+
*
|
|
8
|
+
* Only shows public documentation (no plugins, no categories).
|
|
9
|
+
* Structure: /docs/[section]/[page]
|
|
10
|
+
*/
|
|
5
11
|
export declare function DocsSidebar({ sections }: DocsSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
6
12
|
export {};
|
|
7
13
|
//# sourceMappingURL=docs-sidebar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/docs/docs-sidebar.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AAK3E,UAAU,gBAAgB;IACxB,QAAQ,EAAE,cAAc,EAAE,CAAA;CAC3B;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"docs-sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/docs/docs-sidebar.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AAK3E,UAAU,gBAAgB;IACxB,QAAQ,EAAE,cAAc,EAAE,CAAA;CAC3B;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAqMzD"}
|
|
@@ -3,56 +3,28 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import Link from "next/link";
|
|
4
4
|
import { usePathname } from "next/navigation";
|
|
5
5
|
import { cn } from "../../lib/utils";
|
|
6
|
-
import { ChevronRight, FileText, Folder, BookOpen,
|
|
6
|
+
import { ChevronRight, FileText, Folder, BookOpen, Search, X } from "lucide-react";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { useTranslations } from "next-intl";
|
|
9
9
|
import { Input } from "../ui/input";
|
|
10
10
|
import { THEME_REGISTRY } from "@nextsparkjs/registries/theme-registry";
|
|
11
11
|
function DocsSidebar({ sections }) {
|
|
12
|
-
var _a, _b
|
|
12
|
+
var _a, _b;
|
|
13
13
|
const pathname = usePathname();
|
|
14
14
|
const t = useTranslations("docs");
|
|
15
|
-
const
|
|
15
|
+
const getActiveSection = () => {
|
|
16
16
|
const parts = pathname.split("/").filter(Boolean);
|
|
17
|
-
if (parts[0]
|
|
18
|
-
return
|
|
17
|
+
if (parts[0] === "docs" && parts.length >= 2) {
|
|
18
|
+
return parts[1];
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
if (category === "plugins" && parts.length >= 5) {
|
|
22
|
-
return {
|
|
23
|
-
category: "plugins",
|
|
24
|
-
plugin: parts[2],
|
|
25
|
-
section: parts[3]
|
|
26
|
-
};
|
|
27
|
-
} else if (parts.length >= 4) {
|
|
28
|
-
return {
|
|
29
|
-
category,
|
|
30
|
-
section: parts[2],
|
|
31
|
-
plugin: null
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
return { category: null, section: null, plugin: null };
|
|
20
|
+
return null;
|
|
35
21
|
};
|
|
36
|
-
const
|
|
22
|
+
const activeSection = getActiveSection();
|
|
37
23
|
const activeTheme = process.env.NEXT_PUBLIC_ACTIVE_THEME || "default";
|
|
38
24
|
const themeAppConfig = (_a = THEME_REGISTRY[activeTheme]) == null ? void 0 : _a.appConfig;
|
|
39
|
-
const
|
|
40
|
-
const pluginsConfig = ((_c = themeAppConfig == null ? void 0 : themeAppConfig.docs) == null ? void 0 : _c.plugins) ?? { enabled: true, open: false, label: "Plugins" };
|
|
41
|
-
const coreConfig = ((_d = themeAppConfig == null ? void 0 : themeAppConfig.docs) == null ? void 0 : _d.core) ?? { enabled: true, open: false, label: "Core" };
|
|
25
|
+
const publicConfig = ((_b = themeAppConfig == null ? void 0 : themeAppConfig.docs) == null ? void 0 : _b.public) ?? { enabled: true, open: true, label: "Documentation" };
|
|
42
26
|
const [expandedSections, setExpandedSections] = useState(() => {
|
|
43
|
-
return
|
|
44
|
-
});
|
|
45
|
-
const [expandedCategories, setExpandedCategories] = useState(() => {
|
|
46
|
-
const expanded = /* @__PURE__ */ new Set();
|
|
47
|
-
if (activeElements.category) {
|
|
48
|
-
expanded.add(activeElements.category);
|
|
49
|
-
}
|
|
50
|
-
if (!activeElements.category) {
|
|
51
|
-
if (themeConfig.open) expanded.add("theme");
|
|
52
|
-
if (pluginsConfig.open) expanded.add("plugins");
|
|
53
|
-
if (coreConfig.open) expanded.add("core");
|
|
54
|
-
}
|
|
55
|
-
return expanded;
|
|
27
|
+
return activeSection ? /* @__PURE__ */ new Set([activeSection]) : /* @__PURE__ */ new Set();
|
|
56
28
|
});
|
|
57
29
|
const [searchQuery, setSearchQuery] = useState("");
|
|
58
30
|
const filterSections = (sections2) => {
|
|
@@ -81,210 +53,16 @@ function DocsSidebar({ sections }) {
|
|
|
81
53
|
}
|
|
82
54
|
setExpandedSections(newExpanded);
|
|
83
55
|
};
|
|
84
|
-
const toggleCategory = (category) => {
|
|
85
|
-
const newExpanded = new Set(expandedCategories);
|
|
86
|
-
if (newExpanded.has(category)) {
|
|
87
|
-
newExpanded.delete(category);
|
|
88
|
-
} else {
|
|
89
|
-
newExpanded.add(category);
|
|
90
|
-
}
|
|
91
|
-
setExpandedCategories(newExpanded);
|
|
92
|
-
};
|
|
93
56
|
const handleKeyDown = (e, slug) => {
|
|
94
57
|
if (e.key === "Enter" || e.key === " ") {
|
|
95
58
|
e.preventDefault();
|
|
96
59
|
toggleSection(slug);
|
|
97
60
|
}
|
|
98
61
|
};
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
const coreSections = filterSections(sections.filter((s) => s.source === "core"));
|
|
106
|
-
const themeSections = filterSections(sections.filter((s) => s.source === "theme"));
|
|
107
|
-
const pluginSections = filterSections(sections.filter((s) => s.source === "plugin"));
|
|
108
|
-
const isProduction = process.env.NODE_ENV === "production";
|
|
109
|
-
const showPluginsDocsInProd = ((_e = themeAppConfig == null ? void 0 : themeAppConfig.docs) == null ? void 0 : _e.showPluginsDocsInProd) ?? false;
|
|
110
|
-
const finalPluginsEnabled = pluginsConfig.enabled && (!isProduction || showPluginsDocsInProd);
|
|
111
|
-
const visibleCoreSections = coreConfig.enabled ? coreSections : [];
|
|
112
|
-
const visibleThemeSections = themeConfig.enabled ? themeSections : [];
|
|
113
|
-
const visiblePluginSections = finalPluginsEnabled ? pluginSections : [];
|
|
114
|
-
const pluginsByName = visiblePluginSections.reduce((acc, section) => {
|
|
115
|
-
if (!section.pluginName) return acc;
|
|
116
|
-
if (!acc[section.pluginName]) {
|
|
117
|
-
acc[section.pluginName] = [];
|
|
118
|
-
}
|
|
119
|
-
acc[section.pluginName].push(section);
|
|
120
|
-
return acc;
|
|
121
|
-
}, {});
|
|
122
|
-
const [expandedPlugins, setExpandedPlugins] = useState(() => {
|
|
123
|
-
return activeElements.plugin ? /* @__PURE__ */ new Set([activeElements.plugin]) : /* @__PURE__ */ new Set();
|
|
124
|
-
});
|
|
125
|
-
const togglePlugin = (pluginName) => {
|
|
126
|
-
const newExpanded = new Set(expandedPlugins);
|
|
127
|
-
if (newExpanded.has(pluginName)) {
|
|
128
|
-
newExpanded.delete(pluginName);
|
|
129
|
-
} else {
|
|
130
|
-
newExpanded.add(pluginName);
|
|
131
|
-
}
|
|
132
|
-
setExpandedPlugins(newExpanded);
|
|
133
|
-
};
|
|
134
|
-
const handlePluginKeyDown = (e, pluginName) => {
|
|
135
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
136
|
-
e.preventDefault();
|
|
137
|
-
togglePlugin(pluginName);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
const renderSections = (categorySections, category, pluginName) => {
|
|
141
|
-
return categorySections.map((section) => {
|
|
142
|
-
const isExpanded = searchQuery.trim() ? true : expandedSections.has(section.slug);
|
|
143
|
-
const isActive = activeElements.section === section.slug;
|
|
144
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
145
|
-
/* @__PURE__ */ jsxs(
|
|
146
|
-
"button",
|
|
147
|
-
{
|
|
148
|
-
onClick: () => toggleSection(section.slug),
|
|
149
|
-
onKeyDown: (e) => handleKeyDown(e, section.slug),
|
|
150
|
-
className: cn(
|
|
151
|
-
"flex items-center w-full text-left px-2 py-1.5 rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
152
|
-
isActive ? "bg-primary/10 text-primary font-semibold hover:bg-primary/15" : "hover:bg-accent"
|
|
153
|
-
),
|
|
154
|
-
"aria-expanded": isExpanded,
|
|
155
|
-
"aria-controls": `section-${section.slug}`,
|
|
156
|
-
"data-cy": `docs-section-toggle-${section.slug}`,
|
|
157
|
-
children: [
|
|
158
|
-
/* @__PURE__ */ jsx(
|
|
159
|
-
ChevronRight,
|
|
160
|
-
{
|
|
161
|
-
className: cn(
|
|
162
|
-
"h-4 w-4 mr-1 transition-transform",
|
|
163
|
-
isExpanded && "rotate-90"
|
|
164
|
-
),
|
|
165
|
-
"aria-hidden": "true"
|
|
166
|
-
}
|
|
167
|
-
),
|
|
168
|
-
/* @__PURE__ */ jsx(Folder, { className: cn(
|
|
169
|
-
"h-4 w-4 mr-2",
|
|
170
|
-
isActive && "text-primary"
|
|
171
|
-
), "aria-hidden": "true" }),
|
|
172
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium flex-1", children: section.title })
|
|
173
|
-
]
|
|
174
|
-
}
|
|
175
|
-
),
|
|
176
|
-
isExpanded && /* @__PURE__ */ jsx(
|
|
177
|
-
"div",
|
|
178
|
-
{
|
|
179
|
-
className: "ml-6 space-y-0.5",
|
|
180
|
-
id: `section-${section.slug}`,
|
|
181
|
-
"data-cy": `docs-section-pages-${section.slug}`,
|
|
182
|
-
children: section.pages.map((page) => {
|
|
183
|
-
const href = pluginName ? `/docs/plugins/${pluginName}/${section.slug}/${page.slug}` : `/docs/${category}/${section.slug}/${page.slug}`;
|
|
184
|
-
const isActive2 = pathname === href;
|
|
185
|
-
return /* @__PURE__ */ jsxs(
|
|
186
|
-
Link,
|
|
187
|
-
{
|
|
188
|
-
href,
|
|
189
|
-
className: cn(
|
|
190
|
-
"flex items-center px-2 py-1.5 rounded-md text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
191
|
-
isActive2 ? "bg-accent text-accent-foreground font-medium" : "hover:bg-accent/50"
|
|
192
|
-
),
|
|
193
|
-
"aria-current": isActive2 ? "page" : void 0,
|
|
194
|
-
"data-cy": `docs-page-link-${page.slug}`,
|
|
195
|
-
children: [
|
|
196
|
-
/* @__PURE__ */ jsx(FileText, { className: "h-3.5 w-3.5 mr-2", "aria-hidden": "true" }),
|
|
197
|
-
/* @__PURE__ */ jsx("span", { children: page.title })
|
|
198
|
-
]
|
|
199
|
-
},
|
|
200
|
-
page.slug
|
|
201
|
-
);
|
|
202
|
-
})
|
|
203
|
-
}
|
|
204
|
-
)
|
|
205
|
-
] }, section.slug);
|
|
206
|
-
});
|
|
207
|
-
};
|
|
208
|
-
const renderPluginSections = (pluginName, pluginSections2) => {
|
|
209
|
-
const isPluginExpanded = searchQuery.trim() ? true : expandedPlugins.has(pluginName);
|
|
210
|
-
const isPluginActive = activeElements.plugin === pluginName;
|
|
211
|
-
const pluginDisplayName = pluginName.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
212
|
-
return /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
|
|
213
|
-
/* @__PURE__ */ jsxs(
|
|
214
|
-
"button",
|
|
215
|
-
{
|
|
216
|
-
onClick: () => togglePlugin(pluginName),
|
|
217
|
-
onKeyDown: (e) => handlePluginKeyDown(e, pluginName),
|
|
218
|
-
className: cn(
|
|
219
|
-
"flex items-center w-full text-left px-2 py-1.5 rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
220
|
-
isPluginActive ? "bg-purple-500/10 text-purple-700 dark:text-purple-400 font-semibold hover:bg-purple-500/15" : "hover:bg-accent"
|
|
221
|
-
),
|
|
222
|
-
"aria-expanded": isPluginExpanded,
|
|
223
|
-
"data-cy": `docs-plugin-toggle-${pluginName}`,
|
|
224
|
-
children: [
|
|
225
|
-
/* @__PURE__ */ jsx(
|
|
226
|
-
ChevronRight,
|
|
227
|
-
{
|
|
228
|
-
className: cn(
|
|
229
|
-
"h-4 w-4 mr-1 transition-transform",
|
|
230
|
-
isPluginExpanded && "rotate-90"
|
|
231
|
-
),
|
|
232
|
-
"aria-hidden": "true"
|
|
233
|
-
}
|
|
234
|
-
),
|
|
235
|
-
/* @__PURE__ */ jsx(Puzzle, { className: cn(
|
|
236
|
-
"h-4 w-4 mr-2",
|
|
237
|
-
isPluginActive ? "text-purple-700 dark:text-purple-400" : "text-purple-600 dark:text-purple-400"
|
|
238
|
-
), "aria-hidden": "true" }),
|
|
239
|
-
/* @__PURE__ */ jsxs("span", { className: "text-sm font-medium", children: [
|
|
240
|
-
pluginDisplayName,
|
|
241
|
-
" Plugin"
|
|
242
|
-
] })
|
|
243
|
-
]
|
|
244
|
-
}
|
|
245
|
-
),
|
|
246
|
-
isPluginExpanded && /* @__PURE__ */ jsx("div", { className: "ml-4 mt-1 space-y-1", children: renderSections(pluginSections2, "core", pluginName) })
|
|
247
|
-
] }, pluginName);
|
|
248
|
-
};
|
|
249
|
-
const renderCategory = (category, categorySections, icon, label) => {
|
|
250
|
-
const isExpanded = searchQuery.trim() ? true : expandedCategories.has(category);
|
|
251
|
-
const isCategoryActive = activeElements.category === category;
|
|
252
|
-
return /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
253
|
-
/* @__PURE__ */ jsxs(
|
|
254
|
-
"button",
|
|
255
|
-
{
|
|
256
|
-
onClick: () => toggleCategory(category),
|
|
257
|
-
onKeyDown: (e) => handleCategoryKeyDown(e, category),
|
|
258
|
-
className: cn(
|
|
259
|
-
"flex items-center w-full text-left px-2 py-2 mb-2 rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
260
|
-
isCategoryActive ? "bg-accent text-accent-foreground hover:bg-accent" : "hover:bg-accent/50"
|
|
261
|
-
),
|
|
262
|
-
"aria-expanded": isExpanded,
|
|
263
|
-
"data-cy": `docs-category-toggle-${category}`,
|
|
264
|
-
children: [
|
|
265
|
-
/* @__PURE__ */ jsx(
|
|
266
|
-
ChevronRight,
|
|
267
|
-
{
|
|
268
|
-
className: cn(
|
|
269
|
-
"h-4 w-4 mr-2 transition-transform",
|
|
270
|
-
isExpanded && "rotate-90"
|
|
271
|
-
),
|
|
272
|
-
"aria-hidden": "true"
|
|
273
|
-
}
|
|
274
|
-
),
|
|
275
|
-
icon,
|
|
276
|
-
/* @__PURE__ */ jsx("span", { className: cn(
|
|
277
|
-
"text-sm font-semibold",
|
|
278
|
-
isCategoryActive && "font-bold"
|
|
279
|
-
), children: label })
|
|
280
|
-
]
|
|
281
|
-
}
|
|
282
|
-
),
|
|
283
|
-
isExpanded && /* @__PURE__ */ jsx("div", { className: "ml-2 space-y-1", children: category === "plugins" ? Object.keys(pluginsByName).length > 0 ? Object.entries(pluginsByName).map(
|
|
284
|
-
([pluginName, pluginSections2]) => renderPluginSections(pluginName, pluginSections2)
|
|
285
|
-
) : /* @__PURE__ */ jsx("p", { className: "px-2 py-2 text-sm text-muted-foreground italic", children: "No documentation available" }) : categorySections.length > 0 ? renderSections(categorySections, category) : /* @__PURE__ */ jsx("p", { className: "px-2 py-2 text-sm text-muted-foreground italic", children: "No documentation available" }) })
|
|
286
|
-
] });
|
|
287
|
-
};
|
|
62
|
+
const publicSections = filterSections(sections.filter((s) => s.source === "public"));
|
|
63
|
+
if (!publicConfig.enabled) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
288
66
|
return /* @__PURE__ */ jsxs(
|
|
289
67
|
"nav",
|
|
290
68
|
{
|
|
@@ -293,7 +71,10 @@ function DocsSidebar({ sections }) {
|
|
|
293
71
|
"data-cy": "docs-sidebar-nav",
|
|
294
72
|
children: [
|
|
295
73
|
/* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
296
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
75
|
+
/* @__PURE__ */ jsx(BookOpen, { className: "h-5 w-5 text-primary" }),
|
|
76
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: publicConfig.label })
|
|
77
|
+
] }),
|
|
297
78
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-4", children: t("description") }),
|
|
298
79
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
299
80
|
/* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
|
|
@@ -301,7 +82,7 @@ function DocsSidebar({ sections }) {
|
|
|
301
82
|
Input,
|
|
302
83
|
{
|
|
303
84
|
type: "text",
|
|
304
|
-
placeholder: "
|
|
85
|
+
placeholder: t("search.placeholder"),
|
|
305
86
|
value: searchQuery,
|
|
306
87
|
onChange: (e) => setSearchQuery(e.target.value),
|
|
307
88
|
className: "pl-9 pr-9",
|
|
@@ -313,39 +94,80 @@ function DocsSidebar({ sections }) {
|
|
|
313
94
|
{
|
|
314
95
|
onClick: () => setSearchQuery(""),
|
|
315
96
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
316
|
-
"aria-label": "
|
|
97
|
+
"aria-label": t("search.clear"),
|
|
317
98
|
"data-cy": "docs-search-clear",
|
|
318
99
|
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
319
100
|
}
|
|
320
101
|
)
|
|
321
102
|
] })
|
|
322
103
|
] }),
|
|
323
|
-
searchQuery.trim() &&
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
104
|
+
searchQuery.trim() && publicSections.length === 0 && /* @__PURE__ */ jsx("div", { className: "text-center py-8 px-4", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("search.noResults", { query: searchQuery }) }) }),
|
|
105
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: publicSections.map((section) => {
|
|
106
|
+
const isExpanded = searchQuery.trim() ? true : expandedSections.has(section.slug);
|
|
107
|
+
const isActive = activeSection === section.slug;
|
|
108
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
109
|
+
/* @__PURE__ */ jsxs(
|
|
110
|
+
"button",
|
|
111
|
+
{
|
|
112
|
+
onClick: () => toggleSection(section.slug),
|
|
113
|
+
onKeyDown: (e) => handleKeyDown(e, section.slug),
|
|
114
|
+
className: cn(
|
|
115
|
+
"flex items-center w-full text-left px-2 py-1.5 rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
116
|
+
isActive ? "bg-primary/10 text-primary font-semibold hover:bg-primary/15" : "hover:bg-accent"
|
|
117
|
+
),
|
|
118
|
+
"aria-expanded": isExpanded,
|
|
119
|
+
"aria-controls": `section-${section.slug}`,
|
|
120
|
+
"data-cy": `docs-section-toggle-${section.slug}`,
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ jsx(
|
|
123
|
+
ChevronRight,
|
|
124
|
+
{
|
|
125
|
+
className: cn(
|
|
126
|
+
"h-4 w-4 mr-1 transition-transform",
|
|
127
|
+
isExpanded && "rotate-90"
|
|
128
|
+
),
|
|
129
|
+
"aria-hidden": "true"
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
/* @__PURE__ */ jsx(Folder, { className: cn(
|
|
133
|
+
"h-4 w-4 mr-2",
|
|
134
|
+
isActive && "text-primary"
|
|
135
|
+
), "aria-hidden": "true" }),
|
|
136
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium flex-1", children: section.title })
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
isExpanded && /* @__PURE__ */ jsx(
|
|
141
|
+
"div",
|
|
142
|
+
{
|
|
143
|
+
className: "ml-6 space-y-0.5",
|
|
144
|
+
id: `section-${section.slug}`,
|
|
145
|
+
"data-cy": `docs-section-pages-${section.slug}`,
|
|
146
|
+
children: section.pages.map((page) => {
|
|
147
|
+
const href = `/docs/${section.slug}/${page.slug}`;
|
|
148
|
+
const isPageActive = pathname === href;
|
|
149
|
+
return /* @__PURE__ */ jsxs(
|
|
150
|
+
Link,
|
|
151
|
+
{
|
|
152
|
+
href,
|
|
153
|
+
className: cn(
|
|
154
|
+
"flex items-center px-2 py-1.5 rounded-md text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
155
|
+
isPageActive ? "bg-accent text-accent-foreground font-medium" : "hover:bg-accent/50"
|
|
156
|
+
),
|
|
157
|
+
"aria-current": isPageActive ? "page" : void 0,
|
|
158
|
+
"data-cy": `docs-page-link-${page.slug}`,
|
|
159
|
+
children: [
|
|
160
|
+
/* @__PURE__ */ jsx(FileText, { className: "h-3.5 w-3.5 mr-2", "aria-hidden": "true" }),
|
|
161
|
+
/* @__PURE__ */ jsx("span", { children: page.title })
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
page.slug
|
|
165
|
+
);
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
] }, section.slug);
|
|
170
|
+
}) })
|
|
349
171
|
]
|
|
350
172
|
}
|
|
351
173
|
);
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { DocsLayout } from './docs-layout';
|
|
7
7
|
export { DocsSidebar } from './docs-sidebar';
|
|
8
|
+
export { SuperadminDocsSidebar } from './superadmin-docs-sidebar';
|
|
8
9
|
export { DocsBreadcrumbs } from './docs-breadcrumbs';
|
|
9
10
|
export { DocsContent } from './docs-content';
|
|
10
11
|
export type { BreadcrumbItem } from './docs-breadcrumbs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/docs/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAG1C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAG5C,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/docs/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAG1C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAG5C,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { DocsLayout } from "./docs-layout";
|
|
2
2
|
import { DocsSidebar } from "./docs-sidebar";
|
|
3
|
+
import { SuperadminDocsSidebar } from "./superadmin-docs-sidebar";
|
|
3
4
|
import { DocsBreadcrumbs } from "./docs-breadcrumbs";
|
|
4
5
|
import { DocsContent } from "./docs-content";
|
|
5
6
|
export {
|
|
6
7
|
DocsBreadcrumbs,
|
|
7
8
|
DocsContent,
|
|
8
9
|
DocsLayout,
|
|
9
|
-
DocsSidebar
|
|
10
|
+
DocsSidebar,
|
|
11
|
+
SuperadminDocsSidebar
|
|
10
12
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DocSectionMeta } from '@nextsparkjs/registries/docs-registry';
|
|
2
|
+
interface SuperadminDocsSidebarProps {
|
|
3
|
+
sections: DocSectionMeta[];
|
|
4
|
+
}
|
|
5
|
+
export declare function SuperadminDocsSidebar({ sections }: SuperadminDocsSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=superadmin-docs-sidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"superadmin-docs-sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/docs/superadmin-docs-sidebar.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AAE3E,UAAU,0BAA0B;IAClC,QAAQ,EAAE,cAAc,EAAE,CAAA;CAC3B;AAED,wBAAgB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,EAAE,0BAA0B,2CA0H7E"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { usePathname } from "next/navigation";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
import { ChevronRight, FileText, Folder, Shield } from "lucide-react";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
function SuperadminDocsSidebar({ sections }) {
|
|
9
|
+
const pathname = usePathname();
|
|
10
|
+
const getActiveSection = () => {
|
|
11
|
+
const parts = pathname.split("/").filter(Boolean);
|
|
12
|
+
if (parts[0] === "superadmin" && parts[1] === "docs" && parts.length >= 3) {
|
|
13
|
+
return parts[2];
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
};
|
|
17
|
+
const activeSection = getActiveSection();
|
|
18
|
+
const [expandedSections, setExpandedSections] = useState(() => {
|
|
19
|
+
return activeSection ? /* @__PURE__ */ new Set([activeSection]) : /* @__PURE__ */ new Set();
|
|
20
|
+
});
|
|
21
|
+
const toggleSection = (slug) => {
|
|
22
|
+
const newExpanded = new Set(expandedSections);
|
|
23
|
+
if (newExpanded.has(slug)) {
|
|
24
|
+
newExpanded.delete(slug);
|
|
25
|
+
} else {
|
|
26
|
+
newExpanded.add(slug);
|
|
27
|
+
}
|
|
28
|
+
setExpandedSections(newExpanded);
|
|
29
|
+
};
|
|
30
|
+
const handleKeyDown = (e, slug) => {
|
|
31
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
toggleSection(slug);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return /* @__PURE__ */ jsxs(
|
|
37
|
+
"nav",
|
|
38
|
+
{
|
|
39
|
+
className: "h-full overflow-y-auto p-4",
|
|
40
|
+
"aria-label": "Admin documentation navigation",
|
|
41
|
+
"data-cy": "superadmin-docs-sidebar",
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
44
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
45
|
+
/* @__PURE__ */ jsx(Shield, { className: "h-5 w-5 text-red-600" }),
|
|
46
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: "Admin Docs" })
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Documentation for administrators" })
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: sections.map((section) => {
|
|
51
|
+
const isExpanded = expandedSections.has(section.slug);
|
|
52
|
+
const isActive = activeSection === section.slug;
|
|
53
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
54
|
+
/* @__PURE__ */ jsxs(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
onClick: () => toggleSection(section.slug),
|
|
58
|
+
onKeyDown: (e) => handleKeyDown(e, section.slug),
|
|
59
|
+
className: cn(
|
|
60
|
+
"flex items-center w-full text-left px-2 py-1.5 rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
61
|
+
isActive ? "bg-red-500/10 text-red-700 dark:text-red-400 font-semibold hover:bg-red-500/15" : "hover:bg-accent"
|
|
62
|
+
),
|
|
63
|
+
"aria-expanded": isExpanded,
|
|
64
|
+
"aria-controls": `section-${section.slug}`,
|
|
65
|
+
"data-cy": `superadmin-docs-section-${section.slug}`,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx(
|
|
68
|
+
ChevronRight,
|
|
69
|
+
{
|
|
70
|
+
className: cn(
|
|
71
|
+
"h-4 w-4 mr-1 transition-transform",
|
|
72
|
+
isExpanded && "rotate-90"
|
|
73
|
+
),
|
|
74
|
+
"aria-hidden": "true"
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ jsx(Folder, { className: cn(
|
|
78
|
+
"h-4 w-4 mr-2",
|
|
79
|
+
isActive ? "text-red-600 dark:text-red-400" : "text-muted-foreground"
|
|
80
|
+
), "aria-hidden": "true" }),
|
|
81
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium flex-1", children: section.title })
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
isExpanded && /* @__PURE__ */ jsx(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
className: "ml-6 space-y-0.5",
|
|
89
|
+
id: `section-${section.slug}`,
|
|
90
|
+
"data-cy": `superadmin-docs-pages-${section.slug}`,
|
|
91
|
+
children: section.pages.map((page) => {
|
|
92
|
+
const href = `/superadmin/docs/${section.slug}/${page.slug}`;
|
|
93
|
+
const isPageActive = pathname === href;
|
|
94
|
+
return /* @__PURE__ */ jsxs(
|
|
95
|
+
Link,
|
|
96
|
+
{
|
|
97
|
+
href,
|
|
98
|
+
className: cn(
|
|
99
|
+
"flex items-center px-2 py-1.5 rounded-md text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
100
|
+
isPageActive ? "bg-accent text-accent-foreground font-medium" : "hover:bg-accent/50"
|
|
101
|
+
),
|
|
102
|
+
"aria-current": isPageActive ? "page" : void 0,
|
|
103
|
+
"data-cy": `superadmin-docs-page-${page.slug}`,
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsx(FileText, { className: "h-3.5 w-3.5 mr-2", "aria-hidden": "true" }),
|
|
106
|
+
/* @__PURE__ */ jsx("span", { children: page.title })
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
page.slug
|
|
110
|
+
);
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
] }, section.slug);
|
|
115
|
+
}) })
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
SuperadminDocsSidebar
|
|
122
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperadminSidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/superadmin/layouts/SuperadminSidebar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SuperadminSidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/superadmin/layouts/SuperadminSidebar.tsx"],"names":[],"mappings":"AA+BA;;;;;GAKG;AACH,wBAAgB,iBAAiB,4CAuMhC"}
|
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
ArrowLeft,
|
|
13
13
|
ChevronLeft,
|
|
14
14
|
ChevronRight,
|
|
15
|
-
CreditCard
|
|
15
|
+
CreditCard,
|
|
16
|
+
FileText
|
|
16
17
|
} from "lucide-react";
|
|
17
18
|
import { cn } from "../../../lib/utils";
|
|
18
19
|
import { Button } from "../../ui/button";
|
|
@@ -50,6 +51,13 @@ function SuperadminSidebar() {
|
|
|
50
51
|
description: "View roles & permissions matrix",
|
|
51
52
|
selectorKey: "teamRoles"
|
|
52
53
|
},
|
|
54
|
+
{
|
|
55
|
+
title: "Documentation",
|
|
56
|
+
href: "/superadmin/docs",
|
|
57
|
+
icon: FileText,
|
|
58
|
+
description: "Admin guides and references",
|
|
59
|
+
selectorKey: "docs"
|
|
60
|
+
},
|
|
53
61
|
{
|
|
54
62
|
title: "Subscriptions",
|
|
55
63
|
href: "/superadmin/subscriptions",
|