@griddo/ax 1.75.231 → 1.75.233
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 +3 -8
- package/src/api/structuredData.tsx +1 -6
- package/src/containers/StructuredData/actions.tsx +1 -1
- package/src/modules/Categories/CategoriesList/CategoryItem/index.tsx +2 -4
- package/src/modules/Categories/CategoriesList/CategoryNav/NavItem/index.tsx +8 -6
- package/src/modules/Categories/CategoriesList/CategoryNav/index.tsx +11 -3
- package/src/modules/Categories/CategoriesList/index.tsx +8 -7
- package/src/modules/StructuredData/StructuredDataList/index.tsx +2 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "1.75.
|
|
4
|
+
"version": "1.75.233",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -36,8 +36,7 @@
|
|
|
36
36
|
"test:dev:coverage": "npm run test:coverage -- --watch",
|
|
37
37
|
"lint": "eslint .",
|
|
38
38
|
"format": "prettier -w .",
|
|
39
|
-
"start:test": "env-cmd -f env/.env.development node scripts/dev.js"
|
|
40
|
-
"cypress:open": "cypress open"
|
|
39
|
+
"start:test": "env-cmd -f env/.env.development node scripts/dev.js"
|
|
41
40
|
},
|
|
42
41
|
"dependencies": {
|
|
43
42
|
"@atlaskit/tree": "^8.2.0",
|
|
@@ -50,7 +49,6 @@
|
|
|
50
49
|
"@testing-library/react": "^13.0.0",
|
|
51
50
|
"@testing-library/user-event": "^14.0.4",
|
|
52
51
|
"@types/compress.js": "^1.1.0",
|
|
53
|
-
"@types/cypress": "^1.1.3",
|
|
54
52
|
"@types/draft-js": "^0.10.44",
|
|
55
53
|
"@types/lodash.isequal": "^4.5.5",
|
|
56
54
|
"@types/markdown-draft-js": "^2.2.2",
|
|
@@ -84,7 +82,6 @@
|
|
|
84
82
|
"connected-react-router": "^6.9.2",
|
|
85
83
|
"css-loader": "^4.3.0",
|
|
86
84
|
"css-minimizer-webpack-plugin": "3.0.2",
|
|
87
|
-
"cypress-iframe": "^1.0.1",
|
|
88
85
|
"date-fns": "^2.21.3",
|
|
89
86
|
"dotenv": "6.2.0",
|
|
90
87
|
"dotenv-expand": "5.1.0",
|
|
@@ -169,12 +166,10 @@
|
|
|
169
166
|
"@types/jest": "^27.4.1",
|
|
170
167
|
"@types/redux-mock-store": "^1.0.3",
|
|
171
168
|
"babel-jest": "^27.5.1",
|
|
172
|
-
"cypress": "^12.3.0",
|
|
173
169
|
"eslint": "^6.1.0",
|
|
174
170
|
"eslint-config-prettier": "^8.3.0",
|
|
175
171
|
"eslint-config-react-app": "^5.0.2",
|
|
176
172
|
"eslint-loader": "^4.0.2",
|
|
177
|
-
"eslint-plugin-cypress": "^2.12.1",
|
|
178
173
|
"eslint-plugin-flowtype": "^5.7.2",
|
|
179
174
|
"eslint-plugin-import": "^2.23.4",
|
|
180
175
|
"eslint-plugin-jsx-a11y": "6.2.3",
|
|
@@ -235,5 +230,5 @@
|
|
|
235
230
|
"publishConfig": {
|
|
236
231
|
"access": "public"
|
|
237
232
|
},
|
|
238
|
-
"gitHead": "
|
|
233
|
+
"gitHead": "0c4bf25fd3bc162c209e0f5eb641d82c7d10e99e"
|
|
239
234
|
}
|
|
@@ -120,7 +120,6 @@ const getDataContents = (params: IGetStructuredDataParams, siteID?: number | nul
|
|
|
120
120
|
filterQuery,
|
|
121
121
|
relatedFields = false,
|
|
122
122
|
order,
|
|
123
|
-
lang,
|
|
124
123
|
} = params;
|
|
125
124
|
|
|
126
125
|
const url = siteID ? `${host}/site/${siteID}${endpoint}` : `${host}${endpoint}`;
|
|
@@ -131,11 +130,7 @@ const getDataContents = (params: IGetStructuredDataParams, siteID?: number | nul
|
|
|
131
130
|
if (order) SERVICES.GET_DATA_CONTENTS.dynamicUrl += `&order=${order}`;
|
|
132
131
|
if (filterQuery) SERVICES.GET_DATA_CONTENTS.dynamicUrl += filterQuery;
|
|
133
132
|
|
|
134
|
-
|
|
135
|
-
...(lang && { lang }),
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
return sendRequest(SERVICES.GET_DATA_CONTENTS, null, dataHeader);
|
|
133
|
+
return sendRequest(SERVICES.GET_DATA_CONTENTS, null);
|
|
139
134
|
};
|
|
140
135
|
|
|
141
136
|
const createDataContent = (data: any) => {
|
|
@@ -117,9 +117,7 @@ const CategoryItem = (props: ICategoryItemProps): JSX.Element => {
|
|
|
117
117
|
);
|
|
118
118
|
|
|
119
119
|
const translations = isTranslatable ? (
|
|
120
|
-
<FloatingMenu Button={FlagsButton}>
|
|
121
|
-
{languageMenu()}
|
|
122
|
-
</FloatingMenu>
|
|
120
|
+
<FloatingMenu Button={FlagsButton}>{languageMenu()}</FloatingMenu>
|
|
123
121
|
) : (
|
|
124
122
|
"Not translatable"
|
|
125
123
|
);
|
|
@@ -141,7 +139,7 @@ const CategoryItem = (props: ICategoryItemProps): JSX.Element => {
|
|
|
141
139
|
<S.StyledActionMenu icon="more" options={menuOptions} tooltip="Actions" />
|
|
142
140
|
</S.ActionsCell>
|
|
143
141
|
</S.CategoryRow>
|
|
144
|
-
<CategoryPanel isOpen={isOpen} toggleModal={toggleModal} item={category} getContents={getContents}/>
|
|
142
|
+
<CategoryPanel isOpen={isOpen} toggleModal={toggleModal} item={category} getContents={getContents} />
|
|
145
143
|
</>
|
|
146
144
|
);
|
|
147
145
|
};
|
|
@@ -9,7 +9,11 @@ import * as S from "./style";
|
|
|
9
9
|
const NavItem = (props: IProps): JSX.Element => {
|
|
10
10
|
const { current, categories, dataPack, onClick, isFirst } = props;
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const initialState = current
|
|
13
|
+
? categories.map((category: IStructuredData) => category.id).includes(current.id)
|
|
14
|
+
: isFirst;
|
|
15
|
+
|
|
16
|
+
const [isOpen, setIsOpen] = useState(initialState);
|
|
13
17
|
|
|
14
18
|
const toggleOpen = () => setIsOpen(!isOpen);
|
|
15
19
|
|
|
@@ -25,16 +29,14 @@ const NavItem = (props: IProps): JSX.Element => {
|
|
|
25
29
|
</S.NavLink>
|
|
26
30
|
<S.Dropdown isOpen={isOpen}>
|
|
27
31
|
{categories &&
|
|
28
|
-
categories.map((category: IStructuredData
|
|
32
|
+
categories.map((category: IStructuredData) => {
|
|
29
33
|
const isSelected = !!current && category.id === current.id;
|
|
30
34
|
const selectedClass = isSelected ? "selected" : "";
|
|
31
35
|
const handleClick = () => onClick(category.id);
|
|
32
36
|
return (
|
|
33
|
-
<MenuItem key={
|
|
37
|
+
<MenuItem key={category.id} onClick={handleClick}>
|
|
34
38
|
<NavLink to="#" className={selectedClass}>
|
|
35
|
-
<S.Link active={isSelected}>
|
|
36
|
-
{category.title}
|
|
37
|
-
</S.Link>
|
|
39
|
+
<S.Link active={isSelected}>{category.title}</S.Link>
|
|
38
40
|
</NavLink>
|
|
39
41
|
</MenuItem>
|
|
40
42
|
);
|
|
@@ -2,10 +2,11 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import { IDataPack, IStructuredData } from "@ax/types";
|
|
4
4
|
import { SubNav } from "@ax/components";
|
|
5
|
+
import { sortBy } from "@ax/helpers";
|
|
5
6
|
import NavItem from "./NavItem";
|
|
6
7
|
|
|
7
8
|
const CategoryNav = (props: IProps): JSX.Element => {
|
|
8
|
-
const { current, categories, onClick, dataPacks } = props;
|
|
9
|
+
const { current, categories, onClick, dataPacks, setSelectedCategory, scope } = props;
|
|
9
10
|
|
|
10
11
|
return (
|
|
11
12
|
<SubNav>
|
|
@@ -14,12 +15,17 @@ const CategoryNav = (props: IProps): JSX.Element => {
|
|
|
14
15
|
const dataPackCategories = categories.filter((cat: IStructuredData) => cat.dataPacks.includes(dataPack.id));
|
|
15
16
|
const hasCategories = dataPackCategories.length > 0;
|
|
16
17
|
if (hasCategories) {
|
|
18
|
+
const isFirst = result.length === 0;
|
|
19
|
+
const orderedCategories = dataPackCategories.sort(sortBy("title", false));
|
|
20
|
+
if (isFirst && !current) {
|
|
21
|
+
setSelectedCategory(orderedCategories[0].id, scope);
|
|
22
|
+
}
|
|
17
23
|
result.push(
|
|
18
24
|
<NavItem
|
|
19
25
|
key={dataPack.title}
|
|
20
|
-
isFirst={
|
|
26
|
+
isFirst={isFirst}
|
|
21
27
|
dataPack={dataPack}
|
|
22
|
-
categories={
|
|
28
|
+
categories={orderedCategories}
|
|
23
29
|
current={current}
|
|
24
30
|
onClick={onClick}
|
|
25
31
|
/>
|
|
@@ -36,6 +42,8 @@ interface IProps {
|
|
|
36
42
|
categories: IStructuredData[];
|
|
37
43
|
onClick(id: string): void;
|
|
38
44
|
dataPacks: IDataPack[];
|
|
45
|
+
setSelectedCategory(id: string, scope: string): void;
|
|
46
|
+
scope: string;
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
export default CategoryNav;
|
|
@@ -45,7 +45,6 @@ const CategoriesList = (props: IProps): JSX.Element => {
|
|
|
45
45
|
const scope = currentSiteID ? "site" : "global";
|
|
46
46
|
const currentCategories =
|
|
47
47
|
scope === "site" ? getFilteredStructuredData(activatedDataPacks, categories[scope]) : categories[scope];
|
|
48
|
-
const firstCategoryID = currentCategories[0] ? currentCategories[0].id : null;
|
|
49
48
|
|
|
50
49
|
const catIds = currentDataContent && currentDataContent.map((cat: any) => cat.id);
|
|
51
50
|
|
|
@@ -63,12 +62,11 @@ const CategoriesList = (props: IProps): JSX.Element => {
|
|
|
63
62
|
return {
|
|
64
63
|
page,
|
|
65
64
|
itemsPerPage,
|
|
66
|
-
lang: lang.locale,
|
|
67
65
|
pagination: true,
|
|
68
66
|
deleted: false,
|
|
69
67
|
include_draft: false,
|
|
70
68
|
};
|
|
71
|
-
}, [
|
|
69
|
+
}, [page]);
|
|
72
70
|
|
|
73
71
|
const getContents = useCallback(
|
|
74
72
|
(id: string) => {
|
|
@@ -81,11 +79,12 @@ const CategoriesList = (props: IProps): JSX.Element => {
|
|
|
81
79
|
);
|
|
82
80
|
|
|
83
81
|
useEffect(() => {
|
|
84
|
-
getContents(
|
|
85
|
-
|
|
82
|
+
currentStructuredData && getContents(currentStructuredData.id);
|
|
83
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
|
+
}, [lang, currentStructuredData]);
|
|
86
85
|
|
|
87
86
|
const handleClick = (dataID: string) => {
|
|
88
|
-
|
|
87
|
+
setSelectedCategory(dataID, scope);
|
|
89
88
|
};
|
|
90
89
|
|
|
91
90
|
const { isOpen, toggleModal } = useModal();
|
|
@@ -181,6 +180,8 @@ const CategoriesList = (props: IProps): JSX.Element => {
|
|
|
181
180
|
categories={currentCategories}
|
|
182
181
|
onClick={handleClick}
|
|
183
182
|
dataPacks={activatedDataPacks}
|
|
183
|
+
setSelectedCategory={setSelectedCategory}
|
|
184
|
+
scope={scope}
|
|
184
185
|
/>
|
|
185
186
|
<S.TableWrapper>
|
|
186
187
|
<ErrorToast />
|
|
@@ -217,7 +218,7 @@ const CategoriesList = (props: IProps): JSX.Element => {
|
|
|
217
218
|
</TableList>
|
|
218
219
|
</S.TableWrapper>
|
|
219
220
|
</S.CategoryListWrapper>
|
|
220
|
-
<CategoryPanel isOpen={isOpen} toggleModal={toggleModal} getContents={getContents}/>
|
|
221
|
+
<CategoryPanel isOpen={isOpen} toggleModal={toggleModal} getContents={getContents} />
|
|
221
222
|
{isVisible && <Toast {...toastProps} />}
|
|
222
223
|
</MainWrapper>
|
|
223
224
|
);
|
|
@@ -497,7 +497,8 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
497
497
|
values: getOptionValues(structuredData),
|
|
498
498
|
};
|
|
499
499
|
|
|
500
|
-
const notEditableText =
|
|
500
|
+
const notEditableText =
|
|
501
|
+
"Sorry, this content cannot be edited because it comes from an external source or belongs to a preconfigured system.";
|
|
501
502
|
|
|
502
503
|
const languageProps = {
|
|
503
504
|
globalLangs: isAllPages || isDataTranslatable ? globalLangs : null,
|