@griddo/ax 10.3.23 → 10.3.25

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 (126) hide show
  1. package/package.json +2 -2
  2. package/src/__tests__/components/Gallery/GalleryFilters/Orientation/Orientation.test.tsx +5 -2
  3. package/src/__tests__/components/Gallery/GalleryFilters/SortBy/SortBy.test.tsx +5 -4
  4. package/src/__tests__/components/Gallery/GalleryFilters/Type/Type.test.tsx +5 -2
  5. package/src/__tests__/components/TableFilters/CategoryFilter/CategoryFilter.test.tsx +12 -11
  6. package/src/__tests__/components/TableFilters/DateFilter/DateFilter.test.tsx +17 -16
  7. package/src/__tests__/components/TableFilters/LiveFilter/LiveFilter.test.tsx +14 -13
  8. package/src/__tests__/components/TableFilters/NameFilter/NameFilter.test.tsx +21 -20
  9. package/src/__tests__/components/TableFilters/RoleFilter/RoleFilter.test.tsx +6 -5
  10. package/src/__tests__/components/TableFilters/SiteFilter/SiteFilter.test.tsx +8 -7
  11. package/src/__tests__/components/TableFilters/StatusFilter/StatusFilter.test.tsx +21 -20
  12. package/src/__tests__/components/TableFilters/TranslationsFilter/TranslationsFilter.test.tsx +24 -23
  13. package/src/__tests__/components/TableFilters/TypeFilter/TypeFilter.test.tsx +6 -5
  14. package/src/__tests__/components/TableFilters/UsersFilter/UsersFilter.test.tsx +17 -16
  15. package/src/api/sites.tsx +5 -9
  16. package/src/components/Button/index.tsx +3 -1
  17. package/src/components/Button/style.tsx +6 -0
  18. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/TemplateManager/index.tsx +2 -2
  19. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/index.tsx +1 -1
  20. package/src/components/Fields/ArrayFieldGroup/ArrayFieldInline/index.tsx +3 -2
  21. package/src/components/Fields/ArrayFieldGroup/ArrayFieldItem/index.tsx +3 -1
  22. package/src/components/Fields/ArrayFieldGroup/index.tsx +5 -2
  23. package/src/components/Fields/CheckField/style.tsx +2 -2
  24. package/src/components/Fields/ColorPicker/index.tsx +4 -2
  25. package/src/components/Fields/ColorPicker/style.tsx +4 -0
  26. package/src/components/Fields/DateField/DatePickerInput/index.tsx +1 -1
  27. package/src/components/Fields/FileField/index.tsx +3 -1
  28. package/src/components/Fields/FileField/style.tsx +9 -4
  29. package/src/components/Fields/SliderField/index.tsx +4 -2
  30. package/src/components/Fields/SliderField/style.tsx +53 -4
  31. package/src/components/Fields/TimeField/style.tsx +6 -5
  32. package/src/components/FileGallery/index.tsx +26 -16
  33. package/src/components/FileGallery/style.tsx +12 -1
  34. package/src/components/FilterTagsBar/index.tsx +61 -0
  35. package/src/components/FilterTagsBar/style.tsx +30 -0
  36. package/src/components/FloatingMenu/index.tsx +5 -1
  37. package/src/components/Gallery/GalleryFilters/Orientation/index.tsx +14 -6
  38. package/src/components/Gallery/GalleryFilters/SortBy/index.tsx +24 -8
  39. package/src/components/Gallery/GalleryFilters/Type/index.tsx +22 -9
  40. package/src/components/Gallery/GalleryPanel/GalleryDragAndDrop/style.tsx +2 -1
  41. package/src/components/Gallery/hooks.tsx +37 -23
  42. package/src/components/Gallery/index.tsx +38 -20
  43. package/src/components/Gallery/style.tsx +15 -2
  44. package/src/components/MainWrapper/AppBar/index.tsx +3 -0
  45. package/src/components/MainWrapper/index.tsx +1 -0
  46. package/src/components/SearchTagsBar/index.tsx +43 -0
  47. package/src/components/SearchTagsBar/style.tsx +30 -0
  48. package/src/components/TableFilters/CategoryFilter/index.tsx +17 -10
  49. package/src/components/TableFilters/CheckGroupFilter/index.tsx +12 -9
  50. package/src/components/TableFilters/DateFilter/index.tsx +3 -2
  51. package/src/components/TableFilters/LastAccessFilter/index.tsx +4 -4
  52. package/src/components/TableFilters/LiveFilter/index.tsx +26 -22
  53. package/src/components/TableFilters/NameFilter/index.tsx +4 -3
  54. package/src/components/TableFilters/PermissionsFilter/index.tsx +4 -3
  55. package/src/components/TableFilters/RoleFilter/index.tsx +17 -7
  56. package/src/components/TableFilters/SiteFilter/index.tsx +23 -8
  57. package/src/components/TableFilters/StateFilter/index.tsx +15 -6
  58. package/src/components/TableFilters/StatusFilter/index.tsx +3 -2
  59. package/src/components/TableFilters/TranslationsFilter/index.tsx +19 -11
  60. package/src/components/TableFilters/TypeFilter/index.tsx +9 -5
  61. package/src/components/TableFilters/UsersFilter/index.tsx +4 -3
  62. package/src/components/Tag/index.tsx +5 -4
  63. package/src/components/index.tsx +4 -0
  64. package/src/containers/Navigation/Menu/actions.tsx +1 -13
  65. package/src/containers/Navigation/Menu/constants.tsx +0 -1
  66. package/src/containers/Navigation/Menu/interfaces.tsx +1 -7
  67. package/src/containers/Navigation/Menu/reducer.tsx +0 -4
  68. package/src/containers/Sites/actions.tsx +2 -1
  69. package/src/containers/Sites/interfaces.tsx +2 -2
  70. package/src/containers/Sites/reducer.tsx +2 -2
  71. package/src/containers/StructuredData/actions.tsx +2 -1
  72. package/src/forms/editor.tsx +1 -1
  73. package/src/modules/Categories/CategoriesList/CategoryItem/style.tsx +2 -0
  74. package/src/modules/Content/BulkHeader/TableHeader/index.tsx +26 -14
  75. package/src/modules/Content/BulkHeader/index.tsx +3 -3
  76. package/src/modules/Content/PageItem/index.tsx +21 -23
  77. package/src/modules/Content/PageItem/style.tsx +2 -0
  78. package/src/modules/Content/hooks.tsx +23 -13
  79. package/src/modules/Content/index.tsx +44 -11
  80. package/src/modules/Content/style.tsx +19 -1
  81. package/src/modules/FileDrive/Breadcrumb/style.tsx +1 -1
  82. package/src/modules/FileDrive/FileDragAndDrop/index.tsx +7 -6
  83. package/src/modules/FileDrive/FileDragAndDrop/style.tsx +2 -0
  84. package/src/modules/FileDrive/FileFilters/SortBy/index.tsx +24 -8
  85. package/src/modules/FileDrive/FileFilters/Type/index.tsx +26 -22
  86. package/src/modules/FileDrive/hooks.tsx +28 -13
  87. package/src/modules/FileDrive/index.tsx +31 -18
  88. package/src/modules/FileDrive/style.tsx +20 -1
  89. package/src/modules/Navigation/Defaults/Item/style.tsx +2 -0
  90. package/src/modules/Navigation/Menus/List/Nav/index.tsx +10 -12
  91. package/src/modules/Navigation/Menus/List/Table/SidePanel/index.tsx +0 -2
  92. package/src/modules/Navigation/Menus/List/index.tsx +8 -5
  93. package/src/modules/Redirects/BulkHeader/TableHeader/index.tsx +4 -2
  94. package/src/modules/Redirects/BulkHeader/index.tsx +3 -2
  95. package/src/modules/Redirects/hooks.tsx +23 -15
  96. package/src/modules/Redirects/index.tsx +61 -44
  97. package/src/modules/Redirects/style.tsx +10 -0
  98. package/src/modules/Settings/Integrations/BulkHeader/TableHeader/index.tsx +7 -11
  99. package/src/modules/Settings/Integrations/BulkHeader/index.tsx +4 -8
  100. package/src/modules/Settings/Integrations/hooks.tsx +23 -19
  101. package/src/modules/Settings/Integrations/index.tsx +22 -26
  102. package/src/modules/Settings/Integrations/style.tsx +7 -0
  103. package/src/modules/Sites/SitesList/GridView/GridHeaderFilter/index.tsx +8 -7
  104. package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/index.tsx +10 -5
  105. package/src/modules/Sites/SitesList/ListView/BulkHeader/index.tsx +4 -3
  106. package/src/modules/Sites/SitesList/hooks.tsx +26 -20
  107. package/src/modules/Sites/SitesList/index.tsx +53 -22
  108. package/src/modules/Sites/SitesList/style.tsx +16 -0
  109. package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/index.tsx +3 -3
  110. package/src/modules/StructuredData/StructuredDataList/BulkHeader/index.tsx +3 -3
  111. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +3 -3
  112. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/style.tsx +2 -0
  113. package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/style.tsx +2 -0
  114. package/src/modules/StructuredData/StructuredDataList/hooks.tsx +25 -15
  115. package/src/modules/StructuredData/StructuredDataList/index.tsx +57 -14
  116. package/src/modules/StructuredData/StructuredDataList/style.tsx +10 -1
  117. package/src/modules/Users/Roles/BulkHeader/TableHeader/index.tsx +2 -2
  118. package/src/modules/Users/Roles/BulkHeader/index.tsx +2 -5
  119. package/src/modules/Users/Roles/hooks.tsx +24 -15
  120. package/src/modules/Users/Roles/index.tsx +7 -18
  121. package/src/modules/Users/UserList/BulkHeader/TableHeader/index.tsx +5 -18
  122. package/src/modules/Users/UserList/BulkHeader/index.tsx +15 -13
  123. package/src/modules/Users/UserList/hooks.tsx +27 -25
  124. package/src/modules/Users/UserList/index.tsx +69 -43
  125. package/src/modules/Users/UserList/style.tsx +10 -1
  126. package/src/types/index.tsx +19 -13
