@griddo/ax 1.62.8 → 1.63.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 (81) hide show
  1. package/package.json +6 -5
  2. package/src/GlobalStore.tsx +1 -1
  3. package/src/Style/index.tsx +2 -0
  4. package/src/api/pages.tsx +20 -0
  5. package/src/api/utils.tsx +5 -2
  6. package/src/components/Browser/index.tsx +144 -39
  7. package/src/components/Browser/style.tsx +47 -11
  8. package/src/components/ConfigPanel/index.tsx +3 -3
  9. package/src/components/Fields/RichText/index.tsx +2 -2
  10. package/src/components/Fields/UrlField/utils.tsx +10 -1
  11. package/src/components/Icon/components/Desktop.js +9 -4
  12. package/src/components/Icon/components/Phone.js +4 -4
  13. package/src/components/Icon/components/Share.js +12 -0
  14. package/src/components/Icon/components/Tablet.js +4 -4
  15. package/src/components/Icon/svgs/Share.svg +3 -0
  16. package/src/components/MainWrapper/AppBar/index.tsx +19 -7
  17. package/src/components/MainWrapper/AppBar/style.tsx +20 -4
  18. package/src/components/MainWrapper/index.tsx +1 -1
  19. package/src/components/SideModal/index.tsx +1 -1
  20. package/src/components/TableFilters/DateFilter/index.tsx +48 -0
  21. package/src/components/TableFilters/DateFilter/style.tsx +29 -0
  22. package/src/components/TableFilters/index.tsx +2 -0
  23. package/src/components/Tabs/index.tsx +17 -7
  24. package/src/components/Tabs/style.tsx +29 -16
  25. package/src/components/Tooltip/index.tsx +1 -1
  26. package/src/components/Tooltip/style.tsx +2 -0
  27. package/src/components/index.tsx +2 -0
  28. package/src/containers/App/reducer.tsx +3 -1
  29. package/src/containers/PageEditor/actions.tsx +65 -10
  30. package/src/containers/Settings/DataPacks/actions.tsx +4 -1
  31. package/src/containers/Sites/actions.tsx +3 -1
  32. package/src/helpers/dates.tsx +3 -4
  33. package/src/helpers/index.tsx +2 -0
  34. package/src/helpers/strings.tsx +38 -7
  35. package/src/index.tsx +2 -2
  36. package/src/modules/Content/OptionTable/index.tsx +29 -2
  37. package/src/modules/Content/PageItem/index.tsx +11 -2
  38. package/src/modules/Content/index.tsx +9 -0
  39. package/src/modules/GlobalEditor/Editor/index.tsx +7 -9
  40. package/src/modules/GlobalEditor/{Editor/PageBrowser → PageBrowser}/index.tsx +14 -6
  41. package/src/modules/GlobalEditor/Preview/index.tsx +19 -0
  42. package/src/modules/GlobalEditor/Preview/style.tsx +9 -0
  43. package/src/modules/GlobalEditor/index.tsx +36 -9
  44. package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/DefaultsBrowser/index.tsx +5 -1
  45. package/src/modules/PageEditor/Editor/index.tsx +5 -5
  46. package/src/modules/PageEditor/{Editor/PageBrowser → PageBrowser}/index.tsx +11 -4
  47. package/src/modules/PageEditor/Preview/index.tsx +14 -0
  48. package/src/modules/PageEditor/Preview/style.tsx +9 -0
  49. package/src/modules/PageEditor/index.tsx +39 -16
  50. package/src/modules/PublicPreview/index.tsx +92 -0
  51. package/src/modules/PublicPreview/style.tsx +18 -0
  52. package/src/modules/Redirects/BulkHeader/TableHeader/index.tsx +16 -3
  53. package/src/modules/Redirects/BulkHeader/TableHeader/style.tsx +9 -3
  54. package/src/modules/Redirects/BulkHeader/index.tsx +7 -1
  55. package/src/modules/Redirects/RedirectItem/index.tsx +4 -0
  56. package/src/modules/Redirects/RedirectItem/style.tsx +19 -3
  57. package/src/modules/Redirects/atoms.tsx +0 -1
  58. package/src/modules/Redirects/hooks.tsx +67 -0
  59. package/src/modules/Redirects/index.tsx +23 -9
  60. package/src/modules/Redirects/utils.tsx +10 -0
  61. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/ConfigPanel/Field/index.tsx +107 -0
  62. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/ConfigPanel/Field/style.tsx +54 -0
  63. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/ConfigPanel/index.tsx +66 -0
  64. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/ConfigPanel/style.tsx +42 -0
  65. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/TemplateBrowser/index.tsx +58 -0
  66. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/index.tsx +41 -0
  67. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/index.tsx +93 -0
  68. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/style.tsx +25 -0
  69. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/index.tsx +48 -0
  70. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/style.tsx +53 -0
  71. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/index.tsx +40 -36
  72. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/style.tsx +4 -5
  73. package/src/modules/Settings/ContentTypes/DataPacks/Config/index.tsx +4 -4
  74. package/src/modules/Settings/ContentTypes/DataPacks/index.tsx +5 -1
  75. package/src/modules/Settings/{Analytics → SeoAnalyticsSettings/Analytics}/atoms.tsx +0 -0
  76. package/src/modules/Settings/{Analytics → SeoAnalyticsSettings/Analytics}/index.tsx +20 -11
  77. package/src/modules/Settings/{Analytics → SeoAnalyticsSettings/Analytics}/style.tsx +6 -0
  78. package/src/modules/Settings/{SeoSettings → SeoAnalyticsSettings}/index.tsx +11 -4
  79. package/src/routes/publicRoutes.tsx +3 -1
  80. package/src/routes/site.tsx +14 -10
  81. package/src/types/index.tsx +9 -0
