@griddo/ax 1.58.4 → 1.59.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 (120) hide show
  1. package/package.json +2 -2
  2. package/src/GlobalStore.tsx +3 -1
  3. package/src/api/checkgroups.tsx +1 -1
  4. package/src/api/domains.tsx +26 -0
  5. package/src/api/index.tsx +3 -1
  6. package/src/api/sites.tsx +25 -8
  7. package/src/api/utils.tsx +1 -1
  8. package/src/components/Browser/index.tsx +8 -3
  9. package/src/components/ElementsTooltip/index.tsx +23 -8
  10. package/src/components/ElementsTooltip/style.tsx +4 -5
  11. package/src/components/ErrorCenter/index.tsx +11 -1
  12. package/src/components/ErrorCenter/style.tsx +4 -3
  13. package/src/components/Fields/CheckGroup/index.tsx +5 -4
  14. package/src/components/Fields/ComponentArray/MixableComponentArray/AddItemButton/index.tsx +1 -0
  15. package/src/components/Fields/ReferenceField/Context/index.tsx +10 -6
  16. package/src/components/Fields/ReferenceField/ItemList/Item/index.tsx +2 -2
  17. package/src/components/Fields/ReferenceField/ItemList/index.tsx +15 -14
  18. package/src/components/FieldsBehavior/index.tsx +2 -1
  19. package/src/components/FloatingMenu/index.tsx +3 -1
  20. package/src/components/FloatingMenu/style.tsx +7 -5
  21. package/src/components/Gallery/GalleryPanel/DetailPanel/index.tsx +17 -19
  22. package/src/components/Gallery/GalleryPanel/DetailPanel/style.tsx +32 -19
  23. package/src/components/Gallery/style.tsx +1 -1
  24. package/src/components/Icon/components/Category.js +5 -6
  25. package/src/components/Icon/components/Refresh.js +12 -0
  26. package/src/components/Icon/svgs/Category.svg +1 -1
  27. package/src/components/Icon/svgs/Refresh.svg +3 -0
  28. package/src/components/Lists/style.tsx +10 -9
  29. package/src/components/MainWrapper/AppBar/index.tsx +16 -5
  30. package/src/components/MainWrapper/AppBar/style.tsx +2 -1
  31. package/src/components/SideModal/index.tsx +10 -4
  32. package/src/components/TableCounter/style.tsx +1 -4
  33. package/src/components/TableFilters/CategoryFilter/index.tsx +92 -0
  34. package/src/{modules/Content/HeaderMenus/Translations → components/TableFilters/CategoryFilter}/style.tsx +4 -3
  35. package/src/components/TableFilters/CustomizeFilters/index.tsx +52 -0
  36. package/src/components/TableFilters/CustomizeFilters/style.tsx +28 -0
  37. package/src/{modules/StructuredData/StructuredDataList/HeaderMenus/Live → components/TableFilters/LiveFilter}/index.tsx +18 -6
  38. package/src/{modules/Content/HeaderMenus/Live → components/TableFilters/LiveFilter}/style.tsx +0 -0
  39. package/src/{modules/StructuredData/StructuredDataList/HeaderMenus/Name → components/TableFilters/NameFilter}/index.tsx +18 -9
  40. package/src/{modules/Content/HeaderMenus/Name → components/TableFilters/NameFilter}/style.tsx +0 -0
  41. package/src/{modules/StructuredData/StructuredDataList/HeaderMenus/Site → components/TableFilters/SiteFilter}/index.tsx +3 -3
  42. package/src/{modules/StructuredData/StructuredDataList/HeaderMenus/Site → components/TableFilters/SiteFilter}/style.tsx +1 -1
  43. package/src/{modules/Content/HeaderMenus/Status → components/TableFilters/StatusFilter}/index.tsx +7 -4
  44. package/src/{modules/Content/HeaderMenus/Status → components/TableFilters/StatusFilter}/style.tsx +0 -0
  45. package/src/{modules/StructuredData/StructuredDataList/HeaderMenus/Translations → components/TableFilters/TranslationsFilter}/index.tsx +4 -4
  46. package/src/{modules/StructuredData/StructuredDataList/HeaderMenus/Translations → components/TableFilters/TranslationsFilter}/style.tsx +0 -0
  47. package/src/{modules/StructuredData/StructuredDataList/HeaderMenus/Types → components/TableFilters/TypeFilter}/index.tsx +13 -9
  48. package/src/{modules/StructuredData/StructuredDataList/HeaderMenus/Types → components/TableFilters/TypeFilter}/style.tsx +1 -1
  49. package/src/components/TableFilters/index.tsx +19 -0
  50. package/src/components/Tag/index.tsx +1 -1
  51. package/src/components/Tag/style.tsx +10 -11
  52. package/src/components/index.tsx +19 -0
  53. package/src/containers/Domains/actions.tsx +51 -0
  54. package/src/containers/Domains/constants.tsx +5 -0
  55. package/src/containers/Domains/index.tsx +4 -0
  56. package/src/containers/Domains/interfaces.tsx +9 -0
  57. package/src/containers/Domains/reducer.tsx +22 -0
  58. package/src/containers/Gallery/actions.tsx +0 -1
  59. package/src/containers/PageEditor/actions.tsx +7 -0
  60. package/src/containers/PageEditor/utils.tsx +1 -1
  61. package/src/containers/Settings/Languages/constants.tsx +3 -3
  62. package/src/containers/Settings/Languages/index.tsx +2 -5
  63. package/src/containers/Sites/actions.tsx +3 -2
  64. package/src/containers/StructuredData/actions.tsx +62 -3
  65. package/src/containers/StructuredData/constants.tsx +4 -0
  66. package/src/containers/StructuredData/interfaces.tsx +13 -1
  67. package/src/containers/StructuredData/reducer.tsx +9 -1
  68. package/src/forms/editor.tsx +4 -0
  69. package/src/forms/elements.tsx +2 -5
  70. package/src/forms/index.tsx +2 -1
  71. package/src/forms/validators.tsx +12 -5
  72. package/src/helpers/arrays.tsx +12 -1
  73. package/src/helpers/index.tsx +4 -1
  74. package/src/helpers/strings.tsx +7 -0
  75. package/src/hooks/content.tsx +41 -0
  76. package/src/hooks/index.tsx +3 -1
  77. package/src/modules/Categories/CategoriesList/CategoryNav/NavItem/style.tsx +9 -9
  78. package/src/modules/Content/BulkHeader/TableHeader/index.tsx +95 -24
  79. package/src/modules/Content/BulkHeader/TableHeader/style.tsx +6 -19
  80. package/src/modules/Content/BulkHeader/index.tsx +16 -0
  81. package/src/modules/Content/ContentFilters/index.tsx +4 -4
  82. package/src/modules/Content/OptionTable/style.tsx +1 -1
  83. package/src/modules/Content/PageItem/atoms.tsx +28 -0
  84. package/src/modules/Content/PageItem/index.tsx +67 -24
  85. package/src/modules/Content/PageItem/style.tsx +14 -7
  86. package/src/modules/Content/hooks.tsx +27 -17
  87. package/src/modules/Content/index.tsx +53 -6
  88. package/src/modules/GlobalEditor/index.tsx +5 -11
  89. package/src/modules/GlobalSettings/Robots/Item/RobotsPanel/index.tsx +61 -0
  90. package/src/modules/GlobalSettings/Robots/Item/RobotsPanel/style.tsx +30 -0
  91. package/src/modules/GlobalSettings/Robots/Item/index.tsx +33 -0
  92. package/src/modules/GlobalSettings/Robots/Item/style.tsx +28 -0
  93. package/src/modules/GlobalSettings/Robots/index.tsx +120 -0
  94. package/src/modules/GlobalSettings/Robots/style.tsx +32 -0
  95. package/src/modules/GlobalSettings/index.tsx +26 -0
  96. package/src/modules/PageEditor/index.tsx +2 -5
  97. package/src/modules/Settings/Globals/style.tsx +1 -1
  98. package/src/modules/StructuredData/Form/ConnectedField/index.tsx +10 -2
  99. package/src/modules/StructuredData/Form/index.tsx +48 -9
  100. package/src/modules/StructuredData/Form/style.tsx +3 -6
  101. package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/index.tsx +84 -35
  102. package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/style.tsx +6 -25
  103. package/src/modules/StructuredData/StructuredDataList/BulkHeader/index.tsx +10 -1
  104. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/atoms.tsx +24 -3
  105. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +53 -22
  106. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/style.tsx +16 -9
  107. package/src/modules/StructuredData/StructuredDataList/OptionTable/style.tsx +1 -1
  108. package/src/modules/StructuredData/StructuredDataList/hooks.tsx +9 -2
  109. package/src/modules/StructuredData/StructuredDataList/index.tsx +45 -5
  110. package/src/routes/multisite.tsx +8 -0
  111. package/src/types/index.tsx +28 -11
  112. package/src/modules/Content/HeaderMenus/Live/index.tsx +0 -93
  113. package/src/modules/Content/HeaderMenus/Name/index.tsx +0 -52
  114. package/src/modules/Content/HeaderMenus/Translations/index.tsx +0 -62
  115. package/src/modules/Content/HeaderMenus/Types/index.tsx +0 -73
  116. package/src/modules/Content/HeaderMenus/Types/style.tsx +0 -34
  117. package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Live/style.tsx +0 -37
  118. package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Name/style.tsx +0 -29
  119. package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Status/index.tsx +0 -47
  120. package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Status/style.tsx +0 -30
