@griddo/ax 10.4.7 → 10.4.9

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 (45) hide show
  1. package/package.json +2 -2
  2. package/src/__tests__/components/Browser/Browser.test.tsx +4 -4
  3. package/src/__tests__/components/Fields/ComponentArray/MixableComponentArray/MixableComponentArray.test.tsx +39 -7
  4. package/src/__tests__/components/Fields/ComponentArray/MixableComponentArray/PasteModuleButton/PasteModuleButton.test.tsx +8 -8
  5. package/src/__tests__/components/Fields/ComponentContainer/ComponentContainer.test.tsx +28 -16
  6. package/src/components/Browser/index.tsx +5 -5
  7. package/src/components/BulkSelectionOptions/style.tsx +1 -0
  8. package/src/components/ConfigPanel/Header/index.tsx +8 -4
  9. package/src/components/Fields/AsyncCheckGroup/style.tsx +3 -0
  10. package/src/components/Fields/CheckField/index.tsx +4 -1
  11. package/src/components/Fields/CheckField/style.tsx +19 -3
  12. package/src/components/Fields/CheckGroup/index.tsx +3 -2
  13. package/src/components/Fields/CheckGroup/style.tsx +3 -0
  14. package/src/components/Fields/ComponentArray/MixableComponentArray/BulkHeader/index.tsx +47 -0
  15. package/src/components/Fields/ComponentArray/MixableComponentArray/BulkHeader/style.tsx +44 -0
  16. package/src/components/Fields/ComponentArray/MixableComponentArray/PasteModuleButton/index.tsx +31 -12
  17. package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +153 -59
  18. package/src/components/Fields/ComponentArray/SameComponentArray/index.tsx +1 -1
  19. package/src/components/Fields/ComponentArray/helpers.tsx +45 -4
  20. package/src/components/Fields/ComponentContainer/EmptyContainer/index.tsx +2 -2
  21. package/src/components/Fields/ComponentContainer/index.tsx +68 -33
  22. package/src/components/Fields/ComponentContainer/style.tsx +78 -11
  23. package/src/components/Fields/ReferenceField/Context/index.tsx +1 -1
  24. package/src/components/MainWrapper/AppBar/atoms.tsx +5 -8
  25. package/src/components/SideModal/SideModalOption/index.tsx +5 -3
  26. package/src/containers/Navigation/Defaults/actions.tsx +86 -55
  27. package/src/containers/Navigation/Defaults/interfaces.tsx +2 -2
  28. package/src/containers/Navigation/Defaults/reducer.tsx +3 -3
  29. package/src/containers/PageEditor/actions.tsx +142 -109
  30. package/src/containers/PageEditor/interfaces.tsx +1 -1
  31. package/src/containers/PageEditor/reducer.tsx +2 -2
  32. package/src/containers/PageEditor/utils.tsx +1 -1
  33. package/src/containers/Settings/DataPacks/actions.tsx +7 -2
  34. package/src/forms/elements.tsx +20 -14
  35. package/src/hooks/bulk.tsx +57 -2
  36. package/src/hooks/iframe.ts +5 -5
  37. package/src/modules/Content/index.tsx +10 -1
  38. package/src/modules/FramePreview/index.tsx +4 -4
  39. package/src/modules/GlobalEditor/Editor/index.tsx +6 -6
  40. package/src/modules/GlobalEditor/PageBrowser/index.tsx +2 -2
  41. package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/index.tsx +6 -6
  42. package/src/modules/PageEditor/Editor/index.tsx +7 -7
  43. package/src/modules/PageEditor/PageBrowser/index.tsx +2 -2
  44. package/src/modules/Users/UserForm/index.tsx +52 -34
  45. package/src/types/index.tsx +1 -0
@@ -2,7 +2,7 @@ import styled from "styled-components";
2
2
 
