Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/actions/page-template-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
DEFAULT_CURRENT_PAGE,
DEFAULT_ORDER_DIR,
DEFAULT_PER_PAGE,
PAGE_MODULES_DOWNLOAD,
PAGES_MODULE_KINDS
} from "../utils/constants";
import { snackbarErrorHandler, snackbarSuccessHandler } from "./base-actions";
Expand All @@ -48,7 +49,7 @@ export const PAGE_TEMPLATE_UNARCHIVED = "PAGE_TEMPLATE_UNARCHIVED";

export const getPageTemplates =
(
term = null,
term = "",
page = DEFAULT_CURRENT_PAGE,
perPage = DEFAULT_PER_PAGE,
order = "id",
Expand Down Expand Up @@ -106,7 +107,7 @@ export const getPageTemplate = (formTemplateId) => async (dispatch) => {

const params = {
access_token: accessToken,
expand: "materials,meta_fields,meta_fields.values"
expand: "modules"
};

return getRequest(
Expand Down Expand Up @@ -160,8 +161,14 @@ const normalizeEntity = (entity) => {
module.file_type_id?.value || module.file_type_id;
}

if (module.kind === PAGES_MODULE_KINDS.DOCUMENT && module.file) {
normalizedModule.file = module.file[0] || null;
if (module.kind === PAGES_MODULE_KINDS.DOCUMENT) {
if (module.type === PAGE_MODULES_DOWNLOAD.FILE) {
normalizedModule.file = module.file[0] || null;
delete normalizedModule.external_url;
} else {
delete normalizedModule.file;
delete normalizedModule.file_id;
}
Comment on lines +164 to +171
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Guard module.file before indexing.

module.file[0] will throw if module.file is undefined or not an array, and can drop existing file objects.

🛠️ Suggested fix
-      if (module.type === PAGE_MODULES_DOWNLOAD.FILE) {
-        normalizedModule.file = module.file[0] || null;
+      if (module.type === PAGE_MODULES_DOWNLOAD.FILE) {
+        const fileValue = Array.isArray(module.file)
+          ? module.file[0]
+          : module.file || null;
+        normalizedModule.file = fileValue;
         delete normalizedModule.external_url;
       } else {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (module.kind === PAGES_MODULE_KINDS.DOCUMENT) {
if (module.type === PAGE_MODULES_DOWNLOAD.FILE) {
normalizedModule.file = module.file[0] || null;
delete normalizedModule.external_url;
} else {
delete normalizedModule.file;
delete normalizedModule.file_id;
}
if (module.kind === PAGES_MODULE_KINDS.DOCUMENT) {
if (module.type === PAGE_MODULES_DOWNLOAD.FILE) {
const fileValue = Array.isArray(module.file)
? module.file[0]
: module.file || null;
normalizedModule.file = fileValue;
delete normalizedModule.external_url;
} else {
delete normalizedModule.file;
delete normalizedModule.file_id;
}
🤖 Prompt for AI Agents
In `@src/actions/page-template-actions.js` around lines 164 - 171, Guard against
indexing module.file by checking its type before accessing [0]; in the
PAGES_MODULE_KINDS.DOCUMENT branch inside the logic that handles
PAGE_MODULES_DOWNLOAD.FILE, replace the direct module.file[0] usage with a safe
assignment that handles arrays, objects and undefined (e.g., if
Array.isArray(module.file) use module.file[0] || null, else if module.file is an
object use module.file, otherwise null) so you don't throw when module.file is
undefined or overwrite existing file objects; update the code that sets
normalizedModule.file and the related deletes accordingly.

}

delete normalizedModule._tempId;
Expand Down
9 changes: 7 additions & 2 deletions src/components/forms/media-upload-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import React from "react";
import T from "i18n-react/dist/i18n-react";
import "awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css";
import { Input, Dropdown } from "openstack-uicore-foundation/lib/components";
import { Dropdown, Input } from "openstack-uicore-foundation/lib/components";
import TextEditorV3 from "openstack-uicore-foundation/lib/components/inputs/editor-input-v3";
import { isEmpty, scrollToError, shallowEqual } from "../../utils/methods";

Expand Down Expand Up @@ -103,6 +103,11 @@ class MediaUploadForm extends React.Component {
.filter((t) => t.class_name === "PresentationType")
.map((t) => ({ value: t.id, label: t.name }));

const mediaFileTypesDDL = mediaFileTypes.map((mft) => ({
value: mft.id,
label: mft.name
}));
Comment on lines +106 to +109
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Guard against undefined mediaFileTypes before .map().

If the prop is briefly undefined while loading, this will throw and break the form.

🛠️ Suggested fix
-    const mediaFileTypesDDL = mediaFileTypes.map((mft) => ({
+    const mediaFileTypesDDL = (mediaFileTypes || []).map((mft) => ({
       value: mft.id,
       label: mft.name
     }));

Also applies to: 191-191

🤖 Prompt for AI Agents
In `@src/components/forms/media-upload-form.js` around lines 106 - 109, The map
over mediaFileTypes can throw when mediaFileTypes is undefined; update the
mapping in media-upload-form.js (the mediaFileTypesDDL creation and the other
mapping around line ~191) to safely handle that by defaulting to an empty array
before mapping (e.g., use (mediaFileTypes || []) or Array.isArray check) so the
code never calls .map on undefined and returns an empty dropdown list until
props load.


return (
<form className="media-upload-form">
<input type="hidden" id="id" value={entity.id} />
Expand Down Expand Up @@ -183,7 +188,7 @@ class MediaUploadForm extends React.Component {
className="right-space"
value={entity.type_id}
placeholder={T.translate("media_upload.placeholders.select_type")}
options={mediaFileTypes}
options={mediaFileTypesDDL}
onChange={this.handleChange}
/>
</div>
Expand Down
12 changes: 5 additions & 7 deletions src/components/inputs/formik-text-editor.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import React from "react";
import TextEditorV3 from "openstack-uicore-foundation/lib/components/inputs/editor-input-v3";
import { useFormikContext } from "formik";
import { useField } from "formik";
import normalizeHtmlString from "../../utils/normalize-html-string";

const FormikTextEditor = ({ name, ...props }) => {
const { values, errors, touched, setFieldValue, setFieldTouched } =
useFormikContext();
const [field, meta, helpers] = useField(name);

return (
<TextEditorV3
name={name}
id={name}
value={values[name]}
value={field.value}
onChange={(e) => {
const stringValue = normalizeHtmlString(e.target.value);
setFieldValue(name, stringValue);
helpers.setValue(stringValue);
}}
onBlur={() => setFieldTouched(name, true)}
error={touched?.[name] && errors?.[name] ? errors?.[name] : ""}
error={meta.touched && meta.error}
Comment on lines 10 to +18
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat -n src/components/inputs/formik-text-editor.js

Repository: fntechgit/summit-admin

Length of output: 947


🏁 Script executed:

fd TextEditorV3 -t js --exec head -20 {} \;

Repository: fntechgit/summit-admin

Length of output: 235


🏁 Script executed:

rg "useField|useFormik|connect" src/components/inputs/formik-text-editor.js -A 5

Repository: fntechgit/summit-admin

Length of output: 334


🏁 Script executed:

rg "TextEditorV3" -t jsx -t js -A 3 src/

Repository: fntechgit/summit-admin

Length of output: 93


🏁 Script executed:

rg "useField" -t jsx -t js -B 2 -A 10 src/components/inputs/

Repository: fntechgit/summit-admin

Length of output: 93


🏁 Script executed:

fd formik -t js src/components/inputs/ --exec basename {} \;

Repository: fntechgit/summit-admin

Length of output: 235


🏁 Script executed:

rg "TextEditorV3" src/ -A 3

Repository: fntechgit/summit-admin

Length of output: 18232


🏁 Script executed:

rg "useField" src/components/inputs/ -B 2 -A 10

Repository: fntechgit/summit-admin

Length of output: 1367


🏁 Script executed:

find src/components/inputs -name "*formik*"

Repository: fntechgit/summit-admin

Length of output: 109


🏁 Script executed:

rg "useField|useFormik" src/components/inputs/ -A 8

Repository: fntechgit/summit-admin

Length of output: 1022


🏁 Script executed:

find src/components/inputs -name "formik-*" -exec basename {} \;

Repository: fntechgit/summit-admin

Length of output: 87


🏁 Script executed:

rg "helpers\." src/components/inputs/ -B 3 -A 2

Repository: fntechgit/summit-admin

Length of output: 534


🏁 Script executed:

rg "FormikTextEditor" src/ -B 2 -A 3

Repository: fntechgit/summit-admin

Length of output: 12133


🏁 Script executed:

find src -name "*.test.*" -o -name "*.spec.*" | head -20

Repository: fntechgit/summit-admin

Length of output: 1365


🏁 Script executed:

rg "field.onBlur" src/

Repository: fntechgit/summit-admin

Length of output: 152


🏁 Script executed:

cat -n src/components/mui/formik-inputs/mui-formik-textfield.js | head -50

Repository: fntechgit/summit-admin

Length of output: 1576


🏁 Script executed:

rg "onBlur" src/components/mui/formik-inputs/ -B 2 -A 2

Repository: fntechgit/summit-admin

Length of output: 502


Wire onBlur so Formik can mark the field as touched.

Without onBlur, the field's touched state never updates during editing. Validation errors will only appear on submit, not during user interaction. Other Formik field wrappers in the codebase (e.g., MuiFormikTextField) follow the same pattern.

🛠️ Suggested fix
      onChange={(e) => {
        const stringValue = normalizeHtmlString(e.target.value);
        helpers.setValue(stringValue);
      }}
+      onBlur={field.onBlur}
      error={meta.touched && meta.error}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<TextEditorV3
name={name}
id={name}
value={values[name]}
value={field.value}
onChange={(e) => {
const stringValue = normalizeHtmlString(e.target.value);
setFieldValue(name, stringValue);
helpers.setValue(stringValue);
}}
onBlur={() => setFieldTouched(name, true)}
error={touched?.[name] && errors?.[name] ? errors?.[name] : ""}
error={meta.touched && meta.error}
<TextEditorV3
name={name}
id={name}
value={field.value}
onChange={(e) => {
const stringValue = normalizeHtmlString(e.target.value);
helpers.setValue(stringValue);
}}
onBlur={field.onBlur}
error={meta.touched && meta.error}
🤖 Prompt for AI Agents
In `@src/components/inputs/formik-text-editor.js` around lines 10 - 18, The
TextEditorV3 field isn't wiring onBlur to Formik so the field never becomes
touched; add an onBlur handler on the TextEditorV3 that marks the Formik field
as touched (use helpers.setTouched(true)) so validation runs during interaction;
keep the existing onChange (normalizeHtmlString and helpers.setValue) and add
onBlur={() => helpers.setTouched(true)} (or an event-aware variant that calls
helpers.setTouched(true) and forwards the event) to the TextEditorV3 props to
match how other wrappers like MuiFormikTextField behave.

license={process.env.JODIT_LICENSE_KEY}
{...props}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/mui/formik-inputs/mui-formik-datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const MuiFormikDatepicker = ({ name, label, required, ...props }) => {

MuiFormikDatepicker.propTypes = {
name: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
label: PropTypes.string,
required: PropTypes.bool
};

Expand Down
8 changes: 4 additions & 4 deletions src/components/mui/formik-inputs/mui-formik-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
const MuiFormikUpload = ({
id,
name,
onImageDeleted,
onDelete,
maxFiles = MAX_INVENTORY_IMAGES_UPLOAD_QTY
}) => {
const [field, meta, helpers] = useField(name);
Expand Down Expand Up @@ -59,8 +59,8 @@ const MuiFormikUpload = ({
(i) => i.filename !== imageFile.name
);
helpers.setValue(updated);
if (onImageDeleted) {
onImageDeleted(imageFile.id);
if (onDelete) {
onDelete(imageFile.id);
}
};

Expand Down Expand Up @@ -91,7 +91,7 @@ const MuiFormikUpload = ({
MuiFormikUpload.propTypes = {
id: PropTypes.string,
name: PropTypes.string.isRequired,
onImageDeleted: PropTypes.func,
onDelete: PropTypes.func,
maxFiles: PropTypes.number
};

Expand Down
1 change: 1 addition & 0 deletions src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3969,6 +3969,7 @@
"external_url": "External URL",
"upload_file": "Upload File",
"text_input": "Text input",
"input_url_link": "Input URL Link",
"media_module": "Media Request Module",
"name": "Name",
"upload_deadline": "Upload Deadline",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ import { connect } from "react-redux";
import T from "i18n-react/dist/i18n-react";
import {
archivePageTemplate,
deletePageTemplate,
getPageTemplates,
getPageTemplate,
savePageTemplate,
deletePageTemplate,
unarchivePageTemplate
} from "../../../actions/page-template-actions";
import MuiTable from "../../../components/mui/table/mui-table";
Expand All @@ -47,6 +48,7 @@ const PageTemplateListPage = ({
hideArchived,
totalPageTemplates,
getPageTemplates,
getPageTemplate,
archivePageTemplate,
unarchivePageTemplate,
savePageTemplate,
Expand Down Expand Up @@ -118,7 +120,7 @@ const PageTemplateListPage = ({
: archivePageTemplate(item.id);

const handleEdit = (row) => {
console.log("EDIT", row);
getPageTemplate(row.id).then(() => setPageTemplateId(row.id));
};

const handleDelete = (row) => {
Expand Down Expand Up @@ -283,6 +285,7 @@ const mapStateToProps = ({ pageTemplateListState }) => ({

export default connect(mapStateToProps, {
getPageTemplates,
getPageTemplate,
archivePageTemplate,
unarchivePageTemplate,
savePageTemplate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,22 @@ import { FormikProvider, useFormik } from "formik";
import * as yup from "yup";
import MuiFormikTextField from "../../../../components/mui/formik-inputs/mui-formik-textfield";
import PageModules from "./page-template-modules-form";
import { resetPageTemplateForm } from "../../../../actions/page-template-actions";
import {
PAGES_MODULE_KINDS,
PAGE_MODULES_MEDIA_TYPES
PAGE_MODULES_MEDIA_TYPES,
PAGE_MODULES_DOWNLOAD
} from "../../../../utils/constants";

const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => {
const PageTemplatePopup = ({
pageTemplate,
open,
onClose,
onSave,
resetPageTemplateForm
}) => {
const handleClose = () => {
resetPageTemplateForm();
onClose();
};

Expand Down Expand Up @@ -78,8 +87,16 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => {
kind: yup.string().equals([PAGES_MODULE_KINDS.DOCUMENT]),
name: yup.string().required(T.translate("validation.required")),
description: yup.string().required(T.translate("validation.required")),
external_url: yup.string(),
file: yup.array().min(1, T.translate("validation.file_required"))
external_url: yup.string().when("type", {
is: PAGE_MODULES_DOWNLOAD.URL,
then: (schema) => schema.required(T.translate("validation.required")),
otherwise: (schema) => schema.nullable()
}),
file: yup.array().when("type", {
is: PAGE_MODULES_DOWNLOAD.FILE,
then: (schema) => schema.min(1, T.translate("validation.file_required")),
otherwise: (schema) => schema.nullable()
})
Comment on lines +90 to +99
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check if the file exists and examine the code at the specified lines
find . -name "index.js" -path "*/sponsors-global/page-templates/page-template-popup/*" | head -5

Repository: fntechgit/summit-admin

Length of output: 137


🏁 Script executed:

# Search for yup usage in the repository to understand context
rg "yup\.string\(\)\.when" --type js -A 3 | head -30

Repository: fntechgit/summit-admin

Length of output: 552


🌐 Web query:

Biome lint rule yup.when then property suspicious

💡 Result:

Biome’s lint/suspicious/noThenProperty rule flags any object/class member named then (to prevent accidental “thenables” that can confuse await / dynamic import() semantics). It’s enabled by default and has no autofix. [1]

That collides with Yup’s object-form when() API, which uses { is, then, otherwise }. [2]

Options to resolve it

1) Prefer Yup’s function-form when() (no then property)
Yup supports when(keys, (values, schema) => Schema) as an alternative to the { then, otherwise } object form. [2]

count: yup.number().when('isBig', ([isBig], schema) =>
  isBig ? schema.min(5) : schema.min(0)
),

2) Suppress the rule for that line/block
Biome supports targeted suppression comments using the rule’s diagnostic category. [3]

// biome-ignore lint/suspicious/noThenProperty: Yup's API requires `then`/`otherwise` keys
count: yup.number().when('isBig', {
  is: true,
  then: (schema) => schema.min(5),
  otherwise: (schema) => schema.min(0),
});

3) Disable the rule in biome.json (project-wide)

{
  "linter": {
    "rules": {
      "suspicious": {
        "noThenProperty": "off"
      }
    }
  }
}

(That configuration key is the one documented for the rule.) [1]

Sources: Biome rule docs [1], Yup when() API docs (object + function overloads) [2], Biome suppression syntax [3].


🏁 Script executed:

# Search for functional form of yup.when() usage in the codebase
rg "\.when\(" --type js -A 2 | grep -A 2 "=>" | head -40

Repository: fntechgit/summit-admin

Length of output: 2238


🏁 Script executed:

# Check if there are examples of yup.when with functional signature
rg "when\(\s*['\"][^'\"]+['\"],\s*\(" --type js -B 1 -A 3 | head -50

Repository: fntechgit/summit-admin

Length of output: 48


Replace yup.when() object syntax with functional form to resolve Biome noThenProperty lint error.

Biome's noThenProperty rule (enabled by default) flags then properties on objects, which conflicts with Yup's object-form when() API. Use the functional signature instead.

Suggested fix
-    external_url: yup.string().when("type", {
-      is: PAGE_MODULES_DOWNLOAD.URL,
-      then: (schema) => schema.required(T.translate("validation.required")),
-      otherwise: (schema) => schema.nullable()
-    }),
-    file: yup.array().when("type", {
-      is: PAGE_MODULES_DOWNLOAD.FILE,
-      then: (schema) => schema.min(1, T.translate("validation.file_required")),
-      otherwise: (schema) => schema.nullable()
-    })
+    external_url: yup.string().when("type", (type, schema) =>
+      type === PAGE_MODULES_DOWNLOAD.URL
+        ? schema.required(T.translate("validation.required"))
+        : schema.nullable()
+    ),
+    file: yup.array().when("type", (type, schema) =>
+      type === PAGE_MODULES_DOWNLOAD.FILE
+        ? schema.min(1, T.translate("validation.file_required"))
+        : schema.nullable()
+    )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
external_url: yup.string().when("type", {
is: PAGE_MODULES_DOWNLOAD.URL,
then: (schema) => schema.required(T.translate("validation.required")),
otherwise: (schema) => schema.nullable()
}),
file: yup.array().when("type", {
is: PAGE_MODULES_DOWNLOAD.FILE,
then: (schema) => schema.min(1, T.translate("validation.file_required")),
otherwise: (schema) => schema.nullable()
})
external_url: yup.string().when("type", (type, schema) =>
type === PAGE_MODULES_DOWNLOAD.URL
? schema.required(T.translate("validation.required"))
: schema.nullable()
),
file: yup.array().when("type", (type, schema) =>
type === PAGE_MODULES_DOWNLOAD.FILE
? schema.min(1, T.translate("validation.file_required"))
: schema.nullable()
)
🧰 Tools
🪛 Biome (2.3.14)

[error] 92-92: Do not add then to an object.

(lint/suspicious/noThenProperty)


[error] 97-97: Do not add then to an object.

(lint/suspicious/noThenProperty)

🤖 Prompt for AI Agents
In `@src/pages/sponsors-global/page-templates/page-template-popup/index.js` around
lines 90 - 99, The yup.when() uses the object syntax which triggers Biome's
noThenProperty lint; update the schemas for external_url and file in this module
to use the functional form of when() instead of the object form (refer to
symbols external_url, file and the discriminators PAGE_MODULES_DOWNLOAD.URL /
PAGE_MODULES_DOWNLOAD.FILE and the yup schema where they are defined) so that
the conditional validation is expressed as yup.string().when("type", (type,
schema) => type === PAGE_MODULES_DOWNLOAD.URL ?
schema.required(T.translate("validation.required")) : schema.nullable()) and
similarly for file with .when("type", (type, schema) => type ===
PAGE_MODULES_DOWNLOAD.FILE ? schema.min(1,
T.translate("validation.file_required")) : schema.nullable()).

});

const mediaModuleSchema = yup.object().shape({
Expand All @@ -88,7 +105,7 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => {
type: yup.string().required(T.translate("validation.required")),
upload_deadline: yup.date().required(T.translate("validation.required")),
description: yup.string().required(T.translate("validation.required")),
file_type_id: yup.object().when("type", {
file_type_id: yup.number().when("type", {
is: PAGE_MODULES_MEDIA_TYPES.FILE,
then: (schema) => schema.required(T.translate("validation.required")),
otherwise: (schema) => schema.nullable()
Expand Down Expand Up @@ -124,6 +141,7 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => {
...m,
custom_order: idx
}));

onSave({ ...values, modules: modulesWithOrder });
}
});
Expand All @@ -148,24 +166,24 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => {
>
<DialogContent sx={{ p: 0 }}>
<Grid2 container spacing={2} size={12} sx={{ p: 2 }}>
<Grid2 spacing={2} size={4}>
<Grid2 size={4}>
<MuiFormikTextField
name="code"
label={T.translate("page_template_list.code")}
fullWidth
/>
</Grid2>
<Grid2 spacing={2} size={8}>
<Grid2 size={8}>
<MuiFormikTextField
name="name"
label={T.translate("page_template_list.name")}
fullWidth
/>
</Grid2>
</Grid2>
<Divider gutterBottom />
<Divider sx={{ mb: 2 }} />
<Grid2 container spacing={2} size={12} sx={{ p: 2 }}>
<Grid2 spacing={2} size={4}>
<Grid2 size={4}>
<Button
variant="contained"
fullWidth
Expand All @@ -175,7 +193,7 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => {
{T.translate("page_template_list.page_crud.add_info")}
</Button>
</Grid2>
<Grid2 spacing={2} size={4}>
<Grid2 size={4}>
<Button
variant="contained"
fullWidth
Expand All @@ -185,7 +203,7 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => {
{T.translate("page_template_list.page_crud.add_doc")}
</Button>
</Grid2>
<Grid2 spacing={2} size={4}>
<Grid2 size={4}>
<Button
variant="contained"
fullWidth
Expand All @@ -196,7 +214,7 @@ const PageTemplatePopup = ({ pageTemplate, open, onClose, onSave }) => {
</Button>
</Grid2>
</Grid2>
<Divider gutterBottom />
<Divider sx={{ mb: 2 }} />
<Box sx={{ py: 2 }}>
<PageModules name="modules" />
</Box>
Expand All @@ -219,8 +237,10 @@ PageTemplatePopup.propTypes = {
onSave: PropTypes.func.isRequired
};

const mapStateToProps = ({ currentPageTemplateState }) => ({
...currentPageTemplateState
const mapStateToProps = ({ pageTemplateState }) => ({
pageTemplate: pageTemplateState.entity
});

export default connect(mapStateToProps, {})(PageTemplatePopup);
export default connect(mapStateToProps, {
resetPageTemplateForm
})(PageTemplatePopup);
Loading