@@ -17,7 +17,8 @@ export const PanelActions = styled.div`
17
17
  display: flex;
18
18
  justify-content: flex-end;
19
19
  background-color: ${p => p.theme.color.uiBarBackground};
20
- padding: ${p => p.theme.spacing.m};
20
+ padding: ${p => p.theme.spacing.s} ${p => p.theme.spacing.m};
21
+ border-top: 1px solid ${p => p.theme.color.uiLine};
21
22
  button:not(:first-child) {
22
23
  margin-left: ${p => p.theme.spacing.s};
23
24
  }
@@ -26,24 +27,36 @@ export const PanelActions = styled.div`
26
27
  export const PanelForm = styled.div`
27
28
  position: relative;
28
29
  width: 100%;
29
- height: 100%;
30
+ height: calc(${p => p.theme.spacing.xl} * 8);
30
31
  overflow: auto;
31
- padding: ${p => `${p.theme.spacing.m} ${p.theme.spacing.m} 80px ${p.theme.spacing.m}`};
32
32
  `;
33
33
 
34
- export const DateWrapper = styled.div`
35
- ${p => p.theme.textStyle.uiXS};
34
+ export const Date = styled.div`
35
+ ${p => p.theme.textStyle.uiM};
36
+ color: ${p => p.theme.color.textMediumEmphasis};
37
+ margin-bottom: ${p => p.theme.spacing.xxs};
38
+ `;
39
+
40
+ export const Type = styled.div`
41
+ ${p => p.theme.textStyle.uiM};
36
42
  color: ${p => p.theme.color.textMediumEmphasis};
