@griddo/ax 1.66.3 → 1.66.4

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 (71) hide show
  1. package/package.json +2 -2
  2. package/src/api/pages.tsx +15 -3
  3. package/src/api/redirects.tsx +4 -2
  4. package/src/api/sites.tsx +4 -2
  5. package/src/components/Browser/index.tsx +3 -1
  6. package/src/components/Browser/style.tsx +2 -2
  7. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field/index.tsx +0 -1
  8. package/src/components/ErrorCenter/index.tsx +8 -5
  9. package/src/components/ErrorCenter/style.tsx +21 -8
  10. package/src/components/Fields/ColorPicker/index.tsx +1 -0
  11. package/src/components/Fields/LinkField/index.tsx +85 -0
  12. package/src/components/Fields/ReferenceField/ItemList/index.tsx +5 -1
  13. package/src/components/Fields/ReferenceField/index.tsx +18 -14
  14. package/src/components/Fields/UrlField/index.tsx +13 -1
  15. package/src/components/Fields/index.tsx +2 -0
  16. package/src/components/FieldsBehavior/index.tsx +14 -1
  17. package/src/components/Icon/components/Copy.js +14 -0
  18. package/src/components/Icon/svgs/Copy2.svg +3 -0
  19. package/src/components/MainWrapper/AppBar/index.tsx +21 -10
  20. package/src/components/MainWrapper/AppBar/style.tsx +11 -3
  21. package/src/components/MainWrapper/index.tsx +2 -0
  22. package/src/components/Modal/style.tsx +0 -1
  23. package/src/components/SearchField/index.tsx +36 -4
  24. package/src/components/SearchField/style.tsx +23 -10
  25. package/src/components/SideModal/style.tsx +6 -6
  26. package/src/components/TableFilters/StatusFilter/index.tsx +2 -2
  27. package/src/components/index.tsx +2 -0
  28. package/src/containers/App/actions.tsx +3 -7
  29. package/src/containers/PageEditor/actions.tsx +91 -22
  30. package/src/containers/PageEditor/constants.tsx +1 -1
  31. package/src/containers/PageEditor/interfaces.tsx +6 -6
  32. package/src/containers/PageEditor/reducer.tsx +4 -4
  33. package/src/containers/PageEditor/utils.tsx +2 -1
  34. package/src/containers/Sites/actions.tsx +35 -23
  35. package/src/containers/Sites/constants.tsx +1 -0
  36. package/src/containers/Sites/interfaces.tsx +6 -0
  37. package/src/containers/Sites/reducer.tsx +4 -0
  38. package/src/forms/editor.tsx +34 -1
  39. package/src/forms/errors.tsx +1 -0
  40. package/src/forms/index.tsx +15 -1
  41. package/src/forms/validators.tsx +168 -9
  42. package/src/guards/error/index.tsx +1 -1
  43. package/src/helpers/dataPacks.tsx +8 -1
  44. package/src/helpers/index.tsx +2 -1
  45. package/src/modules/Content/PageItem/index.tsx +54 -4
  46. package/src/modules/Content/atoms.tsx +41 -3
  47. package/src/modules/Content/index.tsx +111 -64
  48. package/src/modules/Content/style.tsx +8 -1
  49. package/src/modules/GlobalEditor/Editor/index.tsx +3 -1
  50. package/src/modules/GlobalEditor/PageBrowser/index.tsx +3 -0
  51. package/src/modules/GlobalEditor/index.tsx +8 -6
  52. package/src/modules/Navigation/Menus/List/Table/SidePanel/Form/index.tsx +8 -0
  53. package/src/modules/PageEditor/Editor/index.tsx +6 -2
  54. package/src/modules/PageEditor/PageBrowser/index.tsx +3 -0
  55. package/src/modules/PageEditor/index.tsx +29 -15
  56. package/src/modules/Redirects/index.tsx +40 -10
  57. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/index.tsx +1 -1
  58. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/index.tsx +1 -1
  59. package/src/modules/Settings/ContentTypes/DataPacks/Config/index.tsx +1 -1
  60. package/src/modules/Settings/ContentTypes/DataPacks/index.tsx +1 -1
  61. package/src/modules/Sites/index.tsx +3 -3
  62. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +1 -1
  63. package/src/modules/StructuredData/StructuredDataList/atoms.tsx +1 -1
  64. package/src/modules/Users/Profile/index.tsx +3 -4
  65. package/src/modules/Users/UserCreate/SiteItem/index.tsx +1 -1
  66. package/src/modules/Users/UserCreate/SiteItem/style.tsx +1 -1
  67. package/src/modules/Users/UserForm/style.tsx +3 -3
  68. package/src/modules/Users/UserList/UserItem/index.tsx +3 -1
  69. package/src/modules/Users/UserList/hooks.tsx +1 -1
  70. package/src/modules/Users/UserList/index.tsx +2 -2
  71. package/src/types/index.tsx +16 -3
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { INavItem, IRedirect, IRootState } from "@ax/types";
4
+ import { IEmptyStateProps, INavItem, IRedirect, IRootState } from "@ax/types";
5
5
  import { appActions } from "@ax/containers/App";
