@griddo/ax 1.75.141 → 1.75.142

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": "1.75.141",
4
+ "version": "1.75.142",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -230,5 +230,5 @@
230
230
  "publishConfig": {
231
231
  "access": "public"
232
232
  },
233
- "gitHead": "7ade1706b9320d25589e8328af2fbccde199ebcd"
233
+ "gitHead": "c42f344536ff8a664420e1c2eeaf6197515fed41"
234
234
  }
@@ -1,16 +1,16 @@
1
- import React from "react";
1
+ import React, { forwardRef } from "react";
2
2
 
3
3
  import * as S from "./style";
4
4
 
5
- const ErrorToast = (props: IProps) => {
5
+ const ErrorToast = (props: IProps, ref: any) => {
6
6
  const { size } = props;
7
- return (
8
- <S.ErrorWrapper id="error" data-testid="error-wrapper" size={size}/>
9
- );
7
+
8
+ return <S.ErrorWrapper id="error" data-testid="error-wrapper" size={size} ref={ref} />;
10
9
  };
11
10
 
12
11
  export interface IProps {
13
12
  size?: string;
13
+ ref?: any;
14
14
  }
15
15
 
16
- export default ErrorToast;
16
+ export default forwardRef(ErrorToast);
@@ -11,7 +11,7 @@ const MainWrapper = (props: IWrapperProps): JSX.Element => {
11
11
  return (
12
12
  <S.Wrapper fixedAppBar={fixedAppBar} data-testid="main-wrapper">
13
13
  <AppBar {...props} />
14
- <S.Main fullWidth={fullWidth} data-testid="main-component">
14
+ <S.Main fullWidth={fullWidth} data-testid="main-component" id="main-component">
15
15
  {children}
16
16
  </S.Main>
17
17
  </S.Wrapper>
@@ -4,6 +4,7 @@ import { connect } from "react-redux";
4
4
  import { appActions } from "@ax/containers/App";
5
5
  import { sitesActions } from "@ax/containers/Sites";
6
6
  import { ICheck, IGetSitesParams, IRootState, ISettingsForm, ISite, ISiteListConfig, IUser } from "@ax/types";
7
+ import { IError } from "@ax/containers/App/reducer";
7
8
  import { useBulkSelection, useModal } from "@ax/hooks";
8
9
  import { MainWrapper, Modal, ErrorToast, Icon, IconAction, TableList, EmptyState } from "@ax/components";
9
10
 
@@ -31,6 +32,7 @@ const SitesList = (props: ISitesListProps): JSX.Element => {
31
32
  getSites,
32
33
  publishSitesBulk,
33
34
  unpublishSitesBulk,
35
+ error,
34
36
  config,
35
37
  setListConfig,
36
38
  } = props;
@@ -59,6 +61,7 @@ const SitesList = (props: ISitesListProps): JSX.Element => {
59
61
  const [searchQuery, setSearchQuery] = useState<string | null>("");
60
62
  const [currentFilterQuery, setCurrentFilterQuery] = useState(currentConfig.filter);
61
63
  const tableRef = useRef<HTMLDivElement>(null);
64
+ const errorRef = useRef<HTMLDivElement>(null);
62
65
 
63
66
  const pagination = {
64
67
  setPage,
@@ -116,6 +119,13 @@ const SitesList = (props: ISitesListProps): JSX.Element => {
116
119
  // eslint-disable-next-line react-hooks/exhaustive-deps
117
120
  }, [page, searchQuery, filterValues]);
118
121
 
122
+ useEffect(() => {
123
+ const errorCode = (error && error.code) || undefined;
124
+ if (errorCode === 400 && errorRef.current) {
125
+ errorRef.current.scrollIntoView();
126
+ }
127
+ }, [error]);
128
+
119
129
  const saveSiteSettings = async () => {
120
130
  const result = await saveSettings(form);
121
131
  if (result) {
@@ -321,7 +331,7 @@ const SitesList = (props: ISitesListProps): JSX.Element => {
321
331
 
322
332
  return (
323
333
  <MainWrapper title="Sites" rightButton={rightButtonProps} searchAction={setSearchQuery}>
324
- <ErrorToast />
334
+ <ErrorToast ref={errorRef} />
325
335
  <S.SitesListWrapper>
326
336
  {currentRecentSites?.length > 0 ? <RecentSitesList /> : null}
327
337
  <AllSitesHeader />
@@ -347,6 +357,7 @@ interface ISitesProps {
347
357
  currentUser: IUser;
348
358
  totalItems: number;
349
359
  token: string;
360
+ error: IError;
350
361
  config: ISiteListConfig;
351
362
  }
352
363
 
@@ -356,6 +367,7 @@ const mapStateToProps = (state: IRootState) => ({
356
367
  token: state.app.token,
357
368
  sites: state.sites.sites,
358
369
  recentSites: state.sites.recentSites,
370
+ error: state.app.error,
359
371
  config: state.sites.config,
360
372
  });
361
373