@griddo/ax 10.5.0 → 10.5.2

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.5.0",
4
+ "version": "10.5.2",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -232,5 +232,5 @@
232
232
  "publishConfig": {
233
233
  "access": "public"
234
234
  },
235
- "gitHead": "245671251ee67a3d95f10705ddab42178208a5c5"
235
+ "gitHead": "197fb75444ae01e8c0d9d26ebac3b14ed780d10d"
236
236
  }
@@ -30,6 +30,7 @@ const Header = (props: IHeaderProps) => {
30
30
  const { isVisible, toggleToast, setIsVisible } = useToast();
31
31
  const [y, setY] = useState(window.scrollY);
32
32
  const [scrollDown, setScrollDown] = useState(false);
33
+ const [breadcrumbOld, setBreadcrumbOld] = useState(breadcrumb);
33
34
 
34
35
  const handleNavigation = useCallback(
35
36
  (e: Event) => {
@@ -59,7 +60,11 @@ const Header = (props: IHeaderProps) => {
59
60
  if (headerRef.current) {
60
61
  const height = headerRef.current.offsetHeight + headerRef.current.offsetTop;
61
62
  setHeaderHeight(height);
62
- window.scrollTo(0, 0);
63
+ setBreadcrumbOld(breadcrumb);
64
+ if (JSON.stringify(breadcrumbOld) !== JSON.stringify(breadcrumb)) {
65
+ window.scrollTo(0, 0);
66
+ setBreadcrumbOld(breadcrumb);
67
+ }
63
68
  }
64
69
  }, [headerRef, breadcrumb, setHeaderHeight]);
65
70
 
@@ -1,11 +1,12 @@
1
1
  import React from "react";
2
- import { RouteComponentProps, withRouter } from "react-router-dom";
2
+ import { RouteComponentProps, useHistory, withRouter } from "react-router-dom";
3
3
  import { Button, Circle, Icon } from "@ax/components";
4
4
 
5
5
  import * as S from "./style";
6
6
 
7
7
  const ErrorPage = (props: IProps): JSX.Element => {
8
- const { type, history } = props;
8
+ const { type } = props;
9
+ const history = useHistory();
9
10
 
10
11
  const griddoLogo = "/img/logos/logoGriddoExtended@3x.svg";
11
12
 
@@ -55,7 +55,9 @@ const ItemList = (props: IProps) => {
55
55
 
56
56
  if (langItem) {
57
57
  const newSelIds: number[] = fixed.filter((id: number) => id !== langItem.id);
58
- const selItems: IStructuredDataContent[] = selectedItems.filter((item: IStructuredDataContent) => item.id !== langItem.id);
58
+ const selItems: IStructuredDataContent[] = selectedItems.filter(
59
+ (item: IStructuredDataContent) => item.id !== langItem.id
60
+ );
59
61
  setState((state: IReferenceState) => ({ ...state, fixed: newSelIds, selectedItems: selItems }));
60
62
  handleListDelete(newSelIds);
61
63
  }
@@ -5,7 +5,7 @@ import { useModal } from "@ax/hooks";
5
5
  import { IStructuredDataContent, IDataSource, ISite, IRootState, IStructuredData } from "@ax/types";
6
6
  import { structuredData } from "@ax/api";
7
7
  import { capitalize, isReqOk, splitCamelCase } from "@ax/helpers";
8
- import { IconAction, FloatingPanel, Select, Tag } from "@ax/components";
8
+ import { IconAction, FloatingPanel, Select, Tag, Icon } from "@ax/components";
9
9
  import AutoPanel from "./AutoPanel";
10
10
  import ItemList from "./ItemList";
11
11
  import ManualPanel from "./ManualPanel";
@@ -45,10 +45,9 @@ const ReferenceField = (props: IReferenceFieldProps) => {
45
45
  const isAuto = mode === "auto";
46
46
  const hasMaxItems = !!(value && value.fixed && maxItems && !isAuto && value.fixed.length >= maxItems);
47
47
  const sourcesIDs = sources.map((source: ISource) => source.structuredData);
48
+ const { fixed, order, quantity, allLanguages, preferenceLanguage, fullRelations = false } = state;
48
49
 
49
50
  const handleMode = (mode: string) => {
50
- const { fixed, order, quantity, allLanguages, preferenceLanguage, fullRelations = false } = state;
51
-
52
51
  const manualSources: string[] = state.selectedItems.reduce(
53
52
  (unique: string[], selItem: IStructuredDataContent) =>
54
53
  unique.includes(selItem.structuredData) ? unique : [...unique, selItem.structuredData],
@@ -134,6 +133,7 @@ const ReferenceField = (props: IReferenceFieldProps) => {
134
133
  const newValue = {
135
134
  mode,
136
135
  fixed,
136
+ fullRelations,
137
137
  };
138
138
  onChange(newValue);
139
139
  resetValidation && resetValidation();
@@ -143,6 +143,7 @@ const ReferenceField = (props: IReferenceFieldProps) => {
143
143
  const newValue = {
144
144
  mode,
145
145
  fixed,
146
+ fullRelations,
146
147
  };
147
148
  onChange(newValue);
148
149
  };
@@ -228,6 +229,11 @@ const ReferenceField = (props: IReferenceFieldProps) => {
228
229
  Elements
229
230
  <Asterisk />
230
231
  </S.Label>
232
+ <S.Note>
233
+ Only <strong>published</strong> &#40; <Icon name="active" size="16" /> &#41; data is displayed. &apos;Pending to
234
+ publish&apos; &#40; <Icon name="uploadPending" size="16" /> &#41; data won&apos;t appear until the publishing
235
+ process is complete.
236
+ </S.Note>
231
237
  <S.ModeWrapper>
232
238
  {!singleMode && (
233
239
  <Select
@@ -18,7 +18,7 @@ const Asterisk = styled.span`
18
18
  const ActionWrapper = styled.div`
19
19
  position: absolute;
20
20
  right: 0;
21
- top: ${(p) => p.theme.spacing.m};
21
+ top: ${(p) => p.theme.spacing.xxs};
22
22
  `;
23
23
 
24
24
  const DataWrapper = styled.div`
@@ -47,6 +47,7 @@ const Title = styled.span`
47
47
 
48
48
  const ModeWrapper = styled.div`
49
49
  display: flex;
50
+ position: relative;
50
51
  align-items: center;
51
52
  min-height: 32px;
52
53
  margin-bottom: ${(p) => p.theme.spacing.xxs};
@@ -57,6 +58,20 @@ const SingleModeText = styled.span`
57
58
  color: ${(p) => p.theme.colors.textHighEmphasis};
58
59
  `;
59
60
 
61
+ const Note = styled.div`
62
+ ${(p) => p.theme.textStyle.uiXS};
63
+ background-color: ${(p) => p.theme.color.uiBackground03};
64
+ padding: ${(p) => p.theme.spacing.s};
65
+ border-radius: ${(p) => p.theme.radii.s};
66
+ color: ${(p) => p.theme.color.textMediumEmphasis};
67
+ margin-top: ${(p) => p.theme.spacing.xxs};
68
+ margin-bottom: ${(p) => p.theme.spacing.xxs};
69
+ svg {
70
+ vertical-align: middle;
71
+ display: inline-block;
72
+ }
73
+ `;
74
+
60
75
  export {
61
76
  Asterisk,
62
77
  Wrapper,
@@ -69,4 +84,5 @@ export {
69
84
  Title,
70
85
  ModeWrapper,
71
86
  SingleModeText,
87
+ Note,
72
88
  };
@@ -203,7 +203,14 @@ const GalleryDetailPanel = (props: IProps) => {
203
203
  onChange={handleDescription}
204
204
  disabled={!isAllowedToEdit}
205
205
  />
206
- <FieldsBehavior title="Tags" value={imageForm.tags} fieldType="TagsField" onChange={handleTags} disabled={!isAllowedToEdit} />
206
+ <FieldsBehavior
207
+ title="Tags"
208
+ value={imageForm.tags}
209
+ fieldType="TagsField"
210
+ onChange={handleTags}
211
+ disabled={!isAllowedToEdit}
212
+ helptext="Type a tag and press enter to create it"
213
+ />
207
214
  </S.FormWrapper>
208
215
  </S.PanelForm>
209
216
  );
@@ -222,28 +229,30 @@ const GalleryDetailPanel = (props: IProps) => {
222
229
  {isSaving.delete ? `Deleting` : `Delete`}
223
230
  </Button>
224
231
  )}
225
- {isAllowedToEdit && <Button
226
- type="button"
227
- buttonStyle="line"
228
- onClick={handleSave}
229
- disabled={isSaving.save || isSaving.saveAdd || isSaving.delete}
230
- >
231
- {isSaving.save ? `Saving` : `Save`}
232
- </Button>}
233
- {isAllowedToEdit && <Button
234
- type="button"
235
- onClick={handleSaveAndAdd}
236
- disabled={isSaving.save || isSaving.saveAdd || isSaving.delete}
237
- >
238
- {isSaving.saveAdd ? `Saving` : `Save & Add`}
239
- </Button>}
240
- {!isAllowedToEdit && <Button
241
- type="button"
242
- onClick={handleAdd}
243
- disabled={isSaving.delete}
244
- >
245
- Add
246
- </Button>}
232
+ {isAllowedToEdit && (
233
+ <Button
234
+ type="button"
235
+ buttonStyle="line"
236
+ onClick={handleSave}
237
+ disabled={isSaving.save || isSaving.saveAdd || isSaving.delete}
238
+ >
239
+ {isSaving.save ? `Saving` : `Save`}
240
+ </Button>
241
+ )}
242
+ {isAllowedToEdit && (
243
+ <Button
244
+ type="button"
245
+ onClick={handleSaveAndAdd}
246
+ disabled={isSaving.save || isSaving.saveAdd || isSaving.delete}
247
+ >
248
+ {isSaving.saveAdd ? `Saving` : `Save & Add`}
249
+ </Button>
250
+ )}
251
+ {!isAllowedToEdit && (
252
+ <Button type="button" onClick={handleAdd} disabled={isSaving.delete}>
253
+ Add
254
+ </Button>
255
+ )}
247
256
  </S.PanelActions>
248
257
  {deletedToast && <Toast message="1 image deleted" setIsVisible={setDeletedToast} />}
249
258
  </S.DetailPanelWrapper>
@@ -1091,7 +1091,7 @@ function setSelectedContent(editorID: number): (dispatch: Dispatch, getState: an
1091
1091
 
1092
1092
  dispatch(setIsLoading(true));
1093
1093
  const {
1094
- pageEditor: { editorContent },
1094
+ pageEditor: { editorContent, tab },
1095
1095
  navigation: { header },
1096
1096
  } = getState();
1097
1097
  /*
@@ -1110,7 +1110,7 @@ function setSelectedContent(editorID: number): (dispatch: Dispatch, getState: an
1110
1110
 
1111
1111
  const schema = getSchema(component);
1112
1112
  const defaultTab = "content";
1113
- dispatch(setTab(defaultTab));
1113
+ dispatch(setTab(tab || defaultTab));
1114
1114
  dispatch(setSchema(schema));
1115
1115
  dispatch(setSelectedEditorID(editorID));
1116
1116
  dispatch(updateBreadcrumb(editorID));
@@ -20,7 +20,7 @@ export const ItemThumbnail = (props: IItemThumbnailProps): JSX.Element => {
20
20
  const { src, width, height, borderRadius } = props;
21
21
  const thumbnailPlaceholder = "/img/placeholder/thumbnail@1x.png";
22
22
  return src ? (
23
- <S.ImageWrapper data-testid="sites-item-thumbnail-wrapper" borderRadius={borderRadius}>
23
+ <S.ImageWrapper data-testid="sites-item-thumbnail-wrapper" borderRadius={borderRadius} height={height}>
24
24
  <Image width={width} height={height} url={src} />
25
25
  </S.ImageWrapper>
26
26
  ) : (
@@ -153,8 +153,8 @@ const EmptyStateWrapper = styled.div`
153
153
  margin-top: 100px;
154
154
  `;
155
155
 
156
- const ImageWrapper = styled.div<{ borderRadius?: boolean }>`
157
- height: 199px;
156
+ const ImageWrapper = styled.div<{ borderRadius?: boolean; height: number }>`
157
+ height: ${(p) => (p.height ? p.height : 199)}px;
158
158
  img {
159
159
  border-radius: ${(p) => (p.borderRadius ? p.theme.spacing.xs : 0)};
160
160
  object-fit: cover;