@@ -150,6 +150,7 @@ const GridList = styled.div<{ isEmpty: boolean; fullWidth: boolean }>`
150
150
 
151
151
  const EmptyStateWrapper = styled.div`
152
152
  text-align: center;
153
+ margin-top: 100px;
153
154
  `;
154
155
 
155
156
  const ImageWrapper = styled.div<{ borderRadius?: boolean }>`
@@ -184,6 +185,19 @@ const AllSitesListWrapper = styled.div`
184
185
  }
185
186
  `;
186
187
 
188
+ const SearchTags = styled.div`
189
+ & > div:nth-child(1) {
190
+ margin-bottom: ${(p) => p.theme.spacing.xs};
191
+ }
192
+ & > div:nth-child(2) {
193
+ margin-bottom: ${(p) => p.theme.spacing.xs};
194
+ }
195
+ `;
196
+
197
+ const SearchTagsGrid = styled.div`
198
+ margin: ${(p) => `${p.theme.spacing.xs} ${p.theme.spacing.m}`};
199
+ `;
200
+
187
201
  export {
188
202
  SectionHeader,
189
203
  CollapseButton,
@@ -202,4 +216,6 @@ export {
202
216
  ItemName,
203
217
  PaginationWrapper,
204
218
  AllSitesListWrapper,
219
+ SearchTags,
220
+ SearchTagsGrid,
205
221
  };
@@ -12,7 +12,7 @@ import {
12
12
  LiveFilter,
13
13
  TranslationsFilter,
14
14
  } from "@ax/components";
15
- import { IColumn, IStructuredDataQueryValues } from "@ax/types";
15
+ import { IColumn, IQueryValue, IStructuredDataQueryValues } from "@ax/types";
16
16
  import { getGlobalPageTypes } from "@ax/helpers";
17
17
 
18
18
  import * as S from "./style";
@@ -134,8 +134,8 @@ interface IProps {
134
134
  isScrolling: boolean;
135
135
  selectAllItems: () => void;
136
136
  isFromPage: boolean;
137
- sortItems: (orderPointer: string, isAscending: boolean) => void;
138
- filterItems: (filterPointer: string, filtersSelected: string) => void;
137
+ sortItems: (orderPointer: IQueryValue[], isAscending: boolean) => void;
138
+ filterItems: (filterPointer: string, filtersSelected: IQueryValue[]) => void;
139
139
  sortedListStatus: { isAscending: boolean; sortedByDate: boolean; sortedByTitle: boolean; sortedByURL: boolean };
140
140
  isAllPages: boolean;
141
141
  filterValues: IStructuredDataQueryValues;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { BulkSelectionOptions } from "@ax/components";
3
- import { IColumn, IStructuredDataQueryValues, IStructuredDataSortedInitialState } from "@ax/types";
3
+ import { IColumn, IQueryValue, IStructuredDataQueryValues, IStructuredDataSortedInitialState } from "@ax/types";
4
4
  import { usePermission } from "@ax/hooks";
5
5
  import TableHeader from "./TableHeader";
6
6
 
@@ -90,8 +90,8 @@ interface IProps {
90
90
  isScrolling: boolean;
91
91
  isEditable: boolean | null;
92
92
  isFromPage: boolean;
93
- sortItems: (orderPointer: string, isAscending: boolean) => void;
94
- filterItems: (filterPointer: string, filtersSelected: string) => void;
93
+ sortItems: (orderPointer: IQueryValue[], isAscending: boolean) => void;
94
+ filterItems: (filterPointer: string, filtersSelected: IQueryValue[]) => void;
95
95
  sortedListStatus: IStructuredDataSortedInitialState;
96
96
  isAllPages: boolean;
97
97
  filterValues: IStructuredDataQueryValues;
@@ -379,11 +379,11 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
379
379
  <S.NameCell role="cell" onClick={_handleClick} ref={nameCellRef}>
380
380
  <Tooltip
381
381
  content={[
382
- <>
382
+ <React.Fragment key="page-title">
383
383
  <strong>{globalPage.title}</strong>
384
384
  <br />
385
- </>,
386
- <>{fullPath.page}</>,
385
+ </React.Fragment>,
386
+ <React.Fragment key="page-slug">{fullPath.page}</React.Fragment>,
387
387
  ]}
388
388
  left={0}
389
389
  top={1}
@@ -105,6 +105,8 @@ const FlagsWrapper = styled.div`
105
105
  svg {
106
106
  margin-right: 2px;
107
107
  margin-bottom: -3px;
108
+ display: inline;
109
+ vertical-align: baseline;
108
110
  }
109
111
  `;
110
112
 
@@ -78,6 +78,8 @@ const FlagsWrapper = styled.div`
78
78
  svg {
79
79
  margin-right: 2px;
80
80
  margin-bottom: -3px;
81
+ display: inline;
82
+ vertical-align: baseline;
81
83
  }
82
84
  `;
83
85
 
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useState } from "react";
2
- import { IStructuredData, IStructuredDataQueryValues, IStructuredDataSortedInitialState } from "@ax/types";
2
+ import { IQueryValue, IStructuredData, IStructuredDataQueryValues, IStructuredDataSortedInitialState } from "@ax/types";
3
3
 
4
4
  const useSortedListStatus = (): IUseSortedListStatus => {
5
5
  const sortedInitialState: IStructuredDataSortedInitialState = {
@@ -21,23 +21,32 @@ const useFilterQuery = (
21
21
  currentStructuredData: IStructuredData | null,
22
22
  values: Record<string, IStructuredDataQueryValues> | null
23
23
  ): IUseFilterQuery => {
24
+
24
25
  const structuredDataType = currentStructuredData ? currentStructuredData.id : "all";
25
- const initialQueryValues = {
26
- types: "all",
27
- translated: "all",
28
- liveStatus: "all",
29
- order: "",
30
- filterSites: "all",
31
- categories: "all",
32
- related: "all",
26
+ const initialQueryValues: IStructuredDataQueryValues = {
27
+ types: [{value: "all", label: "All"}],
28
+ translated: [{value: "all", label: "All"}],
29
+ liveStatus: [{value: "all", label: "All"}],
30
+ order: [],
31
+ filterSites: [{value: "all", label: "All"}],
32
+ categories: [{value: "all", label: "All"}],
33
+ related: [{value: "all", label: "All"}],
33
34
  };
34
35
 
35
- const getFilterQuery = (filterValues: IStructuredDataQueryValues) => {
36
+ const getFilterQuery = (filterValues: IStructuredDataQueryValues): string => {
36
37
  const { types, translated, liveStatus, order, filterSites, categories, related } = filterValues;
37
38
  let filterQuery = "";
38
39
 
39
- const currentQuery = (pointer: string, values: string) => {
40
- return filterQuery ? filterQuery.concat(`&${pointer}=${values}`) : `&${pointer}=${values}`;
40
+ const currentQuery = (pointer: string, values: IQueryValue[]): string => {
41
+ const stringValues = Array.isArray(values) && values.length
42
+ ? values.map((value) => (value.value !== "all" ? value.value : "")).join(",")
43
+ : "";
44
+
45
+ return !stringValues.length
46
+ ? filterQuery
47
+ : filterQuery.length
48
+ ? filterQuery.concat(`&${pointer}=${stringValues}`)
49
+ : `&${pointer}=${stringValues}`;
41
50
  };
42
51
 
43
52
  const isNotInitialValue = (pointer: keyof IStructuredDataQueryValues) => {
@@ -68,15 +77,16 @@ const useFilterQuery = (
68
77
  // eslint-disable-next-line react-hooks/exhaustive-deps
69
78
  }, [structuredDataType]);
70
79
 
71
- const setFiltersSelection = (pointer: string, filter: string, isAscendent?: boolean) => {
80
+ const setFiltersSelection = (pointer: string, filter: IQueryValue[], isAscendent?: boolean) => {
72
81
  const { types, translated, liveStatus, order, filterSites, categories, related } =
73
82
  state[structuredDataType] || initialQueryValues;
83
+
74
84
  const orderMethod = isAscendent ? "asc" : "desc";
75
85
  const filterValues = {
76
86
  types: pointer === "types" ? filter : types,
77
87
  translated: pointer === "translated" ? filter : translated,
78
88
  liveStatus: pointer === "liveStatus" ? filter : liveStatus,
79
- order: pointer === "order" ? `${filter}-${orderMethod}` : order,
89
+ order: pointer === "order" ? [{value: `${filter[0].value}-${orderMethod}`, label: filter[0].label}] : order,
80
90
  filterSites: pointer === "filterSites" ? filter : filterSites,
81
91
  categories: pointer === "categories" ? filter : categories,
82
92
  related: pointer === "related" ? filter : related,
@@ -106,7 +116,7 @@ interface IUseSortedListStatus {
106
116
  }
107
117
 
108
118
  interface IUseFilterQuery {
109
- setFiltersSelection(pointer: string, filter: string, isAscendent?: boolean): void;
119
+ setFiltersSelection(pointer: string, filter: IQueryValue[], isAscendent?: boolean): void;
110
120
  resetFilterQuery(): void;
111
121
  filterValues: Record<string, IStructuredDataQueryValues>;
112
122
  query: string;
@@ -17,6 +17,8 @@ import {
17
17
  ICheck,
18
18
  IColumn,
19
19
  IStructuredDataQueryValues,
20
+ ISite,
21
+ IQueryValue,
20
22
  } from "@ax/types";
21
23
  import {
22
24
  ISetCurrentPageIDAction,
@@ -30,7 +32,17 @@ import { structuredDataActions } from "@ax/containers/StructuredData";
30
32
  import { sitesActions } from "@ax/containers/Sites";
31
33
  import { pageEditorActions } from "@ax/containers/PageEditor";
32
34
  import { analyticsActions } from "@ax/containers/Analytics";
33
- import { MainWrapper, TableList, ErrorToast, Toast, Notification, EmptyState, Modal } from "@ax/components";
35
+ import {
36
+ MainWrapper,
37
+ TableList,
38
+ ErrorToast,
39
+ Toast,
40
+ Notification,
41
+ EmptyState,
42
+ Modal,
43
+ SearchTagsBar,
44
+ FilterTagsBar,
45
+ } from "@ax/components";
34
46
 
35
47
  import StructuredDataItem from "./StructuredDataItem";
36
48
  import BulkHeader from "./BulkHeader";
@@ -90,6 +102,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
90
102
  setContentFilters,
91
103
  contentFilters,
92
104
  checkUserSession,
105
+ sites,
93
106
  } = props;
94
107
 
95
108
  const itemsPerPage = 50;
@@ -150,7 +163,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
150
163
  live: { title: "Live", show: true },
151
164
  status: { title: "Status", show: true },
152
165
  translation: { title: "Trans.", show: true },
153
- ...((isStructuredDataFromPage || currentStructuredData === null) && { seo: { title: "SEO", show: true } }),
166
+ ...((isStructuredDataFromPage || currentStructuredData === null) && { seo: { title: "SEO", show: true } }),
154
167
  };
155
168
 
156
169
  const extraColumns = categoryColumns.reduce((acc: Record<string, IColumn>, cur: any) => {
@@ -240,9 +253,9 @@ const StructuredDataList = (props: IProps): JSX.Element => {
240
253
  const type = currentStructuredData && isGlobalData ? currentStructuredData.id : "all";
241
254
  setStructuredDataType(type);
242
255
 
243
- filterItems("types", "all");
256
+ filterItems("types", [{ value: "all", label: "All" }]);
244
257
  if (filter === "all-pages" || !isStructuredDataFromPage) {
245
- filterItems("filterSites", "all");
258
+ filterItems("filterSites", [{ value: "all", label: "All" }]);
246
259
  setColumnsState({ all: allColumns });
247
260
  }
248
261
  unselectAllItems();
@@ -289,8 +302,14 @@ const StructuredDataList = (props: IProps): JSX.Element => {
289
302
  } else {
290
303
  emptyState.message = isAllPages
291
304
  ? "You don’t have pages with this content type yet."
292
- : allowedToCreatePages && isDataEditable ? "To start using pages in your site, create as many pages as you need." : undefined;
293
- emptyState.button = isAllPages ? "View all content" : allowedToCreatePages && isDataEditable ? "Create the first page" : undefined;
305
+ : allowedToCreatePages && isDataEditable
306
+ ? "To start using pages in your site, create as many pages as you need."
307
+ : undefined;
308
+ emptyState.button = isAllPages
309
+ ? "View all content"
310
+ : allowedToCreatePages && isDataEditable
311
+ ? "Create the first page"
312
+ : undefined;
294
313
  emptyState.action = isAllPages ? resetFilterValues : isDataEditable ? addNewAction : undefined;
295
314
  }
296
315
  const isEmpty = isStructuredDataFromPage ? !currentSitePages.length : !currentDataContent.length;
@@ -426,15 +445,15 @@ const StructuredDataList = (props: IProps): JSX.Element => {
426
445
  }
427
446
  };
428
447
 
429
- const sortItems = async (orderPointer: string, isAscending: boolean) => {
448
+ const sortItems = async (orderPointer: IQueryValue[], isAscending: boolean) => {
430
449
  setPage(firstPage);
431
- const sortedState = getSortedListStatus(orderPointer, isAscending);
450
+ const sortedState = getSortedListStatus(orderPointer[0].value.toString(), isAscending);
432
451
  setSortedListStatus(sortedState);
433
452
 
434
453
  setFiltersSelection("order", orderPointer, isAscending);
435
454
  };
436
455
 
437
- const filterItems = async (filterPointer: string, filtersSelected: string) => {
456
+ const filterItems = async (filterPointer: string, filtersSelected: IQueryValue[]) => {
438
457
  setPage(firstPage);
439
458
  if (!isStructuredDataFromPage && filterPointer === "categories") filterPointer = "related";
440
459
  setFiltersSelection(filterPointer, filtersSelected);
@@ -486,11 +505,13 @@ const StructuredDataList = (props: IProps): JSX.Element => {
486
505
 
487
506
  const addNewAction = isAllPages || isStructuredDataFromPage ? toggleNewModal : createNewData;
488
507
 
489
- const rightButtonProps = allowedToCreatePages ? {
490
- label: "New",
491
- action: addNewAction,
492
- disabled: !isDataEditable,
493
- } : undefined;
508
+ const rightButtonProps = allowedToCreatePages
509
+ ? {
510
+ label: "New",
511
+ action: addNewAction,
512
+ disabled: !isDataEditable,
513
+ }
514
+ : undefined;
494
515
 
495
516
  const options: { filters: IStructuredDataFilter[]; values: IStructuredDataValue[] } = {
496
517
  filters: getOptionFilters(structuredData),
@@ -574,6 +595,16 @@ const StructuredDataList = (props: IProps): JSX.Element => {
574
595
  ? "These pages contains some errors, so you can not publish them yet. Please, review the errors on the pages."
575
596
  : "This page contains some errors, so you can not publish it yet. Please, review the errors on the page.";
576
597
 
598
+ const labelCategory = isStructuredDataFromPage ? { categories: "Category" } : { related: "Category " };
599
+
600
+ let filterLabels = {
601
+ types: "Type",
602
+ liveStatus: "Live",
603
+ translated: "Translated",
604
+ filterSites: "Site",
605
+ ...labelCategory,
606
+ };
607
+
577
608
  return (
578
609
  <MainWrapper
579
610
  title="Global Data"
@@ -582,6 +613,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
582
613
  language={languageProps.lang}
583
614
  languageActions={languageProps.languageActions}
584
615
  searchAction={setSearchQuery}
616
+ searchValue={searchQuery}
585
617
  >
586
618
  <S.StructuredDataWrapper ref={wrapperRef}>
587
619
  <ContentFilters
@@ -615,6 +647,15 @@ const StructuredDataList = (props: IProps): JSX.Element => {
615
647
  tableRef={tableRef}
616
648
  >
617
649
  <>
650
+ <S.SearchTags>
651
+ <SearchTagsBar query={searchQuery} setQuery={setSearchQuery} />
652
+ <FilterTagsBar
653
+ filters={filterValues[currentStructuredData?.id || "all"]}
654
+ setFilters={setFiltersSelection}
655
+ labels={filterLabels}
656
+ resetFilters={resetFilterQuery}
657
+ />
658
+ </S.SearchTags>
618
659
  {!isEmpty ? (
619
660
  content
620
661
  ) : (
@@ -671,6 +712,7 @@ const mapStateToProps = (state: IRootState) => ({
671
712
  currentSiteErrorPages: state.sites.currentSiteErrorPages,
672
713
  skipReviewOnPublish: state.app.globalSettings.skipReviewOnPublish,
673
714
  contentFilters: state.structuredData.contentFilters,
715
+ sites: state.sites.sites,
674
716
  });
675
717
 
676
718
  const mapDispatchToProps = {
@@ -741,6 +783,7 @@ interface ICategoriesProps {
741
783
  currentSiteErrorPages: number[];
742
784
  skipReviewOnPublish?: boolean;
743
785
  contentFilters: Record<string, IStructuredDataQueryValues> | null;
786
+ sites: ISite[];
744
787
  }
745
788
 
746
789
  type IProps = ICategoriesProps & IDispatchProps;
@@ -29,4 +29,13 @@ const ModalContent = styled.div`
29
29
  }
30
30
  `;
31
31
 
32
- export { StructuredDataWrapper, NotificationWrapper, TableListWrapper, EmptyWrapper, ModalContent };
32
+ const SearchTags = styled.div`
33
+ & > div:nth-child(1) {
34
+ margin-bottom: ${(p) => p.theme.spacing.xs};
35
+ }
36
+ & > div:nth-child(2) {
37
+ margin-bottom: ${(p) => p.theme.spacing.xs};
38
+ }
39
+ `;
40
+
41
+ export { StructuredDataWrapper, NotificationWrapper, TableListWrapper, EmptyWrapper, ModalContent, SearchTags };
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
 
3
3
  import { CheckField, TableCounter, NameFilter, PermissionsFilter, UsersFilter } from "@ax/components";
4
+ import { IQueryValue } from "@ax/types";
4
5
 
5
6
  import * as S from "./style";
6
7
 
@@ -42,8 +43,7 @@ interface IProps {
42
43
  totalItems: number;
43
44
  isScrolling: boolean;
44
45
  selectAllItems: () => void;
45
- filterItems: (filterPointer: string, filtersSelected: string) => void;
46
- sortItems: any;
46
+ sortItems: (orderPointer: IQueryValue[], isAscending: boolean) => void;
47
47
  sortedListStatus: any;
48
48
  filterValues: any;
49
49
  isSiteView: boolean;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { BulkSelectionOptions } from "@ax/components";
3
3
  import TableHeader from "./TableHeader";
4
- import { IRole } from "@ax/types";
4
+ import { IQueryValue, IRole } from "@ax/types";
5
5
 
6
6
  const BulkHeader = (props: IBulkHeaderProps): JSX.Element => {
7
7
  const {
@@ -13,7 +13,6 @@ const BulkHeader = (props: IBulkHeaderProps): JSX.Element => {
13
13
  totalItems,
14
14
  isScrolling,
15
15
  sortItems,
16
- filterItems,
17
16
  sortedListStatus,
18
17
  filterValues,
19
18
  isSiteView,
@@ -45,7 +44,6 @@ const BulkHeader = (props: IBulkHeaderProps): JSX.Element => {
45
44
  filterValues={filterValues}
46
45
  totalItems={totalItems}
47
46
  selectAllItems={selectAllItems}
48
- filterItems={filterItems}
49
47
  isScrolling={isScrolling}
50
48
  sortItems={sortItems}
51
49
  sortedListStatus={sortedListStatus}
@@ -62,10 +60,9 @@ export interface IBulkHeaderProps {
62
60
  selectAllItems: () => void;
63
61
  totalItems: number;
64
62
  isScrolling: boolean;
65
- sortItems: (orderPointer: string, isAscending: boolean) => void;
63
+ sortItems: (orderPointer: IQueryValue[], isAscending: boolean) => void;
66
64
  sortedListStatus: any;
67
65
  filterValues: any;
68
- filterItems: (filterPointer: string, filtersSelected: string) => void;
69
66
  isSiteView: boolean;
70
67
  roles: IRole[];
71
68
  selectedRoles: number[];
@@ -1,5 +1,5 @@
1
1
  import { useState } from "react";
2
- import { IRolesQueryValues } from "@ax/types";
2
+ import { IQueryValue, IRolesQueryValues } from "@ax/types";
3
3
 
4
4
  const useSortedListStatus = (): any => {
5
5
  const sortedInitialState: {
@@ -23,18 +23,25 @@ const useSortedListStatus = (): any => {
23
23
  };
24
24
 
25
25
  const useFilterQuery = (): IRolesFilterQuery => {
26
- const initialQueryValues = {
27
- order: "",
26
+ const initialQueryValues: Record<string, IQueryValue[]> = {
27
+ order: [],
28
28
  };
29
29
 
30
30
  const [query, setQuery] = useState(initialQueryValues);
31
+ const [currentFilterQuery, setCurrentFilterQuery] = useState("");
31
32
 
32
33
  const setFilterQuery = (filterValues: IRolesQueryValues) => {
33
34
  const { order } = filterValues;
34
35
  let filterQuery = "";
35
36
 
36
- const currentQuery = (pointer: string, values: string) => {
37
- return filterQuery ? filterQuery.concat(`&${pointer}=${values}`) : `?${pointer}=${values}`;
37
+ const currentQuery = (pointer: string, values: IQueryValue[]): string => {
38
+ const stringValues = Array.isArray(values) ? values.map((value) => value.value).join(",") : "";
39
+
40
+ return !stringValues.length
41
+ ? filterQuery
42
+ : filterQuery.length
43
+ ? filterQuery.concat(`&${pointer}=${stringValues}`)
44
+ : `?${pointer}=${stringValues}`;
38
45
  };
39
46
 
40
47
  const isNotInitialValue = (pointer: keyof IRolesQueryValues) => {
@@ -43,36 +50,38 @@ const useFilterQuery = (): IRolesFilterQuery => {
43
50
 
44
51
  if (isNotInitialValue("order")) filterQuery = currentQuery("order", order);
45
52
 
46
- return filterQuery;
53
+ setCurrentFilterQuery(filterQuery);
47
54
  };
48
55
 
49
- const setFiltersSelection = (pointer: string, filter: string, isAscendent?: boolean) => {
56
+ const setFiltersSelection = (pointer: string, filter: IQueryValue[], isAscendent?: boolean) => {
50
57
  const { order } = query;
51
58
  const orderMethod = isAscendent ? "asc" : "desc";
52
59
  const filterValues = {
53
- order: pointer === "order" ? `${filter}-${orderMethod}` : order,
60
+ order: pointer === "order" ? [{ value: `${filter[0].value}-${orderMethod}`, label: filter[0].label }] : order,
54
61
  };
55
62
 
56
63
  setQuery(filterValues);
57
-
58
- return filterValues;
64
+ setFilterQuery(filterValues);
59
65
  };
60
66
 
61
- const resetFilterQuery = () => setQuery(initialQueryValues);
67
+ const resetFilterQuery = () => {
68
+ setQuery(initialQueryValues);
69
+ setCurrentFilterQuery("");
70
+ }
62
71
 
63
72
  return {
64
73
  setFiltersSelection,
65
- setFilterQuery,
66
74
  resetFilterQuery,
67
75
  filterValues: query,
76
+ filterQuery: currentFilterQuery,
68
77
  };
69
78
  };
70
79
 
71
80
  interface IRolesFilterQuery {
72
- setFiltersSelection(pointer: string, filter: string, isAscendent?: boolean): IRolesQueryValues;
73
- setFilterQuery(filterValues: IRolesQueryValues): string;
81
+ setFiltersSelection(pointer: string, filter: IQueryValue[], isAscendent?: boolean): void;
74
82
  resetFilterQuery(): void;
75
- filterValues: IRolesQueryValues;
83
+ filterValues: Record<string, IQueryValue[]>;
84
+ filterQuery: string;
76
85
  }
77
86
 
78
87
  export { useSortedListStatus, useFilterQuery };
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useRef, useState } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { IRootState, IRole, IGetRoles, IActivateRole, ISite } from "@ax/types";
4
+ import { IRootState, IRole, IGetRoles, IActivateRole, ISite, IQueryValue } from "@ax/types";
5
5
  import { useBulkSelection, useToast } from "@ax/hooks";
6
6
  import { appActions } from "@ax/containers/App";
7
7
  import { usersActions } from "@ax/containers/Users";
@@ -23,14 +23,13 @@ const Roles = (props: IRolesProps): JSX.Element => {
23
23
 
24
24
  const [page, setPage] = useState(1);
25
25
  const [isScrolling, setIsScrolling] = useState(false);
26
- const [currentFilterQuery, setCurrentFilterQuery] = useState("");
27
26
  const [activatedItems, setActivatedItems] = useState<number[]>([]);
28
27
  const [undoToastActionValue, setUndoToastActionValue] = useState<boolean>(false);
29
28
  const [isOpen, setIsOpen] = useState(false);
30
29
  const [selectedRole, setSelectedRole] = useState<IRole | null>(null);
31
30
 
32
31
  const { sortedListStatus, setSortedListStatus } = useSortedListStatus();
33
- const { setFiltersSelection, setFilterQuery, filterValues } = useFilterQuery();
32
+ const { setFiltersSelection, filterValues } = useFilterQuery();
34
33
 
35
34
  const tableRef = useRef<HTMLDivElement>(null);
36
35
  const wrapperRef = useRef<HTMLDivElement>(null);
@@ -52,10 +51,10 @@ const Roles = (props: IRolesProps): JSX.Element => {
52
51
 
53
52
  useEffect(() => {
54
53
  const { order } = filterValues;
55
- const handleGetRoles = async () => await getRoles({ siteId, order });
54
+ const handleGetRoles = async () => await getRoles({ siteId, order: order[0]?.value.toString() });
56
55
  handleGetRoles();
57
56
  // eslint-disable-next-line react-hooks/exhaustive-deps
58
- }, [currentFilterQuery]);
57
+ }, [filterValues]);
59
58
 
60
59
  useEffect(() => {
61
60
  if (wrapperRef.current) {
@@ -86,20 +85,11 @@ const Roles = (props: IRolesProps): JSX.Element => {
86
85
  currPage: page,
87
86
  };
88
87
 
89
- const sortItems = async (orderPointer: string, isAscending: boolean) => {
88
+ const sortItems = async (orderPointer: IQueryValue[], isAscending: boolean) => {
90
89
  setPage(firstPage);
91
- const sortedState = getSortedListStatus(orderPointer, isAscending);
90
+ const sortedState = getSortedListStatus(orderPointer[0].value.toString(), isAscending);
92
91
  setSortedListStatus(sortedState);
93
- const filtersSelection = setFiltersSelection("order", orderPointer, isAscending);
94
- const filterQuery = setFilterQuery(filtersSelection);
95
- setCurrentFilterQuery(filterQuery);
96
- };
97
-
98
- const filterItems = async (filterPointer: string, filtersSelected: string) => {
99
- setPage(firstPage);
100
- const filtersSelection = setFiltersSelection(filterPointer, filtersSelected);
101
- const filterQuery = setFilterQuery(filtersSelection);
102
- setCurrentFilterQuery(filterQuery);
92
+ setFiltersSelection("order", orderPointer, isAscending);
103
93
  };
104
94
 
105
95
  const activateCurrentRoles = (active: boolean) => {
@@ -153,7 +143,6 @@ const Roles = (props: IRolesProps): JSX.Element => {
153
143
  checkState={checkState}
154
144
  isScrolling={isScrolling}
155
145
  sortItems={sortItems}
156
- filterItems={filterItems}
157
146
  sortedListStatus={sortedListStatus}
158
147
  isSiteView={isSiteView}
159
148
  roles={roles}
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
 
3
3
  import { CheckField, TableCounter, SiteFilter, NameFilter, RoleFilter } from "@ax/components";
4
- import { IRole } from "@ax/types";
4
+ import { IQueryValue, IRole } from "@ax/types";
5
5
 
6
6
  import * as S from "./style";
7
7
 
@@ -69,19 +69,6 @@ const TableHeader = (props: IProps): JSX.Element => {
69
69
  pointer="filterSites"
70
70
  center={false}
71
71
  label="Sites"
72
- selectAllOption="noFilter"
73
- filters={[
74
- {
75
- name: "noFilter",
76
- value: "noFilter",
77
- title: "All",
78
- },
79
- {
80
- name: "all",
81
- value: "all",
82
- title: "Access to all sites",
83
- },
84
- ]}
85
72
  />
86
73
  </S.SiteWrapper>
87
74
  <S.StatusHeader />
@@ -99,10 +86,10 @@ interface IProps {
99
86
  isScrolling: boolean;
100
87
  isSiteView: boolean;
101
88
  selectAllItems: () => void;
102
- filterItems: (filterPointer: string, filtersSelected: string) => void;
103
- sortItems: any;
104
- sortedListStatus: any;
105
- filterValues: any;
89
+ filterItems: (filterPointer: string, filtersSelected: IQueryValue[]) => void;
90
+ sortItems: (orderPointer: IQueryValue[], isAscending: boolean) => void;
91
+ sortedListStatus: { isAscending: boolean; sortedByName: boolean; sortedByDateCreated: boolean };
92
+ filterValues: Record<string, IQueryValue[]>;
106
93
  roles: IRole[];
107
94
  }
108
95