@griddo/ax 1.75.91 → 1.75.93

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 (57) hide show
  1. package/package.json +2 -2
  2. package/src/__mocks__/store/SitesList.ts +24 -0
  3. package/src/__tests__/components/Avatar/__snapshots__/Avatar.test.tsx.snap +10 -10
  4. package/src/__tests__/modules/Sites/Sites.test.tsx +3 -0
  5. package/src/__tests__/modules/Sites/SitesList/SitesList.test.tsx +8 -1
  6. package/src/components/ErrorCenter/index.tsx +10 -1
  7. package/src/components/Fields/ComponentContainer/index.tsx +1 -1
  8. package/src/components/Gallery/GalleryPanel/GalleryDragAndDrop/index.tsx +34 -19
  9. package/src/components/Gallery/GalleryPanel/GalleryDragAndDrop/style.tsx +5 -0
  10. package/src/components/Notification/style.tsx +2 -2
  11. package/src/components/Tooltip/style.tsx +1 -1
  12. package/src/containers/App/actions.tsx +2 -0
  13. package/src/containers/Gallery/actions.tsx +19 -10
  14. package/src/containers/PageEditor/actions.tsx +19 -22
  15. package/src/containers/PageEditor/utils.tsx +5 -5
  16. package/src/containers/Sites/actions.tsx +35 -8
  17. package/src/containers/Sites/constants.tsx +1 -0
  18. package/src/containers/Sites/interfaces.tsx +8 -2
  19. package/src/containers/Sites/reducer.tsx +18 -1
  20. package/src/containers/Users/actions.tsx +23 -2
  21. package/src/forms/validators.tsx +1 -3
  22. package/src/helpers/requests.tsx +1 -1
  23. package/src/hooks/bulk.tsx +2 -1
  24. package/src/hooks/content.tsx +27 -2
  25. package/src/hooks/index.tsx +4 -1
  26. package/src/hooks/window.ts +16 -0
  27. package/src/modules/App/Routing/NavMenu/index.tsx +3 -2
  28. package/src/modules/App/Routing/NavMenu/style.tsx +2 -2
  29. package/src/modules/Content/PageItem/index.tsx +18 -10
  30. package/src/modules/Content/PageItem/style.tsx +26 -4
  31. package/src/modules/Content/index.tsx +41 -5
  32. package/src/modules/Content/utils.tsx +5 -2
  33. package/src/modules/CreatePass/index.tsx +8 -11
  34. package/src/modules/FramePreview/index.tsx +2 -6
  35. package/src/modules/GlobalEditor/PageBrowser/index.tsx +2 -4
  36. package/src/modules/GlobalEditor/index.tsx +13 -15
  37. package/src/modules/PageEditor/Editor/index.tsx +1 -3
  38. package/src/modules/PageEditor/PageBrowser/index.tsx +2 -6
  39. package/src/modules/PageEditor/index.tsx +23 -20
  40. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/ConfigPanel/Field/index.tsx +1 -1
  41. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/TemplateBrowser/index.tsx +3 -3
  42. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/index.tsx +17 -10
  43. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/index.tsx +23 -25
  44. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/style.tsx +3 -3
  45. package/src/modules/Sites/SitesList/GridView/GridHeaderFilter/index.tsx +2 -2
  46. package/src/modules/Sites/SitesList/GridView/GridSiteItem/index.tsx +1 -1
  47. package/src/modules/Sites/SitesList/atoms.tsx +1 -1
  48. package/src/modules/Sites/SitesList/hooks.tsx +3 -4
  49. package/src/modules/Sites/SitesList/index.tsx +47 -19
  50. package/src/modules/Sites/SitesList/style.tsx +7 -1
  51. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +11 -6
  52. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/style.tsx +10 -1
  53. package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +1 -1
  54. package/src/modules/StructuredData/StructuredDataList/index.tsx +25 -1
  55. package/src/modules/StructuredData/StructuredDataList/utils.tsx +5 -3
  56. package/src/modules/Users/UserCreate/index.tsx +4 -1
  57. package/src/types/index.tsx +21 -2
