@griddo/ax 11.14.2 → 11.14.3-rc.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.
Files changed (64) hide show
  1. package/config/jest/setup.js +13 -7
  2. package/package.json +2 -2
  3. package/src/__tests__/components/KeywordsPreviewModal/KeywordsPreviewModal.test.tsx +4 -3
  4. package/src/components/CategoryCell/index.tsx +3 -1
  5. package/src/components/ElementsTooltip/index.tsx +8 -4
  6. package/src/components/ErrorPage/index.tsx +3 -1
  7. package/src/components/FilterTagsBar/index.tsx +3 -3
  8. package/src/components/HeadingsPreviewModal/utils.tsx +2 -1
  9. package/src/components/KeywordsPreviewModal/atoms.tsx +2 -2
  10. package/src/components/KeywordsPreviewModal/index.tsx +6 -6
  11. package/src/components/KeywordsPreviewModal/utils.tsx +5 -3
  12. package/src/components/Modal/style.tsx +5 -5
  13. package/src/components/TableFilters/CheckGroupFilter/index.tsx +3 -2
  14. package/src/components/TableFilters/LiveFilter/index.tsx +4 -4
  15. package/src/components/TableFilters/SiteFilter/index.tsx +11 -12
  16. package/src/components/TableFilters/TranslationsFilter/index.tsx +2 -2
  17. package/src/components/TableFilters/TranslationsFilter/style.tsx +2 -2
  18. package/src/components/Tag/index.tsx +15 -7
  19. package/src/components/TruncatedTooltip/index.tsx +48 -0
  20. package/src/components/index.tsx +2 -0
  21. package/src/constants/index.ts +3 -0
  22. package/src/helpers/categoryColumns.tsx +55 -0
  23. package/src/helpers/images.tsx +3 -1
  24. package/src/helpers/index.tsx +2 -0
  25. package/src/modules/ActivityLog/ItemLog/EventItem/index.tsx +17 -10
  26. package/src/modules/ActivityLog/ItemLog/EventItem/style.tsx +18 -1
  27. package/src/modules/ActivityLog/ItemLogUser/UserItem/EventItem/index.tsx +10 -7
  28. package/src/modules/ActivityLog/ItemLogUser/UserItem/index.tsx +9 -3
  29. package/src/modules/ActivityLog/ItemLogUser/UserItem/style.tsx +17 -1
  30. package/src/modules/App/Routing/NavMenu/NavItem/style.tsx +1 -0
  31. package/src/modules/App/Routing/index.tsx +2 -2
  32. package/src/modules/App/Routing/style.tsx +8 -1
  33. package/src/modules/Categories/CategoriesList/BulkHeader/TableHeader/style.tsx +1 -0
  34. package/src/modules/Categories/CategoriesList/CategoryItem/index.tsx +7 -3
  35. package/src/modules/Categories/CategoriesList/CategoryItem/style.tsx +38 -5
  36. package/src/modules/Content/BulkHeader/TableHeader/style.tsx +1 -1
  37. package/src/modules/Content/PageItem/index.tsx +80 -204
  38. package/src/modules/Content/PageItem/style.tsx +18 -10
  39. package/src/modules/Content/atoms.tsx +147 -18
  40. package/src/modules/Content/index.tsx +2 -9
  41. package/src/modules/Forms/FormCategoriesList/CategoryItem/index.tsx +7 -3
  42. package/src/modules/Forms/FormCategoriesList/CategoryItem/style.tsx +34 -0
  43. package/src/modules/Forms/FormEditor/index.tsx +28 -50
  44. package/src/modules/Forms/FormList/FormItem/index.tsx +91 -120
  45. package/src/modules/Forms/FormList/FormItem/style.tsx +19 -0
  46. package/src/modules/Forms/FormList/index.tsx +27 -48
  47. package/src/modules/Forms/atoms.tsx +44 -32
  48. package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/index.tsx +8 -8
  49. package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/style.tsx +2 -2
  50. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +83 -101
  51. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/style.tsx +11 -5
  52. package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +31 -54
  53. package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/style.tsx +13 -7
  54. package/src/modules/Users/Roles/BulkHeader/TableHeader/style.tsx +6 -6
  55. package/src/modules/Users/Roles/RoleItem/index.tsx +3 -4
  56. package/src/modules/Users/Roles/RoleItem/style.tsx +12 -15
  57. package/src/modules/Users/Roles/index.tsx +1 -2
  58. package/src/modules/Users/UserCreate/SiteItem/index.tsx +10 -4
  59. package/src/modules/Users/UserCreate/SiteItem/style.tsx +33 -1
  60. package/src/modules/Users/UserForm/index.tsx +6 -4
  61. package/src/modules/Users/UserList/BulkHeader/TableHeader/index.tsx +2 -4
  62. package/src/modules/Users/UserList/BulkHeader/TableHeader/style.tsx +1 -1
  63. package/src/modules/Users/UserList/UserItem/index.tsx +18 -10
  64. package/src/modules/Users/UserList/UserItem/style.tsx +60 -4
