@griddo/ax 1.66.1 → 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.
- package/package.json +2 -2
- package/src/api/pages.tsx +15 -3
- package/src/api/redirects.tsx +4 -2
- package/src/api/sites.tsx +4 -2
- package/src/components/Browser/index.tsx +3 -1
- package/src/components/Browser/style.tsx +2 -2
- package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field/index.tsx +0 -1
- package/src/components/ErrorCenter/index.tsx +8 -5
- package/src/components/ErrorCenter/style.tsx +21 -8
- package/src/components/Fields/ColorPicker/index.tsx +1 -0
- package/src/components/Fields/LinkField/index.tsx +85 -0
- package/src/components/Fields/ReferenceField/ItemList/index.tsx +5 -1
- package/src/components/Fields/ReferenceField/index.tsx +18 -14
- package/src/components/Fields/UrlField/index.tsx +13 -1
- package/src/components/Fields/index.tsx +2 -0
- package/src/components/FieldsBehavior/index.tsx +14 -1
- package/src/components/Icon/components/Copy.js +14 -0
- package/src/components/Icon/svgs/Copy2.svg +3 -0
- package/src/components/Image/index.tsx +17 -9
- package/src/components/Image/utils.ts +55 -0
- package/src/components/MainWrapper/AppBar/index.tsx +21 -10
- package/src/components/MainWrapper/AppBar/style.tsx +11 -3
- package/src/components/MainWrapper/index.tsx +2 -0
- package/src/components/Modal/style.tsx +0 -1
- package/src/components/SearchField/index.tsx +36 -4
- package/src/components/SearchField/style.tsx +23 -10
- package/src/components/SideModal/style.tsx +6 -6
- package/src/components/TableFilters/StatusFilter/index.tsx +2 -2
- package/src/components/index.tsx +2 -0
- package/src/containers/App/actions.tsx +3 -7
- package/src/containers/PageEditor/actions.tsx +91 -22
- package/src/containers/PageEditor/constants.tsx +1 -1
- package/src/containers/PageEditor/interfaces.tsx +6 -6
- package/src/containers/PageEditor/reducer.tsx +4 -4
- package/src/containers/PageEditor/utils.tsx +2 -1
- package/src/containers/Sites/actions.tsx +35 -23
- package/src/containers/Sites/constants.tsx +1 -0
- package/src/containers/Sites/interfaces.tsx +6 -0
- package/src/containers/Sites/reducer.tsx +4 -0
- package/src/forms/editor.tsx +34 -1
- package/src/forms/errors.tsx +1 -0
- package/src/forms/index.tsx +15 -1
- package/src/forms/validators.tsx +168 -9
- package/src/guards/error/index.tsx +1 -1
- package/src/helpers/dataPacks.tsx +8 -1
- package/src/helpers/index.tsx +2 -1
- package/src/modules/Content/PageItem/index.tsx +54 -4
- package/src/modules/Content/atoms.tsx +41 -3
- package/src/modules/Content/index.tsx +111 -64
- package/src/modules/Content/style.tsx +8 -1
- package/src/modules/GlobalEditor/Editor/index.tsx +3 -1
- package/src/modules/GlobalEditor/PageBrowser/index.tsx +3 -0
- package/src/modules/GlobalEditor/index.tsx +8 -6
- package/src/modules/Navigation/Menus/List/Table/SidePanel/Form/index.tsx +8 -0
- package/src/modules/PageEditor/Editor/index.tsx +6 -2
- package/src/modules/PageEditor/PageBrowser/index.tsx +3 -0
- package/src/modules/PageEditor/index.tsx +29 -15
- package/src/modules/Redirects/index.tsx +40 -10
- package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/index.tsx +1 -1
- package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/index.tsx +1 -1
- package/src/modules/Settings/ContentTypes/DataPacks/Config/index.tsx +1 -1
- package/src/modules/Settings/ContentTypes/DataPacks/index.tsx +1 -1
- package/src/modules/Sites/index.tsx +3 -3
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +1 -1
- package/src/modules/StructuredData/StructuredDataList/atoms.tsx +1 -1
- package/src/modules/Users/Profile/index.tsx +3 -4
- package/src/modules/Users/UserCreate/SiteItem/index.tsx +1 -1
- package/src/modules/Users/UserCreate/SiteItem/style.tsx +1 -1
- package/src/modules/Users/UserForm/style.tsx +3 -3
- package/src/modules/Users/UserList/UserItem/index.tsx +3 -1
- package/src/modules/Users/UserList/hooks.tsx +1 -1
- package/src/modules/Users/UserList/index.tsx +2 -2
- package/src/types/index.tsx +16 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
1
|
+
import React, { useEffect, useState, useRef } from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
import { RouteComponentProps } from "react-router-dom";
|
|
4
4
|
|
|
@@ -10,11 +10,11 @@ import { navigationActions } from "@ax/containers/Navigation";
|
|
|
10
10
|
import { pageStatus } from "@ax/containers/PageEditor/interfaces";
|
|
11
11
|
import { RouteLeavingGuard } from "@ax/guards";
|
|
12
12
|
import { useIsDirty, useModal } from "@ax/hooks";
|
|
13
|
-
import { isModuleDisabled } from "@ax/helpers";
|
|
13
|
+
import { isModuleDisabled, getDeactivatedModules } from "@ax/helpers";
|
|
14
14
|
import { dataPacksActions } from "@ax/containers/Settings/DataPacks";
|
|
15
|
-
import { DeleteModal } from "./atoms";
|
|
16
15
|
import Editor from "./Editor";
|
|
17
16
|
import Preview from "./Preview";
|
|
17
|
+
import { DeleteModal } from "./atoms";
|
|
18
18
|
|
|
19
19
|
import * as S from "./style";
|
|
20
20
|
|
|
@@ -46,14 +46,15 @@ const PageEditor = (props: IProps) => {
|
|
|
46
46
|
isNewTranslation,
|
|
47
47
|
} = props;
|
|
48
48
|
|
|
49
|
-
const [deleteAllVersions, setDeleteAllVersions] = useState(false);
|
|
50
49
|
const [isReadOnly, setIsReadOnly] = useState(false);
|
|
51
50
|
const [selectedTab, setSelectedTab] = useState("edit");
|
|
51
|
+
const [deleteAllVersions, setDeleteAllVersions] = useState(false);
|
|
52
52
|
const [notification, setNotification] = useState<INotification | null>(null);
|
|
53
53
|
const { isDirty, setIsDirty, resetDirty } = useIsDirty(editorContent.editorContent, isNewTranslation);
|
|
54
54
|
const { isOpen, toggleModal } = useModal();
|
|
55
55
|
const { isOpen: isUnpublishOpen, toggleModal: toggleUnpublishModal } = useModal();
|
|
56
56
|
const { isOpen: isDeleteOpen, toggleModal: toggleDeleteModal } = useModal();
|
|
57
|
+
const browserRef = useRef<HTMLDivElement>(null);
|
|
57
58
|
|
|
58
59
|
const isGlobal = editorContent.editorContent && editorContent.editorContent.origin === "GLOBAL";
|
|
59
60
|
const isEditable = editorContent.editorContent && editorContent.editorContent.editable;
|
|
@@ -61,8 +62,8 @@ const PageEditor = (props: IProps) => {
|
|
|
61
62
|
const isDraft = props.pageStatus === pageStatus.MODIFIED;
|
|
62
63
|
const hasDraft = editorContent.editorContent && editorContent.editorContent.haveDraftPage;
|
|
63
64
|
const isLivePageChanged = editorContent.editorContent && editorContent.editorContent.liveChanged;
|
|
64
|
-
const isTranslated = pageLanguages.length > 1;
|
|
65
65
|
const structuredData = editorContent.editorContent ? editorContent.editorContent.structuredData : "";
|
|
66
|
+
const isTranslated = pageLanguages.length > 1;
|
|
66
67
|
|
|
67
68
|
useEffect(() => {
|
|
68
69
|
const { pageID, getPage, setTab, sendPagePing } = props;
|
|
@@ -118,7 +119,7 @@ const PageEditor = (props: IProps) => {
|
|
|
118
119
|
const publishPage = async () => {
|
|
119
120
|
const { updatePageStatus, savePage, pageID, validatePage } = props;
|
|
120
121
|
|
|
121
|
-
const validated = await validatePage(true);
|
|
122
|
+
const validated = await validatePage(true, browserRef);
|
|
122
123
|
|
|
123
124
|
if (validated) {
|
|
124
125
|
const publishPage = {
|
|
@@ -138,7 +139,7 @@ const PageEditor = (props: IProps) => {
|
|
|
138
139
|
const publishChanges = async () => {
|
|
139
140
|
const { savePage, validatePage } = props;
|
|
140
141
|
|
|
141
|
-
const validated = await validatePage(true);
|
|
142
|
+
const validated = await validatePage(true, browserRef);
|
|
142
143
|
|
|
143
144
|
if (validated) {
|
|
144
145
|
const publishPage = {
|
|
@@ -167,13 +168,13 @@ const PageEditor = (props: IProps) => {
|
|
|
167
168
|
|
|
168
169
|
const reviewPage = () => {
|
|
169
170
|
const { validatePage } = props;
|
|
170
|
-
validatePage();
|
|
171
|
+
validatePage(false, browserRef);
|
|
171
172
|
};
|
|
172
173
|
|
|
173
174
|
const handlePublishDraft = async () => {
|
|
174
175
|
const { savePage, validatePage } = props;
|
|
175
176
|
|
|
176
|
-
const validated = await validatePage(true);
|
|
177
|
+
const validated = await validatePage(true, browserRef);
|
|
177
178
|
|
|
178
179
|
if (validated) {
|
|
179
180
|
const isSaved = await savePage(false, null, true);
|
|
@@ -295,10 +296,12 @@ const PageEditor = (props: IProps) => {
|
|
|
295
296
|
|
|
296
297
|
const goToPages = (path: string) => setRoute(path);
|
|
297
298
|
|
|
298
|
-
const goToError = (editorID: number, tab: string, template: boolean) => {
|
|
299
|
+
const goToError = (editorID: number | null, tab: string, template: boolean) => {
|
|
299
300
|
const realEditorID = template ? 0 : editorID;
|
|
300
|
-
|
|
301
|
-
|
|
301
|
+
if (realEditorID !== null) {
|
|
302
|
+
setSelectedContent(realEditorID);
|
|
303
|
+
setTab(tab);
|
|
304
|
+
}
|
|
302
305
|
};
|
|
303
306
|
|
|
304
307
|
const modalText = (
|
|
@@ -309,9 +312,18 @@ const PageEditor = (props: IProps) => {
|
|
|
309
312
|
|
|
310
313
|
let isTemplateActivated = true;
|
|
311
314
|
let hasDeactivatedModules = false;
|
|
315
|
+
let deactivatedModules: string[] = [];
|
|
312
316
|
if (editorContent.editorContent && editorContent.editorContent.template) {
|
|
313
317
|
const editorTemplate = editorContent.editorContent.template;
|
|
314
|
-
|
|
318
|
+
const mainContentModules = editorTemplate?.mainContent?.modules;
|
|
319
|
+
|
|
320
|
+
if (mainContentModules) {
|
|
321
|
+
deactivatedModules = getDeactivatedModules(activatedModules, mainContentModules);
|
|
322
|
+
hasDeactivatedModules = deactivatedModules.length > 0;
|
|
323
|
+
} else {
|
|
324
|
+
hasDeactivatedModules = isModuleDisabled(selectedComponent, schema.schemaType, activatedModules);
|
|
325
|
+
}
|
|
326
|
+
|
|
315
327
|
isTemplateActivated = activatedTemplates.find((temp: any) => temp.id === editorTemplate.templateType)
|
|
316
328
|
? true
|
|
317
329
|
: false;
|
|
@@ -395,7 +407,8 @@ const PageEditor = (props: IProps) => {
|
|
|
395
407
|
if (!isTemplateActivated) {
|
|
396
408
|
getSiteDataPackbyTemplate(editorTemplate.templateType);
|
|
397
409
|
} else if (hasDeactivatedModules) {
|
|
398
|
-
|
|
410
|
+
const currentModule = deactivatedModules.length === 1 ? deactivatedModules[0] : selectedComponent;
|
|
411
|
+
getSiteDataPackbyModule(currentModule);
|
|
399
412
|
}
|
|
400
413
|
setHistoryPush("/sites/settings/content-types", false);
|
|
401
414
|
}
|
|
@@ -506,6 +519,7 @@ const PageEditor = (props: IProps) => {
|
|
|
506
519
|
isEditable={isEditable}
|
|
507
520
|
pageTitle={pageName}
|
|
508
521
|
isReadOnly={isReadOnly}
|
|
522
|
+
browserRef={browserRef}
|
|
509
523
|
setNotification={setNotification}
|
|
510
524
|
/>
|
|
511
525
|
</S.Content>
|
|
@@ -622,7 +636,7 @@ interface IPageEditorDispatchProps {
|
|
|
622
636
|
getPage(pageID?: number): Promise<void>;
|
|
623
637
|
savePage(createDraft: boolean, publishPage?: any, publishDraft?: boolean): Promise<boolean>;
|
|
624
638
|
deletePage(params?: ISavePageParams): Promise<boolean>;
|
|
625
|
-
validatePage(publish?: boolean): Promise<boolean>;
|
|
639
|
+
validatePage(publish?: boolean, browserRef?: any): Promise<boolean>;
|
|
626
640
|
updatePageStatus(id: number[], status: string): Promise<boolean>;
|
|
627
641
|
setHistoryPush(path: string, isEditor: boolean): void;
|
|
628
642
|
setLanguage?(lang: { locale: string; id: number | null }): void;
|
|
@@ -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[];
|
|
@@ -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(
|
|
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(
|
|
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<
|
|
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;
|
|
@@ -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
|
|
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(
|
|
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(
|
|
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;
|
|
@@ -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 &&
|
|
118
|
+
{user?.sites?.length > 0 && (
|
|
119
|
+
<ElementsTooltip elements={getElementsNames()} elementsPerRow={3} defaultElements={3} />
|
|
120
|
+
)}
|
|
119
121
|
</S.UserCell>
|
|
120
122
|
)}
|
|
121
123
|
{isSiteView ? null : (
|
|
@@ -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
|
|
package/src/types/index.tsx
CHANGED
|
@@ -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"
|