3
3
  const IconWrapper = styled.div`
4
4
  background-color: ${(p) => p.theme.color.uiBackground03};
5
- border-radius: 4px;
5
+ border-radius: ${(p) => p.theme.radii.s};
6
6
  height: calc(${(p) => p.theme.spacing.s} * 2);
7
7
  width: calc(${(p) => p.theme.spacing.s} * 2);
8
8
  display: flex;
@@ -11,6 +11,13 @@ const IconWrapper = styled.div`
11
11
  margin-right: ${(p) => p.theme.spacing.xs};
12
12
  `;
13
13
 
14
+ const ButtonsWrapper = styled.span`
15
+ display: flex;
16
+ align-items: center;
17
+ margin-left: auto;
18
+ opacity: 0;
19
+ `;
20
+
14
21
  const HiddenButtonsWrapper = styled.span`
15
22
  margin-left: auto;
16
23
  display: none;
@@ -21,7 +28,7 @@ const Component = styled.span<{ disabled?: boolean }>`
21
28
  color: ${(p) => p.theme.color.textHighEmphasis};
22
29
  position: relative;
23
30
  display: flex;
24
- align-items: stretch;
31
+ align-items: center;
25
32
  width: 100%;
26
33
  background: ${(p) => p.theme.color.uiBackground02};
27
34
  border: 1px solid transparent;
@@ -32,10 +39,27 @@ const Component = styled.span<{ disabled?: boolean }>`
32
39
  ${(p) => p.theme.textStyle.fieldLabel};
33
40
  text-align: left;
34
41
  cursor: ${(p) => (p.disabled ? `default` : `pointer`)};
42
+ min-height: 48px;
35
43
 
36
- &:hover ${HiddenButtonsWrapper} {
37
- display: flex;
38
- opacity: 1;
44
+ &:hover {
45
+ border: 1px solid ${(p) => p.theme.color.overlayHoverPrimary};
46
+ &:before {
47
+ content: "";
48
+ position: absolute;
49
+ top: 0;
50
+ left: 0;
51
+ width: 100%;
52
+ height: 100%;
53
+ border-radius: ${(p) => p.theme.radii.s};
54
+ background-color: ${(p) => p.theme.color.overlayHoverPrimary};
55
+ }
56
+ span.light {
57
+ border-color: ${(p) => p.theme.color.interactiveInactive};
58
+ }
59
+ ${HiddenButtonsWrapper}, ${ButtonsWrapper} {
60
+ display: flex;
61
+ opacity: 1;
62
+ }
39
63
  }
40
64
 
41
65
  &:focus,
@@ -44,6 +68,40 @@ const Component = styled.span<{ disabled?: boolean }>`
44
68
  border: 1px solid ${(p) => (p.disabled ? `transparent` : p.theme.color.interactive01)};
45
69
  outline: none;
46
70
  }
71
+
72
+ &.ghosting {
73
+ opacity: 0.3;
74
+ }
75
+
76
+ &.dragging {
77
+ border: 1px solid ${(p) => p.theme.color.interactive01};
78
+ height: 48px;
79
+ &:before {
80
+ content: "";
81
+ position: absolute;
82
+ top: 0;
83
+ left: 0;
84
+ width: 100%;
85
+ height: 100%;
86
+ background-color: ${(p) => p.theme.color.overlayHoverPrimary};
87
+ box-shadow: ${(p) => p.theme.shadow.shadowS};
88
+ }
89
+ &:after {
90
+ content: "";
91
+ position: absolute;
92
+ top: 47px;
93
+ left: 0;
94
+ right: 0;
95
+ width: calc(100% - ${(p) => p.theme.spacing.s});
96
+ height: ${(p) => p.theme.spacing.xs};
97
+ border-radius: ${(p) => `0 0 ${p.theme.radii.s} ${p.theme.radii.s}`};
98
+ background-color: ${(p) => p.theme.color.uiBackground02};
99
+ z-index: -1;
100
+ margin-left: ${(p) => p.theme.spacing.xs};
101
+ margin-right: ${(p) => p.theme.spacing.xs};
102
+ box-shadow: ${(p) => p.theme.shadow.shadowS};
103
+ }
104
+ }
47
105
  `;
48
106
 
49
107
  const Text = styled.div`
@@ -64,18 +122,20 @@ const Label = styled.span<{ containerInfo: boolean | undefined; disabled?: boole
64
122
  : p.theme.color.textHighEmphasis};
65
123
  `;
66
124
 
125
+ const LabelDrag = styled.div`
126
+ ${(p) => p.theme.textStyle.fieldLabel};
127
+ color: ${(p) => p.theme.color.textHighEmphasis};
128
+ span {
129
+ color: ${(p) => p.theme.color.interactive01};
130
+ }
131
+ `;
132
+
67
133
  const Title = styled.span<{ disabled?: boolean }>`
68
134
  ${(p) => p.theme.textStyle.uiXS};
69
135
  color: ${(p) => (p.disabled ? p.theme.color.interactiveDisabled : p.theme.color.textMediumEmphasis)};
70
136
  margin-bottom: ${(p) => p.theme.spacing.xxs};
71
137
  `;
72
138
 
73
- const ButtonsWrapper = styled.span`
74
- display: flex;
75
- align-items: center;
76
- margin-left: auto;
77
- `;
78
-
79
139
  const HandleWrapper = styled.div<{ hidden?: boolean }>`
80
140
  display: ${(p) => (p.hidden ? "none" : "flex")};
81
141
  align-items: center;
@@ -91,14 +151,21 @@ const IconHandleWrapper = styled.div`
91
151
  }