@@ -0,0 +1,54 @@
1
+ import styled from "styled-components";
2
+
3
+ const HiddenButtonsWrapper = styled.span`
4
+ margin-left: auto;
5
+ display: none;
6
+ opacity: 0;
7
+ `;
8
+
9
+ const Component = styled.span<{ isArray?: boolean | undefined; disabled?: boolean }>`
10
+ color: ${p => p.theme.color.textHighEmphasis};
11
+ position: relative;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: ${p => p.isArray ? "space-between" : "initial"};
15
+ width: 100%;
16
+ height: ${p => p.theme.spacing.l};
17
+ background: ${p => p.theme.color.uiBackground02};
18
+ border: 1px solid transparent;
19
+ margin-bottom: ${p => p.theme.spacing.xs};
20
+ padding: 0 ${p => p.theme.spacing.xs};
21
+ border-radius: ${p => p.theme.radii.s};
22
+ box-shadow: ${p => p.theme.shadow.shadowS};
23
+ ${p => p.theme.textStyle.fieldLabel};
24
+ text-align: left;
25
+ cursor: ${p => p.disabled ? `default` : `pointer`};
26
+
27
+ &:hover {
28
+ background: ${p => p.theme.color.overlayHoverPrimary};
29
+ }
30
+
31
+ &:hover ${HiddenButtonsWrapper}{
32
+ display: flex;
33
+ opacity: 1;
34
+ }
35
+
36
+ &:focus,
37
+ &:active {
38
+ background: ${p => p.disabled ? p.theme.color.uiBackground02 : p.theme.color.overlayFocusPrimary};
39
+ border: 1px solid ${p => p.disabled ? `transparent` : p.theme.color.interactive01};
40
+ outline: none;
41
+ }
42
+ `;
43
+
44
+ const Label = styled.span`
45
+ ${p => p.theme.textStyle.fieldLabel};
46
+ color: ${p => p.theme.color.textHighEmphasis};
47
+ margin-left: ${p => p.theme.spacing.xs};
48
+ `;
49
+
50
+ export {
51
+ HiddenButtonsWrapper,
52
+ Component,
53
+ Label,
54
+ };
@@ -0,0 +1,66 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+
4
+ import { IRootState } from "@ax/types";
5
+ import { Loading } from "@ax/components";
6
+ import { pageEditorActions } from "@ax/containers/PageEditor";
7
+ import { dataPacksActions } from "@ax/containers/Settings";
8
+
9
+ import { Field } from "./Field";
10
+ import * as S from "./style";
11
+
12
+ const navigationTypes = ["header", "footer"];
13
+
14
+ const ConfigPanel = (props: IProps): JSX.Element => {
15
+ const {
16
+ isLoading,
17
+ template,
18
+ ...rest
19
+ } = props;
20
+
21
+ if (isLoading && !template) return <Loading />;
22
+
23
+ return (
24
+ <>
25
+ <S.HeaderWrapper>
26
+ <S.Title>{template}</S.Title>
27
+ </S.HeaderWrapper>
28
+ <S.Tab>Config</S.Tab>
29
+ <S.FieldsWrapper>
30
+ <S.FieldsTitle>Default modules</S.FieldsTitle>
31
+ {navigationTypes.map((type, idx) => (
32
+ <Field key={idx} type={type} template={template} {...rest} />
33
+ ))}
34
+ </S.FieldsWrapper>
35
+ </>
36
+ );
37
+ };
38
+
39
+ interface IStateProps {
40
+ isLoading: boolean;
41
+ template: string;
42
+ defaults: any;
43
+ content: any;
44
+ dataPackConfigFormData: any;
45
+ theme: string;
46
+ }
47
+
48
+ interface IDispatchProps {
49
+ updateEditorContent: (selectedEditorID: number, key: string, value: any) => void;
50
+ updateDataPackFormValue: (value: any) => void;
51
+ }
52
+
53
+ type IProps = IStateProps & IDispatchProps;
54
+
55
+ const mapStateToProps = (state: IRootState) => ({
56
+ defaults: state.navigation.currentDefaultsContent,
57
+ content: { ...state.pageEditor.editorContent },
58
+ dataPackConfigFormData: state.dataPacks.configFormData,
59
+ });
60
+
61
+ const mapDispatchToProps = {
62
+ updateEditorContent: pageEditorActions.updateEditorContent,
63
+ updateDataPackFormValue: dataPacksActions.updateFormValue,
64
+ };
65
+
66
+ export default connect(mapStateToProps, mapDispatchToProps)(ConfigPanel);
@@ -0,0 +1,42 @@
1
+ import styled from "styled-components";
2
+
3
+ const HeaderWrapper = styled.div`
4
+ display: flex;
5
+ flex-direction: column;
6
+ position: relative;
7
+ `;
8
+
9
+ const Title = styled.p`
10
+ ${(p) => p.theme.textStyle.headingS};
11
+ margin-bottom: ${(p) => p.theme.spacing.xs};
12
+ `;
13
+
14
+ const Tab = styled.div`
15
+ border-bottom: ${p => `1px solid ${p.theme.color.uiLine}`};
16
+ margin: ${p => p.theme.spacing.s} 0;
17
+ padding-bottom: ${p => p.theme.spacing.s};
18
+ ${(p) => p.theme.textStyle.headingXS};
19
+ color: ${p => p.theme.color.textHighEmphasis};
20
+ text-align: center;
21
+ `;
22
+
23
+ const FieldsWrapper = styled.div`
24
+ margin: ${(p) => `${p.theme.spacing.m} 0 ${p.theme.spacing.m} 0`};
25
+ `;
26
+
27
+ const FieldsTitle = styled.div`
28
+ position: relative;
29
+ ${(p) => p.theme.textStyle.headingXXS};
30
+ color: ${(p) => p.theme.colors.textMediumEmphasis};
31
+ padding-bottom: ${(p) => p.theme.spacing.xs};
32
+ margin-bottom: ${(p) => p.theme.spacing.m};
33
+ border-bottom: 1px solid ${(p) => p.theme.color.uiLine};
34
+ `;
35
+
36
+ export {
37
+ HeaderWrapper,
38
+ Title,
39
+ Tab,
40
+ FieldsWrapper,
41
+ FieldsTitle,
42
+ };
@@ -0,0 +1,58 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+
4
+ import { Browser } from "@ax/components";
5
+ import { ILanguage, IRootState, ISocialState } from "@ax/types";
6
+
7
+ const TemplateBrowser = (props: IProps) => {
8
+ const {
9
+ socials,
10
+ cloudinaryName,
11
+ damDomain,
12
+ content: { editorContent, header, footer },
13
+ selectedEditorID,
14
+ currentSiteInfo: { theme, id: siteID },
15
+ siteLangs,
16
+ } = props;
17
+
18
+ const updatedContent = { ...editorContent };
19
+
20
+ return (
21
+ <Browser
22
+ isPage={true}
23
+ socials={socials}
24
+ content={updatedContent}
25
+ selectedEditorID={selectedEditorID}
26
+ url=""
27
+ theme={theme}
28
+ cloudinaryName={cloudinaryName}
29
+ damDomain={damDomain}
30
+ siteLangs={siteLangs}
31
+ siteID={siteID}
32
+ header={header}
33
+ footer={footer}
34
+ />
35
+ );
36
+ };
37
+
38
+ interface IProps {
39
+ content: any;
40
+ selectedEditorID: number;
41
+ currentSiteInfo: any;
42
+ socials: ISocialState;
43
+ cloudinaryName: string | null;
44
+ damDomain: string | null;
45
+ siteLangs: ILanguage[];
46
+ }
47
+
48
+ const mapStateToProps = (state: IRootState): IProps => ({
49
+ content: { ...state.pageEditor.editorContent },
50
+ selectedEditorID: state.navigation.selectedEditorID as number,
51
+ currentSiteInfo: state.sites.currentSiteInfo,
52
+ socials: state.social,
53
+ cloudinaryName: state.app.globalSettings.cloudinaryName,
54
+ damDomain: state.app.globalSettings.damDomain,
55
+ siteLangs: state.sites.currentSiteLanguages,
56
+ });
57
+
58
+ export default connect(mapStateToProps)(TemplateBrowser);
@@ -0,0 +1,41 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+ import { themes } from "components";
4
+
5
+ import { ResizePanel } from "@ax/components";
6
+ import { IRootState } from "@ax/types";
7
+
8
+ import TemplateBrowser from "./TemplateBrowser";
9
+ import ConfigPanel from "./ConfigPanel";
10
+
11
+ const Editor = (props: IProps) => {
12
+ const { isLoading, template } = props;
13
+
14
+ const defaultTheme = themes.find((theme: any) => theme.default);
15
+ const theme = defaultTheme ? defaultTheme.value : themes[0].value;
16
+
17
+ return (
18
+ <ResizePanel
19
+ leftPanel={<TemplateBrowser />}
20
+ rightPanel={
21
+ <ConfigPanel
22
+ template={template}
23
+ isLoading={isLoading}
24
+ theme={theme}
25
+ />
26
+ }
27
+ />
28
+ );
29
+ };
30
+
31
+ type IProps = {
32
+ isLoading: boolean;
33
+ template: string;
34
+ }
35
+
36
+ const mapStateToProps = (state: IRootState): IProps => ({
37
+ isLoading: state.app.isLoading,
38
+ template: state.pageEditor.template,
39
+ });
40
+
41
+ export default connect(mapStateToProps)(Editor);
@@ -0,0 +1,93 @@
1
+ import React, { useEffect } from "react";
2
+ import { connect } from "react-redux";
3
+
4
+ import { IRootState } from "@ax/types";
5
+ import { useIsDirty } from "@ax/hooks";
6
+ import { RouteLeavingGuard } from "@ax/guards";
7
+ import { ErrorToast, Loading, MainWrapper } from "@ax/components";
8
+ import { appActions } from "@ax/containers/App";
9
+ import { dataPacksActions } from "@ax/containers/Settings";
10
+
11
+ import Editor from "./Editor";
12
+ import * as S from "./style";
13
+
14
+ const TemplateEditor = (props: IProps) => {
15
+ const {
16
+ isLoading,
17
+ isSaving,
18
+ editorContent,
19
+ setHistoryPush,
20
+ template,
21
+ updateDataPack,
22
+ dataPackSelected,
23
+ } = props;
24
+
25
+ const { isDirty, setIsDirty } = useIsDirty(editorContent);
26
+
27
+ const rightButtonProps = {
28
+ label: !isDirty ? "Saved" : isSaving ? "Saving" : "Save",
29
+ disabled: isSaving || !isDirty,
30
+ action: async () => {
31
+ await updateDataPack(dataPackSelected.id);
32
+ setIsDirty(false);
33
+ },
34
+ };
35
+
36
+ const leavingGuardText = (
37
+ <>
38
+ Some content <strong>is not saved</strong> on this page.
39
+ </>
40
+ );
41
+
42
+ const goBack = (path: string) => setHistoryPush(path);
43
+
44
+ return isLoading && !template ? (
45
+ <Loading />
46
+ ) : (
47
+ <>
48
+ <RouteLeavingGuard when={isDirty} action={goBack} text={leavingGuardText} />
49
+ <MainWrapper
50
+ title={template}
51
+ backLink={true}
52
+ rightButton={rightButtonProps}
53
+ fixedAppBar={true}
54
+ fullWidth={true}
55
+ >
56
+ <ErrorToast size="l" />
57
+ <S.Content>
58
+ <Editor />
59
+ </S.Content>
60
+ </MainWrapper>
61
+ </>
62
+ );
63
+ };
64
+
65
+ const mapStateToProps = (state: IRootState) => ({
66
+ isLoading: state.app.isLoading,
67
+ isSaving: state.app.isSaving,
68
+ editorContent: state.pageEditor.editorContent,
69
+ template: state.pageEditor.template,
70
+ dataPackSelected: state.dataPacks.selected,
71
+ });
72
+
73
+ interface IStateProps {
74
+ isLoading: boolean;
75
+ isSaving: boolean;
76
+ editorContent: any;
77
+ template: string;
78
+ dataPackSelected: any;
79
+ }
80
+
81
+ const mapDispatchToProps = {
82
+ setHistoryPush: appActions.setHistoryPush,
83
+ updateDataPack: dataPacksActions.updateDataPack,
84
+ };
85
+
86
+ interface IDispatchProps {
87
+ setHistoryPush(path: string, isEditor?: boolean): void;
88
+ updateDataPack: (dataPack?: any) => Promise<void>;
89
+ }
90
+
91
+ type IProps = IStateProps & IDispatchProps;
92
+
93
+ export default connect(mapStateToProps, mapDispatchToProps)(TemplateEditor);
@@ -0,0 +1,25 @@
1
+ import styled from "styled-components";
2
+
3
+ const Content = styled.section`
4
+ display: flex;
5
+ min-height: 100%;
6
+ `;
7
+
8
+ const NotificationWrapper = styled.div`
9
+ position: fixed;
10
+ width: 100%;
11
+ top: ${p => `calc(${p.theme.spacing.s} * 4)`};
12
+ left: 0;
13
+ right: 0;
14
+ z-index: 1100;
15
+ `;
16
+
17
+ const ModalContent = styled.div`
18
+ padding: ${p => p.theme.spacing.m};
19
+ `;
20
+
21
+ export {
22
+ Content,
23
+ NotificationWrapper,
24
+ ModalContent
25
+ }
@@ -0,0 +1,48 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+
4
+ import { ITemplate } from "@ax/types";
5
+ import { appActions } from "@ax/containers/App";
6
+ import { pageEditorActions } from "@ax/containers/PageEditor";
7
+
8
+ import * as S from "./style";
9
+
10
+ const TemplateConfig = (props: IProps): React.ReactElement => {
11
+ const { setHistoryPush, templates, getTemplatePage } = props;
12
+
13
+ const goToEditor = async (template: ITemplate) => {
14
+ await getTemplatePage(template.id);
15
+ setHistoryPush("/sites/settings/content-types/editor", true);
16
+ };
17
+
18
+ return (
19
+ <>
20
+ <S.Heading>Template configuration</S.Heading>
21
+ <S.Text>
22
+ {"You can set custom settings in these templates and will be shown by default. However, they can be modified on the page's editor."}
23
+ </S.Text>
24
+ <S.TemplatesWrapper>
25
+ {templates &&
26
+ templates.map((template: ITemplate, key: number) => (
27
+ <S.TemplateCard key={`${key}${template.title}`} onClick={() => goToEditor(template)}>
28
+ {template.thumbnails && <S.TemplateThumbnail backgroundUrl={template.thumbnails["2x"]} />}
29
+ <S.TemplateCardTitle>{template.title}</S.TemplateCardTitle>
30
+ </S.TemplateCard>
31
+ ))}
32
+ </S.TemplatesWrapper>
33
+ </>
34
+ )
35
+ }
36
+
37
+ interface IProps {
38
+ templates: ITemplate[];
39
+ setHistoryPush(path: string, isEditor?: boolean): void;
40
+ getTemplatePage: (template: string) => Promise<void>;
41
+ }
42
+
43
+ const mapDispatchToProps = {
44
+ setHistoryPush: appActions.setHistoryPush,
45
+ getTemplatePage: pageEditorActions.getTemplatePage,
46
+ };
47
+
48
+ export default connect(null, mapDispatchToProps)(TemplateConfig);
@@ -0,0 +1,53 @@
1
+ import styled from "styled-components";
2
+
3
+ const TemplatesWrapper = styled.div`
4
+ display: grid;
5
+ grid-template-columns: repeat(3, 1fr);
6
+ grid-gap: ${p => p.theme.spacing.xs};
7
+ padding: ${p => p.theme.spacing.m} 0;
8
+ `;
9
+
10
+ const TemplateCard = styled.div`
11
+ display: flex;
12
+ align-items: center;
13
+ padding: ${(p) => p.theme.spacing.s};
14
+ background-color: ${(p) => p.theme.color.interactiveBackground};
15
+ border-radius: ${p => p.theme.radii.s};
16
+ border: 1px solid ${(p) => p.theme.color.uiLine};
17
+ cursor: pointer;
18
+ `;
19
+
20
+ const TemplateCardTitle = styled.div`
21
+ ${p => p.theme.textStyle.uiMSemibold};
22
+ color: ${p => p.theme.color.textHighEmphasis};
23
+ `;
24
+
25
+ const TemplateThumbnail = styled.div<{ backgroundUrl: string }>`
26
+ background: url(${p => p.backgroundUrl}) no-repeat;
27
+ background-size: cover;
28
+ background-position: top;
29
+ min-height: 86px;
30
+ width: 63px;
31
+ margin-right: ${(p) => p.theme.spacing.s};
32
+ `;
33
+
34
+ const Heading = styled.div`
35
+ ${(p) => p.theme.textStyle.headingXS};
36
+ color: ${(p) => p.theme.color.textHighEmphasis};
37
+ padding-bottom: ${(p) => p.theme.spacing.xs};
38
+ `;
39
+
40
+ const Text = styled.div`
41
+ ${(p) => p.theme.textStyle.uiM};
42
+ color: ${(p) => p.theme.color.textMediumEmphasis};
43
+ width: calc(${(p) => p.theme.spacing.l} * 12);
44
+ `;
45
+
46
+ export {
47
+ TemplateCard,
48
+ TemplateCardTitle,
49
+ TemplateThumbnail,
50
+ TemplatesWrapper,
51
+ Heading,
52
+ Text,
53
+ }
@@ -1,11 +1,12 @@
1
1
  import React, { useState } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { IDataPackConfigImport, IDataPackConfigImportCategory, IRootState } from "@ax/types";
