@griddo/ax 10.6.14 → 10.6.16
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "10.6.
|
|
4
|
+
"version": "10.6.16",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -233,5 +233,5 @@
|
|
|
233
233
|
"publishConfig": {
|
|
234
234
|
"access": "public"
|
|
235
235
|
},
|
|
236
|
-
"gitHead": "
|
|
236
|
+
"gitHead": "70b2e0f5430ab937321332b83cd48b81303a138a"
|
|
237
237
|
}
|
|
@@ -46,7 +46,8 @@ const NavMenu = (props: IProps) => {
|
|
|
46
46
|
const goToPublishedSite = () => {
|
|
47
47
|
const language = siteLanguages.find((l) => l.id === lang.id);
|
|
48
48
|
if (language && language.home) {
|
|
49
|
-
|
|
49
|
+
const urlHome = `${language.home}${language.home.endsWith("/") ? "" : "/"}`;
|
|
50
|
+
window.open(urlHome, "_blank");
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
IDataPack,
|
|
6
|
+
IDataPackConfigImport,
|
|
7
|
+
IDataPackConfigImportCategory,
|
|
8
|
+
IRootState,
|
|
9
|
+
ISite,
|
|
10
|
+
IStructuredData,
|
|
11
|
+
ITemplate,
|
|
12
|
+
} from "@ax/types";
|
|
5
13
|
import { dataPacksActions } from "@ax/containers/Settings";
|
|
6
14
|
import { FieldsBehavior, Modal, Tag } from "@ax/components";
|
|
7
15
|
import { useModal } from "@ax/hooks";
|
|
@@ -11,12 +19,17 @@ import * as S from "./style";
|
|
|
11
19
|
|
|
12
20
|
const Form = (props: IProps): JSX.Element => {
|
|
13
21
|
const { currentSite, selected, updateFormValue, configFormData, allStructuredData } = props;
|
|
14
|
-
const { templates, categories, structuredData } = selected;
|
|
15
22
|
|
|
16
23
|
if (!currentSite) {
|
|
17
24
|
throw new Error(`ERROR: User reached Data Pack form with null site info`);
|
|
18
25
|
}
|
|
19
26
|
|
|
27
|
+
if (!selected) {
|
|
28
|
+
throw new Error(`ERROR: User reached Data Pack form without one selected`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { templates, categories, structuredData } = selected;
|
|
32
|
+
|
|
20
33
|
const getSubscribedData = (importValue: IDataPackConfigImport[]) => {
|
|
21
34
|
const value: Record<string, ICategoryValue[]> = {};
|
|
22
35
|
if (!importValue) return value;
|
|
@@ -82,21 +95,21 @@ const Form = (props: IProps): JSX.Element => {
|
|
|
82
95
|
const secondaryAction = { title: "Cancel", onClick: toggleModal };
|
|
83
96
|
|
|
84
97
|
const getCategoryText = (id: string): string => {
|
|
85
|
-
const data = [...categories, ...allStructuredData.global, ...allStructuredData.site].find(
|
|
86
|
-
(elem: any) => elem.id === id
|
|
87
|
-
);
|
|
98
|
+
const data = [...categories, ...allStructuredData.global, ...allStructuredData.site].find((elem) => elem.id === id);
|
|
88
99
|
return data ? data.title : id;
|
|
89
100
|
};
|
|
90
101
|
|
|
91
102
|
const getIsGlobal = (id: string): boolean => {
|
|
92
|
-
const data = allStructuredData && allStructuredData.site.find((elem
|
|
103
|
+
const data = allStructuredData && allStructuredData.site.find((elem) => elem.id === id);
|
|
93
104
|
return data && data.local ? false : true;
|
|
94
105
|
};
|
|
95
106
|
|
|
107
|
+
const globalPageData = structuredData.find((data) => data.fromPage && !data.local);
|
|
108
|
+
|
|
96
109
|
const elements =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
110
|
+
globalPageData &&
|
|
111
|
+
globalPageData.relatedCategories &&
|
|
112
|
+
globalPageData.relatedCategories.map((cat) => {
|
|
100
113
|
return { source: cat, key: cat, placeholder: getCategoryText(cat), isGlobal: getIsGlobal(cat) };
|
|
101
114
|
});
|
|
102
115
|
|
|
@@ -132,12 +145,10 @@ const Form = (props: IProps): JSX.Element => {
|
|
|
132
145
|
</S.CategoriesWrapper>
|
|
133
146
|
);
|
|
134
147
|
|
|
135
|
-
const isGlobalDataPage = structuredData[0] && structuredData[0].fromPage && !structuredData[0].local;
|
|
136
|
-
|
|
137
148
|
return (
|
|
138
149
|
<>
|
|
139
150
|
<S.Config>
|
|
140
|
-
{
|
|
151
|
+
{!!globalPageData && (
|
|
141
152
|
<S.SectionContent>
|
|
142
153
|
<S.SubscribeWrapper>
|
|
143
154
|
<S.Heading>Subscribe to data</S.Heading>
|
|
@@ -215,11 +226,11 @@ interface ICategoryValue {
|
|
|
215
226
|
}
|
|
216
227
|
|
|
217
228
|
interface IProps {
|
|
218
|
-
selected:
|
|
229
|
+
selected: IDataPack | null;
|
|
219
230
|
currentSite: ISite | null;
|
|
220
231
|
updateFormValue: (config?: any) => void;
|
|
221
232
|
configFormData: any;
|
|
222
|
-
allStructuredData:
|
|
233
|
+
allStructuredData: { global: IStructuredData[]; site: IStructuredData[] };
|
|
223
234
|
}
|
|
224
235
|
|
|
225
236
|
const mapDispatchToProps = {
|
package/src/types/index.tsx
CHANGED
|
@@ -454,6 +454,7 @@ export interface IStructuredData {
|
|
|
454
454
|
dataPacks: string[];
|
|
455
455
|
private?: boolean;
|
|
456
456
|
exportable?: boolean;
|
|
457
|
+
relatedCategories: string[];
|
|
457
458
|
}
|
|
458
459
|
|
|
459
460
|
export interface IDataLanguage {
|
|
@@ -628,6 +629,7 @@ export interface IDataPack {
|
|
|
628
629
|
categories: any[];
|
|
629
630
|
activated: boolean;
|
|
630
631
|
config: string;
|
|
632
|
+
structuredData: IStructuredData[];
|
|
631
633
|
}
|
|
632
634
|
|
|
633
635
|
export interface ISocialState {
|