@griddo/ax 11.14.4 → 11.14.5-rc.0

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.
Files changed (48) hide show
  1. package/package.json +2 -2
  2. package/src/api/sites.tsx +2 -2
  3. package/src/components/Fields/ImageField/index.tsx +52 -28
  4. package/src/components/Fields/ImageField/style.tsx +22 -13
  5. package/src/components/Fields/NoteField/index.tsx +1 -3
  6. package/src/components/Fields/NoteField/style.tsx +1 -0
  7. package/src/components/Fields/TextArea/style.tsx +5 -2
  8. package/src/components/Fields/ToggleField/index.tsx +3 -2
  9. package/src/components/FieldsBehavior/index.tsx +27 -3
  10. package/src/components/FieldsBehavior/style.tsx +9 -7
  11. package/src/components/FloatingNote/index.tsx +1 -1
  12. package/src/components/FloatingPanel/style.tsx +4 -1
  13. package/src/components/HeadingsPreviewModal/style.tsx +1 -1
  14. package/src/components/Icon/components/Party.js +16 -0
  15. package/src/components/Icon/svgs/Party.svg +3 -0
  16. package/src/components/Image/index.tsx +2 -1
  17. package/src/components/Image/utils.ts +3 -3
  18. package/src/components/MainWrapper/AppBar/atoms.tsx +118 -34
  19. package/src/components/MainWrapper/AppBar/index.tsx +64 -86
  20. package/src/components/MainWrapper/AppBar/style.tsx +5 -0
  21. package/src/components/MainWrapper/index.tsx +2 -41
  22. package/src/containers/Navigation/Defaults/reducer.tsx +2 -2
  23. package/src/containers/Sites/actions.tsx +2 -3
  24. package/src/modules/Content/index.tsx +26 -8
  25. package/src/modules/Content/style.tsx +5 -0
  26. package/src/modules/GlobalSettings/Robots/Item/RobotsPanel/index.tsx +34 -17
  27. package/src/modules/GlobalSettings/Robots/Item/RobotsPanel/style.tsx +37 -5
  28. package/src/modules/GlobalSettings/Robots/index.tsx +4 -3
  29. package/src/modules/Navigation/Defaults/DefaultsEditor/index.tsx +8 -17
  30. package/src/modules/Navigation/Defaults/Item/index.tsx +17 -19
  31. package/src/modules/Navigation/Defaults/index.tsx +5 -8
  32. package/src/modules/Settings/Globals/NavigationModules/index.tsx +1 -1
  33. package/src/modules/Settings/Globals/NavigationModules/style.tsx +1 -2
  34. package/src/modules/Settings/Globals/index.tsx +194 -73
  35. package/src/modules/Settings/Globals/style.tsx +67 -1
  36. package/src/modules/Settings/Integrations/IntegrationItem/index.tsx +2 -3
  37. package/src/modules/Sites/SitesList/GridView/GridSiteItem/index.tsx +13 -5
  38. package/src/modules/Sites/SitesList/GridView/GridSiteItem/style.tsx +16 -8
  39. package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/index.tsx +1 -0
  40. package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/style.tsx +7 -1
  41. package/src/modules/Sites/SitesList/ListView/ListSiteItem/index.tsx +8 -1
  42. package/src/modules/Sites/SitesList/ListView/ListSiteItem/style.tsx +7 -1
  43. package/src/modules/Sites/SitesList/SiteModal/index.tsx +77 -23
  44. package/src/modules/Sites/SitesList/atoms.tsx +4 -4
  45. package/src/modules/Sites/SitesList/index.tsx +9 -47
  46. package/src/modules/Sites/SitesList/style.tsx +8 -4
  47. package/src/modules/Users/UserForm/index.tsx +1 -1
  48. package/src/types/index.tsx +11 -22
@@ -1,7 +1,7 @@
1
- import React, { useState } from "react";
1
+ import { useState } from "react";
2
2
 
3
- import { IDomainRobot } from "@ax/types";
4
- import { FloatingPanel, Button, FieldsBehavior } from "@ax/components";
3
+ import { Button, FloatingPanel } from "@ax/components";
4
+ import type { IDomainRobot } from "@ax/types";
5
5
 