4
+ import { IDataPackConfigImport, IDataPackConfigImportCategory, IRootState, ITemplate } from "@ax/types";
5
5
  import { dataPacksActions } from "@ax/containers/Settings";
6
6
  import { FieldsBehavior, Modal, Tag } from "@ax/components";
7
7
  import { useModal } from "@ax/hooks";
8
8
 
9
+ import TemplateConfig from "./TemplateConfig";
9
10
  import * as S from "./style";
10
11
 
11
12
  const Form = (props: IProps): JSX.Element => {
@@ -30,7 +31,7 @@ const Form = (props: IProps): JSX.Element => {
30
31
  const { isOpen, toggleModal } = useModal();
31
32
 
32
33
  const selectOptions: { value: string; label: string }[] = [];
33
- templates.forEach((template: any) =>
34
+ templates.forEach((template: ITemplate) =>
34
35
  selectOptions.push({
35
36
  value: template.id,
36
37
  label: template.title,
@@ -135,47 +136,50 @@ const Form = (props: IProps): JSX.Element => {
135
136
  <>
136
137
  <S.Config>
137
138
  {isGlobalDataPage && (
138
- <S.SubscribeWrapper>
139
- <S.Heading>Subscribe to data</S.Heading>
140
- <S.SubscribeContent>
141
- <S.SubscribeText>
139
+ <S.SectionContent>
140
+ <S.SubscribeWrapper>
141
+ <S.Heading>Subscribe to data</S.Heading>
142
+ <S.Text>
142
143
  If you want to get any Global {selected.title} Pages on this site automatically, you can do so by
143
144
  selecting the respective categories.
144
- </S.SubscribeText>
145
+ </S.Text>
145
146
  {configFormData && configFormData.import && getCategoryLabels()}
146
147
  <S.StyledButton type="button" buttonStyle="text" icon="addCircle" onClick={toggleModal}>
147
148
  Add Category
148
149
  </S.StyledButton>
149
- </S.SubscribeContent>
150
- </S.SubscribeWrapper>
150
+ </S.SubscribeWrapper>
151
+ </S.SectionContent>
151
152
  )}
152
- <S.Heading>Detail page configuration</S.Heading>
153
- <FieldsBehavior
154
- title="Default URL parent for detail template"
155
- name="defaultParent"
156
- fieldType="AsyncSelect"
157
- site={currentSite}
158
- entity={"pages"}
159
- value={configFormData && configFormData.defaultParent}
160
- onChange={setDefaultParent}
161
- options={{ excludeDetailPages: true }}
162
- />
163
- <FieldsBehavior
164
- title="Modifiable in page"
165
- name="defaultParent"
166
- fieldType="ToggleField"
167
- value={(configFormData && configFormData.modifiableOnPage) || false}
168
- checked={(configFormData && configFormData.modifiableOnPage) || false}
169
- onChange={setModifiableOnPage}
170
- />
171
- <FieldsBehavior
172
- title="Meta robots index default"
173
- name="indexDefault"
174
- fieldType="RadioGroup"
175
- value={(configFormData && configFormData.indexDefault) || false}
176
- options={indexDefaultOptions}
177
- onChange={setIndexDefault}
178
- />
153
+ <S.SectionContent>
154
+ <S.Heading>Detail page configuration</S.Heading>
155
+ <FieldsBehavior
156
+ title="Default URL parent for detail template"
157
+ name="defaultParent"
158
+ fieldType="AsyncSelect"
159
+ site={currentSite}
160
+ entity={"pages"}
161
+ value={configFormData && configFormData.defaultParent}
162
+ onChange={setDefaultParent}
163
+ options={{ excludeDetailPages: true }}
164
+ />
165
+ <FieldsBehavior
166
+ title="Modifiable in page"
167
+ name="defaultParent"
168
+ fieldType="ToggleField"
169
+ value={(configFormData && configFormData.modifiableOnPage) || false}
170
+ checked={(configFormData && configFormData.modifiableOnPage) || false}
171
+ onChange={setModifiableOnPage}
172
+ />
173
+ <FieldsBehavior
174
+ title="Meta robots index default"
175
+ name="indexDefault"
176
+ fieldType="RadioGroup"
177
+ value={(configFormData && configFormData.indexDefault) || false}
178
+ options={indexDefaultOptions}
179
+ onChange={setIndexDefault}
180
+ />
181
+ </S.SectionContent>
182
+ <TemplateConfig templates={templates} />
179
183
  </S.Config>
180
184
  <Modal
181
185
  isOpen={isOpen}
@@ -21,13 +21,12 @@ const SubscribeWrapper = styled.div`
21
21
  position: relative;
22
22
  `;
23
23
 
24
- const SubscribeContent = styled.div`
24
+ const SectionContent = styled.div`
25
25
  border-bottom: 1px solid ${(p) => p.theme.color.uiLine};
26
26
  margin-bottom: ${(p) => p.theme.spacing.m};
27
- padding-bottom: ${(p) => p.theme.spacing.m};
28
27
  `;
29
28
 
30
- const SubscribeText = styled.div`
29
+ const Text = styled.div`
31
30
  ${(p) => p.theme.textStyle.uiM};
32
31
  color: ${(p) => p.theme.color.textMediumEmphasis};
33
32
  width: calc(${(p) => p.theme.spacing.l} * 12);
@@ -48,8 +47,8 @@ export {
48
47
  Config,
49
48
  ModalContent,
50
49
  SubscribeWrapper,
51
- SubscribeContent,
52
- SubscribeText,
50
+ SectionContent,
51
+ Text,
53
52
  StyledButton,
54
53
  CategoriesWrapper,
55
54
  };
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { IRootState, ISite } from "@ax/types";
4
+ import { IRootState, ISite, ITemplate } from "@ax/types";
5
5
  import { getSchemaThumbnails, getTemplateThumbnails } from "@ax/helpers";
6
6
 
7
7
  import Card from "./Card";
@@ -9,7 +9,7 @@ import Form from "./Form";
9
9
 
10
10
  import * as S from "./style";
11
11
 
12
- const ConfigPack = (props: any): JSX.Element => {
12
+ const ConfigPack = (props: IProps): JSX.Element => {
13
13
  const { selected, currentSiteInfo } = props;
14
14
  const { title, description, categories, templates, modules, structuredData } = selected;
15
15
  const isFromPage = templates && templates.length > 0;
@@ -48,7 +48,7 @@ const ConfigPack = (props: any): JSX.Element => {
48
48
  );
49
49
  })}
50
50
  {templates &&
51
- templates.map((template: any, key: number) => {
51
+ templates.map((template: ITemplate, key: number) => {
52
52
  const thumbnails = getTemplateThumbnails(template.id, currentSiteInfo.theme);
53
53
  return (
54
54
  <Card
@@ -77,4 +77,4 @@ const mapStateToProps = (state: IRootState) => ({
77
77
  currentSiteInfo: state.sites.currentSiteInfo,
78
78
  });
79
79
 
80
- export default connect(mapStateToProps, null)(ConfigPack);
80
+ export default connect(mapStateToProps)(ConfigPack);