92
152
  `;
93
153
 
154
+ const CheckWrapper = styled.div`
155
+ margin-left: ${(p) => p.theme.spacing.xxs};
156
+ width: ${(p) => p.theme.spacing.s};
157
+ `;
158
+
94
159
  export {
95
160
  IconWrapper,
96
161
  Component,
97
162
  Text,
98
163
  Label,
164
+ LabelDrag,
99
165
  Title,
100
166
  ButtonsWrapper,
101
167
  HiddenButtonsWrapper,
102
168
  HandleWrapper,
103
169
  IconHandleWrapper,
170
+ CheckWrapper,
104
171
  };
@@ -50,7 +50,7 @@ const useReferenceProvider = (modes?: string[]) => {
50
50
 
51
51
  const setReorderElements = (item: IStructuredDataContent, newIndex: number): number[] => {
52
52
  const { selectedItems, fixed, fullRelations = false } = state;
53
- const newItems = moveElement(item.id, selectedItems, newIndex, "id");
53
+ const newItems = moveElement([item.id], selectedItems, newIndex, "id");
54
54
  const originalItemId = item.relatedPage?.originalStructuredDataId;
55
55
  const itemId = originalItemId && state.fixed.includes(originalItemId) ? originalItemId : item.id;
56
56
  const newFixed: number[] = moveArrayElement(itemId, fixed, newIndex);
@@ -31,14 +31,11 @@ const ActionMenuBtn = (props: any) => {
31
31
  const ActionMenu = (props: any) => {
32
32
  const { menu } = props;
33
33
  return (
34
- menu &&
35
- menu.options.length > 0 && (
36
- <S.ActionMenu>
37
- <S.ActionMenuTitle> More actions </S.ActionMenuTitle>
38
- <ActionMenuBtn menu={menu} />
39
- {menu.options.map((item: any, i: number) => item && ActionMenuItem(item))}
40
- </S.ActionMenu>
41
- )
34
+ <S.ActionMenu>
35
+ <S.ActionMenuTitle> More actions </S.ActionMenuTitle>
36
+ <ActionMenuBtn menu={menu} />
37
+ {menu && menu.options.map((item: any, i: number) => item && ActionMenuItem(item))}
38
+ </S.ActionMenu>
42
39
  );
43
40
  };
44
41
 
@@ -24,8 +24,10 @@ const SideModalOption = (props: IProps) => {
24
24
  const label = isNavigationDefault ? option.title : getDisplayName(optionParam);
25
25
 
26
26
  const setOption = () => {
27
- handleClick(option);
28
- toggleModal();
27
+ if(handleClick) {
28
+ handleClick(option);
29
+ toggleModal();
30
+ }
29
31
  };
30
32
 
31
33
  const defaultTag = option.tag ? (
@@ -45,7 +47,7 @@ const SideModalOption = (props: IProps) => {
45
47
 
46
48
  interface IProps {
47
49
  option: any;
48
- handleClick: any;
50
+ handleClick?: (option: any) => void;
49
51
  toggleModal: () => void;
50
52
  children: string;
51
53
  theme: string;
@@ -1,7 +1,15 @@
1
1
  import { Dispatch } from "redux";
2
2
 
3
3
  import { navigation } from "@ax/api";
4
- import { IBreadcrumbItem, INavPages, INotification, ISchema, IUpdateNavigationParam } from "@ax/types";
4
+ import {
5
+ IBreadcrumbItem,
6
+ IModule,
7
+ INavPages,
8
+ INotification,
9
+ IRootState,
10
+ ISchema,
11
+ IUpdateNavigationParam,
12
+ } from "@ax/types";
5
13
  import {
6
14
  getDefaultSchema,
7
15
  getSchema,
@@ -119,7 +127,7 @@ function setIsNewTranslation(isNewTranslation: boolean): ISetIsNewTranslation {
119
127
  return { type: SET_IS_NEW_TRANSLATION, payload: { isNewTranslation } };
120
128
  }
121
129
 
122
- function setCopyModule(moduleCopy: Record<string, unknown> | null): ISetCopyModule {
130
+ function setCopyModule(moduleCopy: { date: Date; elements: IModule[] } | null): ISetCopyModule {
123
131
  return { type: SET_COPY_MODULE, payload: { moduleCopy } };
124
132
  }
125
133
 
@@ -260,7 +268,7 @@ function createNavigation(navHtml?: HTMLDivElement | null): (dispatch: Dispatch,
260
268
 
261
269
  const successAction = async (response: any) => {
262
270
  const updatedContent = { ...editorContent, ...response };
263
- generateContent(updatedContent, dispatch, getState);
271
+ generateContent(updatedContent)(dispatch, getState);
264
272
  dispatch(setIsNewTranslation(false));
265
273
  dispatch(appActions.setIsSaving(false));
266
274
  };
@@ -309,7 +317,7 @@ function updateNavigation(
309
317
 
310
318
  const successAction = async (response: any) => {
311
319
  if (fromEditor) {
312
- generateContent(response, dispatch, getState);
320
+ generateContent(response)(dispatch, getState);
313
321
  } else {
314
322
  getNavigationByType(data.type)(dispatch, getState);
315
323
  }
@@ -437,7 +445,7 @@ function generateNewDefault(dispatch: Dispatch, getState: any) {
437
445
  dispatch(setIsNewTranslation(false));
438
446
  dispatch(setCurrentNavigationLanguages([]));
439
447
 
440
- generateContent(defaultSchema, dispatch, getState);
448
+ generateContent(defaultSchema)(dispatch, getState);
441
449
  }
442
450
 
443
451
  function getValues(): (dispatch: Dispatch, getState: any) => Promise<void> {
@@ -463,7 +471,7 @@ function getValues(): (dispatch: Dispatch, getState: any) => Promise<void> {
463
471
  response.component = navigationModuleComponent;
464
472
  }
465
473
  dispatch(setSelectedEditorID(rootEditorID));
466
- generateContent(response, dispatch, getState);
474
+ generateContent(response)(dispatch, getState);
467
475
  },
468
476
  handleError: (response: any) => appActions.handleError(response)(dispatch),
469
477
  };
@@ -547,7 +555,7 @@ function addComponent(type: any, key: string): (dispatch: Dispatch, getState: an
547
555
  type,
548
556
  };
549
557
  const updatedContent = getUpdatedComponents(editorContent, component, key);
550
- generateContent(updatedContent, dispatch, getState);
558
+ generateContent(updatedContent)(dispatch, getState);
551
559
 
552
560
  if (type.editorID) {
553
561
  localStorage.setItem("selectedID", `${type.editorID}`);
@@ -559,21 +567,23 @@ function addComponent(type: any, key: string): (dispatch: Dispatch, getState: an
559
567
  };
560
568
  }
561
569
 
562
- function deleteModule(editorID: number, key: string): (dispatch: Dispatch, getState: any) => void {
570
+ function deleteModule(editorID: number[], key: string): (dispatch: Dispatch, getState: any) => void {
563
571
  return (dispatch, getState) => {
564
572
  const { editorContent } = getStateValues(getState);
565
573
  const updatedContent: any = deepClone(editorContent);
566
574
 
567
- const { parent, grandParent } = findByEditorID(updatedContent, editorID);
575
+ const { parent, grandParent } = findByEditorID(updatedContent, editorID[0]);
568
576
  const parentModule = Array.isArray(parent) ? grandParent : parent;
569
577
 
570
- const parentKey = key ? key : getParentKey(parentModule, editorID);
578
+ const parentKey = key ? key : getParentKey(parentModule, editorID[0]);
571
579
  const itemsArr = parentModule[parentKey];
572
580
 
573
- const index = itemsArr.findIndex((module: any) => module.editorID === editorID);
574
- itemsArr.splice(index, 1);
581
+ editorID.forEach((moduleID) => {
582
+ const index = itemsArr.findIndex((module: IModule) => module.editorID === moduleID);
583
+ itemsArr.splice(index, 1);
584
+ });
575
585
 
576
- generateContent(updatedContent, dispatch, getState);
586
+ generateContent(updatedContent)(dispatch, getState);
577
587
  };
578
588
  }
579
589
 
@@ -595,29 +605,36 @@ function replaceModule(module: any, parent: any, objKey: string): (dispatch: Dis
595
605
  });
596
606
 
597
607
  const updatedContent = updateByEditorID(editorContent, parent.editorID, objKey, updatedVal);
598
- generateContent(updatedContent, dispatch, getState);
608
+ generateContent(updatedContent)(dispatch, getState);
599
609
  };
600
610
  }
601
611
 
602
- function duplicateModule(editorID: number, key?: string): (dispatch: Dispatch, getState: any) => Promise<number> {
612
+ function duplicateModule(editorID: number[], key?: string): (dispatch: Dispatch, getState: any) => number {
603
613
  return (dispatch, getState) => {
604
614
  const { editorContent } = getStateValues(getState);
605
615
 
606
616
  const updatedContent: any = { ...editorContent };
607
- const { element: originalItem, parent, grandParent } = findByEditorID(updatedContent, editorID);
617
+ const { parent, grandParent } = findByEditorID(updatedContent, editorID[0]);
608
618
  const parentModule = Array.isArray(parent) ? grandParent : parent;
609
619
 
610
- const parentKey = key ? key : getParentKey(parentModule, editorID);
620
+ const parentKey = key ? key : getParentKey(parentModule, editorID[0]);
611
621
  const itemsArr = parentModule[parentKey];
622
+ let duplicatedItemIndex = 0;
612
623
 
613
- const originalItemIndex = itemsArr.findIndex((module: any) => module.editorID === editorID);
614
- const duplicatedItemIndex = originalItemIndex + 1;
615
- itemsArr.splice(duplicatedItemIndex, 0, originalItem);
624
+ editorID.forEach((id) => {
625
+ const { element: originalItem } = findByEditorID(updatedContent, id);
626
+ const originalItemIndex = itemsArr.findIndex((module: IModule) => module.editorID === id);
627
+ duplicatedItemIndex = originalItemIndex + 1;
628
+ itemsArr.splice(duplicatedItemIndex, 0, originalItem);
629
+ });
616
630
 
617
- generateContent(updatedContent, dispatch, getState);
631
+ generateContent(updatedContent)(dispatch, getState);
618
632
 
619
633
  const { editorContent: generatedContent } = getStateValues(getState);
620
- const { parent: generatedParent, grandParent: generatedGrandParent } = findByEditorID(generatedContent, editorID);
634
+ const { parent: generatedParent, grandParent: generatedGrandParent } = findByEditorID(
635
+ generatedContent,
636
+ editorID[0]
637
+ );
621
638
  const module = Array.isArray(generatedParent) ? generatedGrandParent : generatedParent;
622
639
  const duplicatedEditorID = module[parentKey][duplicatedItemIndex].editorID;
623
640
 
@@ -628,7 +645,7 @@ function duplicateModule(editorID: number, key?: string): (dispatch: Dispatch, g
628
645
  }
629
646
 
630
647
  function moveModule(
631
- elementID: number,
648
+ elementID: number[],
632
649
  content: any,
633
650
  newIndex: number,
634
651
  key: string
@@ -639,29 +656,39 @@ function moveModule(
639
656
  navigation: { selectedContent, editorContent },
640
657
  } = getState();
641
658
 
659
+ const updatedContent: any = { ...editorContent };
642
660
  const contentElements = [...selectedContent[key]];
643
- const { element: selectedModule } = findByEditorID(editorContent, selectedContent.editorID);
661
+ const { element: selectedModule } = findByEditorID(updatedContent, selectedContent.editorID);
644
662
  selectedModule[key] = moveElement(elementID, contentElements, newIndex);
645
663
 
646
- generateContent(editorContent, dispatch, getState);
664
+ dispatch(setEditorContent(updatedContent));
665
+ dispatch(setSelectedDefaultContent(selectedContent));
647
666
  } catch {
648
667
  console.log("error in moveModule");
649
668
  }
650
669
  };
651
670
  }
652
671
 
653
- function copyModule(editorID: number): (dispatch: Dispatch, getState: any) => boolean {
672
+ function copyModule(editorID: number[]): (dispatch: Dispatch, getState: any) => boolean {
654
673
  return (dispatch, getState) => {
655
674
  const {
656
675
  navigation: { editorContent },
657
676
  } = getState();
658
677
 
659
- const { element: originalElement } = findByEditorID(editorContent, editorID);
660
- if (originalElement) {
661
- const { editorID, parentEditorID, ...element } = originalElement;
678
+ const modulesToCopy: IModule[] = [];
679
+
680
+ editorID.forEach((id) => {
681
+ const { element: originalElement } = findByEditorID(editorContent, id);
682
+ if (originalElement) {
683
+ const { editorID, parentEditorID, ...element } = originalElement;
684
+ modulesToCopy.push(element);
685
+ }
686
+ });
687
+
688
+ if (modulesToCopy.length) {
662
689
  const payload = {
663
690
  date: new Date(),
664
- element,
691
+ elements: modulesToCopy,
665
692
  };
666
693
  dispatch(setCopyModule(payload));
667
694
  return true;
@@ -673,25 +700,27 @@ function copyModule(editorID: number): (dispatch: Dispatch, getState: any) => bo
673
700
 
674
701
  function pasteModule(
675
702
  editorID: number,
676
- key: string
703
+ key: string,
704
+ modulesToPaste: IModule[]
677
705
  ): (dispatch: Dispatch, getState: any) => Promise<{ error?: INotification }> {
678
706
  return async (dispatch, getState) => {
679
707
  const {
680
- navigation: { moduleCopy, editorContent },
681
- } = getState();
708
+ navigation: { editorContent },
709
+ }: IRootState = getState();
682
710
 
683
711
  const { element: originalElement } = findByEditorID(editorContent, editorID);
684
-
685
- const validatedModuleCopy: any = deepClone(moduleCopy.element);
686
-
687
712
  const itemsArr = originalElement[key];
688
- itemsArr.push(validatedModuleCopy);
713
+
714
+ modulesToPaste.forEach((element) => {
715
+ const validatedModuleCopy: any = deepClone(element);
716
+ itemsArr.push(validatedModuleCopy);
717
+ });
689
718
 
690
719
  const updatedPageContent = {
691
720
  ...editorContent,
692
721
  };
693
722
 
694
- generateContent(updatedPageContent, dispatch, getState);
723
+ generateContent(updatedPageContent)(dispatch, getState);
695
724
 
696
725
  return { error: undefined };
697
726
  };
@@ -708,23 +737,25 @@ function replaceElementsInCollection(newValue: string, reference: string): (disp
708
737
  };
709
738
  }
710
739
 
711
- function generateContent(editorContent: any, dispatch: Dispatch, getState: any) {
712
- const {
713
- navigation: { selectedEditorID },
714
- } = getState();
715
- const { pageContent } = generateEditorIDs(editorContent);
716
- const { element: selectedContent, parent: selectedParent } = findByEditorID(pageContent, selectedEditorID);
717
- const { component } = selectedContent;
718
- const schema = selectedContent && getSchema(component);
719
-
720
- dispatch(setSchema(schema));
721
- dispatch(setEditorContent(pageContent));
722
- dispatch(updateBreadcrumb(selectedEditorID));
723
- dispatch(setSelectedDefaultContent(selectedContent));
724
- dispatch(setSelectedDefaultParentContent(selectedParent));
725
- dispatch(setTab("content"));
726
- dispatch(setCurrentNavigationLanguages(editorContent.navigationLanguages));
727
- dispatch(setIsLoading(false));
740
+ function generateContent(editorContent: any): (dispatch: Dispatch, getState: any) => void {
741
+ return async (dispatch, getState) => {
742
+ const {
743
+ navigation: { selectedEditorID },
744
+ } = getState();
745
+ const { pageContent } = generateEditorIDs(editorContent);
746
+ const { element: selectedContent, parent: selectedParent } = findByEditorID(pageContent, selectedEditorID);
747
+ const { component } = selectedContent;
748
+ const schema = selectedContent && getSchema(component);
749
+
750
+ dispatch(setSchema(schema));
751
+ dispatch(setEditorContent(pageContent));
752
+ dispatch(updateBreadcrumb(selectedEditorID));
753
+ dispatch(setSelectedDefaultContent(selectedContent));
754
+ dispatch(setSelectedDefaultParentContent(selectedParent));
755
+ dispatch(setTab("content"));
756
+ dispatch(setCurrentNavigationLanguages(editorContent.navigationLanguages));
757
+ dispatch(setIsLoading(false));
758
+ };
728
759
  }
729
760
 
730
761
  function updateEditorContent(
@@ -1,4 +1,4 @@
1
- import { IBreadcrumbItem, INavPages, ISchema } from "@ax/types";
1
+ import { IBreadcrumbItem, IModule, INavPages, ISchema } from "@ax/types";
2
2
  import {
3
3
  SET_EDITOR_CONTENT,
4
4
  SET_BREADCRUMB,
@@ -84,7 +84,7 @@ export interface ISetIsNewTranslation {
84
84
 
85
85
  export interface ISetCopyModule {
86
86
  type: typeof SET_COPY_MODULE;
87
- payload: { moduleCopy: Record<string, unknown> | null };
87
+ payload: { moduleCopy: { date: Date; elements: IModule[] } | null };
88
88
  }
89
89
 
90
90
  export interface ISetNavPages {
@@ -1,4 +1,4 @@
1
- import { IBreadcrumbItem, INavPages, ISchema } from "@ax/types";
1
+ import { IBreadcrumbItem, IModule, INavPages, ISchema } from "@ax/types";
2
2
 
3
3
  import {
4
4
  SET_EDITOR_CONTENT,
@@ -36,7 +36,7 @@ export interface INavigationState {
36
36
  currentNavigationLanguages: any[];
37
37
  isNewTranslation: boolean;
38
38
  form: any;
39
- moduleCopy: { date: string; element: Record<string, unknown> } | null;
39
+ moduleCopy: { date: Date; elements: IModule[] } | null;
40
40
  navigationPages: INavPages | null;
41
41
  }
42
42
 
@@ -60,7 +60,7 @@ export const initialState = {
60
60
  navigationPages: null,
61
61
  };
62
62
 
63
- export function reducer(state = initialState, action: NavigationActionsCreators): INavigationState {
63
+ export function reducer(state = initialState, action: any): INavigationState {
64
64
  switch (action.type) {
65
65
  case SET_EDITOR_CONTENT:
66
66
  case SET_BREADCRUMB: