@wikex/admin-kit 0.5.0 → 0.7.0
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/CHANGELOG.md +16 -0
- package/README.md +34 -2
- package/dist/admin/before-login.js +8 -7
- package/dist/admin/header.js +107 -65
- package/dist/admin/logout-button.js +3 -3
- package/dist/admin/nav-client.js +204 -140
- package/dist/admin/theme-toggle.js +3 -3
- package/dist/admin/view-site.js +6 -9
- package/dist/{chunk-7FEACJUN.js → chunk-5DJKPKJ6.js} +2 -1
- package/dist/{chunk-GZ2B5BTH.js → chunk-B6FIGT4Q.js} +9 -6
- package/dist/chunk-BKR24U6B.js +25 -0
- package/dist/chunk-N7CP6ZLG.js +26 -0
- package/dist/chunk-PPWCNGRB.js +303 -0
- package/dist/index.js +1 -1
- package/dist/minimal/index.d.ts +107 -0
- package/dist/minimal/index.js +132 -0
- package/dist/minimal/provider.d.ts +14 -0
- package/dist/minimal/provider.js +12 -0
- package/dist/starter.js +1 -1
- package/package.json +9 -1
- package/src/styles/admin.scss +353 -64
- package/dist/chunk-SAI5SWZA.js +0 -29
package/dist/admin/nav-client.js
CHANGED
|
@@ -8,10 +8,26 @@ import {
|
|
|
8
8
|
useAdminBrand
|
|
9
9
|
} from "../chunk-X7VETFVD.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
} from "../chunk-
|
|
11
|
+
MinimalLogoutButton_default
|
|
12
|
+
} from "../chunk-B6FIGT4Q.js";
|
|
13
13
|
|
|
14
|
-
// src/admin/
|
|
14
|
+
// src/admin/MinimalNavClient.tsx
|
|
15
|
+
import {
|
|
16
|
+
Avatar,
|
|
17
|
+
Backdrop,
|
|
18
|
+
Box,
|
|
19
|
+
Divider,
|
|
20
|
+
IconButton,
|
|
21
|
+
List,
|
|
22
|
+
ListItemButton,
|
|
23
|
+
ListItemIcon,
|
|
24
|
+
ListItemText,
|
|
25
|
+
ListSubheader,
|
|
26
|
+
Paper,
|
|
27
|
+
Stack,
|
|
28
|
+
Tooltip,
|
|
29
|
+
Typography
|
|
30
|
+
} from "@mui/material";
|
|
15
31
|
import { Link, useAuth, useConfig, useNav } from "@payloadcms/ui";
|
|
16
32
|
import {
|
|
17
33
|
BookOpenText,
|
|
@@ -35,7 +51,7 @@ import {
|
|
|
35
51
|
} from "lucide-react";
|
|
36
52
|
import { usePathname } from "next/navigation";
|
|
37
53
|
import { formatAdminURL } from "payload/shared";
|
|
38
|
-
import { useEffect, useMemo, useState } from "react";
|
|
54
|
+
import { Fragment, useEffect, useMemo, useState } from "react";
|
|
39
55
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
40
56
|
var iconBySlug = {
|
|
41
57
|
categories: Tags,
|
|
@@ -55,6 +71,32 @@ var getInitials = (name, email) => {
|
|
|
55
71
|
const source = name?.trim() || email?.split("@")[0] || "AD";
|
|
56
72
|
return source.split(/\s+/).slice(0, 2).map((part) => part.charAt(0).toUpperCase()).join("");
|
|
57
73
|
};
|
|
74
|
+
var NavLink = ({ active, href, icon: Icon, isMini, label, onClick }) => {
|
|
75
|
+
const link = /* @__PURE__ */ jsxs(
|
|
76
|
+
ListItemButton,
|
|
77
|
+
{
|
|
78
|
+
"aria-current": active ? "page" : void 0,
|
|
79
|
+
className: "minimal-nav__item",
|
|
80
|
+
component: Link,
|
|
81
|
+
href,
|
|
82
|
+
onClick,
|
|
83
|
+
prefetch: false,
|
|
84
|
+
selected: active,
|
|
85
|
+
sx: { borderRadius: 1, minHeight: 44, px: 1.5 },
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsx(ListItemIcon, { sx: { color: "inherit", minWidth: 36 }, children: /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true", size: 22, strokeWidth: 1.8 }) }),
|
|
88
|
+
/* @__PURE__ */ jsx(
|
|
89
|
+
ListItemText,
|
|
90
|
+
{
|
|
91
|
+
primary: label,
|
|
92
|
+
primaryTypographyProps: { fontSize: 14, fontWeight: active ? 700 : 600 }
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
return isMini ? /* @__PURE__ */ jsx(Tooltip, { arrow: true, placement: "right", title: label, children: link }) : link;
|
|
99
|
+
};
|
|
58
100
|
var AdminNavClient = ({ groups }) => {
|
|
59
101
|
const pathname = usePathname();
|
|
60
102
|
const brand = useAdminBrand();
|
|
@@ -70,8 +112,7 @@ var AdminNavClient = ({ groups }) => {
|
|
|
70
112
|
const [isMini, setIsMini] = useState(false);
|
|
71
113
|
const [isMobile, setIsMobile] = useState(false);
|
|
72
114
|
useEffect(() => {
|
|
73
|
-
|
|
74
|
-
setIsMini(storedValue === "true");
|
|
115
|
+
setIsMini(window.localStorage.getItem("minimal-admin-nav-mini") === "true");
|
|
75
116
|
}, []);
|
|
76
117
|
useEffect(() => {
|
|
77
118
|
const mediaQuery = window.matchMedia("(max-width: 768px)");
|
|
@@ -81,7 +122,7 @@ var AdminNavClient = ({ groups }) => {
|
|
|
81
122
|
return () => mediaQuery.removeEventListener("change", syncViewport);
|
|
82
123
|
}, []);
|
|
83
124
|
useEffect(() => {
|
|
84
|
-
document.documentElement.style.setProperty("--nav-width", isMini ? "88px" : "
|
|
125
|
+
document.documentElement.style.setProperty("--nav-width", isMini ? "88px" : "300px");
|
|
85
126
|
window.localStorage.setItem("minimal-admin-nav-mini", String(isMini));
|
|
86
127
|
return () => {
|
|
87
128
|
document.documentElement.style.removeProperty("--nav-width");
|
|
@@ -89,169 +130,192 @@ var AdminNavClient = ({ groups }) => {
|
|
|
89
130
|
}, [isMini]);
|
|
90
131
|
const userLabel = user?.name?.trim() || user?.email?.split("@")[0] || "Qu\u1EA3n tr\u1ECB vi\xEAn";
|
|
91
132
|
const initials = useMemo(() => getInitials(user?.name, user?.email), [user?.email, user?.name]);
|
|
133
|
+
const compact = isMini && !isMobile;
|
|
92
134
|
const closeMobileNav = () => {
|
|
93
135
|
if (window.matchMedia("(max-width: 768px)").matches) setNavOpen(false);
|
|
94
136
|
};
|
|
137
|
+
const isActive = (href) => pathname === href || href !== adminRoute && pathname.startsWith(`${href}/`);
|
|
95
138
|
const classes = [
|
|
96
139
|
"minimal-nav",
|
|
97
140
|
navOpen && "minimal-nav--open",
|
|
98
|
-
|
|
141
|
+
compact && "minimal-nav--mini",
|
|
99
142
|
shouldAnimate && "minimal-nav--animate",
|
|
100
143
|
hydrated && "minimal-nav--hydrated"
|
|
101
144
|
].filter(Boolean).join(" ");
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
145
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
146
|
+
/* @__PURE__ */ jsx(
|
|
147
|
+
Backdrop,
|
|
148
|
+
{
|
|
149
|
+
className: "minimal-nav__backdrop",
|
|
150
|
+
onClick: () => setNavOpen(false),
|
|
151
|
+
open: isMobile && navOpen
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ jsxs(
|
|
155
|
+
Box,
|
|
156
|
+
{
|
|
157
|
+
"aria-label": "\u0110i\u1EC1u h\u01B0\u1EDBng qu\u1EA3n tr\u1ECB",
|
|
158
|
+
className: classes,
|
|
159
|
+
component: "aside",
|
|
160
|
+
inert: isMobile && !navOpen || void 0,
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsxs(Paper, { className: "minimal-nav__scroll", elevation: 0, ref: navRef, square: true, children: [
|
|
163
|
+
/* @__PURE__ */ jsxs(Stack, { alignItems: "center", className: "minimal-nav__brand-row", direction: "row", children: [
|
|
164
|
+
/* @__PURE__ */ jsxs(
|
|
165
|
+
Link,
|
|
166
|
+
{
|
|
167
|
+
"aria-label": `V\u1EC1 dashboard ${brand.siteName}`,
|
|
168
|
+
className: "minimal-nav__brand",
|
|
169
|
+
href: adminRoute,
|
|
170
|
+
onClick: closeMobileNav,
|
|
171
|
+
prefetch: false,
|
|
172
|
+
children: [
|
|
173
|
+
/* @__PURE__ */ jsx("span", { className: "minimal-nav__brand-full", children: /* @__PURE__ */ jsx(AdminLogo, {}) }),
|
|
174
|
+
/* @__PURE__ */ jsx("span", { className: "minimal-nav__brand-icon", children: /* @__PURE__ */ jsx(AdminIcon, {}) })
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
/* @__PURE__ */ jsx(
|
|
179
|
+
IconButton,
|
|
180
|
+
{
|
|
181
|
+
"aria-label": "\u0110\xF3ng menu",
|
|
182
|
+
className: "minimal-nav__mobile-close",
|
|
183
|
+
onClick: () => setNavOpen(false),
|
|
184
|
+
size: "small",
|
|
185
|
+
children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true", size: 20 })
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
] }),
|
|
112
189
|
/* @__PURE__ */ jsxs(
|
|
113
|
-
|
|
190
|
+
Paper,
|
|
114
191
|
{
|
|
115
|
-
"
|
|
116
|
-
|
|
192
|
+
className: "minimal-nav__workspace",
|
|
193
|
+
component: Link,
|
|
194
|
+
elevation: 0,
|
|
117
195
|
href: adminRoute,
|
|
118
196
|
onClick: closeMobileNav,
|
|
119
197
|
prefetch: false,
|
|
198
|
+
title: brand.siteName,
|
|
120
199
|
children: [
|
|
121
|
-
/* @__PURE__ */ jsx(
|
|
122
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ jsx(Avatar, { className: "minimal-nav__workspace-icon", variant: "rounded", children: /* @__PURE__ */ jsx(GalleryVerticalEnd, { "aria-hidden": "true", size: 20 }) }),
|
|
201
|
+
/* @__PURE__ */ jsxs("span", { className: "minimal-nav__workspace-copy", children: [
|
|
202
|
+
/* @__PURE__ */ jsx(Typography, { component: "small", variant: "caption", children: "Kh\xF4ng gian l\xE0m vi\u1EC7c" }),
|
|
203
|
+
/* @__PURE__ */ jsx(Typography, { component: "strong", variant: "subtitle2", children: brand.siteName })
|
|
204
|
+
] }),
|
|
205
|
+
/* @__PURE__ */ jsx(Menu, { "aria-hidden": "true", className: "minimal-nav__workspace-menu", size: 18 })
|
|
123
206
|
]
|
|
124
207
|
}
|
|
125
208
|
),
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
"aria-label": "\u0110\xF3ng menu",
|
|
130
|
-
className: "minimal-nav__mobile-close",
|
|
131
|
-
onClick: () => setNavOpen(false),
|
|
132
|
-
type: "button",
|
|
133
|
-
children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true" })
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
] }),
|
|
137
|
-
/* @__PURE__ */ jsxs(
|
|
138
|
-
Link,
|
|
139
|
-
{
|
|
140
|
-
className: "minimal-nav__workspace",
|
|
141
|
-
href: adminRoute,
|
|
142
|
-
onClick: closeMobileNav,
|
|
143
|
-
prefetch: false,
|
|
144
|
-
title: brand.siteName,
|
|
145
|
-
children: [
|
|
146
|
-
/* @__PURE__ */ jsx("span", { className: "minimal-nav__workspace-icon", children: /* @__PURE__ */ jsx(GalleryVerticalEnd, { "aria-hidden": "true" }) }),
|
|
147
|
-
/* @__PURE__ */ jsxs("span", { className: "minimal-nav__workspace-copy", children: [
|
|
148
|
-
/* @__PURE__ */ jsx("small", { children: "Kh\xF4ng gian l\xE0m vi\u1EC7c" }),
|
|
149
|
-
/* @__PURE__ */ jsx("strong", { children: brand.siteName })
|
|
150
|
-
] }),
|
|
151
|
-
/* @__PURE__ */ jsx(Menu, { "aria-hidden": "true", className: "minimal-nav__workspace-menu" })
|
|
152
|
-
]
|
|
153
|
-
}
|
|
154
|
-
),
|
|
155
|
-
/* @__PURE__ */ jsxs("nav", { className: "minimal-nav__menu", children: [
|
|
156
|
-
/* @__PURE__ */ jsxs("div", { className: "minimal-nav__group", children: [
|
|
157
|
-
/* @__PURE__ */ jsx("span", { className: "minimal-nav__group-label", children: "T\u1ED5ng quan" }),
|
|
158
|
-
/* @__PURE__ */ jsxs(
|
|
159
|
-
Link,
|
|
209
|
+
/* @__PURE__ */ jsxs(Box, { className: "minimal-nav__menu", component: "nav", children: [
|
|
210
|
+
/* @__PURE__ */ jsx(
|
|
211
|
+
List,
|
|
160
212
|
{
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
213
|
+
className: "minimal-nav__group",
|
|
214
|
+
disablePadding: true,
|
|
215
|
+
subheader: /* @__PURE__ */ jsx(ListSubheader, { className: "minimal-nav__group-label", component: "div", disableSticky: true, children: "T\u1ED5ng quan" }),
|
|
216
|
+
children: /* @__PURE__ */ jsx(
|
|
217
|
+
NavLink,
|
|
218
|
+
{
|
|
219
|
+
active: pathname === adminRoute,
|
|
220
|
+
href: adminRoute,
|
|
221
|
+
icon: LayoutDashboard,
|
|
222
|
+
isMini: compact,
|
|
223
|
+
label: "T\u1ED5ng quan",
|
|
224
|
+
onClick: closeMobileNav
|
|
225
|
+
}
|
|
226
|
+
)
|
|
171
227
|
}
|
|
172
|
-
)
|
|
228
|
+
),
|
|
229
|
+
groups.map((group) => /* @__PURE__ */ jsx(
|
|
230
|
+
List,
|
|
231
|
+
{
|
|
232
|
+
className: "minimal-nav__group",
|
|
233
|
+
disablePadding: true,
|
|
234
|
+
subheader: /* @__PURE__ */ jsx(ListSubheader, { className: "minimal-nav__group-label", component: "div", disableSticky: true, children: translateGroupLabel(group.label) }),
|
|
235
|
+
children: group.items.map((item) => {
|
|
236
|
+
const href = formatAdminURL({ adminRoute, path: `/${item.type}/${item.slug}` });
|
|
237
|
+
return /* @__PURE__ */ jsx(
|
|
238
|
+
NavLink,
|
|
239
|
+
{
|
|
240
|
+
active: isActive(href),
|
|
241
|
+
href,
|
|
242
|
+
icon: iconBySlug[item.slug] || FileText,
|
|
243
|
+
isMini: compact,
|
|
244
|
+
label: item.label,
|
|
245
|
+
onClick: closeMobileNav
|
|
246
|
+
},
|
|
247
|
+
`${item.type}-${item.slug}`
|
|
248
|
+
);
|
|
249
|
+
})
|
|
250
|
+
},
|
|
251
|
+
group.label
|
|
252
|
+
)),
|
|
253
|
+
folders && folders.browseByFolder ? /* @__PURE__ */ jsx(
|
|
254
|
+
List,
|
|
255
|
+
{
|
|
256
|
+
className: "minimal-nav__group",
|
|
257
|
+
disablePadding: true,
|
|
258
|
+
subheader: /* @__PURE__ */ jsx(ListSubheader, { className: "minimal-nav__group-label", component: "div", disableSticky: true, children: "Th\u01B0 vi\u1EC7n" }),
|
|
259
|
+
children: /* @__PURE__ */ jsx(
|
|
260
|
+
NavLink,
|
|
261
|
+
{
|
|
262
|
+
active: isActive(
|
|
263
|
+
formatAdminURL({ adminRoute, path: adminRoutes.browseByFolder })
|
|
264
|
+
),
|
|
265
|
+
href: formatAdminURL({ adminRoute, path: adminRoutes.browseByFolder }),
|
|
266
|
+
icon: Library,
|
|
267
|
+
isMini: compact,
|
|
268
|
+
label: "Duy\u1EC7t theo th\u01B0 m\u1EE5c",
|
|
269
|
+
onClick: closeMobileNav
|
|
270
|
+
}
|
|
271
|
+
)
|
|
272
|
+
}
|
|
273
|
+
) : null
|
|
173
274
|
] }),
|
|
174
|
-
|
|
175
|
-
/* @__PURE__ */ jsx(
|
|
176
|
-
group.items.map((item) => {
|
|
177
|
-
const href = formatAdminURL({
|
|
178
|
-
adminRoute,
|
|
179
|
-
path: `/${item.type}/${item.slug}`
|
|
180
|
-
});
|
|
181
|
-
const Icon = iconBySlug[item.slug] || FileText;
|
|
182
|
-
const active = isActive(href);
|
|
183
|
-
return /* @__PURE__ */ jsxs(
|
|
184
|
-
Link,
|
|
185
|
-
{
|
|
186
|
-
"aria-current": active ? "page" : void 0,
|
|
187
|
-
className: `minimal-nav__item ${active ? "minimal-nav__item--active" : ""}`,
|
|
188
|
-
href,
|
|
189
|
-
onClick: closeMobileNav,
|
|
190
|
-
prefetch: false,
|
|
191
|
-
title: item.label,
|
|
192
|
-
children: [
|
|
193
|
-
/* @__PURE__ */ jsx(Icon, { "aria-hidden": "true" }),
|
|
194
|
-
/* @__PURE__ */ jsx("span", { children: item.label })
|
|
195
|
-
]
|
|
196
|
-
},
|
|
197
|
-
`${item.type}-${item.slug}`
|
|
198
|
-
);
|
|
199
|
-
})
|
|
200
|
-
] }, group.label)),
|
|
201
|
-
folders && folders.browseByFolder && /* @__PURE__ */ jsxs("div", { className: "minimal-nav__group", children: [
|
|
202
|
-
/* @__PURE__ */ jsx("span", { className: "minimal-nav__group-label", children: "Th\u01B0 vi\u1EC7n" }),
|
|
275
|
+
/* @__PURE__ */ jsxs(Box, { className: "minimal-nav__footer", children: [
|
|
276
|
+
/* @__PURE__ */ jsx(Divider, { sx: { mb: 1.5 } }),
|
|
203
277
|
/* @__PURE__ */ jsxs(
|
|
204
|
-
|
|
278
|
+
ListItemButton,
|
|
205
279
|
{
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
href: formatAdminURL({ adminRoute, path: adminRoutes.
|
|
280
|
+
className: "minimal-nav__account",
|
|
281
|
+
component: Link,
|
|
282
|
+
href: formatAdminURL({ adminRoute, path: adminRoutes.account }),
|
|
209
283
|
onClick: closeMobileNav,
|
|
210
284
|
prefetch: false,
|
|
211
|
-
|
|
285
|
+
sx: { borderRadius: 1.25 },
|
|
212
286
|
children: [
|
|
213
|
-
/* @__PURE__ */ jsx(
|
|
214
|
-
/* @__PURE__ */ jsx(
|
|
287
|
+
/* @__PURE__ */ jsx(Avatar, { className: "minimal-nav__avatar", children: initials }),
|
|
288
|
+
/* @__PURE__ */ jsx(
|
|
289
|
+
ListItemText,
|
|
290
|
+
{
|
|
291
|
+
className: "minimal-nav__account-copy",
|
|
292
|
+
primary: userLabel,
|
|
293
|
+
primaryTypographyProps: { fontSize: 14, fontWeight: 600, noWrap: true },
|
|
294
|
+
secondary: user?.email || "T\xE0i kho\u1EA3n qu\u1EA3n tr\u1ECB",
|
|
295
|
+
secondaryTypographyProps: { fontSize: 12, noWrap: true }
|
|
296
|
+
}
|
|
297
|
+
)
|
|
215
298
|
]
|
|
216
299
|
}
|
|
217
|
-
)
|
|
300
|
+
),
|
|
301
|
+
/* @__PURE__ */ jsx("div", { className: "minimal-nav__logout", children: /* @__PURE__ */ jsx(MinimalLogoutButton_default, {}) })
|
|
218
302
|
] })
|
|
219
303
|
] }),
|
|
220
|
-
/* @__PURE__ */
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
]
|
|
236
|
-
}
|
|
237
|
-
),
|
|
238
|
-
/* @__PURE__ */ jsx("div", { className: "minimal-nav__logout", children: /* @__PURE__ */ jsx(LogoutButton_default, {}) })
|
|
239
|
-
] })
|
|
240
|
-
] }),
|
|
241
|
-
/* @__PURE__ */ jsx(
|
|
242
|
-
"button",
|
|
243
|
-
{
|
|
244
|
-
"aria-label": isMini ? "M\u1EDF r\u1ED9ng menu" : "Thu g\u1ECDn menu",
|
|
245
|
-
className: "minimal-nav__collapse",
|
|
246
|
-
onClick: () => setIsMini((current) => !current),
|
|
247
|
-
title: isMini ? "M\u1EDF r\u1ED9ng menu" : "Thu g\u1ECDn menu",
|
|
248
|
-
type: "button",
|
|
249
|
-
children: isMini ? /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true" })
|
|
250
|
-
}
|
|
251
|
-
)
|
|
252
|
-
]
|
|
253
|
-
}
|
|
254
|
-
);
|
|
304
|
+
/* @__PURE__ */ jsx(
|
|
305
|
+
IconButton,
|
|
306
|
+
{
|
|
307
|
+
"aria-label": isMini ? "M\u1EDF r\u1ED9ng menu" : "Thu g\u1ECDn menu",
|
|
308
|
+
className: "minimal-nav__collapse",
|
|
309
|
+
onClick: () => setIsMini((current) => !current),
|
|
310
|
+
size: "small",
|
|
311
|
+
title: isMini ? "M\u1EDF r\u1ED9ng menu" : "Thu g\u1ECDn menu",
|
|
312
|
+
children: isMini ? /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true" })
|
|
313
|
+
}
|
|
314
|
+
)
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
] });
|
|
255
319
|
};
|
|
256
320
|
export {
|
|
257
321
|
AdminNavClient
|
package/dist/admin/view-site.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/* @__PURE__ */ jsx(ArrowUpRight, { "aria-hidden": "true" })
|
|
7
|
-
] });
|
|
8
|
-
var ViewSite_default = AdminViewSite;
|
|
1
|
+
'use client';
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
MinimalViewSite_default
|
|
5
|
+
} from "../chunk-BKR24U6B.js";
|
|
9
6
|
export {
|
|
10
|
-
|
|
7
|
+
MinimalViewSite_default as default
|
|
11
8
|
};
|
|
@@ -107,6 +107,7 @@ var wikexAdminPlugin = (options = {}) => {
|
|
|
107
107
|
const components = admin.components ?? {};
|
|
108
108
|
const beforeDashboard = options.components?.beforeDashboard;
|
|
109
109
|
const provider = options.components?.provider;
|
|
110
|
+
const providers = appendUnique(components.providers, ["@wikex/admin-kit/minimal/provider"]);
|
|
110
111
|
return {
|
|
111
112
|
...config,
|
|
112
113
|
admin: {
|
|
@@ -130,7 +131,7 @@ var wikexAdminPlugin = (options = {}) => {
|
|
|
130
131
|
logout: {
|
|
131
132
|
Button: components.logout?.Button ?? "@wikex/admin-kit/admin/logout-button"
|
|
132
133
|
},
|
|
133
|
-
providers: typeof provider !== "string" ?
|
|
134
|
+
providers: typeof provider !== "string" ? providers : appendUnique(providers, [provider])
|
|
134
135
|
},
|
|
135
136
|
livePreview: admin.livePreview ?? {
|
|
136
137
|
breakpoints: [
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
// src/admin/
|
|
3
|
+
// src/admin/MinimalLogoutButton.tsx
|
|
4
|
+
import { ListItemButton, ListItemIcon, ListItemText } from "@mui/material";
|
|
4
5
|
import { Link, useConfig, useTranslation } from "@payloadcms/ui";
|
|
5
6
|
import { LogOut } from "lucide-react";
|
|
6
7
|
import { formatAdminURL } from "payload/shared";
|
|
@@ -17,23 +18,25 @@ var AdminLogoutButton = ({ tabIndex = 0 }) => {
|
|
|
17
18
|
const { t } = useTranslation();
|
|
18
19
|
const label = t("authentication:logOut");
|
|
19
20
|
return /* @__PURE__ */ jsxs(
|
|
20
|
-
|
|
21
|
+
ListItemButton,
|
|
21
22
|
{
|
|
22
23
|
"aria-label": label,
|
|
23
24
|
className: "admin-sign-out",
|
|
25
|
+
component: Link,
|
|
24
26
|
href: formatAdminURL({ adminRoute, path: logoutRoute }),
|
|
25
27
|
prefetch: false,
|
|
28
|
+
sx: { borderRadius: 1 },
|
|
26
29
|
tabIndex,
|
|
27
30
|
title: label,
|
|
28
31
|
children: [
|
|
29
|
-
/* @__PURE__ */ jsx(
|
|
30
|
-
/* @__PURE__ */ jsx(
|
|
32
|
+
/* @__PURE__ */ jsx(ListItemIcon, { className: "admin-sign-out__icon", sx: { minWidth: 36 }, children: /* @__PURE__ */ jsx(LogOut, { size: 19, strokeWidth: 2 }) }),
|
|
33
|
+
/* @__PURE__ */ jsx(ListItemText, { className: "admin-sign-out__label", primary: label })
|
|
31
34
|
]
|
|
32
35
|
}
|
|
33
36
|
);
|
|
34
37
|
};
|
|
35
|
-
var
|
|
38
|
+
var MinimalLogoutButton_default = AdminLogoutButton;
|
|
36
39
|
|
|
37
40
|
export {
|
|
38
|
-
|
|
41
|
+
MinimalLogoutButton_default
|
|
39
42
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// src/admin/MinimalViewSite.tsx
|
|
4
|
+
import { Button } from "@mui/material";
|
|
5
|
+
import { ArrowUpRight } from "lucide-react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var AdminViewSite = () => /* @__PURE__ */ jsx(
|
|
8
|
+
Button,
|
|
9
|
+
{
|
|
10
|
+
className: "admin-view-site",
|
|
11
|
+
component: "a",
|
|
12
|
+
endIcon: /* @__PURE__ */ jsx(ArrowUpRight, { "aria-hidden": "true", size: 16 }),
|
|
13
|
+
href: "/",
|
|
14
|
+
rel: "noreferrer",
|
|
15
|
+
size: "small",
|
|
16
|
+
target: "_blank",
|
|
17
|
+
variant: "outlined",
|
|
18
|
+
children: "Xem website"
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
var MinimalViewSite_default = AdminViewSite;
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
MinimalViewSite_default
|
|
25
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// src/admin/MinimalThemeToggle.tsx
|
|
4
|
+
import { Switch, Tooltip } from "@mui/material";
|
|
5
|
+
import { useTheme } from "@payloadcms/ui";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var AdminThemeToggle = () => {
|
|
8
|
+
const { setTheme, theme } = useTheme();
|
|
9
|
+
const isDark = theme === "dark";
|
|
10
|
+
const label = isDark ? "Chuy\u1EC3n sang giao di\u1EC7n s\xE1ng" : "Chuy\u1EC3n sang giao di\u1EC7n t\u1ED1i";
|
|
11
|
+
return /* @__PURE__ */ jsx(Tooltip, { title: label, children: /* @__PURE__ */ jsx(
|
|
12
|
+
Switch,
|
|
13
|
+
{
|
|
14
|
+
checked: isDark,
|
|
15
|
+
className: "admin-theme-toggle",
|
|
16
|
+
inputProps: { "aria-label": label },
|
|
17
|
+
onChange: () => setTheme(isDark ? "light" : "dark"),
|
|
18
|
+
size: "small"
|
|
19
|
+
}
|
|
20
|
+
) });
|
|
21
|
+
};
|
|
22
|
+
var MinimalThemeToggle_default = AdminThemeToggle;
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
MinimalThemeToggle_default
|
|
26
|
+
};
|