@@ -33,7 +33,7 @@ const GlobalEditor = (props: IProps) => {
33
33
  errors,
34
34
  setSelectedContent,
35
35
  setTab,
36
- pageEditor: { editorContent },
36
+ editorContent,
37
37
  sitePageID,
38
38
  setHistoryPush,
39
39
  setCurrentPageID,
@@ -49,15 +49,15 @@ const GlobalEditor = (props: IProps) => {
49
49
  const [isReadOnly, setIsReadOnly] = useState(false);
50
50
  const [selectedTab, setSelectedTab] = useState("edit");
51
51
  const [notification, setNotification] = useState<INotification | null>(null);
52
- const { isDirty, setIsDirty, resetDirty } = useIsDirty(editorContent.editorContent, isNewTranslation);
52
+ const { isDirty, setIsDirty, resetDirty } = useIsDirty(editorContent, isNewTranslation);
53
53
  const [errorPagesChecked, setErrorPagesChecked] = useState(false);
54
54
  const browserRef = useRef<HTMLDivElement>(null);
55
55
 
56
56
  const isPublished = props.pageStatus === pageStatus.PUBLISHED || props.pageStatus === pageStatus.UPLOAD_PENDING;
57
57
  const isDraft = props.pageStatus === pageStatus.MODIFIED;
58
- const hasDraft = editorContent.editorContent && editorContent.editorContent.haveDraftPage;
59
- const isLivePageChanged = editorContent.editorContent && editorContent.editorContent.liveChanged;
60
- const structuredData = editorContent.editorContent ? editorContent.editorContent.structuredData : "";
58
+ const hasDraft = editorContent && editorContent.haveDraftPage;
59
+ const isLivePageChanged = editorContent && editorContent.liveChanged;
60
+ const structuredData = editorContent ? editorContent.structuredData : "";
61
61
 
62
62
  const errorNotificationText =
63
63
  "There are some errors on the page so you can not publish yet. Please review them in the error panel.";
@@ -68,9 +68,7 @@ const GlobalEditor = (props: IProps) => {
68
68
  useEffect(() => {
69
69
  const { pageID, getPage, setTab, setCurrentSiteInfo, sendPagePing, setStructuredDataFilter } = props;
70
70
  setCurrentSiteInfo(null);
71
- editorContent.editorContent &&
72
- editorContent.editorContent.structuredData &&
73
- setStructuredDataFilter(editorContent.editorContent.structuredData);
71
+ editorContent && editorContent.structuredData && setStructuredDataFilter(editorContent.structuredData);
74
72
  const defaultTab = "content";
75
73
  const handleGetPage = async () => await getPage(pageID, true);
76
74
  setTab(defaultTab);
@@ -105,8 +103,8 @@ const GlobalEditor = (props: IProps) => {
105
103
  }, [userEditing]);
106
104
 
107
105
  useEffect(() => {
108
- if (!errorPagesChecked && !isLoading && editorContent.editorContent) {
109
- const pageId = editorContent.editorContent.id;
106
+ if (!errorPagesChecked && !isLoading && editorContent) {
107
+ const pageId = editorContent.id;
110
108
  const hasErrors = currentSiteErrorPages.some((errorPageId) => pageId === errorPageId);
111
109
  hasErrors && reviewPage();
112
110
  setErrorPagesChecked(true);
@@ -297,7 +295,7 @@ const GlobalEditor = (props: IProps) => {
297
295
  ],
298
296
  };
299
297
 
300
- const isEditable = editorContent.editorContent && editorContent.editorContent.editable;
298
+ const isEditable = editorContent && editorContent.editable;
301
299
 
302
300
  const handleSavePage = async () => {
303
301
  const { savePage } = props;
@@ -346,7 +344,7 @@ const GlobalEditor = (props: IProps) => {
346
344
  };
347
345
 
348
346
  const goToLivePage = () => {
349
- const currentPageUrl = editorContent.editorContent.fullUrl;
347
+ const currentPageUrl = editorContent.fullUrl;
350
348
  if (currentPageUrl) {
351
349
  window.open(currentPageUrl, "_blank");
352
350
  }
@@ -355,7 +353,7 @@ const GlobalEditor = (props: IProps) => {
355
353
  const toggleDraftPage = async () => {
356
354
  const { getPage } = props;
357
355
  resetDirty();
358
- const pageID = isDraft ? editorContent.editorContent.draftFromPage : editorContent.editorContent.haveDraftPage;
356
+ const pageID = isDraft ? editorContent.draftFromPage : editorContent.haveDraftPage;
359
357
  await getPage(pageID);
360
358
  };
361
359
 
@@ -533,7 +531,7 @@ const mapStateToProps = (state: IRootState): IPageEditorStateProps => ({
533
531
  lang: state.app.lang,
534
532
  globalLangs: state.app.globalLangs,
535
533
  pageLanguages: state.pageEditor.currentPageLanguages,
536
- pageEditor: state.pageEditor,
534
+ editorContent: state.pageEditor.editorContent,
537
535
  errors: state.pageEditor.errors,
538
536
  sitePageID: state.pageEditor.sitePageID,
539
537
  savedSiteInfo: state.sites.savedSiteInfo,
@@ -553,7 +551,7 @@ interface IPageEditorStateProps {
553
551
  lang: { locale: string; id: number | null };
554
552
  globalLangs: any[];
555
553
  pageLanguages: any[];
556
- pageEditor: any;
554
+ editorContent: any;
557
555
  errors: IErrorItem[];
558
556
  sitePageID: number | null;
559
557
  savedSiteInfo: any;
@@ -44,9 +44,7 @@ const Editor = (props: IProps) => {
44
44
  content,
45
45
  } = props;
46
46
 
47
- const {
48
- editorContent: { header, footer },
49
- } = content;
47
+ const { header, footer } = content;
50
48
 
51
49
  const actions = {
52
50
  deleteModuleAction: deleteModule,
@@ -9,11 +9,7 @@ const PageBrowser = (props: IProps) => {
9
9
  const {
10
10
  socials,
11
11
  cloudinaryName,
12
- content: {
13
- editorContent: { path, slug },
14
- header,
15
- footer,
16
- },
12
+ content: { header, footer, path, slug },
17
13
  setSelectedContent,
18
14
  currentSiteInfo: { theme, id: siteID },
19
15
  siteLangs,
@@ -39,7 +35,7 @@ const PageBrowser = (props: IProps) => {
39
35
  return (
40
36
  <Browser
41
37
  isPage={true}
42
- content={props.content.editorContent}
38
+ content={props.content}
43
39
  header={header}
44
40
  footer={footer}
45
41
  socials={socials}
@@ -40,7 +40,8 @@ const PageEditor = (props: IProps) => {
40
40
  errors,
41
41
  setSelectedContent,
42
42
  setTab,
43
- pageEditor: { editorContent, schema },
43
+ editorContent,
44
+ schema,
44
45
  userEditing,
45
46
  isNewTranslation,
46
47
  currentSiteErrorPages,
@@ -50,21 +51,21 @@ const PageEditor = (props: IProps) => {
50
51
  const [isReadOnly, setIsReadOnly] = useState(false);
51
52
  const [selectedTab, setSelectedTab] = useState("edit");
52
53
  const [notification, setNotification] = useState<INotification | null>(null);
53
- const { isDirty, setIsDirty, resetDirty } = useIsDirty(editorContent.editorContent, isNewTranslation);
54
+ const { isDirty, setIsDirty, resetDirty } = useIsDirty(editorContent, isNewTranslation);
54
55
  const { isOpen, toggleModal } = useModal();
55
56
  const { isOpen: isUnpublishOpen, toggleModal: toggleUnpublishModal } = useModal();
56
57
  const { isOpen: isDeleteOpen, toggleModal: toggleDeleteModal } = useModal();
57
58
  const [errorPagesChecked, setErrorPagesChecked] = useState(false);
58
59
  const browserRef = useRef<HTMLDivElement>(null);
59
60
 
60
- const isGlobal = editorContent.editorContent && editorContent.editorContent.origin === "GLOBAL";
61
- const isEditable = editorContent.editorContent && editorContent.editorContent.editable;
61
+ const isGlobal = editorContent && editorContent.origin === "GLOBAL";
62
+ const isEditable = editorContent && editorContent.editable;
62
63
  const isPublished = props.pageStatus === pageStatus.PUBLISHED || props.pageStatus === pageStatus.UPLOAD_PENDING;
63
64
  const isDraft = props.pageStatus === pageStatus.MODIFIED;
64
- const hasDraft = editorContent.editorContent && editorContent.editorContent.haveDraftPage;
65
- const isLivePageChanged = editorContent.editorContent && editorContent.editorContent.liveChanged;
65
+ const hasDraft = editorContent && editorContent.haveDraftPage;
66
+ const isLivePageChanged = editorContent && editorContent.liveChanged;
66
67
  const isTranslated = pageLanguages.length > 1;
67
- const structuredData = editorContent.editorContent ? editorContent.editorContent.structuredData : "";
68
+ const structuredData = editorContent ? editorContent.structuredData : "";
68
69
 
69
70
  const errorNotificationText =
70
71
  "There are some errors on the page so you can not publish yet. Please review them in the error panel.";
@@ -108,8 +109,8 @@ const PageEditor = (props: IProps) => {
108
109
  }, [lang]);
109
110
 
110
111
  useEffect(() => {
111
- if (!errorPagesChecked && !isLoading && editorContent.editorContent) {
112
- const pageId = editorContent.editorContent.id;
112
+ if (!errorPagesChecked && !isLoading && editorContent) {
113
+ const pageId = editorContent.id;
113
114
  const hasErrors = currentSiteErrorPages.some((errorPageId) => pageId === errorPageId);
114
115
  hasErrors && reviewPage();
115
116
  setErrorPagesChecked(true);
@@ -323,10 +324,10 @@ const PageEditor = (props: IProps) => {
323
324
 
324
325
  const goToPages = (path: string) => setRoute(path);
325
326
 
326
- const goToError = (editorID: number | null, tab: string, template: boolean) => {
327
+ const goToError = async (editorID: number | null, tab: string, template: boolean) => {
327
328
  const realEditorID = template ? 0 : editorID;
328
329
  if (realEditorID !== null) {
329
- setSelectedContent(realEditorID);
330
+ await setSelectedContent(realEditorID);
330
331
  setTab(tab);
331
332
  }
332
333
  };
@@ -340,8 +341,8 @@ const PageEditor = (props: IProps) => {
340
341
  let isTemplateActivated = true;
341
342
  let hasDeactivatedModules = false;
342
343
  let deactivatedModules: string[] = [];
343
- if (editorContent.editorContent && editorContent.editorContent.template) {
344
- const editorTemplate = editorContent.editorContent.template;
344
+ if (editorContent && editorContent.template) {
345
+ const editorTemplate = editorContent.template;
345
346
  const mainContentModules = editorTemplate?.mainContent?.modules;
346
347
 
347
348
  if (mainContentModules) {
@@ -389,7 +390,7 @@ const PageEditor = (props: IProps) => {
389
390
  };
390
391
 
391
392
  const goToLivePage = () => {
392
- const currentPageUrl = editorContent.editorContent.fullUrl;
393
+ const currentPageUrl = editorContent.fullUrl;
393
394
  if (currentPageUrl) {
394
395
  window.open(currentPageUrl, "_blank");
395
396
  }
@@ -398,7 +399,7 @@ const PageEditor = (props: IProps) => {
398
399
  const toggleDraftPage = async () => {
399
400
  const { getPage } = props;
400
401
  resetDirty();
401
- const pageID = isDraft ? editorContent.editorContent.draftFromPage : editorContent.editorContent.haveDraftPage;
402
+ const pageID = isDraft ? editorContent.draftFromPage : editorContent.haveDraftPage;
402
403
  await getPage(pageID);
403
404
  };
404
405
 
@@ -429,8 +430,8 @@ const PageEditor = (props: IProps) => {
429
430
  "This content is part of disabled content type package. To edit it, you must first activate it.";
430
431
 
431
432
  const handleClickNotification = () => {
432
- if (editorContent.editorContent && editorContent.editorContent.template) {
433
- const editorTemplate = editorContent.editorContent.template;
433
+ if (editorContent && editorContent.template) {
434
+ const editorTemplate = editorContent.template;
434
435
  if (!isTemplateActivated) {
435
436
  getSiteDataPackbyTemplate(editorTemplate.templateType);
436
437
  } else if (hasDeactivatedModules) {
@@ -596,7 +597,8 @@ const mapStateToProps = (state: IRootState): IPageEditorStateProps => ({
596
597
  lang: state.app.lang,
597
598
  siteLanguages: state.sites.currentSiteLanguages,
598
599
  pageLanguages: state.pageEditor.currentPageLanguages,
599
- pageEditor: state.pageEditor,
600
+ editorContent: state.pageEditor.editorContent,
601
+ schema: state.pageEditor.schema,
600
602
  activatedTemplates: state.dataPacks.templates,
601
603
  activatedModules: state.dataPacks.modules,
602
604
  errors: state.pageEditor.errors,
@@ -617,7 +619,7 @@ interface IPageEditorStateProps {
617
619
  lang: { locale: string; id: number | null };
618
620
  siteLanguages: any[];
619
621
  pageLanguages: any[];
620
- pageEditor: any;
622
+ editorContent: any;
621
623
  activatedTemplates: any[];
622
624
  activatedModules: string[];
623
625
  errors: IErrorItem[];
@@ -626,6 +628,7 @@ interface IPageEditorStateProps {
626
628
  isNewTranslation: boolean;
627
629
  currentSiteErrorPages: number[];
628
630
  skipReviewOnPublish?: boolean;
631
+ schema: any;
629
632
  }
630
633
 
631
634
  const mapDispatchToProps = {
@@ -662,7 +665,7 @@ interface IPageEditorDispatchProps {
662
665
  getSiteDataPackbyTemplate(templateType: string): void;
663
666
  getSiteDataPackbyModule(module: string): void;
664
667
  getDefaults(): void;
665
- setSelectedContent(editorID: number): void;
668
+ setSelectedContent(editorID: number): Promise<void>;
666
669
  sendPagePing(pageID: number): Promise<boolean>;
667
670
  discardDraft(): Promise<void>;
668
671
  deleteBulk(ids: number[]): Promise<boolean>;
@@ -48,7 +48,7 @@ const Field = (props: IField): JSX.Element => {
48
48
  },
49
49
  };
50
50
  updateDataPackFormValue(configFormData);
51
- updateEditorContent(pageEditorID, type, option.id);
51
+ updateEditorContent(pageEditorID, type, option.id ? option : null);
52
52
  toggleModal();
53
53
  };
54
54
 
@@ -8,18 +8,18 @@ const TemplateBrowser = (props: IProps) => {
8
8
  const {
9
9
  socials,
10
10
  cloudinaryName,
11
- content: { editorContent, header, footer },
11
+ content,
12
12
  currentSiteInfo: { theme, id: siteID },
13
13
  siteLangs,
14
14
  } = props;
15
15
 
16
- const updatedContent = { ...editorContent };
16
+ const { header, footer } = content;
17
17
 
18
18
  return (
19
19
  <Browser
20
20
  isPage={true}
21
21
  socials={socials}
22
- content={updatedContent}
22
+ content={content}
23
23
  url=""
24
24
  theme={theme}
25
25
  cloudinaryName={cloudinaryName}
@@ -4,11 +4,12 @@ import { connect } from "react-redux";
4
4
  import { ITemplate } from "@ax/types";
5
5
  import { appActions } from "@ax/containers/App";
6
6
  import { pageEditorActions } from "@ax/containers/PageEditor";
7
+ import { getTemplateThumbnails } from "@ax/helpers";
7
8
 
8
9
  import * as S from "./style";
9
10
 
10
11
  const TemplateConfig = (props: IProps): React.ReactElement => {
11
- const { setHistoryPush, templates, getTemplatePage } = props;
12
+ const { setHistoryPush, templates, getTemplatePage, currentSite } = props;
12
13
 
13
14
  const goToEditor = async (template: ITemplate) => {
14
15
  await getTemplatePage(template.id);
@@ -19,22 +20,28 @@ const TemplateConfig = (props: IProps): React.ReactElement => {
19
20
  <>
20
21
  <S.Heading>Template configuration</S.Heading>
21
22
  <S.Text>
22
- {"You can set custom settings in these templates and will be shown by default. However, they can be modified on the page's editor."}
23
+ {
24
+ "You can set custom settings in these templates and will be shown by default. However, they can be modified on the page's editor."
25
+ }
23
26
  </S.Text>
24
27
  <S.TemplatesWrapper>
25
28
  {templates &&
26
- templates.map((template: ITemplate, key: number) => (
27
- <S.TemplateCard key={`${key}${template.title}`} onClick={() => goToEditor(template)}>
28
- {template.thumbnails && <S.TemplateThumbnail backgroundUrl={template.thumbnails["2x"]} />}
29
- <S.TemplateCardTitle>{template.title}</S.TemplateCardTitle>
30
- </S.TemplateCard>
31
- ))}
29
+ templates.map((template: ITemplate, key: number) => {
30
+ const thumbnails = getTemplateThumbnails(template.id, currentSite.theme);
31
+ return (
32
+ <S.TemplateCard key={`${key}${template.title}`} onClick={() => goToEditor(template)}>
33
+ {template.thumbnails && <S.TemplateThumbnail backgroundUrl={thumbnails && thumbnails["2x"]} />}
34
+ <S.TemplateCardTitle>{template.title}</S.TemplateCardTitle>
35
+ </S.TemplateCard>
36
+ );
37
+ })}
32
38
  </S.TemplatesWrapper>
33
39
  </>
34
- )
35
- }
40
+ );
41
+ };
36
42
 
37
43
  interface IProps {
44
+ currentSite: any;
38
45
  templates: ITemplate[];
39
46
  setHistoryPush(path: string, isEditor?: boolean): void;
40
47
  getTemplatePage: (template: string) => Promise<void>;
@@ -105,30 +105,28 @@ const Form = (props: IProps): JSX.Element => {
105
105
  updateFormValue({ import: filteredNewCategories });
106
106
  };
107
107
 
108
- const getCategoryLabels = () => {
109
- return (
110
- <S.CategoriesWrapper>
111
- {configFormData &&
112
- configFormData.import &&
113
- configFormData.import.map((data: IDataPackConfigImport) => {
114
- return (
115
- data.categories &&
116
- data.categories.map((category: IDataPackConfigImportCategory) => {
117
- const categoryText = getCategoryText(category.structuredData);
118
- const handleDeleteTag = () => deleteTag(category.id);
119
- return (
120
- <Tag
121
- key={`${categoryText}-${category.title}`}
122
- text={`${categoryText}: ${category.title}`}
123
- onDeleteAction={handleDeleteTag}
124
- />
125
- );
126
- })
127
- );
128
- })}
129
- </S.CategoriesWrapper>
130
- );
131
- };
108
+ const getCategoryLabels = () => (
109
+ <S.CategoriesWrapper isEmpty={!Object.keys(selectedCategories).length}>
110
+ {configFormData &&
111
+ configFormData.import &&
112
+ configFormData.import.map((data: IDataPackConfigImport) => {
113
+ return (
114
+ data.categories &&
115
+ data.categories.map((category: IDataPackConfigImportCategory) => {
116
+ const categoryText = getCategoryText(category.structuredData);
117
+ const handleDeleteTag = () => deleteTag(category.id);
118
+ return (
119
+ <Tag
120
+ key={`${categoryText}-${category.title}`}
121
+ text={`${categoryText}: ${category.title}`}
122
+ onDeleteAction={handleDeleteTag}
123
+ />
124
+ );
125
+ })
126
+ );
127
+ })}
128
+ </S.CategoriesWrapper>
129
+ );
132
130
 
133
131
  const isGlobalDataPage = structuredData[0] && structuredData[0].fromPage && !structuredData[0].local;
134
132
 
@@ -178,7 +176,7 @@ const Form = (props: IProps): JSX.Element => {
178
176
  onChange={setIndexDefault}
179
177
  />
180
178
  </S.SectionContent>
181
- <TemplateConfig templates={templates} />
179
+ <TemplateConfig templates={templates} currentSite={currentSite}/>
182
180
  </S.Config>
183
181
  <Modal
184
182
  isOpen={isOpen}
@@ -30,11 +30,11 @@ const Text = styled.div`
30
30
  ${(p) => p.theme.textStyle.uiM};
31
31
  color: ${(p) => p.theme.color.textMediumEmphasis};
32
32
  width: calc(${(p) => p.theme.spacing.l} * 12);
33
+ padding-bottom: ${(p) => p.theme.spacing.m};
33
34
  `;
34
35
 
35
- const CategoriesWrapper = styled.div`
36
- margin-top: ${(p) => p.theme.spacing.m};
37
- padding-bottom: ${(p) => p.theme.spacing.m};
36
+ const CategoriesWrapper = styled.div<{isEmpty: boolean}>`
37
+ padding-bottom: ${(p) => p.isEmpty ? 0 : p.theme.spacing.m};
38
38
  `;
39
39
 
40
40
  const StyledButton = styled(Button)`
@@ -54,10 +54,10 @@ const GridHeaderFilter = ({ sortItems, sortedState }: IGridHeaderFilterProps): J
54
54
  Oldest
55
55
  </ListItem>
56
56
  <ListTitle>Sort by creation</ListTitle>
57
- <ListItem isSelected={sortedByDateCreated && isAscending} onClick={sortAscendingDateCreated}>
57
+ <ListItem isSelected={sortedByDateCreated && !isAscending} onClick={sortDescendingDateCreated}>
58
58
  Newest
59
59
  </ListItem>
60
- <ListItem isSelected={sortedByDateCreated && !isAscending} onClick={sortDescendingDateCreated}>
60
+ <ListItem isSelected={sortedByDateCreated && isAscending} onClick={sortAscendingDateCreated}>
61
61
  Oldest
62
62
  </ListItem>
63
63
  </FloatingMenu>
@@ -117,7 +117,7 @@ const GridSiteItem = (props: IGridSiteItemProps): JSX.Element => {
117
117
  return (
118
118
  <>
119
119
  <S.SiteWrapper key={site.id} onClick={setSite} data-testid="grid-site-item">
120
- <Tooltip content={siteTooltip}>
120
+ <Tooltip content={siteTooltip} >
121
121
  <ItemThumbnail src={site.thumbnail} width={280} height={199} />
122
122
  </Tooltip>
123
123
  <S.Wrapper>
@@ -9,7 +9,7 @@ export const ItemName = (props: IItemNameProps): JSX.Element => {
9
9
  const { name, length } = props;
10
10
  return name.length > length ? (
11
11
  <Tooltip content={name} left={120}>
12
- <S.ItemName data-testid="trimmed-item-name">{trimText(name, 36)}</S.ItemName>
12
+ <S.ItemName data-testid="trimmed-item-name">{trimText(name, length)}</S.ItemName>
13
13
  </Tooltip>
14
14
  ) : (
15
15
  <S.ItemName data-testid="sites-item-name">{name}</S.ItemName>
@@ -22,10 +22,10 @@ const useSortedListStatus = () => {
22
22
  };
23
23
  };
24
24
 
25
- const useFilterQuery = (): ISitesFilterQuery => {
25
+ const useFilterQuery = (defaultValues?: { order: string; liveStatus: string }): ISitesFilterQuery => {
26
26
  const initialQueryValues = {
27
- order: "lastAccess-desc",
28
- liveStatus: "all",
27
+ order: defaultValues ? defaultValues.order : "lastAccess-desc",
28
+ liveStatus: defaultValues ? defaultValues.liveStatus : "all",
29
29
  };
30
30
 
31
31
  const [query, setQuery] = useState(initialQueryValues);
@@ -57,7 +57,6 @@ const useFilterQuery = (): ISitesFilterQuery => {
57
57
 
58
58
  const setFiltersSelection = (pointer: string, filter: string, orderMethod?: string) => {
59
59
  const { order, liveStatus } = query;
60
-
61
60
  const liveStatusValue: any = {
62
61
  all: "all",
63
62
  active: "online",