@griddo/ax 11.4.11 → 11.4.12
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/helpers/index.tsx +2 -0
- package/src/helpers/objects.tsx +13 -0
- package/src/modules/App/Routing/NavMenu/NavItem/index.tsx +3 -1
- package/src/modules/App/Routing/NavMenu/NavItem/style.tsx +16 -11
- package/src/modules/Content/OptionTable/index.tsx +5 -3
- package/src/modules/Settings/ContentTypes/DataPacks/AddModal/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "11.4.
|
|
4
|
+
"version": "11.4.12",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Diego M. Béjar <diego.bejar@secuoyas.com>",
|
|
@@ -220,5 +220,5 @@
|
|
|
220
220
|
"publishConfig": {
|
|
221
221
|
"access": "public"
|
|
222
222
|
},
|
|
223
|
-
"gitHead": "
|
|
223
|
+
"gitHead": "11ecbd2d13ead48984d887f30d684f739e50176d"
|
|
224
224
|
}
|
package/src/helpers/index.tsx
CHANGED
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
hasProps,
|
|
40
40
|
encodeData,
|
|
41
41
|
findObjectValue,
|
|
42
|
+
removeDuplicatesByProperty,
|
|
42
43
|
} from "./objects";
|
|
43
44
|
|
|
44
45
|
import {
|
|
@@ -228,4 +229,5 @@ export {
|
|
|
228
229
|
getMaxColumns,
|
|
229
230
|
updateColumns,
|
|
230
231
|
findObjectValue,
|
|
232
|
+
removeDuplicatesByProperty,
|
|
231
233
|
};
|
package/src/helpers/objects.tsx
CHANGED
|
@@ -129,6 +129,18 @@ const findObjectValue = (obj: Record<string, any>, key: string): any | undefined
|
|
|
129
129
|
return undefined;
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
+
const removeDuplicatesByProperty = <T, K extends keyof T>(items: T[], key: K): T[] => {
|
|
133
|
+
const seen = new Set<T[K]>();
|
|
134
|
+
return items.filter((item) => {
|
|
135
|
+
const value = item[key];
|
|
136
|
+
if (seen.has(value)) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
seen.add(value);
|
|
140
|
+
return true;
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
|
|
132
144
|
export {
|
|
133
145
|
isEmptyObj,
|
|
134
146
|
deepClone,
|
|
@@ -144,4 +156,5 @@ export {
|
|
|
144
156
|
hasProps,
|
|
145
157
|
encodeData,
|
|
146
158
|
findObjectValue,
|
|
159
|
+
removeDuplicatesByProperty,
|
|
147
160
|
};
|
|
@@ -53,7 +53,9 @@ const NavItem = (props: IProps) => {
|
|
|
53
53
|
)}
|
|
54
54
|
</S.NavLink>
|
|
55
55
|
<S.Dropdown isSubmenu={hasSubmenu} isSubmenuOpen={state[name]} className={DropdownClass} type={type}>
|
|
56
|
-
<S.Heading
|
|
56
|
+
<S.Heading onClick={handleClick}>
|
|
57
|
+
<div>{name}</div>
|
|
58
|
+
</S.Heading>
|
|
57
59
|
{routesGroups &&
|
|
58
60
|
routesGroups.map((subGroup: any, groupI: any) => (
|
|
59
61
|
<React.Fragment key={groupI}>
|
|
@@ -2,7 +2,10 @@ import styled from "styled-components";
|
|
|
2
2
|
|
|
3
3
|
export const Heading = styled.li`
|
|
4
4
|
${(p) => p.theme.textStyle.headingXXS};
|
|
5
|
-
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
6
9
|
`;
|
|
7
10
|
|
|
8
11
|
export const Dropdown = styled.ul<{ isSubmenu?: boolean; isSubmenuOpen: boolean; type: string }>`
|
|
@@ -18,6 +21,7 @@ export const Dropdown = styled.ul<{ isSubmenu?: boolean; isSubmenuOpen: boolean;
|
|
|
18
21
|
|
|
19
22
|
${Heading} {
|
|
20
23
|
margin-bottom: ${(p) => (p.isSubmenu ? p.theme.spacing.xs : "0")};
|
|
24
|
+
cursor: ${(p) => (p.isSubmenu ? "default" : "pointer")};
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
&.floating {
|
|
@@ -63,23 +67,24 @@ export const Arrow = styled.div`
|
|
|
63
67
|
export const LinkName = styled.span<{ active: boolean }>`
|
|
64
68
|
white-space: nowrap;
|
|
65
69
|
overflow: hidden;
|
|
66
|
-
color: ${(p) => p.active ? p.theme.color.textHighEmphasisInverse : p.theme.color.textMediumEmphasisInverse};
|
|
70
|
+
color: ${(p) => (p.active ? p.theme.color.textHighEmphasisInverse : p.theme.color.textMediumEmphasisInverse)};
|
|
67
71
|
`;
|
|
68
72
|
|
|
69
73
|
export const Item = styled.li<{ type: string; isOpened: boolean; isSubmenuOpen: boolean; active: boolean }>`
|
|
70
74
|
position: relative;
|
|
71
|
-
margin-left: ${(p) => p.isSubmenuOpen ? "0" : p.theme.spacing.s};
|
|
72
|
-
margin-right: ${(p) => p.isOpened && !p.isSubmenuOpen ? p.theme.spacing.s : "0"};
|
|
73
|
-
padding-left: ${(p) => p.isSubmenuOpen ? p.theme.spacing.s : "0"};
|
|
74
|
-
padding-right: ${(p) => p.isOpened && !p.isSubmenuOpen ? "0" : p.theme.spacing.s};
|
|
75
|
-
border-radius: ${(p) => p.isOpened ? p.theme.radii.s : `${p.theme.radii.s} 0 0 ${p.theme.radii.s}`};
|
|
76
|
-
background-color: ${(p) => p.isSubmenuOpen ? p.theme.color.overlayHoverDark : "transparent"
|
|
77
|
-
color: ${(p) => p.isSubmenuOpen ? p.theme.color.textHighEmphasisInverse : "inherit"
|
|
75
|
+
margin-left: ${(p) => (p.isSubmenuOpen ? "0" : p.theme.spacing.s)};
|
|
76
|
+
margin-right: ${(p) => (p.isOpened && !p.isSubmenuOpen ? p.theme.spacing.s : "0")};
|
|
77
|
+
padding-left: ${(p) => (p.isSubmenuOpen ? p.theme.spacing.s : "0")};
|
|
78
|
+
padding-right: ${(p) => (p.isOpened && !p.isSubmenuOpen ? "0" : p.theme.spacing.s)};
|
|
79
|
+
border-radius: ${(p) => (p.isOpened ? p.theme.radii.s : `${p.theme.radii.s} 0 0 ${p.theme.radii.s}`)};
|
|
80
|
+
background-color: ${(p) => (p.isSubmenuOpen ? p.theme.color.overlayHoverDark : "transparent")};
|
|
81
|
+
color: ${(p) => (p.isSubmenuOpen ? p.theme.color.textHighEmphasisInverse : "inherit")};
|
|
78
82
|
margin-bottom: ${(p) => p.theme.spacing.xxs};
|
|
79
83
|
|
|
80
84
|
svg {
|
|
81
85
|
path {
|
|
82
|
-
fill: ${(p) =>
|
|
86
|
+
fill: ${(p) =>
|
|
87
|
+
p.isSubmenuOpen || p.active ? p.theme.color.textHighEmphasisInverse : p.theme.color.textMediumEmphasisInverse};
|
|
83
88
|
}
|
|
84
89
|
}
|
|
85
90
|
|
|
@@ -120,7 +125,7 @@ export const Item = styled.li<{ type: string; isOpened: boolean; isSubmenuOpen:
|
|
|
120
125
|
cursor: pointer;
|
|
121
126
|
|
|
122
127
|
&.selected {
|
|
123
|
-
background-color: ${(p) => p.isSubmenuOpen ? "transparent" : p.theme.color.overlayPressedDark
|
|
128
|
+
background-color: ${(p) => (p.isSubmenuOpen ? "transparent" : p.theme.color.overlayPressedDark)};
|
|
124
129
|
color: ${(p) => p.theme.color.textHighEmphasisInverse};
|
|
125
130
|
|
|
126
131
|
path {
|
|
@@ -2,7 +2,7 @@ import React, { useReducer, useEffect } from "react";
|
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
|
|
4
4
|
import { IRootState, IStructuredData, ITemplateOption, IThemeElements } from "@ax/types";
|
|
5
|
-
import { filterThemeTemplates, getThumbnailProps } from "@ax/helpers";
|
|
5
|
+
import { filterThemeTemplates, getThumbnailProps, removeDuplicatesByProperty } from "@ax/helpers";
|
|
6
6
|
import { MenuItem, RadioGroup } from "@ax/components";
|
|
7
7
|
import { structuredDataActions } from "@ax/containers/StructuredData";
|
|
8
8
|
import { SecondaryActionButton, MainActionButton } from "./../atoms";
|
|
@@ -43,8 +43,8 @@ const OptionTable = (props: IOptionTableProps): JSX.Element => {
|
|
|
43
43
|
const currentType = currentStructuredData
|
|
44
44
|
? currentStructuredData.dataPacks[0]
|
|
45
45
|
: filters.length
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
? filters[0].value
|
|
47
|
+
: "";
|
|
48
48
|
|
|
49
49
|
const initialState: IOptionTableStore = {
|
|
50
50
|
columnValues: filterOptions(currentType, "type"),
|
|
@@ -123,6 +123,8 @@ const OptionTable = (props: IOptionTableProps): JSX.Element => {
|
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
+
filteredOptionsByDataPack = removeDuplicatesByProperty(filteredOptionsByDataPack, "type");
|
|
127
|
+
|
|
126
128
|
filteredOptionsByDataPack.sort((ele, comp) => {
|
|
127
129
|
// Use localeCompare to compare strings alphabetically
|
|
128
130
|
return ele.title.localeCompare(comp.title);
|
|
@@ -83,6 +83,7 @@ const AddModal = (props: IProps) => {
|
|
|
83
83
|
items.map((item: IDataPack, index: number) => {
|
|
84
84
|
const isSelected = state.packsSelected.find((i: IDataPack) => i.id === item.id);
|
|
85
85
|
const schema = getDataPackSchema(item.id);
|
|
86
|
+
if (!schema) return <></>;
|
|
86
87
|
const { image } = schema;
|
|
87
88
|
const imageUrl = typeof image === "string" ? image : image[currentSiteInfo.theme];
|
|
88
89
|
|