@rnaga/wp-next-admin 1.1.1 → 1.1.3
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/client/components/RootLayout.d.ts +4 -0
- package/client/components/RootLayout.d.ts.map +1 -1
- package/client/components/RootLayout.js +2 -2
- package/client/components/WrapperRootLayout.d.ts +4 -0
- package/client/components/WrapperRootLayout.d.ts.map +1 -1
- package/client/components/contents/blogs/Edit.d.ts.map +1 -1
- package/client/components/contents/blogs/Edit.js +0 -1
- package/client/components/contents/dashboard/index.d.ts.map +1 -1
- package/client/components/contents/dashboard/index.js +1 -18
- package/client/components/contents/revisions/List/History.d.ts.map +1 -1
- package/client/components/contents/revisions/List/History.js +0 -1
- package/client/components/contents/settings/index.d.ts.map +1 -1
- package/client/components/contents/settings/index.js +1 -1
- package/client/components/contents/sites/Delete.d.ts.map +1 -1
- package/client/components/contents/sites/Delete.js +0 -1
- package/client/components/contents/sites/Edit.d.ts.map +1 -1
- package/client/components/contents/sites/Edit.js +1 -7
- package/client/components/contents/users/Edit/Roles/Edit.d.ts.map +1 -1
- package/client/components/contents/users/Edit/Roles/Edit.js +0 -1
- package/client/components/contents/users/Edit/index.d.ts.map +1 -1
- package/client/components/contents/users/Edit/index.js +0 -1
- package/client/components/layout/header/index.d.ts.map +1 -1
- package/client/components/layout/header/index.js +25 -2
- package/client/components/utils/post/settings/Summary.d.ts.map +1 -1
- package/client/components/utils/post/settings/Summary.js +0 -1
- package/client/hooks/use-admin-navigation.d.ts.map +1 -1
- package/client/hooks/use-admin-navigation.js +1 -0
- package/client/utils/get-default-admin-hooks.d.ts.map +1 -1
- package/client/utils/get-default-admin-hooks.js +1 -0
- package/client/wp-hooks/index.d.ts.map +1 -1
- package/client/wp-hooks/index.js +1 -0
- package/package.json +1 -1
- package/server/actions/dashboard.d.ts +1 -1
- package/server/components/RootLayout.d.ts.map +1 -1
- package/server/components/RootLayout.js +6 -5
- package/types/client/menus.d.ts +7 -1
- package/types/hooks/filters.d.ts +16 -2
|
@@ -8,6 +8,10 @@ export declare const RootLayout: (props: {
|
|
|
8
8
|
adminUser: types.client.AdminUser;
|
|
9
9
|
defaultMenuSegment: types.client.AdminPageSegment;
|
|
10
10
|
session: Session;
|
|
11
|
+
logging?: {
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
level?: "debug" | "info" | "warn" | "error";
|
|
14
|
+
};
|
|
11
15
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
16
|
export default RootLayout;
|
|
13
17
|
//# sourceMappingURL=RootLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RootLayout.d.ts","sourceRoot":"","sources":["../../../src/client/components/RootLayout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,OAAO,KAAK,KAAK,WAAW,MAAM,2BAA2B,CAAC;AAE9D,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAE1C,eAAO,MAAM,UAAU,GAAI,OAAO;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;IAC7B,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;IAC9B,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;IAClC,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAClD,OAAO,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RootLayout.d.ts","sourceRoot":"","sources":["../../../src/client/components/RootLayout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,OAAO,KAAK,KAAK,WAAW,MAAM,2BAA2B,CAAC;AAE9D,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAE1C,eAAO,MAAM,UAAU,GAAI,OAAO;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;IAC7B,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;IAC9B,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;IAClC,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;KAC7C,CAAC;CACH,4CAwBA,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { WPProvider } from "@rnaga/wp-next-core/client/wp";
|
|
|
5
5
|
import { WPAdminProvider } from "../wp-admin";
|
|
6
6
|
import { initialState } from "../wp-admin/initial-global-state";
|
|
7
7
|
export const RootLayout = (props) => {
|
|
8
|
-
const { site, user, adminUser, children, session, defaultMenuSegment } = props;
|
|
9
|
-
return (_jsx(SessionProvider, { session: session, children: _jsx(WPProvider, { initialState: initialState, user: user, children: _jsx(WPAdminProvider, { site: site, adminUser: adminUser, defaultMenuSegment: defaultMenuSegment, children: children }) }) }));
|
|
8
|
+
const { site, user, adminUser, children, session, defaultMenuSegment, logging, } = props;
|
|
9
|
+
return (_jsx(SessionProvider, { session: session, children: _jsx(WPProvider, { initialState: initialState, user: user, logging: logging, children: _jsx(WPAdminProvider, { site: site, adminUser: adminUser, defaultMenuSegment: defaultMenuSegment, children: children }) }) }));
|
|
10
10
|
};
|
|
11
11
|
export default RootLayout;
|
|
@@ -5,5 +5,9 @@ export declare const WrapperRootLayout: import("react").ComponentType<{
|
|
|
5
5
|
adminUser: import("../../types/client").AdminUser;
|
|
6
6
|
defaultMenuSegment: import("../../types/client").AdminPageSegment;
|
|
7
7
|
session: import("next-auth").Session;
|
|
8
|
+
logging?: {
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
level?: "debug" | "info" | "warn" | "error";
|
|
11
|
+
};
|
|
8
12
|
}>;
|
|
9
13
|
//# sourceMappingURL=WrapperRootLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WrapperRootLayout.d.ts","sourceRoot":"","sources":["../../../src/client/components/WrapperRootLayout.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"WrapperRootLayout.d.ts","sourceRoot":"","sources":["../../../src/client/components/WrapperRootLayout.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB;;;;;;;;eAMwc,CAAC;aAAoB,CAAC;;EAD3f,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Edit.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/contents/blogs/Edit.tsx"],"names":[],"mappings":"AAsBA,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"Edit.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/contents/blogs/Edit.tsx"],"names":[],"mappings":"AAsBA,eAAO,MAAM,IAAI,sDA0RhB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/contents/dashboard/index.tsx"],"names":[],"mappings":"AAgDA,eAAO,MAAM,SAAS,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/contents/dashboard/index.tsx"],"names":[],"mappings":"AAgDA,eAAO,MAAM,SAAS,+CAoQrB,CAAC"}
|
|
@@ -52,7 +52,6 @@ export const Dashboard = () => {
|
|
|
52
52
|
fetchActivity();
|
|
53
53
|
}, [refreshValue().content]);
|
|
54
54
|
const handleSubmit = async (data) => {
|
|
55
|
-
console.log(formData);
|
|
56
55
|
formData.post_author = user?.ID;
|
|
57
56
|
formData.post_title = data.post_title;
|
|
58
57
|
formData.post_content = data.post_content;
|
|
@@ -94,23 +93,7 @@ export const Dashboard = () => {
|
|
|
94
93
|
format: "MMM Do YY, h:mm a",
|
|
95
94
|
}) }), _jsx(Td, { children: _jsx(PostEditLink, { post: post }) })] }, `posts-${post.ID}`))) }) }), _jsx(Divider, {}), _jsx(Typography, { size: "medium", bold: true, children: "Recent Comments" }), _jsx(Table, { stripe: "even", ariaLabel: "table variants", sx: { borderCollapse: "inherit" }, children: _jsx("tbody", { children: dashboard?.activity.comments.map((comment) => (_jsx(Tr, { children: _jsx(Td, { children: _jsxs(Stack, { spacing: 0.5, children: [_jsxs(Typography, { children: ["From ", _jsx("b", { children: comment.comment_author }), " on", " ", _jsx("b", { children: comment.post_title })] }), _jsx(Typography, { sx: {
|
|
96
95
|
p: 1,
|
|
97
|
-
}, children: comment.comment_content }), userCan("edit_comment", comment) && (_jsx(Comments.ActionLink, { comment: comment }))] }) }) }, `comments-${comment.comment_ID}`))) }) })] })] }) }), userCan("edit_posts") && (_jsx(Grid, { size: { xs: 12, md: 6 }, children: _jsxs(Card, { variant: "outlined", children: [_jsx(Typography, { size: "large", bold: true, children: "Quick Drafts" }), _jsx(Divider, {}), _jsx("form", { onSubmit: submit(handleSubmit), children: _jsxs(Stack, { spacing: 1, sx: { display: "grid", gridTemplateColumns: "1fr" }, children: [_jsxs(FormControl, { children: [_jsx(FormLabel, { children: _jsx(Typography, { size: "medium", children: "Title" }) }), _jsx(Input, { size: "medium", name: "post_title" })] }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: _jsx(Typography, { size: "medium", children: "Content" }) }), _jsx(LightEditor
|
|
98
|
-
//editorKey="post-draft"
|
|
99
|
-
//initialValue=""
|
|
100
|
-
// minHeight={200}
|
|
101
|
-
// onChange={(content) => {
|
|
102
|
-
// console.log(content);
|
|
103
|
-
// setFormData({ post_content: content });
|
|
104
|
-
// }}
|
|
105
|
-
, {
|
|
106
|
-
//editorKey="post-draft"
|
|
107
|
-
//initialValue=""
|
|
108
|
-
// minHeight={200}
|
|
109
|
-
// onChange={(content) => {
|
|
110
|
-
// console.log(content);
|
|
111
|
-
// setFormData({ post_content: content });
|
|
112
|
-
// }}
|
|
113
|
-
minHeight: 200, onUpdate: (editor, transaction) => {
|
|
96
|
+
}, children: comment.comment_content }), userCan("edit_comment", comment) && (_jsx(Comments.ActionLink, { comment: comment }))] }) }) }, `comments-${comment.comment_ID}`))) }) })] })] }) }), userCan("edit_posts") && (_jsx(Grid, { size: { xs: 12, md: 6 }, children: _jsxs(Card, { variant: "outlined", children: [_jsx(Typography, { size: "large", bold: true, children: "Quick Drafts" }), _jsx(Divider, {}), _jsx("form", { onSubmit: submit(handleSubmit), children: _jsxs(Stack, { spacing: 1, sx: { display: "grid", gridTemplateColumns: "1fr" }, children: [_jsxs(FormControl, { children: [_jsx(FormLabel, { children: _jsx(Typography, { size: "medium", children: "Title" }) }), _jsx(Input, { size: "medium", name: "post_title" })] }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: _jsx(Typography, { size: "medium", children: "Content" }) }), _jsx(LightEditor, { minHeight: 200, onUpdate: (editor, transaction) => {
|
|
114
97
|
setFormData({ post_content: editor.getHTML() });
|
|
115
98
|
} })] }), _jsx(Button, { type: "submit", children: "Save Draft" })] }) }), _jsx(Divider, {}), _jsx(Typography, { size: "medium", children: "Your Recent Drafts" }), _jsx(Table, { children: _jsx("tbody", { children: dashboard?.postDrafts.map((post) => (_jsx(Tr, { children: _jsxs(Td, { children: [_jsxs(Typography, { display: "block", children: [_jsx(PostEditLink, { post: post }), " ", formatting.date(post.post_date, {
|
|
116
99
|
format: "MMM Do YY",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"History.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/revisions/List/History.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,WAAW,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,GAAG,CAAC;AAO1C,eAAO,MAAM,OAAO,GAAI,OAAO;IAC7B,SAAS,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC;IAC1C,OAAO,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC/C,
|
|
1
|
+
{"version":3,"file":"History.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/revisions/List/History.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,WAAW,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,GAAG,CAAC;AAO1C,eAAO,MAAM,OAAO,GAAI,OAAO;IAC7B,SAAS,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC;IAC1C,OAAO,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC/C,mDA8DA,CAAC"}
|
|
@@ -11,7 +11,6 @@ export const History = (props) => {
|
|
|
11
11
|
setSelectedId(revisions?.[0]?.ID);
|
|
12
12
|
}, []);
|
|
13
13
|
const handleClick = (revision) => {
|
|
14
|
-
console.log("revision.target?.ID", revision.target?.ID, selectedId);
|
|
15
14
|
setSelectedId(revision.target?.ID);
|
|
16
15
|
onClick(revision);
|
|
17
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/contents/settings/index.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/contents/settings/index.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,QAAQ,sDAuLpB,CAAC"}
|
|
@@ -55,7 +55,7 @@ export const Settings = () => {
|
|
|
55
55
|
}, value: options.timezone_string || "Etc/UTC", items: moment.tz.names().map((name) => ({
|
|
56
56
|
label: name,
|
|
57
57
|
value: name,
|
|
58
|
-
})), disableClearable: true })] }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Default Post Category" }), _jsx(SelectWPTerm, { size: "medium", taxonomy: "category", defaultValue: options.default_category, onChange: (term) => setFormData({ default_category: term.term_id }) })] }), !site.isMultiSite && (_jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Membership" }), _jsx(Checkbox, { size: "medium", defaultChecked: options.users_can_register == "1", onChange: handleCheckbox("users_can_register"), label: "Anyone can register" })] })), _jsxs(Stack, { spacing: 1.5, children: [_jsx(FormLabel, { children: "Comments Settings" }), _jsx(Checkbox, { size: "medium", defaultChecked: options.require_name_email == "1", onChange: handleCheckbox("require_name_email"), label: "Comment author must fill out name and email" }), _jsx(Checkbox, { size: "medium", value: 1, name: "comment_registration", defaultChecked: options.comment_registration == "1",
|
|
58
|
+
})), disableClearable: true })] }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Default Post Category" }), _jsx(SelectWPTerm, { size: "medium", taxonomy: "category", defaultValue: options.default_category, onChange: (term) => setFormData({ default_category: term.term_id }) })] }), !site.isMultiSite && (_jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Membership" }), _jsx(Checkbox, { size: "medium", defaultChecked: options.users_can_register == "1", onChange: handleCheckbox("users_can_register"), label: "Anyone can register" })] })), _jsxs(Stack, { spacing: 1.5, children: [_jsx(FormLabel, { children: "Comments Settings" }), _jsx(Checkbox, { size: "medium", defaultChecked: options.require_name_email == "1", onChange: handleCheckbox("require_name_email"), label: "Comment author must fill out name and email" }), _jsx(Checkbox, { size: "medium", value: 1, name: "comment_registration", defaultChecked: options.comment_registration == "1", label: "Users must be registered and logged in to comment" }), _jsx(Checkbox, { size: "medium", value: 1, defaultChecked: options.comment_moderation == "1", onChange: handleCheckbox("comment_moderation"), label: "Comment must be manually approved" }), _jsx(Checkbox, { size: "medium", value: 1, defaultChecked: options.comment_previously_approved == "1", onChange: handleCheckbox("comment_previously_approved"), label: "Comment author must have a previously approved comment" }), _jsx(FormLabel, { children: "Comment Moderation" }), _jsx(InputMultiple, { size: "medium", onChange: (value) => {
|
|
59
59
|
setFormData({ moderation_keys: value.join("\n") });
|
|
60
60
|
}, value: 0 >= options?.moderation_keys.length
|
|
61
61
|
? undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Delete.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/contents/sites/Delete.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"Delete.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/contents/sites/Delete.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,MAAM,sDAkOlB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Edit.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/contents/sites/Edit.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"Edit.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/contents/sites/Edit.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,IAAI,sDAkOhB,CAAC"}
|
|
@@ -53,7 +53,6 @@ export const Edit = () => {
|
|
|
53
53
|
});
|
|
54
54
|
}, [siteId]);
|
|
55
55
|
const handleFormMetaChange = (key, value) => {
|
|
56
|
-
console.log("handleFormMetaChange", key, value);
|
|
57
56
|
setFormData({
|
|
58
57
|
...formData,
|
|
59
58
|
meta_input: {
|
|
@@ -63,7 +62,6 @@ export const Edit = () => {
|
|
|
63
62
|
});
|
|
64
63
|
};
|
|
65
64
|
const handleSubmit = async (data) => {
|
|
66
|
-
console.log("data", data);
|
|
67
65
|
const result = await execute(actions.site.update(siteId, data)).then(safeParse);
|
|
68
66
|
if (!result.success) {
|
|
69
67
|
overlay.snackbar.open("error", result.error);
|
|
@@ -87,9 +85,7 @@ export const Edit = () => {
|
|
|
87
85
|
? [true]
|
|
88
86
|
: [false, "Value can only contain lowercase letters (a-z) and numbers"];
|
|
89
87
|
};
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
console.log("Edit useEffect", formData);
|
|
92
|
-
}, [formData]);
|
|
88
|
+
useEffect(() => { }, [formData]);
|
|
93
89
|
if (!site) {
|
|
94
90
|
return null;
|
|
95
91
|
}
|
|
@@ -98,7 +94,6 @@ export const Edit = () => {
|
|
|
98
94
|
justifyContent: "flex-end",
|
|
99
95
|
gap: 1.5,
|
|
100
96
|
}, children: [_jsx(Button, { size: "medium", type: "submit", children: "Save" }), siteId > 1 && (_jsx(IconButtonDelete, { title: "Delete Site", onClick: handleDelete }))] }), _jsxs(Stack, { spacing: 2, sx: { rowGap: 1, display: "flex" }, children: [_jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Site Name" }), _jsx(Input, { size: "medium", value: formData.meta_input?.["site_name"], placeholder: "Site Name", onChange: (value) => handleFormMetaChange("site_name", value) })] }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Site Admin Email" }), _jsx(Input, { size: "medium", value: formData.meta_input?.["admin_email"], placeholder: "Site Admin Email", onChange: (value) => handleFormMetaChange("admin_email", value) })] }), _jsxs(Box, { sx: { display: "grid", gap: 1.5, gridTemplateColumns: "1fr 1fr" }, children: [_jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Domain" }), _jsx(Input, { size: "medium", value: site.domain })] }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Path" }), _jsx(Input, { size: "medium", name: "path", value: site.path })] })] }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Add New Users" }), _jsx(Checkbox, { size: "medium", defaultChecked: site.site_meta.add_new_users == "1", onChange: (e) => {
|
|
101
|
-
console.log(e.target.checked);
|
|
102
97
|
handleFormMetaChange("add_new_users", e.target.checked ? 1 : 0);
|
|
103
98
|
}, label: "Allow administrators to add new users" })] }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Allow new registrations" }), _jsx(Select, { size: "medium", value: formData.meta_input?.["registration"] || "none", onChange: (value) => handleFormMetaChange("registration", value), enum: [
|
|
104
99
|
{ value: "none", label: "Registration is disabled" },
|
|
@@ -112,7 +107,6 @@ export const Edit = () => {
|
|
|
112
107
|
label: "Both sites and user accounts can be registered",
|
|
113
108
|
},
|
|
114
109
|
] })] }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Banned Names" }), _jsx(InputMultiple, { onChange: (value) => handleFormMetaChange("illegal_names", value), validate: validateName, value: formData.meta_input?.["illegal_names"] || [], limitTags: 15 })] }), _jsxs(Box, { sx: { display: "grid", gap: 1.5, gridTemplateColumns: "1fr 1fr" }, children: [_jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Limited Email Registrations" }), _jsx(InputMultiple, { size: "medium", onChange: (value) => {
|
|
115
|
-
console.log("value", value);
|
|
116
110
|
handleFormMetaChange("limited_email_domains", value);
|
|
117
111
|
}, value: formData.meta_input?.["limited_email_domains"] || [], validate: validateDomain, limitTags: 5 })] }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Banned Email Domains" }), _jsx(InputMultiple, { size: "medium", onChange: (value) => {
|
|
118
112
|
handleFormMetaChange("banned_email_domains", value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Edit.d.ts","sourceRoot":"","sources":["../../../../../../../src/client/components/contents/users/Edit/Roles/Edit.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAarD,eAAO,MAAM,IAAI,GAAI,OAAO;IAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;CACrC,
|
|
1
|
+
{"version":3,"file":"Edit.d.ts","sourceRoot":"","sources":["../../../../../../../src/client/components/contents/users/Edit/Roles/Edit.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAarD,eAAO,MAAM,IAAI,GAAI,OAAO;IAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;CACrC,mDAmFA,CAAC"}
|
|
@@ -46,7 +46,6 @@ export const Edit = (props) => {
|
|
|
46
46
|
})), value: selectedRoleNames, onChange: (items) => {
|
|
47
47
|
const newRoleNames = items.map((item) => item.id);
|
|
48
48
|
setValues(newRoleNames);
|
|
49
|
-
console.log("onChange", items);
|
|
50
49
|
}, slotSxProps: {
|
|
51
50
|
input: { minWidth: "300px", minHeight: "28px" },
|
|
52
51
|
}, limitTags: 5 }), _jsx(Tooltip, { title: "Update Roles", placement: "top", children: _jsx(IconButton, { color: "success", size: "small", onClick: handleUpdateRole, children: _jsx(DoneIcon, {}) }) }), _jsx(Tooltip, { title: "Cancel", placement: "top", children: _jsx(IconButton, { color: "error", size: "small", onClick: onCancelEdit, children: _jsx(CancelIcon, {}) }) })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/users/Edit/index.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,IAAI,GAAI,QAAQ;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/users/Edit/index.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,IAAI,GAAI,QAAQ;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,mDA2FpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/layout/header/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/layout/header/index.tsx"],"names":[],"mappings":"AA6LA,eAAO,MAAM,MAAM,+CA2NlB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo, useRef, useState } from "react";
|
|
3
|
+
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import BookIcon from "@mui/icons-material/Book";
|
|
5
5
|
import HomeIcon from "@mui/icons-material/Home";
|
|
6
6
|
import HomeWorkIcon from "@mui/icons-material/HomeWork";
|
|
@@ -9,6 +9,7 @@ import PersonIcon from "@mui/icons-material/Person";
|
|
|
9
9
|
import ViewSidebarIcon from "@mui/icons-material/ViewSidebar";
|
|
10
10
|
import WebIcon from "@mui/icons-material/Web";
|
|
11
11
|
import { Box, IconButton, MenuItem, MenuList } from "@mui/material";
|
|
12
|
+
import { useWP } from "@rnaga/wp-next-core/client/wp";
|
|
12
13
|
import { PopperMenu } from "@rnaga/wp-next-ui/PopperMenu";
|
|
13
14
|
import { useWPTheme } from "@rnaga/wp-next-ui/ThemeRegistry";
|
|
14
15
|
import { Typography } from "@rnaga/wp-next-ui/Typography";
|
|
@@ -97,13 +98,35 @@ export const Header = () => {
|
|
|
97
98
|
const { wp: { viewport }, site: currentSite, sidebar, } = useWPAdmin();
|
|
98
99
|
const { user } = useAdminUser();
|
|
99
100
|
const { wpRawTheme } = useWPTheme();
|
|
101
|
+
const wpAdmin = useWPAdmin();
|
|
102
|
+
const adminNavigation = useAdminNavigation();
|
|
103
|
+
const { wpHooks } = useWP();
|
|
100
104
|
const homeButtonRef = useRef(null);
|
|
101
105
|
const [openHomeMenu, setOpenHomeMenu] = useState(false);
|
|
102
106
|
const manageSiteButtonRef = useRef(null);
|
|
103
107
|
const [openManageSiteMenu, setOpenManageSiteMenu] = useState(false);
|
|
108
|
+
const [customMenuComponents, setCustomMenuComponents] = useState([]);
|
|
104
109
|
const profileKey = useMemo(() => {
|
|
105
110
|
return `profile-${currentSite.settings.timezone}-${user?.ID}`;
|
|
106
111
|
}, [currentSite.settings.timezone, user]);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
const newCustomMenus = wpHooks.filter.apply("next_admin_bar_menu", [], {
|
|
114
|
+
wpAdmin,
|
|
115
|
+
navigation: adminNavigation,
|
|
116
|
+
wpRawTheme,
|
|
117
|
+
});
|
|
118
|
+
const newCustomMenuComponents = [];
|
|
119
|
+
for (const menu of newCustomMenus) {
|
|
120
|
+
// Check if the menu has role restriction.
|
|
121
|
+
// If not, show the menu. If yes, check if the user has the capability.
|
|
122
|
+
if (!menu.roles ||
|
|
123
|
+
menu.roles.length === 0 ||
|
|
124
|
+
menu.roles.some((role) => user?.role.names.has(role))) {
|
|
125
|
+
newCustomMenuComponents.push(_jsx(React.Fragment, { children: menu.component }, newCustomMenuComponents.length));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
setCustomMenuComponents(newCustomMenuComponents);
|
|
129
|
+
}, [wpAdmin.site.blogId, user?.ID]);
|
|
107
130
|
return (_jsxs(Box
|
|
108
131
|
//variant="solid"
|
|
109
132
|
, {
|
|
@@ -172,5 +195,5 @@ export const Header = () => {
|
|
|
172
195
|
}, anchorOrigin: {
|
|
173
196
|
vertical: "bottom",
|
|
174
197
|
horizontal: "center",
|
|
175
|
-
}, children: _jsx(MenuList, { children: _jsx(ManageSiteMenuItems, {}) }) })] }))] }), _jsx(Profile, {}, profileKey)] }));
|
|
198
|
+
}, children: _jsx(MenuList, { children: _jsx(ManageSiteMenuItems, {}) }) })] })), customMenuComponents.length > 0 && _jsx(Box, { children: customMenuComponents })] }), _jsx(Profile, {}, profileKey)] }));
|
|
176
199
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Summary.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/utils/post/settings/Summary.tsx"],"names":[],"mappings":"AAsCA,eAAO,MAAM,OAAO,+
|
|
1
|
+
{"version":3,"file":"Summary.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/utils/post/settings/Summary.tsx"],"names":[],"mappings":"AAsCA,eAAO,MAAM,OAAO,+CAoFnB,CAAC"}
|
|
@@ -42,7 +42,6 @@ export const Summary = () => {
|
|
|
42
42
|
{ label: "Pending", value: "pending" },
|
|
43
43
|
{ label: "Future", value: "future" },
|
|
44
44
|
], value: formData?.post_status ?? "publish", onChange: (value) => {
|
|
45
|
-
console.log("Selected weight:", value);
|
|
46
45
|
setFormData({ post_status: value });
|
|
47
46
|
} }) }), _jsx(FormContent, { label: "Publish Date", children: _jsxs(Box, { children: [_jsx(DateTimePicker, { size: "medium", value: formData.post_date, onChange: (newValue) => {
|
|
48
47
|
setFormData({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-admin-navigation.d.ts","sourceRoot":"","sources":["../../../src/client/hooks/use-admin-navigation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-admin-navigation.d.ts","sourceRoot":"","sources":["../../../src/client/hooks/use-admin-navigation.ts"],"names":[],"mappings":"AAEA,OAAO,WAAW,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAIhG,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AAGrC,OAAO,KAAK,KAAK,WAAW,MAAM,2BAA2B,CAAC;AAM9D,eAAO,MAAM,kBAAkB,GAAI,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;;;;;2BAkDlD,KAAK,CAAC,MAAM,CAAC,gBAAgB,YAC5B,OAAO,CAAC;QAChB,QAAQ,EAAE,OAAO,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,WAAW,CAAC,mBAAmB,CAAC;KAC/C,CAAC,KACD,MAAM;qBAWD,MAAM,YACF,OAAO,CAAC;QAChB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACvC,WAAW,CAAC,EAAE,WAAW,CAAC,mBAAmB,CAAC;KAC/C,CAAC;;;;;;;;;;;qBA/CK,CAAC,MAAM,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,EAAE;;;;;;;CAgFjE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-default-admin-hooks.d.ts","sourceRoot":"","sources":["../../../src/client/utils/get-default-admin-hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-default-admin-hooks.d.ts","sourceRoot":"","sources":["../../../src/client/utils/get-default-admin-hooks.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,6LAAc,CAAC;AAChD,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/wp-hooks/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/wp-hooks/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,eAAO,MAAM,KAAK,uEAA6D,CAAC"}
|
package/client/wp-hooks/index.js
CHANGED
package/package.json
CHANGED
|
@@ -108,6 +108,7 @@ export declare const activity: () => Promise<import("@rnaga/wp-next-core/types/s
|
|
|
108
108
|
post_parent: string;
|
|
109
109
|
post_name: string;
|
|
110
110
|
post_title: string;
|
|
111
|
+
menu_order: string;
|
|
111
112
|
post_date_gmt: string;
|
|
112
113
|
post_content: string;
|
|
113
114
|
post_excerpt: string;
|
|
@@ -120,7 +121,6 @@ export declare const activity: () => Promise<import("@rnaga/wp-next-core/types/s
|
|
|
120
121
|
post_modified_gmt: string;
|
|
121
122
|
post_content_filtered: string;
|
|
122
123
|
guid: string;
|
|
123
|
-
menu_order: string;
|
|
124
124
|
post_type: string;
|
|
125
125
|
post_mime_type: string;
|
|
126
126
|
comment_count: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RootLayout.d.ts","sourceRoot":"","sources":["../../../src/server/components/RootLayout.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RootLayout.d.ts","sourceRoot":"","sources":["../../../src/server/components/RootLayout.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,eAAO,MAAM,UAAU,GAAU,OAAO;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qDAsGpE,CAAC"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { redirect } from "next/navigation";
|
|
3
|
-
import { WrapperRootLayout as ClientRootLayout } from "../../client/components/WrapperRootLayout";
|
|
4
|
-
import * as actionsAdminUser from "@rnaga/wp-next-core/server/actions/admin-user";
|
|
5
3
|
import { AuthError } from "@rnaga/wp-next-core/client/components/auth";
|
|
4
|
+
import * as actionsAdminUser from "@rnaga/wp-next-core/server/actions/admin-user";
|
|
5
|
+
import { getLoggingConfig, logger, } from "@rnaga/wp-next-core/server/utils/logger";
|
|
6
|
+
import { WrapperRootLayout as ClientRootLayout } from "../../client/components/WrapperRootLayout";
|
|
6
7
|
import { WPAdmin } from "../wp-admin";
|
|
7
8
|
export const RootLayout = async (props) => {
|
|
8
9
|
const { children } = props;
|
|
9
10
|
const { wp, session, paths, basePath, blogBasePath, blogId, siteId, pageSegment, } = await WPAdmin();
|
|
10
11
|
const blogName = (await wp.options.get("blogname")) ?? "";
|
|
11
12
|
if (!wp.current.user || !wp.current.user.props) {
|
|
12
|
-
|
|
13
|
+
logger.info("User not found. If this occurs even after a successful login,", "check if all the necessary hooks are installed and activated.", "Specifically, check if NextCoreInit is properly added by getAdminHooks().");
|
|
13
14
|
return (_jsx(AuthError, { error: "User not found. Please login again.", showLogoutLink: true }));
|
|
14
15
|
}
|
|
15
16
|
if (!process.env.BASE_URL) {
|
|
16
|
-
|
|
17
|
+
logger.info("Base URL not found. Check if the environment variable BASE_URL is set.");
|
|
17
18
|
return (_jsx(AuthError, { error: "Base URL not found. Check if the environment variable BASE_URL is set." }));
|
|
18
19
|
}
|
|
19
20
|
const baseUrl = process.env.BASE_URL;
|
|
@@ -53,5 +54,5 @@ export const RootLayout = async (props) => {
|
|
|
53
54
|
names: new Set(role.names),
|
|
54
55
|
capabilities: new Set(responseAdminUser.data.role.capabilities),
|
|
55
56
|
},
|
|
56
|
-
}, adminUser: currentAdminUser, session: session, children: children }));
|
|
57
|
+
}, adminUser: currentAdminUser, session: session, logging: getLoggingConfig(), children: children }));
|
|
57
58
|
};
|
package/types/client/menus.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface AdminPageSegmentMap {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
type AdminPageSegment<
|
|
8
|
-
K extends keyof AdminPageSegmentMap = keyof AdminPageSegmentMap
|
|
8
|
+
K extends keyof AdminPageSegmentMap = keyof AdminPageSegmentMap,
|
|
9
9
|
> = AdminPageSegmentMap[K] extends true ? keyof AdminPageSegmentMap : never;
|
|
10
10
|
|
|
11
11
|
export type AdminMenu = AdminMenuComponent | AdminOnclick;
|
|
@@ -37,3 +37,9 @@ export interface AdminOnclick {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export type AdminMenus = Map<keyof AdminPageSegment, AdminMenu[]>;
|
|
40
|
+
|
|
41
|
+
export type AdminBarMenus = Array<{
|
|
42
|
+
component: React.ReactNode;
|
|
43
|
+
roles?: string[];
|
|
44
|
+
onClick?: () => void;
|
|
45
|
+
}>;
|
package/types/hooks/filters.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
AdminBarMenus,
|
|
3
|
+
AdminMenu,
|
|
4
|
+
AdminPageSegment,
|
|
5
|
+
} from "../client/menus";
|
|
2
6
|
import type { WPAdmin } from "../client";
|
|
3
7
|
|
|
4
8
|
import { experimental_extendTheme as materialExtendTheme } from "@mui/material/styles";
|
|
5
9
|
import { Context } from "@rnaga/wp-node/core/context";
|
|
6
10
|
|
|
7
11
|
import { useAdminNavigation } from "../../client/hooks/use-admin-navigation";
|
|
8
|
-
|
|
12
|
+
|
|
13
|
+
import type { WPTheme } from "@rnaga/wp-next-ui/types";
|
|
9
14
|
|
|
10
15
|
export {};
|
|
11
16
|
|
|
@@ -28,6 +33,15 @@ declare module "@rnaga/wp-next-core/types/hooks/filters.d" {
|
|
|
28
33
|
}
|
|
29
34
|
) => AdminMenu[];
|
|
30
35
|
|
|
36
|
+
next_admin_bar_menu: (
|
|
37
|
+
menus: AdminBarMenus,
|
|
38
|
+
params: {
|
|
39
|
+
wpAdmin: WPAdmin;
|
|
40
|
+
navigation: AdminNavigation;
|
|
41
|
+
wpRawTheme: WPTheme;
|
|
42
|
+
}
|
|
43
|
+
) => AdminBarMenus;
|
|
44
|
+
|
|
31
45
|
next_admin_preload_modal: (
|
|
32
46
|
components: React.ReactNode[],
|
|
33
47
|
params: {
|