6
6
  import * as S from "./style";
7
7
 
@@ -26,23 +26,40 @@ const RobotsPanel = (props: IProps): JSX.Element => {
26
26
 
27
27
  const placeholder = "User-agent: * \nAllow: *";
28
28
 
29
+ const noteTitle = "From site settings · read-only";
30
+
31
+ const noteText = (
32
+ <>
33
+ Each site under this domain can define its own sitemap and visibility rules for search engines and LLMs from its
34
+ {` `}
35
+ <strong>site settings</strong>. Rules from all sites are listed below and will be combined with your custom rules
36
+ above to generate the final robots.txt.
37
+ <br />
38
+ <br />
39
+ {item.computedContent}
40
+ </>
41
+ );
42
+
29
43
  return (
30
44
  <FloatingPanel title={title} toggleModal={toggleModal} isOpen={isOpen}>
31
45
  <S.Wrapper>
32
- <S.Item>
33
- <S.ItemHeader>You are editing</S.ItemHeader>
34
- <S.ItemContent>{item.fullUrl}</S.ItemContent>
35
- </S.Item>
36
- <FieldsBehavior
37
- fieldType="TextArea"
38
- onChange={setValue}
39
- value={value}
40
- title="Robots.txt"
41
- placeholder={placeholder}
42
- />
43
- <Button buttonStyle="text" type="button" icon="refresh" disabled={!value} onClick={resetItem}>
44
- Reset to default
45
- </Button>
46
+ <S.Content>
47
+ <S.Item>
48
+ <S.ItemHeader>You are editing</S.ItemHeader>
49
+ <S.ItemContent>{item.fullUrl}</S.ItemContent>
50
+ </S.Item>
51
+ <S.StyledFieldsBehavior
52
+ fieldType="TextArea"
53
+ onChange={setValue}
54
+ value={value}
55
+ title="Robots.txt"
56
+ placeholder={placeholder}
57
+ />
58
+ <Button buttonStyle="text" type="button" icon="refresh" disabled={!value} onClick={resetItem}>
59
+ Reset to default
60
+ </Button>
61
+ {item.computedContent?.length > 0 && <S.StyledFNoteField value={{ title: noteTitle, text: noteText }} />}
62
+ </S.Content>
46
63
  <S.Footer>
47
64
  <Button className="button" type="button" onClick={editButton.action}>
48
65
  {editButton.label}
@@ -1,8 +1,31 @@
1
+ import { FieldsBehavior, NoteField } from "@ax/components";
2
+
1
3
  import styled from "styled-components";
2
4
 
3
5
  const Wrapper = styled.div`
4
- padding: ${(p) => p.theme.spacing.m};
6
+ display: flex;
7
+
8
+ flex-direction: column;
5
9
  height: 100%;
10
+ max-height: 100%;
11
+ overflow: hidden;
12
+ `;
13
+
14
+ const Content = styled.div`
15
+ flex: 1;
16
+ overflow-y: auto;
17
+ padding: ${(p) => p.theme.spacing.m};
18
+
19
+ &::-webkit-scrollbar {
20
+ -webkit-appearance: none;
21
+ width: 4px;
22
+ height: 100%;
23
+ }
24
+
25
+ &::-webkit-scrollbar-thumb {
26
+ border-radius: 4px;
27
+ background-color: ${(p) => p.theme.colors.iconNonActive};
28
+ }
6
29
  `;
7
30
 
8
31
  const Item = styled.div`
@@ -27,9 +50,18 @@ const ItemContent = styled.div`
27
50
  `;
28
51
 
29
52
  const Footer = styled.div`
30
- position: absolute;
31
- bottom: ${(p) => p.theme.spacing.m};
32
- right: ${(p) => p.theme.spacing.m};
53
+ display: flex;
54
+ flex-shrink: 0;
55
+ padding: ${(p) => p.theme.spacing.m};
56
+ justify-content: flex-end;
57
+ `;
58
+
59
+ const StyledFieldsBehavior = styled((props) => <FieldsBehavior {...props} />)`
60
+ margin-bottom: 0;
61
+ `;
62
+
63
+ const StyledFNoteField = styled((props) => <NoteField {...props} />)`
64
+ margin-top: ${(p) => p.theme.spacing.m};
33
65
  `;
34
66
 
35
- export { Wrapper, Item, ItemHeader, ItemContent, Footer };
67
+ export { Wrapper, Content, Item, ItemHeader, ItemContent, Footer, StyledFieldsBehavior, StyledFNoteField };
@@ -1,12 +1,13 @@
1
- import React, { useEffect, useState } from "react";
1
+ import { useEffect, useState } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { IDomainRobot, INavItem, IRootState } from "@ax/types";
4
+ import { ErrorToast, Loading, MainWrapper, Nav } from "@ax/components";
5
5
  import { appActions } from "@ax/containers/App";
6
6
  import { domainsActions } from "@ax/containers/Domains";
7
- import { MainWrapper, ErrorToast, Nav, Loading } from "@ax/components";
8
7
  import { RouteLeavingGuard } from "@ax/guards";
9
8
  import { useIsDirty } from "@ax/hooks";
9
+ import type { IDomainRobot, INavItem, IRootState } from "@ax/types";
10
+
10
11
  import Item from "./Item";
11
12
 
12
13
  import * as S from "./style";
@@ -1,23 +1,14 @@
1
1
  import { useEffect, useMemo, useRef, useState } from "react";
2
- import { connect } from "react-redux";
3
2
  import { withErrorBoundary } from "react-error-boundary";
3
+ import { connect } from "react-redux";
4
4
 
5
- import type {
6
- IRootState,
7
- ISite,
8
- INotification,
9
- ILanguage,
10
- INavigationLanguage,
11
- IHeader,
12
- IFooter,
13
- INavigation,
14
- } from "@ax/types";
15
- import { useIsDirty, useModal, usePermission } from "@ax/hooks";
5
+ import { ErrorPage, ErrorToast, Loading, MainWrapper, Modal, Notification, RestoreModal } from "@ax/components";
6
+ import { appActions } from "@ax/containers/App";
7
+ import { menuActions, navigationActions } from "@ax/containers/Navigation";
16
8
  import { RouteLeavingGuard } from "@ax/guards";
9
+ import { useIsDirty, useModal, usePermission } from "@ax/hooks";
10
+ import type { ILanguage, INavigation, INavigationLanguage, INotification, IRootState, ISite } from "@ax/types";
17
11
 
18
- import { appActions } from "@ax/containers/App";
19
- import { navigationActions, menuActions } from "@ax/containers/Navigation";
20
- import { ErrorPage, ErrorToast, Loading, MainWrapper, Modal, Notification, RestoreModal } from "@ax/components";
21
12
  import Editor from "./Editor";
22
13
 
23
14
  import * as S from "./style";
@@ -87,7 +78,7 @@ const DefaultsEditor = (props: IProps) => {
87
78
  useEffect(() => {
88
79
  const editorType = editorContent?.type;
89
80
  const navigationModuleComponent = editorType ? currentSiteInfo?.navigationModules?.[editorType] : undefined;
90
- const currentNavigation = currentDefaultsContent?.find((item: IHeader | IFooter) => item.id === editorContent?.id);
81
+ const currentNavigation = currentDefaultsContent?.find((item) => item.id === editorContent?.id);
91
82
  if (navigationModuleComponent && editorContent && currentNavigation) {
92
83
  const isNavigationModuleChanged = navigationModuleComponent !== currentNavigation.component;
93
84
  if (isNavigationModuleChanged) setIsDirty(true);
@@ -260,7 +251,7 @@ interface IStateProps {
260
251
  isLoading: boolean;
261
252
  lang: { locale: string; id: number | null };
262
253
  siteLanguages: ILanguage[];
263
- currentDefaultsContent: (IHeader | IFooter)[];
254
+ currentDefaultsContent: INavigation[];
264
255
  selectedDefault: string;
265
256
  editorContent: INavigation | null;
266
257
  header: number | null;
@@ -1,7 +1,7 @@
1
- import React, { useState } from "react";
1
+ import { useState } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { IHeader, IFooter, ICheck, ILanguage, INavigationLanguage } from "@ax/types";
4
+ import type { ICheck, ILanguage, INavigationLanguage, INavigation } from "@ax/types";
5
5
  import { useModal, usePermission } from "@ax/hooks";
6
6
  import { appActions } from "@ax/containers/App";
7
7
  import { navigationActions, menuActions } from "@ax/containers/Navigation";
@@ -58,16 +58,16 @@ const DefaultItem = (props: IProps): JSX.Element => {
58
58
 
59
59
  const handleRenameItem = () => {
60
60
  const updatedItem = { ...defaultContent, title: inputValue };
61
- updateNavigation(defaultContent.id, updatedItem);
61
+ updateNavigation(defaultContent.id!, updatedItem);
62
62
  };
63
63
 
64
- const handleSetDefault = () => setDefaultNavigation(defaultContent.id, defaultContent.type);
64
+ const handleSetDefault = () => setDefaultNavigation(defaultContent.id!, defaultContent.type);
65
65
 
66
66
  const handleErrorAction = () => toggleReplaceModal();
67
67
 
68
68
  const removeItem = async () => {
69
- const deleted = await deleteNavigation(defaultContent.id, defaultContent.type, handleErrorAction);
70
- setDeletedNav(defaultContent.id);
69
+ const deleted = await deleteNavigation(defaultContent.id!, defaultContent.type, handleErrorAction);
70
+ setDeletedNav(defaultContent.id!);
71
71
  if (deleted) {
72
72
  toggleToast();
73
73
  }
@@ -104,15 +104,13 @@ const DefaultItem = (props: IProps): JSX.Element => {
104
104
 
105
105
  const getCurrentLanguages = () => {
106
106
  const availables: ILanguage[] = [];
107
- navigationLanguages.forEach(
108
- (navLang) =>
109
- languages &&
110
- languages.forEach((siteLang) => {
111
- if (siteLang.id === navLang.languageId) {
112
- availables.push(siteLang);
113
- }
114
- }),
115
- );
107
+ navigationLanguages.forEach((navLang) => {
108
+ languages?.forEach((siteLang) => {
109
+ if (siteLang.id === navLang.languageId) {
110
+ availables.push(siteLang);
111
+ }
112
+ });
113
+ });
116
114
 
117
115
  return availables;
118
116
  };
@@ -146,7 +144,7 @@ const DefaultItem = (props: IProps): JSX.Element => {
146
144
  const setNav = (id: number) => (isHeader ? setHeader(id) : setFooter(id));
147
145
  const selectedNavLanguage = getSelectedNavLanguage(navigationLanguages, language);
148
146
  const setTranslation = () =>
149
- selectedNavLanguage ? setNav(selectedNavLanguage.navigationId) : setNav(defaultContent.id);
147
+ selectedNavLanguage ? setNav(selectedNavLanguage.navigationId) : setNav(defaultContent.id!);
150
148
  setTranslation();
151
149
  !selectedNavLanguage && createNewTranslation(true);
152
150
  await getMenus();
@@ -162,7 +160,7 @@ const DefaultItem = (props: IProps): JSX.Element => {
162
160
  <S.CheckCell role="cell">
163
161
  <CheckField
164
162
  name="check"
165
- value={defaultContent.id}
163
+ value={defaultContent.id!}
166
164
  checked={isSelected || hoverCheck}
167
165
  onChange={handleOnChange}
168
166
  />
@@ -229,12 +227,12 @@ const DefaultItem = (props: IProps): JSX.Element => {
229
227
  };
230
228
 
231
229
  interface IProps {
232
- defaultContent: IHeader | IFooter;
230
+ defaultContent: INavigation;
233
231
  languages: ILanguage[];
234
232
  lang: { locale: string; id: number | null };
235
233
  handleClick: (e: any) => void;
236
234
  setHistoryPush(path: string, isEditor?: boolean): any;
237
- updateNavigation(navID: number, data: IHeader | IFooter): void;
235
+ updateNavigation(navID: number, data: INavigation): void;
238
236
  isSelected: boolean;
239
237
  toggleToast(): void;
240
238
  onChange: (e: any) => void;
@@ -6,7 +6,7 @@ import { appActions } from "@ax/containers/App";
6
6
  import { menuActions, navigationActions } from "@ax/containers/Navigation";
7
7
  import { capitalize, isMultipleNavigationModules } from "@ax/helpers";
8
8
  import { useBulkSelection, useModal, usePermission, useToast } from "@ax/hooks";
9
- import type { IFooter, IHeader, ILanguage, IRootState, ISite } from "@ax/types";
9
+ import type { IFooter, IHeader, ILanguage, INavigation, IRootState, ISite } from "@ax/types";
10
10
 
11
11
  import { NavigationModulesWarning } from "./atoms";
12
12
  import BulkHeader from "./BulkHeader";
@@ -54,10 +54,7 @@ const DefaultsList = (props: IProps): JSX.Element => {
54
54
  const isAllowedToCreate = usePermission(`navigation.createSite${selectedDefault}`);
55
55
  const isAllowedToDelete = usePermission(`navigation.deleteSite${selectedDefault}`);
56
56
 
57
- const navIds = useMemo(
58
- () => currentDefaultsContent?.map((nav: IHeader | IFooter) => nav.id),
59
- [currentDefaultsContent],
60
- );
57
+ const navIds = useMemo(() => currentDefaultsContent?.map((nav) => nav.id), [currentDefaultsContent]);
61
58
 
62
59
  const {
63
60
  resetBulkSelection,
@@ -105,7 +102,7 @@ const DefaultsList = (props: IProps): JSX.Element => {
105
102
  const isNavigationModulesChanged = Boolean(
106
103
  currentSiteInfo?.navigationModules?.[currentType] &&
107
104
  currentDefaultsContent.some(
108
- (navigation) => navigation.component !== currentSiteInfo?.navigationModules[currentType],
105
+ (navigation) => navigation.component !== currentSiteInfo?.navigationModules?.[currentType],
109
106
  ),
110
107
  );
111
108
  setIsNavigationNotificationOpen(isNavigationModulesChanged);
@@ -251,7 +248,7 @@ const DefaultsList = (props: IProps): JSX.Element => {
251
248
  hasFixedHeader={true}
252
249
  tableRef={tableRef}
253
250
  >
254
- {currentDefaultsContent?.map((defaultContent: IHeader | IFooter) => {
251
+ {currentDefaultsContent?.map((defaultContent) => {
255
252
  const isItemSelected = isSelected(defaultContent.id);
256
253
  return (
257
254
  <DefaultItem
@@ -315,7 +312,7 @@ interface IDefaultsProps {
315
312
  lang: { locale: string; id: number | null };
316
313
  siteLanguages: ILanguage[];
317
314
  selectedDefault: string;
318
- currentDefaultsContent: (IHeader | IFooter)[];
315
+ currentDefaultsContent: INavigation[];
319
316
  totalItems: number;
320
317
  currentSiteInfo: ISite | null;
321
318
  }
@@ -1,4 +1,4 @@
1
- import React, { Dispatch, SetStateAction } from "react";
1
+ import { Dispatch, SetStateAction } from "react";
2
2
 
3
3
  import { Button, Modal } from "@ax/components";
4
4
  import { useModal } from "@ax/hooks";
@@ -3,7 +3,7 @@ import styled from "styled-components";
3
3
  const Wrapper = styled.div`
4
4
  border-top: 1px solid ${(p) => p.theme.color.uiLine};
5
5
  margin: ${(p) => p.theme.spacing.m} 0;
6
- padding: ${(p) => p.theme.spacing.m} 0;
6
+ padding-top: ${(p) => p.theme.spacing.m};
7
7
  `;
8
8
 
9
9
  const Heading = styled.div`
@@ -15,7 +15,6 @@ const Heading = styled.div`
15
15
  const Text = styled.div`
16
16
  ${(p) => p.theme.textStyle.uiM};
17
17
  color: ${(p) => p.theme.color.textMediumEmphasis};
18
- width: calc(${(p) => p.theme.spacing.l} * 12);
19
18
  `;
20
19
 
21
20
  const Separator = styled.div`