37
- margin-bottom: ${p => p.theme.spacing.xs};
43
+ margin-bottom: ${p => p.theme.spacing.xxs};
38
44
  `;
39
45
 
40
46
  export const ImageInfoWrapper = styled.div`
41
- display: flex;
42
- margin-bottom: ${p => p.theme.spacing.m};
47
+ padding: ${p => p.theme.spacing.m};
48
+ border-bottom: 1px solid ${p => p.theme.color.uiLine};
43
49
  `;
44
50
 
45
51
  export const ImageWrapper = styled.div`
46
- max-width: 128px;
52
+ display: flex;
53
+ margin-bottom: ${p => p.theme.spacing.s};
54
+ align-items: flex-start;
55
+ justify-content: space-between;
56
+ `;
57
+
58
+ export const Image = styled.div`
59
+ max-width: 120px;
47
60
  width: 100%;
48
61
  img {
49
62
  border: 1px solid ${p => p.theme.color.uiLine};
@@ -51,28 +64,27 @@ export const ImageWrapper = styled.div`
51
64
  }
52
65
  `;
53
66
 
54
- export const ImageData = styled.div`
55
- margin-left: ${p => p.theme.spacing.s};
56
- `;
57
-
58
67
  export const ImageName = styled.div`
59
68
  ${p => p.theme.textStyle.uiL};
60
69
  color: ${p => p.theme.color.textHighEmphasis};
61
- margin-bottom: ${p => p.theme.spacing.xs};
70
+ margin-bottom: ${p => p.theme.spacing.xxs};
71
+ overflow-wrap: break-word;
62
72
  `;
63
73
 
64
74
  export const ImageSize = styled.div`
65
- ${p => p.theme.textStyle.uiS};
75
+ ${p => p.theme.textStyle.uiM};
66
76
  color: ${p => p.theme.color.textMediumEmphasis};
67
- margin-bottom: ${p => p.theme.spacing.xs};
77
+ margin-bottom: ${p => p.theme.spacing.xxs};
68
78
  `;
69
79
 
70
80
  export const ImageDimensions = styled.div`
71
- ${p => p.theme.textStyle.uiS};
81
+ ${p => p.theme.textStyle.uiM};
72
82
  color: ${p => p.theme.color.textMediumEmphasis};
73
83
  `;
74
84
 
75
- export const FormWrapper = styled.div``;
85
+ export const FormWrapper = styled.div`
86
+ padding: ${p => p.theme.spacing.m};
87
+ `;
76
88
 
77
89
  export const ImageUrl = styled.div`
78
90
  display: flex;
@@ -89,5 +101,6 @@ export const ImageUrl = styled.div`
89
101
  `;
90
102
 
91
103
  export const AddToGlobal = styled.div`
92
- margin-bottom: ${p => p.theme.spacing.m};
104
+ padding: ${p => `${p.theme.spacing.s} ${p.theme.spacing.m} ${p.theme.spacing.xs} ${p.theme.spacing.m}`};
105
+ border-bottom: 1px solid ${p => p.theme.color.uiLine};
93
106
  `;
@@ -56,7 +56,7 @@ export const GalleryWrapper = styled.div`
56
56
  background-color: ${p => p.theme.color.uiBackground01};
57
57
  overflow: auto;
58
58
  padding-right: ${gutter};
59
- min-height: calc(100% - ${p => p.theme.spacing.xl} * 2);
59
+ height: calc(${p => p.theme.spacing.xl} * 7 + ${gutter});
60
60
  position: relative;
61
61
  `;
62
62
 
@@ -1,11 +1,10 @@
1
- import React from "react";
1
+ import * as React from "react";
2
2
 
3
- const SvgCategory = props => (
4
- <svg width={24} height={24} fill="none" {...props}>
3
+ const SvgCategory = (props) => (
4
+ <svg width={24} height={24} fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
5
5
  <path
6
- d="M11 2L5.5 11H16.5L11 2ZM11 5.84L12.93 9H9.06L11 5.84ZM16.5 13C14.01 13 12 15.01 12 17.5C12 19.99 14.01 22 16.5 22C18.99 22 21 19.99 21 17.5C21 15.01 18.99 13 16.5 13ZM16.5 20C15.12 20 14 18.88 14 17.5C14 16.12 15.12 15 16.5 15C17.88 15 19 16.12 19 17.5C19 18.88 17.88 20 16.5 20ZM2 21.5H10V13.5H2V21.5ZM4 15.5H8V19.5H4V15.5Z"
7
- fill="white"
8
- fillOpacity="0.7"
6
+ d="m11 2-5.5 9h11L11 2Zm0 3.84L12.93 9H9.06L11 5.84ZM16.5 13c-2.49 0-4.5 2.01-4.5 4.5s2.01 4.5 4.5 4.5 4.5-2.01 4.5-4.5-2.01-4.5-4.5-4.5Zm0 7a2.5 2.5 0 0 1 0-5 2.5 2.5 0 0 1 0 5ZM2 21.5h8v-8H2v8Zm2-6h4v4H4v-4Z"
7
+ fill="#5057FF"
9
8
  />
10
9
  </svg>
11
10
  );
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+
3
+ const SvgRefresh = (props) => (
4
+ <svg width={24} height={24} fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
5
+ <path
6
+ d="M17.65 6.35A7.958 7.958 0 0 0 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35Z"
7
+ fill="#5057FF"
8
+ />
9
+ </svg>
10
+ );
11
+
12
+ export default SvgRefresh;
@@ -1,3 +1,3 @@
1
1
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M11 2L5.5 11H16.5L11 2ZM11 5.84L12.93 9H9.06L11 5.84ZM16.5 13C14.01 13 12 15.01 12 17.5C12 19.99 14.01 22 16.5 22C18.99 22 21 19.99 21 17.5C21 15.01 18.99 13 16.5 13ZM16.5 20C15.12 20 14 18.88 14 17.5C14 16.12 15.12 15 16.5 15C17.88 15 19 16.12 19 17.5C19 18.88 17.88 20 16.5 20ZM2 21.5H10V13.5H2V21.5ZM4 15.5H8V19.5H4V15.5Z" fill="white" fill-opacity="0.7"/>
2
+ <path d="M11 2L5.5 11H16.5L11 2ZM11 5.84L12.93 9H9.06L11 5.84ZM16.5 13C14.01 13 12 15.01 12 17.5C12 19.99 14.01 22 16.5 22C18.99 22 21 19.99 21 17.5C21 15.01 18.99 13 16.5 13ZM16.5 20C15.12 20 14 18.88 14 17.5C14 16.12 15.12 15 16.5 15C17.88 15 19 16.12 19 17.5C19 18.88 17.88 20 16.5 20ZM2 21.5H10V13.5H2V21.5ZM4 15.5H8V19.5H4V15.5Z" fill="#5057FF"/>
3
3
  </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M17.65 6.35C16.2 4.9 14.21 4 12 4C7.57999 4 4.00999 7.58 4.00999 12C4.00999 16.42 7.57999 20 12 20C15.73 20 18.84 17.45 19.73 14H17.65C16.83 16.33 14.61 18 12 18C8.68999 18 5.99999 15.31 5.99999 12C5.99999 8.69 8.68999 6 12 6C13.66 6 15.14 6.69 16.22 7.78L13 11H20V4L17.65 6.35Z" fill="#5057FF"/>
3
+ </svg>
@@ -1,23 +1,24 @@
1
1
  import styled from "styled-components";
2
2
 
3
3
  const ListTitle = styled.h6`
4
- ${p => p.theme.textStyle.headingXXS};
5
- padding: ${p => `${p.theme.spacing.xs} ${p.theme.spacing.s}`};
4
+ ${(p) => p.theme.textStyle.headingXXS};
5
+ padding: ${(p) => `${p.theme.spacing.xs} ${p.theme.spacing.s}`};
6
6
  cursor: initial;
7
+ white-space: nowrap;
7
8
  `;
8
9
 
9
- const StyledListItem = styled.span <{ isSelected?: boolean }>`
10
- ${p => p.theme.textStyle.uiM};
11
- color: ${p => p.isSelected ? p.theme.colors.interactive01 : p.theme.colors.textMediumEmphasis};
12
- padding: ${p => `${p.theme.spacing.xs} ${p.theme.spacing.s}`};
10
+ const StyledListItem = styled.span<{ isSelected?: boolean }>`
11
+ ${(p) => p.theme.textStyle.uiM};
12
+ color: ${(p) => (p.isSelected ? p.theme.colors.interactive01 : p.theme.colors.textMediumEmphasis)};
13
+ padding: ${(p) => `${p.theme.spacing.xs} ${p.theme.spacing.s}`};
13
14
  cursor: pointer;
14
- font-weight: ${p => p.isSelected ? "bold" : "normal"};
15
+ font-weight: ${(p) => (p.isSelected ? "bold" : "normal")};
15
16
  display: flex;
16
17
  justify-content: space-between;
17
18
 
18
19
  &:hover {
19
- background-color: ${p => p.theme.colors.overlayHoverPrimary};
20
+ background-color: ${(p) => p.theme.colors.overlayHoverPrimary};
20
21
  }
21
22
  `;
22
23
 
23
- export { ListTitle, StyledListItem }
24
+ export { ListTitle, StyledListItem };
@@ -2,7 +2,18 @@ import React from "react";
2
2
  import { withRouter, RouteComponentProps } from "react-router-dom";
3
3
 
4
4
  import { IErrorItem } from "@ax/types";
5
- import { Button, Icon, IconAction, Flag, FloatingMenu, LanguageMenu, Tabs, Tooltip, ErrorCenter, SearchField } from "@ax/components";
5
+ import {
6
+ Button,
7
+ Icon,
8
+ IconAction,
9
+ Flag,
10
+ FloatingMenu,
11
+ LanguageMenu,
12
+ Tabs,
13
+ Tooltip,
14
+ ErrorCenter,
15
+ SearchField,
16
+ } from "@ax/components";
6
17
 
7
18
  import { ActionMenu, ActionSimpleMenu, DownArrowButton } from "./atoms";
8
19
 
@@ -122,11 +133,11 @@ const AppBar = (props: IProps): JSX.Element => {
122
133
 
123
134
  const PageStatus = () =>
124
135
  statusMenu.options && statusMenu.options.length > 0 ? (
125
- <FloatingMenu Button={StatusBtn} isInAppBar={true}>
136
+ <FloatingMenu Button={StatusBtn} isInAppBar={true} position="left" offset={-20}>
126
137
  <ActionSimpleMenu menu={statusMenu} />
127
138
  </FloatingMenu>
128
139
  ) : (
129
- <Icon name={pageStatus!} size="24" />
140
+ <Icon name={pageStatus ?? "offline"} size="24" />
130
141
  );
131
142
 
132
143
  const languageTooltip = typeof currentPageID === "number" && "Add language";
@@ -158,7 +169,7 @@ const AppBar = (props: IProps): JSX.Element => {
158
169
  <>
159
170
  <S.LanguageWrapper>
160
171
  <Tooltip content={languageTooltip} hideOnClick bottom>
161
- <FloatingMenu Button={LanguageBtn} isInAppBar={true}>
172
+ <FloatingMenu Button={LanguageBtn} isInAppBar={true} position="left">
162
173
  {languageMenu}
163
174
  </FloatingMenu>
164
175
  </Tooltip>
@@ -179,7 +190,7 @@ const AppBar = (props: IProps): JSX.Element => {
179
190
  {errors && errors.length > 0 && (
180
191
  <>
181
192
  <S.IconStatusWrapper>
182
- <FloatingMenu Button={ErrorCenterBtn} isInAppBar={true}>
193
+ <FloatingMenu Button={ErrorCenterBtn} isInAppBar={true} position="left" offset={-20}>
183
194
  <ErrorCenter errors={errors} actions={errorActions} />
184
195
  </FloatingMenu>
185
196
  </S.IconStatusWrapper>
@@ -89,6 +89,7 @@ const Separator = styled.div`
89
89
  `;
90
90
 
91
91
  const IconStatusWrapper = styled.div`
92
+ position: relative;
92
93
  height: ${(p) => p.theme.spacing.m};
93
94
  `;
94
95
 
@@ -153,7 +154,7 @@ const ErrorWrapper = styled.div`
153
154
  `;
154
155
 
155
156
  const SearchWrapper = styled.div`
156
- width: ${p => `calc(${p.theme.spacing.xl} * 5)`};
157
+ width: ${(p) => `calc(${p.theme.spacing.xl} * 5)`};
157
158
  display: flex;
158
159
  justify-content: flex-end;
159
160
  `;
@@ -20,6 +20,7 @@ const SideModal = (props: ISideModalProps): JSX.Element | null => {
20
20
  handleClick,
21
21
  current,
22
22
  setDefault,
23
+ showSearch,
23
24
  } = props;
24
25
 
25
26
  const componentList: any = [];
@@ -49,10 +50,12 @@ const SideModal = (props: ISideModalProps): JSX.Element | null => {
49
50
  category: "all",
50
51
  };
51
52
  setOptions(filteredOptions);
53
+ } else {
54
+ setOptions(filteredValues);
52
55
  }
53
56
 
54
57
  // eslint-disable-next-line react-hooks/exhaustive-deps
55
- }, [current]);
58
+ }, [current, whiteList]);
56
59
 
57
60
  const node = useRef<any>(null);
58
61
  const handleClickOutside = (e: any) => {
@@ -133,9 +136,11 @@ const SideModal = (props: ISideModalProps): JSX.Element | null => {
133
136
  <S.Wrapper ref={node} optionsType={optionsType}>
134
137
  <S.Header>
135
138
  <S.Title>{optionsType}</S.Title>
136
- <S.SearchWrapper>
137
- <SearchField onChange={setSearchQuery} closeOnInactive />
138
- </S.SearchWrapper>
139
+ {showSearch && (
140
+ <S.SearchWrapper>
141
+ <SearchField onChange={setSearchQuery} closeOnInactive />
142
+ </S.SearchWrapper>
143
+ )}
139
144
  </S.Header>
140
145
  {setDefault && !setDefault.checked && (
141
146
  <S.CheckFieldWrapper>
@@ -173,6 +178,7 @@ interface ISideModalProps {
173
178
  componentOptions?: any;
174
179
  current?: any;
175
180
  setDefault?: any;
181
+ showSearch?: boolean;
176
182
  }
177
183
 
178
184
  export default SideModal;
@@ -3,12 +3,9 @@ import styled from "styled-components";
3
3
  const ResultsCount = styled.span`
4
4
  ${(p) => p.theme.textStyle.uiXS};
5
5
  color: ${(p) => p.theme.color.textLowEmphasis};
6
- width: 100px;
7
6
  display: inline-flex;
8
7
  align-items: center;
9
8
  justify-content: flex-end;
10
9
  `;
11
10
 
12
- export {
13
- ResultsCount
14
- }
11
+ export { ResultsCount };
@@ -0,0 +1,92 @@
1
+ import React, { useEffect, useState } from "react";
2
+
3
+ import { CheckGroup, FloatingMenu, Icon, ListTitle } from "@ax/components";
4
+ import { areEquals, isNumber, isReqOk } from "@ax/helpers";
5
+ import { checkgroups } from "@ax/api";
6
+ import { IFilterValue } from "@ax/types";
7
+
8
+ import * as S from "./style";
9
+
10
+ const CategoryFilter = (props: ICategoryFilterProps): JSX.Element => {
11
+ const { filterItems, value, structuredData } = props;
12
+
13
+ const filters: IFilterValue[] = [
14
+ {
15
+ name: "all",
16
+ value: "all",
17
+ title: "All",
18
+ },
19
+ ];
20
+
21
+ const storedValue = value.split(",");
22
+ const parsedValue = storedValue.map((value) => (isNumber(value) ? parseInt(value) : value));
23
+ const [initialState] = useState(parsedValue);
24
+ const selectAllOption = "all";
25
+ const [selectedValue, setSelectedValue] = useState([...initialState]);
26
+ const [options, setOptions] = useState(filters);
27
+
28
+ const getSelectCategories = async () => {
29
+ try {
30
+ const items = await checkgroups.getCheckGroupItems("global", structuredData.source);
31
+ if (items && isReqOk(items.status)) {
32
+ return items.data;
33
+ }
34
+ } catch (e) {
35
+ console.log(e);
36
+ }
37
+ return false;
38
+ };
39
+
40
+ useEffect(() => {
41
+ getSelectCategories().then((items) => {
42
+ items &&
43
+ items.forEach((item: { value: string; title: string }) => {
44
+ const newFilter = {
45
+ name: item.value,
46
+ value: item.value,
47
+ title: item.title,
48
+ };
49
+ filters.push(newFilter);
50
+ });
51
+ setOptions(filters);
52
+ });
53
+ // eslint-disable-next-line react-hooks/exhaustive-deps
54
+ }, []);
55
+
56
+ const setQuery = (selection: any) => {
57
+ if (!selection.length) {
58
+ selection = initialState;
59
+ }
60
+ setSelectedValue(selection);
61
+ const queryFilters = selection.join(",");
62
+ filterItems("categories", queryFilters);
63
+ };
64
+
65
+ const isActive = !areEquals(selectedValue, initialState);
66
+
67
+ const Header = () => (
68
+ <S.HeaderWrapper isActive={isActive}>
69
+ {structuredData.title}
70
+ <S.IconsWrapper>
71
+ <Icon name="Filter" size="16" />
72
+ </S.IconsWrapper>
73
+ </S.HeaderWrapper>
74
+ );
75
+
76
+ return (
77
+ <FloatingMenu Button={Header} position="left" closeOnSelect={false} isCheckGroup={true}>
78
+ <ListTitle>Filter by Category</ListTitle>
79
+ <S.ChecksWrapper>
80
+ <CheckGroup options={options} value={selectedValue} onChange={setQuery} selectAllOption={selectAllOption} />
81
+ </S.ChecksWrapper>
82
+ </FloatingMenu>
83
+ );
84
+ };
85
+
86
+ interface ICategoryFilterProps {
87
+ filterItems(pointer: string, filter: string): void;
88
+ value: string;
89
+ structuredData: any;
90
+ }
91
+
92
+ export default CategoryFilter;
@@ -1,8 +1,8 @@
1
1
  import styled from "styled-components";
2
2
  import { Header } from "@ax/components/TableList/style";
3
3
 
4
- const Translations = styled(Header)<{ isActive: boolean }>`
5
- width: 90px;
4
+ const HeaderWrapper = styled(Header)<{ isActive: boolean }>`
5
+ width: 150px;
6
6
  justify-content: center;
7
7
  &:hover {
8
8
  color: ${(p) => p.theme.color.interactive01};
@@ -29,6 +29,7 @@ const InteractiveArrow = styled.div`
29
29
 
30
30
  const ChecksWrapper = styled.div`
31
31
  padding: ${(p) => p.theme.spacing.xs} ${(p) => p.theme.spacing.s};
32
+ overflow-y: auto;
32
33
  `;
33
34
 
34
- export { Translations, IconsWrapper, InteractiveArrow, ChecksWrapper };
35
+ export { HeaderWrapper, IconsWrapper, InteractiveArrow, ChecksWrapper };
@@ -0,0 +1,52 @@
1
+ import React from "react";
2
+ import { CheckGroup, FloatingMenu, Icon, ListTitle } from "@ax/components";
3
+ import { IColumn } from "@ax/types";
4
+
5
+ import * as S from "./style";
6
+
7
+ const CustomizeFilters = (props: ICustomizeFiltersProps): JSX.Element => {
8
+ const { columns, setColumns, value } = props;
9
+
10
+ const options = Object.keys(columns).map((col: string) => {
11
+ const disabled = value.length >= 5 && !value.includes(col);
12
+ return { name: col, title: columns[col].title, value: col, disabled };
13
+ });
14
+
15
+ const toggleColumn = (selection: any) => {
16
+ const updatedColumns = { ...columns };
17
+ Object.keys(columns).forEach((val: string, index: number) => {
18
+ if (selection.includes(val)) {
19
+ updatedColumns[val].show = true;
20
+ } else {
21
+ updatedColumns[val].show = false;
22
+ }
23
+ });
24
+ setColumns(updatedColumns);
25
+ };
26
+
27
+ const Button = () => (
28
+ <S.IconsWrapper>
29
+ <Icon name="settings" size="16" />
30
+ </S.IconsWrapper>
31
+ );
32
+
33
+ return (
34
+ <S.Wrapper>
35
+ <FloatingMenu Button={Button} position="right" closeOnSelect={false}>
36
+ <ListTitle>Customize filters</ListTitle>
37
+ <S.Note>You can select up to five options</S.Note>
38
+ <S.ChecksWrapper>
39
+ <CheckGroup options={options} value={value} onChange={toggleColumn} />
40
+ </S.ChecksWrapper>
41
+ </FloatingMenu>
42
+ </S.Wrapper>
43
+ );
44
+ };
45
+
46
+ interface ICustomizeFiltersProps {
47
+ setColumns(newValue: any): void;
48
+ columns: Record<string, IColumn>;
49
+ value: string[];
50
+ }
51
+
52
+ export default CustomizeFilters;
@@ -0,0 +1,28 @@
1
+ import styled from "styled-components";
2
+
3
+ const Wrapper = styled.div`
4
+ position: relative;
5
+ `;
6
+
7
+ const IconsWrapper = styled.div`
8
+ display: flex;
9
+ align-items: center;
10
+ flex-direction: row;
11
+ svg {
12
+ margin-left: 4px;
13
+ }
14
+ `;
15
+
16
+ const ChecksWrapper = styled.div`
17
+ padding: ${(p) => p.theme.spacing.xs} ${(p) => p.theme.spacing.s};
18
+ `;
19
+
20
+ const Note = styled.div`
21
+ ${(p) => p.theme.textStyle.uiXS};
22
+ background-color: ${(p) => p.theme.color.uiBackground03};
23
+ padding: ${(p) => p.theme.spacing.xs};
24
+ border-radius: ${(p) => p.theme.radii.s};
25
+ margin: ${(p) => `0 ${p.theme.spacing.s}`};
26
+ `;
27
+
28
+ export { Wrapper, IconsWrapper, ChecksWrapper, Note };
@@ -7,8 +7,8 @@ import { IFilterValue, IPageLiveStatus } from "@ax/types";
7
7
 
8
8
  import * as S from "./style";
9
9
 
10
- const Live = (props: ILiveProps): JSX.Element => {
11
- const { filterItems, value } = props;
10
+ const LiveFilter = (props: ILiveFilterProps): JSX.Element => {
11
+ const { filterItems, value, isStructuredData } = props;
12
12
 
13
13
  const filters: IFilterValue[] = [
14
14
  {
@@ -24,6 +24,7 @@ const Live = (props: ILiveProps): JSX.Element => {
24
24
  const selectAllOption = "all";
25
25
  const [selectedValue, setSelectedValue] = useState([...initialState]);
26
26
  const [options, setOptions] = useState(filters);
27
+ const structuredDataStatus = ["offline", "active"];
27
28
 
28
29
  const getLiveStatusValues = async () => {
29
30
  try {
@@ -47,7 +48,9 @@ const Live = (props: ILiveProps): JSX.Element => {
47
48
  title: item.title,
48
49
  icon: item.status,
49
50
  };
50
- filters.push(newFilter);
51
+ if (!isStructuredData || (isStructuredData && structuredDataStatus.includes(newFilter.value))) {
52
+ filters.push(newFilter);
53
+ }
51
54
  });
52
55
  setOptions(filters);
53
56
  })
@@ -79,19 +82,28 @@ const Live = (props: ILiveProps): JSX.Element => {
79
82
  </S.MenuWrapper>
80
83
  );
81
84
 
85
+ const multipleSelection = options.length > 3;
86
+
82
87
  return (
83
88
  <FloatingMenu Button={Header} position="left" closeOnSelect={false}>
84
89
  <ListTitle>Filter by status</ListTitle>
85
90
  <S.ChecksWrapper>
86
- <CheckGroup options={options} value={selectedValue} onChange={setQuery} selectAllOption={selectAllOption} />
91
+ <CheckGroup
92
+ options={options}
93
+ value={selectedValue}
94
+ onChange={setQuery}
95
+ selectAllOption={selectAllOption}
96
+ multipleSelection={multipleSelection}
97
+ />
87
98
  </S.ChecksWrapper>
88
99
  </FloatingMenu>
89
100
  );
90
101
  };
91
102
 
92
- interface ILiveProps {
103
+ interface ILiveFilterProps {
93
104
  filterItems(pointer: string, filter: string): void;
94
105
  value: string;
106
+ isStructuredData?: boolean;
95
107
  }
96
108
 
97
- export default Live;
109
+ export default LiveFilter;
@@ -4,8 +4,10 @@ import { Icon, FloatingMenu, ListTitle, ListItem } from "@ax/components";
4
4
 
5
5
  import * as S from "./style";
6
6
 
7
- const NameHeader = ({ sortItems, sortedState }: INameHeaderProps) => {
7
+ const NameFilter = (props: INameFilterProps): JSX.Element => {
8
+ const { sortItems, sortedState, urlSorting } = props;
8
9
  const { isAscending, sortedByTitle, sortedByURL } = sortedState;
10
+
9
11
  const sortByName = (isAscending: boolean) => sortItems("title", isAscending);
10
12
  const sortAscendingURL = () => sortItems("slug", true);
11
13
  const sortAscendingName = () => sortByName(true);
@@ -15,9 +17,11 @@ const NameHeader = ({ sortItems, sortedState }: INameHeaderProps) => {
15
17
  isAscending ? <Icon name="FullArrowUp" size="16" /> : <Icon name="FullArrowDown" size="16" />;
16
18
  const isActive = sortedByTitle || sortedByURL;
17
19
 
20
+ const title = urlSorting ? "Name & URL" : "Name";
21
+
18
22
  const Header = () => (
19
23
  <S.NameHeader isActive={isActive}>
20
- Name & URL
24
+ {title}
21
25
  <S.IconsWrapper>
22
26
  {(sortedByTitle || sortedByURL) && <SortedStateArrow />}
23
27
  <S.InteractiveArrow>
@@ -36,17 +40,22 @@ const NameHeader = ({ sortItems, sortedState }: INameHeaderProps) => {
36
40
  <ListItem isSelected={sortedByTitle && !isAscending} onClick={sortDescendingName}>
37
41
  Descendent
38
42
  </ListItem>
39
- <ListTitle>URL Sorting</ListTitle>
40
- <ListItem isSelected={sortedByURL} onClick={sortAscendingURL}>
41
- Ascendent
42
- </ListItem>
43
+ {urlSorting && (
44
+ <>
45
+ <ListTitle>URL Sorting</ListTitle>
46
+ <ListItem isSelected={sortedByURL} onClick={sortAscendingURL}>
47
+ Ascendent
48
+ </ListItem>
49
+ </>
50
+ )}
43
51
  </FloatingMenu>
44
52
  );
45
53
  };
46
54
 
47
- interface INameHeaderProps {
55
+ interface INameFilterProps {
48
56
  sortedState: any;
49
- sortItems(orderPointer: string, isAscendent: boolean): any;
57
+ sortItems(orderPointer: string, isAscendent: boolean): void;
58
+ urlSorting?: boolean;
50
59
  }
51
60
 
52
- export default NameHeader;
61
+ export default NameFilter;
@@ -7,7 +7,7 @@ import { IFilterValue } from "@ax/types";
7
7
 
8
8
  import * as S from "./style";
9
9
 
10
- const Site = (props: ISiteProps): JSX.Element => {
10
+ const SiteFilter = (props: ISiteFilterProps): JSX.Element => {
11
11
  const { filterItems, value } = props;
12
12
 
13
13
  const filters: IFilterValue[] = [
@@ -83,9 +83,9 @@ const Site = (props: ISiteProps): JSX.Element => {
83
83
  );
84
84
  };
85
85
 
86
- interface ISiteProps {
86
+ interface ISiteFilterProps {
87
87
  filterItems(pointer: string, filter: string): void;
88
88
  value: string;
89
89
  }
90
90
 
91
- export default Site;
91
+ export default SiteFilter;
@@ -2,7 +2,7 @@ import styled from "styled-components";
2
2
  import { Header } from "@ax/components/TableList/style";
3
3
 
4
4
  const Site = styled(Header)<{ isActive: boolean }>`
5
- width: 230px;
5
+ width: 170px;
6
6
  justify-content: center;
7
7
  &:hover {
8
8
  color: ${(p) => p.theme.color.interactive01};