6
6
  import { redirectsActions } from "@ax/containers/Redirects";
7
7
  import { MainWrapper, ErrorToast, Nav, TableList, EmptyState, Toast } from "@ax/components";
@@ -30,6 +30,7 @@ const Redirects = (props: IProps): JSX.Element => {
30
30
  importRedirects,
31
31
  imports,
32
32
  totalImports,
33
+ isLoading,
33
34
  } = props;
34
35
 
35
36
  const itemsPerPage = 50;
@@ -50,6 +51,10 @@ const Redirects = (props: IProps): JSX.Element => {
50
51
  const { isOpen: isOpenCheckImport, toggleModal: toggleCheckImportModal } = useModal();
51
52
  const [importData, setImportData] = useState<{ from: string; to: string }[]>([]);
52
53
  const [isUploading, setIsUploading] = useState(false);
54
+ const [searchQuery, setSearchQuery] = useState<string>("");
55
+ const [searchFilter, setSearchFilter] = useState<string>("");
56
+ const [isEmpty, setIsEmpty] = useState(false);
57
+ const [emptyStateProps, setEmptyStateProps] = useState<IEmptyStateProps>({});
53
58
 
54
59
  const initState = {
55
60
  from: "",
@@ -62,17 +67,18 @@ const Redirects = (props: IProps): JSX.Element => {
62
67
  const [formValues, setFormValues] = useState<IRedirect>(initState);
63
68
 
64
69
  const redIds = redirects && redirects.map((red: any) => red.id);
65
- const isEmpty = redirects && redirects.length === 0;
66
70
 
67
71
  const getParams = useCallback(() => {
68
72
  const params = {
69
73
  page,
70
74
  itemsPerPage,
71
75
  pagination: true,
76
+ query: searchQuery,
77
+ filterBy: searchFilter === "filterby" ? "" : searchFilter,
72
78
  };
73
79
 
74
80
  return params;
75
- }, [page]);
81
+ }, [page, searchQuery, searchFilter]);
76
82
 
77
83
  useEffect(() => {
78
84
  const params = getParams();
@@ -81,7 +87,26 @@ const Redirects = (props: IProps): JSX.Element => {
81
87
  tableRef.current.scrollTo(0, 0);
82
88
  }
83
89
  // eslint-disable-next-line react-hooks/exhaustive-deps
84
- }, [page, currentFilterQuery]);
90
+ }, [page, currentFilterQuery, searchQuery, searchFilter]);
91
+
92
+ useEffect(() => {
93
+ if (!isLoading) {
94
+ const emptyState: IEmptyStateProps = {};
95
+ const isSearching = searchQuery.length > 0;
96
+ if (isSearching) {
97
+ emptyState.icon = "search";
98
+ emptyState.title = "Oh! No Results Found";
99
+ emptyState.message = "We couldn’t find what you are looking for. Please, try another search.";
100
+ } else {
101
+ emptyState.message = "To have a redirects on your site, create as many redirects as you want.";
102
+ emptyState.button = "Create New redirect";
103
+ emptyState.action = handleModal;
104
+ }
105
+ setIsEmpty(!redirects.length);
106
+ setEmptyStateProps(emptyState);
107
+ }
108
+ // eslint-disable-next-line react-hooks/exhaustive-deps
109
+ }, [isLoading]);
85
110
 