@@ -1,21 +1,12 @@
1
- import React from "react";
1
+ import type React from "react";
2
2
 
3
+ import { Button, ErrorToast, FieldsBehavior, Modal, Select } from "@ax/components";
3
4
  import type { IModal, ISite } from "@ax/types";
4
- import { Modal, FieldsBehavior, Select, Button } from "@ax/components";
5
5
 
6
6
  import * as S from "./style";
7
7
 
8
8
  const DeleteModal = (props: IDeleteModal): JSX.Element => {
9
- const {
10
- isOpen,
11
- toggleModal,
12
- mainModalAction,
13
- secondaryModalAction,
14
- isTranslated,
15
- deleteAllVersions,
16
- setDeleteAllVersions,
17
- title,
18
- } = props;
9
+ const { isOpen, toggleModal, isTranslated, deleteAllVersions, setDeleteAllVersions, title, onDelete, isDeleting } = props;
19
10
 
20
11
  const options = [
21
12
  {
@@ -32,13 +23,21 @@ const DeleteModal = (props: IDeleteModal): JSX.Element => {
32
23
 
33
24
  const pageTitle = title ? <strong>{title}</strong> : "this";
34
25
 
26
+ const mainAction = {
27
+ title: isDeleting ? "Deleting" : "Delete page",
28
+ onClick: onDelete,
29
+ disabled: isDeleting,
30
+ };
31
+
32
+ const secondaryAction = { title: "Cancel", onClick: toggleModal };
33
+
35
34
  return (
36
35
  <Modal
37
36
  isOpen={isOpen}
38
37
  hide={toggleModal}
39
38
  title="Delete Page?"
40
- secondaryAction={secondaryModalAction}
41
- mainAction={mainModalAction}
39
+ secondaryAction={secondaryAction}
40
+ mainAction={mainAction}
42
41
  size="S"
43
42
  >
44
43
  {isTranslated ? (
@@ -81,17 +80,25 @@ const SecondaryActionButton = (props: IActionButton): JSX.Element => (
81
80
  );
82
81
 
83
82
  const CopyModal = (props: ICopyModal): JSX.Element => {
84
- const { isOpen, toggleModal, mainModalAction, secondaryModalAction, setSite, sites, site } = props;
83
+ const { isOpen, toggleModal, setSite, sites, site, onCopy } = props;
85
84
  const sitesOptions = sites.map((site: ISite) => ({ label: site.name, value: site.id.toString() }));
86
85
 
86
+ const mainAction = {
87
+ title: "Copy page",
88
+ onClick: onCopy,
89
+ disabled: !site,
90
+ };
91
+
92
+ const secondaryAction = { title: "Cancel", onClick: toggleModal };
93
+
87
94
  return (
88
95
  <Modal
89
96
  isOpen={isOpen}
90
97
  hide={toggleModal}
91
98
  size="S"
92
99
  title="Copy page in another site"
93
- mainAction={mainModalAction}
94
- secondaryAction={secondaryModalAction}
100
+ mainAction={mainAction}
101
+ secondaryAction={secondaryAction}
95
102
  overflow="visible"
96
103
  >
97
104
  <S.ModalContent>
@@ -114,11 +121,109 @@ const CopyModal = (props: ICopyModal): JSX.Element => {
114
121
  );
115
122
  };
116
123
 
124
+ const DuplicatePageModal = (props: IDuplicatePageModal): JSX.Element => {
125
+ const { isOpen, toggleModal, modalState, onNameChange, onSlugChange, onDuplicate, isSaving } = props;
126
+
127
+ const mainAction = {
128
+ title: "Duplicate",
129
+ onClick: onDuplicate,
130
+ disabled: !modalState.title.trim() || !modalState.slug.trim() || isSaving,
131
+ };
132
+
133
+ const secondaryAction = { title: "Cancel", onClick: toggleModal };
134
+
135
+ return (
136
+ <Modal
137
+ isOpen={isOpen}
138
+ hide={toggleModal}
139
+ title="Duplicate page"
140
+ secondaryAction={secondaryAction}
141
+ mainAction={mainAction}
142
+ size="M"
143
+ >
144
+ <ErrorToast />
145
+ {isOpen ? (
146
+ <S.ModalContent>
147
+ <FieldsBehavior
148
+ fieldType="TextField"
149
+ name="title"
150
+ title="Title"
151
+ mandatory={true}
152
+ value={modalState.title}
153
+ onChange={onNameChange}
154
+ />
155
+ <FieldsBehavior
156
+ fieldType="TextField"
157
+ name="slug"
158
+ title="Slug"
159
+ mandatory={true}
160
+ value={modalState.slug}
161
+ onChange={onSlugChange}
162
+ />
163
+ </S.ModalContent>
164
+ ) : null}
165
+ </Modal>
166
+ );
167
+ };
168
+
169
+ const RemovePageModal = (props: IRemovePageModal): JSX.Element => {
170
+ const { isOpen, toggleModal, pageTitle, onRemove } = props;
171
+
172
+ const mainAction = {
173
+ title: "Remove",
174
+ onClick: onRemove,
175
+ };
176
+
177
+ const secondaryAction = { title: "Cancel", onClick: toggleModal };
178
+
179
+ return (
180
+ <Modal
181
+ isOpen={isOpen}
182
+ hide={toggleModal}
183
+ title="Remove page from this site?"
184
+ secondaryAction={secondaryAction}
185
+ mainAction={mainAction}
186
+ size="S"
187
+ >
188
+ {isOpen ? (
189
+ <S.ModalContent>
190
+ <p>
191
+ Are you sure you want to remove <strong>'{pageTitle}'</strong> from this site?
192
+ <br />
193
+ This action <strong>cannot be undone</strong>.
194
+ </p>
195
+ </S.ModalContent>
196
+ ) : null}
197
+ </Modal>
198
+ );
199
+ };
200
+
201
+ const UnpublishPageModal = (props: IUnpublishPageModal): JSX.Element => {
202
+ const { isOpen, toggleModal } = props;
203
+
204
+ const mainAction = { title: "Ok", onClick: toggleModal };
205
+
206
+ return (
207
+ <Modal isOpen={isOpen} hide={toggleModal} size="S" title="Unpublish Modified Page" mainAction={mainAction}>
208
+ {isOpen && (
209
+ <S.ModalContent>
210
+ <p>
211
+ There are some saved changes that are not published on this page. To Unpublish this page,{" "}
212
+ <strong>you must publish these changes or discard them.</strong>
213
+ </p>
214
+ </S.ModalContent>
215
+ )}
216
+ </Modal>
217
+ );
218
+ };
219
+
117
220
  interface IDeleteModal extends IModal {
118
221
  isTranslated: boolean;
119
222
  deleteAllVersions: boolean;
120
223
  setDeleteAllVersions: React.Dispatch<React.SetStateAction<boolean>>;
121
224
  title?: string;
225
+ onDelete: () => void;
226
+ isDeleting?: boolean;
122
227
  }
123
228
 
124
229
  interface IActionButton {
@@ -131,6 +236,30 @@ interface ICopyModal extends IModal {
131
236
  setSite: React.Dispatch<React.SetStateAction<any>>;
132
237
  sites: ISite[];
133
238
  site: string | null;
239
+ onCopy: () => void;
134
240
  }
135
241
 
136
- export { DeleteModal, CopyModal, MainActionButton, SecondaryActionButton };
242
+ interface IDuplicatePageModal extends IModal {
243
+ modalState: { title: string; slug: string };
244
+ onNameChange: (value: string) => void;
245
+ onSlugChange: (value: string) => void;
246
+ onDuplicate: () => void;
247
+ isSaving: boolean;
248
+ }
249
+
250
+ interface IRemovePageModal extends IModal {
251
+ pageTitle: string;
252
+ onRemove: () => void;
253
+ }
254
+
255
+ interface IUnpublishPageModal extends IModal {}
256
+
257
+ export {
258
+ DeleteModal,
259
+ CopyModal,
260
+ DuplicatePageModal,
261
+ RemovePageModal,
262
+ UnpublishPageModal,
263
+ MainActionButton,
264
+ SecondaryActionButton,
265
+ };
@@ -818,13 +818,6 @@ const Content = (props: IProps): JSX.Element => {
818
818
 
819
819
  const resetFilter = () => resetFilterQuery();
820
820
 
821
- const mainDeleteModalAction = {
822
- title: isDeleting ? "Deleting" : "Delete",
823
- onClick: bulkDelete,
824
- disabled: isDeleting,
825
- };
826
-
827
- const secondaryDeleteModalAction = { title: "Cancel", onClick: toggleDeleteModal };
828
821
 
829
822
  const undoDeleteAction = async () => {
830
823
  if (deletedItem) {
@@ -972,8 +965,8 @@ const Content = (props: IProps): JSX.Element => {
972
965
  <DeleteModal
973
966
  isOpen={isDeleteOpen}
974
967
  toggleModal={toggleDeleteModal}
975
- mainModalAction={mainDeleteModalAction}
976
- secondaryModalAction={secondaryDeleteModalAction}
968
+ onDelete={bulkDelete}
969
+ isDeleting={isDeleting}
977
970
  {...{ isTranslated: arePagesTranslated, deleteAllVersions, setDeleteAllVersions }}
978
971
  />
979
972
  {isVisible && <Toast {...toastProps} />}
@@ -1,7 +1,7 @@
1
1
  import type React from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { CheckField, Icon } from "@ax/components";
4
+ import { CheckField, Icon, TruncatedTooltip } from "@ax/components";
5
5
  import { formsActions } from "@ax/containers/Forms";
6
6
  import { useModal, usePermission } from "@ax/hooks";
7
7
  import type { FormCategory, ICheck } from "@ax/types";
@@ -88,10 +88,14 @@ const CategoryItem = (props: ICategoryItemProps): JSX.Element => {
88
88
  <CheckField name="check" value={category.id} checked={isSelected || hoverCheck} onChange={handleOnChange} />
89
89
  </S.CheckCell>
90
90
  <S.NameCell role="cell" clickable={true}>
91
- <div>{content?.title || ""}</div>
91
+ <TruncatedTooltip content={content?.title || ""} expanded top={-5}>
92
+ <S.Title>{content?.title || ""}</S.Title>
93
+ </TruncatedTooltip>
92
94
  </S.NameCell>
93
95
  <S.CodeCell role="cell" clickable={true}>
94
- {category.content.code}
96
+ <TruncatedTooltip content={category.content.code} expanded top={-5}>
97
+ <S.Code>{category.content.code}</S.Code>
98
+ </TruncatedTooltip>
95
99
  </S.CodeCell>
96
100
  <S.ActionsCell role="cell">
97
101
  <S.StyledActionMenu icon="more" options={menuOptions} tooltip="Actions" />
@@ -23,16 +23,48 @@ const NameCell = styled(Cell)<{ clickable: boolean }>`
23
23
  align-items: center;
24
24
  justify-content: flex-start;
25
25
  flex-grow: 1;
26
+ min-width: 0;
27
+ > * {
28
+ min-width: 0;
29
+ max-width: 100%;
30
+ }
26
31
  `;
27
32
 
28
33
  const ActionsCell = styled(Cell)`
29
34
  flex: 0 0 80px;
30
35
  `;
31
36
 
37
+ const Title = styled.div`
38
+ width: 100%;
39
+ ${(p) => p.theme.textStyle.uiL};
40
+ color: ${(p) => p.theme.color.textHighEmphasis};
41
+ overflow: hidden;
42
+ text-overflow: ellipsis;
43
+ white-space: nowrap;
44
+ display: block;
45
+ min-width: 0;
46
+ `;
47
+
32
48
  const CodeCell = styled(Cell)<{ clickable: boolean }>`
33
49
  ${(p) => p.theme.textStyle.uiXS};
34
50
  pointer-events: ${(p) => (p.clickable ? "auto" : "none")};
35
51
  flex: 0 0 250px;
52
+ min-width: 0;
53
+ > * {
54
+ min-width: 0;
55
+ max-width: 100%;
56
+ }
57
+ `;
58
+
59
+ const Code = styled.div`
60
+ width: 100%;
61
+ ${(p) => p.theme.textStyle.uiXS};
62
+ color: ${(p) => p.theme.color.textMediumEmphasis};
63
+ overflow: hidden;
64
+ text-overflow: ellipsis;
65
+ white-space: nowrap;
66
+ display: block;
67
+ min-width: 0;
36
68
  `;
37
69
 
38
70
  const StyledActionMenu = styled(ActionMenu)`
@@ -84,8 +116,10 @@ const IconWrapperDrag = styled.div`
84
116
  export {
85
117
  CheckCell,
86
118
  NameCell,
119
+ Title,
87
120
  ActionsCell,
88
121
  CodeCell,
122
+ Code,
89
123
  StyledActionMenu,
90
124
  CategoryRow,
91
125
  FlagsWrapper,
@@ -9,7 +9,7 @@ import { formsActions } from "@ax/containers/Forms";
9
9
  import { findFieldsErrors } from "@ax/forms";
10
10
  import { RouteLeavingGuard } from "@ax/guards";
11
11
  import { getDefaultTheme } from "@ax/helpers";
12
- import { useModal, usePermission, useShouldBeSaved } from "@ax/hooks";
12
+ import { useModals, usePermissions, useShouldBeSaved } from "@ax/hooks";
13
13
  import type {
14
14
  FormContent,
15
15
  FormLanguage,
@@ -78,23 +78,20 @@ const FormEditor = (props: IProps) => {
78
78
  const [notification, setNotification] = useState<INotification | null>(null);
79
79
  const [deleteAllVersions, setDeleteAllVersions] = useState(false);
80
80
  const [errors, setErrors] = useState<IErrorItem[]>([]);
81
- const { isOpen: isDeleteOpen, toggleModal: toggleDeleteModal } = useModal();
82
- const { isOpen: isUnpublishOpen, toggleModal: toggleUnpublishModal } = useModal();
83
- const { isOpen: isUseOpen, toggleModal: toggleUseModal } = useModal();
84
- const { isOpen: isUpdateOpen, toggleModal: toggleUpdateModal } = useModal();
81
+ const { isOpen, toggleModal } = useModals(["delete", "unpublish", "use", "update"]);
85
82
 
86
83
  const { isDirty, setIsDirty } = useShouldBeSaved(formContent);
87
84
  const browserRef = useRef<HTMLDivElement>(null);
88
85
 
89
- const deleteFormPermission = isSiteView ? "forms.deleteForms" : "global.forms.deleteForms";
90
- const publishFormPermission = isSiteView ? "forms.publishUnpublishForms" : "global.forms.publishUnpublishForms";
91
- const isAllowedToDeleteForm = usePermission(deleteFormPermission);
92
- const isAllowedToPublishForm = usePermission(publishFormPermission);
86
+ const isAllowedTo = usePermissions({
87
+ deleteForms: isSiteView ? "forms.deleteForms" : "global.forms.deleteForms",
88
+ publishUnpublishForms: isSiteView ? "forms.publishUnpublishForms" : "global.forms.publishUnpublishForms",
89
+ });
93
90
 
94
91
  const toastMsg = (
95
92
  <>
96
93
  This form is used in some pages. Changes will apply to all pages where it’s{" "}
97
- <button type="button" onClick={toggleUseModal}>
94
+ <button type="button" onClick={() => toggleModal("use")}>
98
95
  in use.
99
96
  </button>
100
97
  </>
@@ -130,7 +127,7 @@ const FormEditor = (props: IProps) => {
130
127
  const handleSavePage = async (updateState?: FormState) => {
131
128
  const { saveForm } = props;
132
129
 
133
- isUpdateOpen && toggleUpdateModal();
130
+ isOpen("update") && toggleModal("update");
134
131
 
135
132
  const skipErrorCheck =
136
133
  skipReviewOnPublish || (!isPublishedForm && !updateState) || (isPublishedForm && updateState === "inactive");
@@ -155,16 +152,16 @@ const FormEditor = (props: IProps) => {
155
152
  text: "This form is currently used on multiple pages. Please remove it from those pages before deleting.",
156
153
  type: "error",
157
154
  btnText: "Show pages",
158
- onClick: toggleUseModal,
155
+ onClick: () => toggleModal("use"),
159
156
  });
160
157
  } else {
161
158
  const allFormVersions = dataLanguages.map((lang: FormLanguage) => lang.id);
162
159
  const isDeleted = deleteAllVersions ? await deleteForm(allFormVersions) : await deleteForm(id);
163
160
  if (isDeleted) {
164
161
  setHistoryPush(backLinkRoute, false);
162
+ toggleModal("delete");
165
163
  }
166
164
  }
167
- toggleDeleteModal();
168
165
  };
169
166
 
170
167
  const handleDiscarChanges = async () => {
@@ -181,12 +178,12 @@ const FormEditor = (props: IProps) => {
181
178
  text: "This form is currently used on multiple pages. Please remove it from those pages before unpublishing.",
182
179
  type: "error",
183
180
  btnText: "Show pages",
184
- onClick: toggleUseModal,
181
+ onClick: () => toggleModal("use"),
185
182
  });
186
183
  } else {
187
184
  handleSavePage("inactive");
188
185
  }
189
- isUnpublishOpen && toggleUnpublishModal();
186
+ isOpen("unpublish") && toggleModal("unpublish");
190
187
  };
191
188
 
192
189
  const getSelectedFormLanguage = (language: ILanguage) =>
@@ -224,11 +221,11 @@ const FormEditor = (props: IProps) => {
224
221
  });
225
222
  }
226
223
 
227
- if (isAllowedToDeleteForm) {
224
+ if (isAllowedTo.deleteForms) {
228
225
  menuOptions.push({
229
226
  label: "Delete form",
230
227
  icon: "delete",
231
- action: toggleDeleteModal,
228
+ action: () => toggleModal("delete"),
232
229
  });
233
230
  }
234
231
 
@@ -236,7 +233,7 @@ const FormEditor = (props: IProps) => {
236
233
  state && state === "active"
237
234
  ? {
238
235
  label: "Unpublish form",
239
- action: toggleUnpublishModal,
236
+ action: () => toggleModal("unpublish"),
240
237
  }
241
238
  : {
242
239
  label: "Publish form",
@@ -244,7 +241,7 @@ const FormEditor = (props: IProps) => {
244
241
  };
245
242
 
246
243
  const downArrowMenu = {
247
- button: isAllowedToPublishForm ? publishButton : undefined,
244
+ button: isAllowedTo.publishUnpublishForms ? publishButton : undefined,
248
245
  options: menuOptions,
249
246
  displayed: !deleted,
250
247
  };
@@ -258,26 +255,9 @@ const FormEditor = (props: IProps) => {
258
255
  const rightButtonProps = {
259
256
  label: isSaving ? "Saving" : !isDirty ? "Saved" : isPublishedForm ? "Update changes" : "Save",
260
257
  disabled: (!isDirty && formID !== null && !isNewTranslation) || isSaving,
261
- action: () => (formInUse ? toggleUpdateModal() : handleSavePage()),
262
- };
263
-
264
- const mainDeleteModalAction = {
265
- title: "Delete form",
266
- onClick: removeItem,
258
+ action: () => (formInUse ? toggleModal("update") : handleSavePage()),
267
259
  };
268
- const secondaryDeleteModalAction = { title: "Cancel", onClick: toggleDeleteModal };
269
260
 
270
- const mainUnpublishModalAction = {
271
- title: "Unpublish form",
272
- onClick: unpublishForm,
273
- };
274
-
275
- const secondaryUnpublishModalAction = { title: "Cancel", onClick: toggleUnpublishModal };
276
-
277
- const mainUpdateModalAction = {
278
- title: "Update changes",
279
- onClick: () => handleSavePage(),
280
- };
281
261
 
282
262
  return isLoading ? (
283
263
  <Loading />
@@ -334,26 +314,24 @@ const FormEditor = (props: IProps) => {
334
314
  </S.Content>
335
315
  </MainWrapper>
336
316
  <DeleteModal
337
- isOpen={isDeleteOpen}
338
- toggleModal={toggleDeleteModal}
339
- mainModalAction={mainDeleteModalAction}
340
- secondaryModalAction={secondaryDeleteModalAction}
317
+ isOpen={isOpen("delete")}
318
+ toggleModal={() => toggleModal("delete")}
319
+ onDelete={removeItem}
341
320
  {...{ title, isTranslated, deleteAllVersions, setDeleteAllVersions }}
342
321
  />
343
322
  <UnPublishModal
344
- isOpen={isUnpublishOpen}
345
- toggleModal={toggleUnpublishModal}
346
- mainModalAction={mainUnpublishModalAction}
347
- secondaryModalAction={secondaryUnpublishModalAction}
323
+ isOpen={isOpen("unpublish")}
324
+ toggleModal={() => toggleModal("unpublish")}
325
+ onUnpublish={unpublishForm}
348
326
  title={title}
349
327
  />
350
- {isUpdateOpen && (
351
- <UpdateModal isOpen={isUpdateOpen} toggleModal={toggleUpdateModal} mainModalAction={mainUpdateModalAction} />
328
+ {isOpen("update") && (
329
+ <UpdateModal isOpen={isOpen("update")} toggleModal={() => toggleModal("update")} onUpdate={() => handleSavePage()} />
352
330
  )}
353
- {isUseOpen && (
331
+ {isOpen("use") && (
354
332
  <FormUseModal
355
- isOpen={isUseOpen}
356
- toggleModal={toggleUseModal}
333
+ isOpen={isOpen("use")}
334
+ toggleModal={() => toggleModal("use")}
357
335
  isSiteView={!!currentSiteInfo?.id}
358
336
  formInUse={formInUse}
359
337
  />