86
111
  const {
87
112
  resetBulkSelection,
@@ -176,12 +201,6 @@ const Redirects = (props: IProps): JSX.Element => {
176
201
  toggleOverwriteModal();
177
202
  };
178
203
 
179
- const emptyStateProps = {
180
- message: "To have a redirects on your site, create as many redirects as you want.",
181
- button: "Create New redirect",
182
- action: handleModal,
183
- };
184
-
185
204
  const pagination = {
186
205
  setPage,
187
206
  itemsPerPage,
@@ -236,6 +255,12 @@ const Redirects = (props: IProps): JSX.Element => {
236
255
 
237
256
  const secondaryImportModalAction = { title: "Cancel", onClick: toggleCheckImportModal };
238
257
 
258
+ const searchFilters = [
259
+ { value: "filterby", label: "Filter by" },
260
+ { value: "from", label: "Old URL" },
261
+ { value: "to", label: "New URL" },
262
+ ];
263
+
239
264
  return (
240
265
  <>
241
266
  <MainWrapper
@@ -243,6 +268,9 @@ const Redirects = (props: IProps): JSX.Element => {
243
268
  title="SEO Settings"
244
269
  rightButton={rightButtonProps}
245
270
  rightLineButton={rightLineButtonProps}
271
+ searchAction={setSearchQuery}
272
+ filterSearchAction={setSearchFilter}
273
+ searchFilters={searchFilters}
246
274
  >
247
275
  <S.Wrapper>
248
276
  <Nav current={currentNavItem} items={navItems} onClick={handleMenuClick} />
@@ -341,6 +369,7 @@ const mapStateToProps = (state: IRootState) => ({
341
369
  currentSiteID: state.sites.currentSiteInfo && state.sites.currentSiteInfo.id,
342
370
  totalImports: state.redirects.totalImports,
343
371
  imports: state.redirects.imports,
372
+ isLoading: state.app.isLoading,
344
373
  });
345
374
 
346
375
  const mapDispatchToProps = {
@@ -357,6 +386,7 @@ interface IRedirectsProps {
357
386
  totalItems: number;
358
387
  currentSiteID: number | null;
359
388
  totalImports: number;
389
+ isLoading: boolean;
360
390
  imports: null | {
361
391
  error: IRedirect[];
362
392
  existing: IRedirect[];
@@ -30,7 +30,7 @@ const Editor = (props: IProps) => {
30
30
  type IProps = {
31
31
  isLoading: boolean;
32
32
  template: string;
33
- }
33
+ };
34
34
 
35
35
  const mapStateToProps = (state: IRootState): IProps => ({
36
36
  isLoading: state.app.isLoading,
@@ -1,4 +1,4 @@
1
- import React, { useEffect } from "react";
1
+ import React from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
4
  import { IRootState } from "@ax/types";
@@ -68,7 +68,7 @@ const ConfigPack = (props: IProps): JSX.Element => {
68
68
  };
69
69
 
70
70
  interface IProps {
71
- selected: any;
71
+ selected?: any;
72
72
  currentSiteInfo: ISite;
73
73
  }
74
74
 
@@ -181,7 +181,7 @@ const DataPacks = (props: IProps): JSX.Element => {
181
181
  action: addNewAction,
182
182
  };
183
183
 
184
- const Content = () => (!isEmpty ? <Section /> : <EmptyState {...emptyStateProps} />);
184
+ const Content = () => (selected || !isEmpty ? <Section /> : <EmptyState {...emptyStateProps} />);
185
185
 
186
186
  return (
187
187
  <MainWrapper {...mainWrapperProps}>
@@ -15,7 +15,6 @@ const Sites = (props: IProps): JSX.Element => {
15
15
  const {
16
16
  isLoading,
17
17
  sites,
18
- token,
19
18
  setCurrentSiteInfo,
20
19
  getSites,
21
20
  getStructuredData,
@@ -23,12 +22,13 @@ const Sites = (props: IProps): JSX.Element => {
23
22
  getAllDataPacks,
24
23
  getUser,
25
24
  globalLangs,
25
+ token
26
26
  } = props;
27
27
 
28
28
  const fetchInitialData = async () => {
29
29
  setCurrentSiteInfo(null);
30
30
  await getStructuredData(token);
31
- await getSites(token);
31
+ await getSites();
32
32
  await getAllDataPacks();
33
33
  await getUser("me");
34
34
 
@@ -68,7 +68,7 @@ interface IStateProps {
68
68
 
69
69
  interface IDispatchProps {
70
70
  setCurrentSiteInfo(currentSiteInfo: any): void;
71
- getSites(token: string): Promise<void>;
71
+ getSites(language?: number): Promise<void>;
72
72
  getStructuredData(token: string, siteId?: number): Promise<void>;
73
73
  setLanguage(lang: { locale: string; id: number | null }): void;
74
74
  getAllDataPacks: () => Promise<void>;
@@ -405,7 +405,7 @@ interface IGlobalPageItemProps {
405
405
  isAllPages?: boolean;
406
406
  globalPage: IPage;
407
407
  updatePageStatus(ids: number[], status: string, updatedFromList: boolean): Promise<boolean>;
408
- duplicatePage(pageID: number, data: { title: string; slug: string }): Promise<void>;
408
+ duplicatePage(pageID: number, data: { title: string; slug: string }, siteID?: number): Promise<boolean>;
409
409
  setHistoryPush(path: string, isEditor: boolean): void;
410
410
  deletePage(params?: ISavePageParams, currentLanguage?: string): Promise<boolean>;
411
411
  getGlobalPages(): void;
@@ -87,4 +87,4 @@ interface IActionButton {
87
87
  title: string;
88
88
  }
89
89
 
90
- export { DeleteModal, MainActionButton, SecondaryActionButton };
90
+ export { DeleteModal, MainActionButton, SecondaryActionButton };
@@ -11,14 +11,14 @@ import { useURLSearchParam } from "@ax/hooks";
11
11
  import UserForm from "../UserForm";
12
12
 
13
13
  const Profile = (props: IProps) => {
14
- const { user, getUser, updateUser, isSaving, isLoading, getSites, token } = props;
14
+ const { user, getUser, updateUser, isSaving, isLoading, getSites } = props;
15
15
 
16
16
  const isUserInit = useURLSearchParam("init");
17
17
 
18
18
  const [form, setForm] = useState<IUser>({ ...user });
19
19
 
20
20
  useEffect(() => {
21
- isUserInit ? getSites(token) : getUser("me");
21
+ isUserInit ? getSites() : getUser("me");
22
22
  // eslint-disable-next-line react-hooks/exhaustive-deps
23
23
  }, []);
24
24
 
@@ -58,7 +58,7 @@ const mapStateToProps = (state: IRootState) => ({
58
58
  interface IDispatchProps {
59
59
  setHistoryPush(path: string): any;
60
60
  getUser(id: string): any;
61
- getSites(token: string): Promise<void>;
61
+ getSites(): Promise<void>;
62
62
  updateUser(id: number, data: any, isProfile: boolean, isList: boolean): any;
63
63
  }
64
64
 
@@ -73,7 +73,6 @@ interface IProfileProps {
73
73
  user: IUser;
74
74
  isSaving: boolean;
75
75
  isLoading: boolean;
76
- token: string;
77
76
  }
78
77
 
79
78
  type IProps = IProfileProps & IDispatchProps;
@@ -41,4 +41,4 @@ interface IProps {
41
41
  readOnly?: boolean;
42
42
  }
43
43
 
44
- export default SiteItem;
44
+ export default SiteItem;
@@ -27,4 +27,4 @@ const SiteItem = styled(Row)<{ disabled?: boolean; readOnly?: boolean }>`
27
27
  }
28
28
  `;
29
29
 
30
- export { CheckCell, NameCell, SiteItem };
30
+ export { CheckCell, NameCell, SiteItem };
@@ -19,7 +19,7 @@ const SubTitle = styled.div`
19
19
  `;
20
20
 
21
21
  const ModalContent = styled.div`
22
- padding: ${p => p.theme.spacing.m};
22
+ padding: ${(p) => p.theme.spacing.m};
23
23
  `;
24
24
 
25
25
  const SettingsWrapper = styled.div`
@@ -64,5 +64,5 @@ export {
64
64
  SettingContent,
65
65
  Heading,
66
66
  SearchFieldWrapper,
67
- SelectAllSitesFieldWrapper
68
- };
67
+ SelectAllSitesFieldWrapper,
68
+ };
@@ -115,7 +115,9 @@ const UserItem = (props: IProps): JSX.Element => {
115
115
  </S.UserCell>
116
116
  {isSiteView ? null : (
117
117
  <S.UserCell role="cell" onClick={handleClick}>
118
- {user?.sites?.length > 0 && <ElementsTooltip elements={getElementsNames()} elementsPerRow={3} defaultElements={3} />}
118
+ {user?.sites?.length > 0 && (
119
+ <ElementsTooltip elements={getElementsNames()} elementsPerRow={3} defaultElements={3} />
120
+ )}
119
121
  </S.UserCell>
120
122
  )}
121
123
  {isSiteView ? null : (
@@ -72,4 +72,4 @@ interface IUseFilterQuery {
72
72
  filterValues: IUsersQueryValues;
73
73
  }
74
74
 
75
- export { useSortedListStatus, useFilterQuery };
75
+ export { useSortedListStatus, useFilterQuery };
@@ -18,16 +18,16 @@ import * as S from "./style";
18
18
 
19
19
  const UserList = (props: IProps): JSX.Element => {
20
20
  const {
21
- currentSiteInfo,
22
21
  users,
22
+ sites,
23
23
  getUsers,
24
24
  navItems,
25
25
  currentNavItem,
26
26
  setHistoryPush,
27
27
  getUser,
28
28
  resetUserData,
29
- sites,
30
29
  deleteUser,
30
+ currentSiteInfo,
31
31
  removeUsersBulk,
32
32
  } = props;
33
33
 
@@ -151,8 +151,8 @@ export interface IImage {
151
151
  published: Date;
152
152
  description: string;
153
153
  thumb: string;
154
- tags: string[];
155
154
  file: File;
155
+ tags: string[];
156
156
  orientation: string;
157
157
  }
158
158
 
@@ -573,8 +573,8 @@ export interface IErrorItem {
573
573
  type: string;
574
574
  message: string;
575
575
  validator: Record<string, unknown>;
576
- editorID: number;
577
- component: string;
576
+ editorID: number | null;
577
+ component: string | null;
578
578
  name: string;
579
579
  key: string;
580
580
  tab: string;
@@ -622,6 +622,11 @@ export interface IUsersQueryValues {
622
622
  filterSites: string;
623
623
  }
624
624
 
625
+ export interface IUsersQueryValues {
626
+ order: string;
627
+ filterSites: string;
628
+ }
629
+
625
630
  export interface IDataPackConfigImportCategory {
626
631
  id: number;
627
632
  title: string;
@@ -740,6 +745,13 @@ export interface INotification {
740
745
  onClick?: () => void;
741
746
  }
742
747
 
748
+ export interface ILinkField {
749
+ text: string;
750
+ linkType: string;
751
+ url: IUrlField;
752
+ modal: any;
753
+ }
754
+
743
755
  export type Field =
744
756
  | "AsyncCheckGroup"
745
757
  | "AsyncSelect"
@@ -753,6 +765,7 @@ export type Field =
753
765
  | "HeadingField"
754
766
  | "HiddenField"
755
767
  | "ImageField"
768
+ | "LinkField"
756
769
  | "NumberField"
757
770
  | "RadioField"
758
771
  | "RadioGroup"