@griddo/ax 12.1.0 → 12.2.0-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 (40) hide show
  1. package/package.json +2 -2
  2. package/src/__tests__/components/ContextMenu/ContextMenu.test.tsx +381 -0
  3. package/src/__tests__/components/FloatingMenu/FloatingMenu.test.tsx +3 -3
  4. package/src/__tests__/components/FloatingPanel/FloatingPanel.test.tsx +2 -2
  5. package/src/__tests__/components/SideModal/SideModal.test.tsx +2 -2
  6. package/src/__tests__/hooks/modals.test.tsx +86 -1
  7. package/src/components/ActionMenu/index.tsx +26 -11
  8. package/src/components/ActionMenu/style.tsx +15 -8
  9. package/src/components/ContextMenu/index.tsx +102 -0
  10. package/src/components/ContextMenu/style.tsx +15 -0
  11. package/src/components/Fields/ComponentContainer/index.tsx +9 -2
  12. package/src/components/FloatingMenu/index.tsx +1 -1
  13. package/src/components/FloatingMenu/style.tsx +1 -1
  14. package/src/components/index.tsx +4 -1
  15. package/src/hooks/index.tsx +2 -1
  16. package/src/hooks/modals.tsx +51 -4
  17. package/src/modules/Analytics/DimensionItem/index.tsx +5 -3
  18. package/src/modules/Analytics/GroupItem/index.tsx +5 -3
  19. package/src/modules/Categories/CategoriesList/CategoryItem/index.tsx +5 -2
  20. package/src/modules/Content/PageItem/index.tsx +15 -3
  21. package/src/modules/FileDrive/FolderItem/index.tsx +5 -3
  22. package/src/modules/FileDrive/GridItem/index.tsx +5 -3
  23. package/src/modules/FileDrive/ListItem/index.tsx +5 -3
  24. package/src/modules/Forms/FormCategoriesList/CategoryItem/index.tsx +5 -2
  25. package/src/modules/Forms/FormList/FormItem/index.tsx +5 -2
  26. package/src/modules/MediaGallery/FolderItem/index.tsx +5 -3
  27. package/src/modules/MediaGallery/GridItem/index.tsx +5 -3
  28. package/src/modules/MediaGallery/ListItem/index.tsx +5 -3
  29. package/src/modules/Navigation/Defaults/Item/index.tsx +5 -3
  30. package/src/modules/Navigation/Menus/List/Table/Item/index.tsx +5 -2
  31. package/src/modules/Redirects/RedirectItem/index.tsx +5 -3
  32. package/src/modules/Settings/Integrations/IntegrationForm/VariableItem/index.tsx +5 -3
  33. package/src/modules/Settings/Integrations/IntegrationItem/CopyModal/index.tsx +1 -0
  34. package/src/modules/Settings/Integrations/IntegrationItem/index.tsx +5 -3
  35. package/src/modules/Settings/Languages/Table/Item/index.tsx +5 -3
  36. package/src/modules/Sites/SitesList/GridView/GridSiteItem/index.tsx +5 -2
  37. package/src/modules/Sites/SitesList/ListView/ListSiteItem/index.tsx +5 -2
  38. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +5 -2
  39. package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +5 -3
  40. package/src/modules/Users/UserList/UserItem/index.tsx +5 -3
@@ -1,8 +1,8 @@
1
1
  import type React from "react";
2
2
  import { useState } from "react";
3
3
 
4
- import { Icon } from "@ax/components";
5
- import { useModals } from "@ax/hooks";
4
+ import { ContextMenu, Icon } from "@ax/components";
5
+ import { useContextMenu, useModals } from "@ax/hooks";
6
6
  import type { IActionMenuOption, ICheck, IImage } from "@ax/types";
7
7
 
8
8
  import { DeleteFileModal, MoveItemModal } from "../atoms";
@@ -28,6 +28,7 @@ const GridItem = (props: IProps) => {
28
28
 
29
29
  const [selectedFolder, setSelectedFolder] = useState<number | null>(currentFolderID || null);
30
30
  const { isOpen, toggleModal } = useModals(["delete", "move"]);
31
+ const { contextMenu, handleContextMenu, closeContextMenu } = useContextMenu();
31
32
 
32
33
  const handleCheckClick = (isChecked: boolean) => (e: React.MouseEvent<HTMLDivElement>) => {
33
34
  e.stopPropagation();
@@ -90,7 +91,7 @@ const GridItem = (props: IProps) => {
90
91
 
91
92
  return (
92
93
  <>
93
- <S.ImageWrapper data-testid="image-item" onClick={handleClick} selected={isSelected}>
94
+ <S.ImageWrapper data-testid="image-item" onClick={handleClick} onContextMenu={handleContextMenu} selected={isSelected}>
94
95
  <img src={thumb} alt={alt} />
95
96
  <S.IconWrapper onClick={handleCheckClick(!isSelected)}>
96
97
  <Icon name={isSelected ? "successSolid" : "emptyCheck"} size="24" />
@@ -117,6 +118,7 @@ const GridItem = (props: IProps) => {
117
118
  isMoving={isSaving}
118
119
  />
119
120
  )}
121
+ <ContextMenu position={contextMenu} options={menuOptions} onClose={closeContextMenu} />
120
122
  </>
121
123
  );
122
124
  };
@@ -1,8 +1,8 @@
1
1
  import { useState } from "react";
2
2
 
3
- import { CheckField, ElementsTooltip, Tooltip } from "@ax/components";
3
+ import { CheckField, ContextMenu, ElementsTooltip, Tooltip } from "@ax/components";
4
4
  import { formatBytes, getFileExtension, trimText } from "@ax/helpers";
5
- import { useModals } from "@ax/hooks";
5
+ import { useContextMenu, useModals } from "@ax/hooks";
6
6
  import type { IActionMenuOption, ICheck, IImage } from "@ax/types";
7
7
 
8
8
  import { DeleteFileModal, MoveItemModal } from "../atoms";
@@ -29,6 +29,7 @@ const ListItem = (props: IProps) => {
29
29
 
30
30
  const [selectedFolder, setSelectedFolder] = useState<number | null>(currentFolderID || null);
31
31
  const { isOpen, toggleModal } = useModals(["delete", "move"]);
32
+ const { contextMenu, handleContextMenu, closeContextMenu } = useContextMenu();
32
33
 
33
34
  const handleChange = (value: ICheck) => onChange(value);
34
35
  const handleClick = () => onClick(image);
@@ -89,7 +90,7 @@ const ListItem = (props: IProps) => {
89
90
 
90
91
  return (
91
92
  <>
92
- <S.ItemRow role="rowgroup" selected={isSelected}>
93
+ <S.ItemRow role="rowgroup" selected={isSelected} onContextMenu={handleContextMenu}>
93
94
  <S.CheckCell role="cell">
94
95
  <CheckField name="check" value={id} checked={isSelected || hoverCheck} onChange={handleChange} />
95
96
  </S.CheckCell>
@@ -147,6 +148,7 @@ const ListItem = (props: IProps) => {
147
148
  isMoving={isSaving}
148
149
  />
149
150
  )}
151
+ <ContextMenu position={contextMenu} options={menuOptions} onClose={closeContextMenu} />
150
152
  </>
151
153
  );
152
154
  };
@@ -1,9 +1,9 @@
1
1
  import { connect } from "react-redux";
2
2
 
3
- import { CheckField } from "@ax/components";
3
+ import { CheckField, ContextMenu } from "@ax/components";
4
4
  import { appActions } from "@ax/containers/App";
5
5
  import { menuActions, navigationActions } from "@ax/containers/Navigation";
6
- import { useModals, usePermissions } from "@ax/hooks";
6
+ import { useContextMenu, useModals, usePermissions } from "@ax/hooks";
7
7
  import type { ICheck, ILanguage, INavigation, INavigationLanguage, IRootState } from "@ax/types";
8
8
 
9
9
  import { DeleteModal, RenameModal, SetDefaultModal } from "../atoms";
@@ -36,6 +36,7 @@ const DefaultItem = (props: IProps): JSX.Element => {
36
36
  } = props;
37
37
 
38
38
  const { isOpen, toggleModal } = useModals(["rename", "default", "delete"]);
39
+ const { contextMenu, handleContextMenu, closeContextMenu } = useContextMenu();
39
40
 
40
41
  const { locale } = lang;
41
42
  const { navigationLanguages, type } = defaultContent;
@@ -152,7 +153,7 @@ const DefaultItem = (props: IProps): JSX.Element => {
152
153
 
153
154
  return (
154
155
  <>
155
- <S.DefaultRow role="rowgroup" selected={isSelected} clickable={isAllowedToEdit}>
156
+ <S.DefaultRow role="rowgroup" selected={isSelected} onContextMenu={handleContextMenu} clickable={isAllowedToEdit}>
156
157
  <S.CheckCell role="cell">
157
158
  <CheckField
158
159
  name="check"
@@ -199,6 +200,7 @@ const DefaultItem = (props: IProps): JSX.Element => {
199
200
  onDelete={handleDeleteConfirm}
200
201
  isDeleting={isSaving}
201
202
  />
203
+ <ContextMenu position={contextMenu} options={menuOptions} onClose={closeContextMenu} />
202
204
  </>
203
205
  );
204
206
  };
@@ -2,9 +2,9 @@ import type React from "react";
2
2
  import { useState } from "react";
3
3
  import { connect } from "react-redux";
4
4
 
5
- import { Icon, IconAction, Tooltip } from "@ax/components";
5
+ import { ContextMenu, Icon, IconAction, Tooltip } from "@ax/components";
6
6
  import { menuActions } from "@ax/containers/Navigation";
7
- import { useModals, usePermission } from "@ax/hooks";
7
+ import { useContextMenu, useModals, usePermission } from "@ax/hooks";
8
8
  import type { IMenuItem } from "@ax/types";
9
9
 
10
10
  import { type AnimateLayoutChanges, useSortable } from "@dnd-kit/sortable";
@@ -45,6 +45,7 @@ const Item = (props: IItemProps): JSX.Element => {
45
45
 
46
46
  const { isOpen, toggleModal } = useModals(["sidePanel", "remove", "config"]);
47
47
  const [isOpenedSecond, setIsOpenedSecond] = useState(false);
48
+ const { contextMenu, handleContextMenu, closeContextMenu } = useContextMenu();
48
49
 
49
50
  const animateLayoutChanges: AnimateLayoutChanges = ({ isSorting, wasDragging }) => !(isSorting || wasDragging);
50
51
 
@@ -97,6 +98,7 @@ const Item = (props: IItemProps): JSX.Element => {
97
98
  >
98
99
  <S.Component
99
100
  onClick={openModal}
101
+ onContextMenu={handleContextMenu}
100
102
  isGroup={isGroupingElement}
101
103
  ref={setDraggableNodeRef}
102
104
  cssTransform={transform}
@@ -147,6 +149,7 @@ const Item = (props: IItemProps): JSX.Element => {
147
149
  {isOpen("config") && <ConfigPanel isOpen={isOpen("config")} toggleModal={() => toggleModal("config")} />}
148
150
  </S.Container>
149
151
  <RemoveModal isOpen={isOpen("remove")} toggleModal={() => toggleModal("remove")} deleteItem={deleteItem} item={item} />
152
+ <ContextMenu position={contextMenu} options={actionMenuOptions} onClose={closeContextMenu} />
150
153
  </>
151
154
  );
152
155
  };
@@ -1,9 +1,9 @@
1
1
  import { useState } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { CheckField, ElementsTooltip } from "@ax/components";
4
+ import { CheckField, ContextMenu, ElementsTooltip } from "@ax/components";
5
5
  import { redirectsActions } from "@ax/containers/Redirects";
6
- import { useModals } from "@ax/hooks";
6
+ import { useContextMenu, useModals } from "@ax/hooks";
7
7
  import type { ICheck, IRedirect, IRootState } from "@ax/types";
8
8
 
9
9
  import { format } from "date-fns";
@@ -30,6 +30,7 @@ const RedirectItem = (props: IRedirectItemProps): JSX.Element => {
30
30
  } = props;
31
31
 
32
32
  const { isOpen, toggleModal } = useModals(["edit", "delete"]);
33
+ const { contextMenu, handleContextMenu, closeContextMenu } = useContextMenu();
33
34
  const [isOpenedSecond, setIsOpenedSecond] = useState(false);
34
35
 
35
36
  const toggleSecondaryPanel = () => setIsOpenedSecond(!isOpenedSecond);
@@ -84,7 +85,7 @@ const RedirectItem = (props: IRedirectItemProps): JSX.Element => {
84
85
 
85
86
  return (
86
87
  <>
87
- <S.ItemRow role="rowgroup" selected={isSelected}>
88
+ <S.ItemRow role="rowgroup" selected={isSelected} onContextMenu={handleContextMenu}>
88
89
  <S.CheckCell role="cell">
89
90
  <CheckField
90
91
  name="check"
@@ -131,6 +132,7 @@ const RedirectItem = (props: IRedirectItemProps): JSX.Element => {
131
132
  onDelete={removeItem}
132
133
  isDeleting={isSaving}
133
134
  />
135
+ <ContextMenu position={contextMenu} options={menuOptions} onClose={closeContextMenu} />
134
136
  </>
135
137
  );
136
138
  };
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
 
3
- import { useModal } from "@ax/hooks";
4
- import { Modal, Tooltip } from "@ax/components";
3
+ import { useModal, useContextMenu } from "@ax/hooks";
4
+ import { Modal, Tooltip, ContextMenu } from "@ax/components";
5
5
  import { IIntegrationVariable, ILanguage, IVariableLang } from "@ax/types";
6
6
  import { trimText } from "@ax/helpers";
7
7
  import VariablePanel from "../VariablePanel";
@@ -13,6 +13,7 @@ const VariableItem = (props: IProps): JSX.Element => {
13
13
 
14
14
  const { isOpen, toggleModal } = useModal();
15
15
  const { isOpen: isRemoveOpen, toggleModal: toggleRemoveModal } = useModal();
16
+ const { contextMenu, handleContextMenu, closeContextMenu } = useContextMenu();
16
17
 
17
18
  const handleClick = () => toggleModal();
18
19
 
@@ -58,7 +59,7 @@ const VariableItem = (props: IProps): JSX.Element => {
58
59
 
59
60
  return (
60
61
  <>
61
- <S.Component onClick={handleClick}>
62
+ <S.Component onClick={handleClick} onContextMenu={handleContextMenu}>
62
63
  <S.Name>{item.variableName}</S.Name>
63
64
  <VariableTitle />
64
65
  <S.StyledActionMenu icon="more" options={variableOptions} tooltip="Variable actions" />
@@ -81,6 +82,7 @@ const VariableItem = (props: IProps): JSX.Element => {
81
82
  </p>
82
83
  </S.ModalContent>
83
84
  </Modal>
85
+ <ContextMenu position={contextMenu} options={variableOptions} onClose={closeContextMenu} />
84
86
  </>
85
87
  );
86
88
  };
@@ -26,6 +26,7 @@ const CopyModal = (props: ICopyModalProps): JSX.Element => {
26
26
  mainAction={mainCopyModalAction}
27
27
  size="S"
28
28
  overflow="visible"
29
+ height="auto"
29
30
  >
30
31
  <S.ModalContent>
31
32
  <S.Title>Select a site to copy this add-on.</S.Title>
@@ -1,12 +1,11 @@
1
- import { useState } from "react";
2
1
  import { connect } from "react-redux";
3
2
  import { Link } from "react-router-dom";
4
3
 
5
4
  import { integrations } from "@ax/api";
6
- import { CheckField, Icon, Toast, ToggleField, Tooltip } from "@ax/components";
5
+ import { CheckField, ContextMenu, Icon, Toast, ToggleField, Tooltip } from "@ax/components";
7
6
  import { appActions } from "@ax/containers/App";
8
7
  import { integrationsActions } from "@ax/containers/Integrations";
9
- import { useModals, usePermissions, useToast } from "@ax/hooks";
8
+ import { useContextMenu, useModals, usePermissions, useToast } from "@ax/hooks";
10
9
  import type { ICheck, IIntegration, IRootState } from "@ax/types";
11
10
 
12
11
  import type { UniqueIdentifier } from "@dnd-kit/core";
@@ -32,6 +31,7 @@ const IntegrationItem = (props: IIntegrationItemProps): JSX.Element => {
32
31
  isSaving,
33
32
  } = props;
34
33
 
34
+ const { contextMenu, handleContextMenu, closeContextMenu } = useContextMenu();
35
35
  const { isOpen, toggleModal } = useModals(["delete", "changeState", "copy"]);
36
36
  const { isVisible: isVisibleCopy, toggleToast: toggleToastCopy, setIsVisible: setIsVisibleCopy } = useToast();
37
37
 
@@ -193,6 +193,7 @@ const IntegrationItem = (props: IIntegrationItemProps): JSX.Element => {
193
193
  data-testid="integration-item-row"
194
194
  disabled={!integration.editable}
195
195
  onClick={handleClick}
196
+ onContextMenu={handleContextMenu}
196
197
  clickable={isAllowedTo.manage}
197
198
  ref={setNodeRef}
198
199
  cssTransform={transform}
@@ -259,6 +260,7 @@ const IntegrationItem = (props: IIntegrationItemProps): JSX.Element => {
259
260
  />
260
261
  <CopyModal isOpen={isOpen("copy")} hide={() => toggleModal("copy")} action={copyIntegration} />
261
262
  {isVisibleCopy && <Toast {...copyToastProps} />}
263
+ <ContextMenu position={contextMenu} options={menuOptions} onClose={closeContextMenu} />
262
264
  </>
263
265
  );
264
266
  };
@@ -1,10 +1,10 @@
1
1
  import React from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { useModal, usePermission } from "@ax/hooks";
4
+ import { ContextMenu, Flag } from "@ax/components";
5
+ import { useContextMenu, useModal, usePermission } from "@ax/hooks";
5
6
  import { ILanguage, ISiteLanguage, IRootState, ISite } from "@ax/types";
6
7
  import { languagesActions } from "@ax/containers/Settings";
7
- import { Flag } from "@ax/components";
8
8
  import LanguagePanel from "../../LanguagePanel";
9
9
 
10
10
  import * as S from "./style";
@@ -19,6 +19,7 @@ const Item = (props: IItemProps): JSX.Element => {
19
19
  const { isOpen, toggleModal } = useModal();
20
20
  const isAllowedToEdit = usePermission("general.editLanguage");
21
21
  const isAllowedToDelete = usePermission("general.deleteLanguages");
22
+ const { contextMenu, handleContextMenu, closeContextMenu } = useContextMenu();
22
23
 
23
24
  const siteLanguage: ISiteLanguage = {
24
25
  language: item.id,
@@ -51,7 +52,7 @@ const Item = (props: IItemProps): JSX.Element => {
51
52
 
52
53
  return (
53
54
  <>
54
- <S.Component onClick={openModal} disabled={!isAllowedToEdit}>
55
+ <S.Component onClick={openModal} onContextMenu={handleContextMenu} disabled={!isAllowedToEdit}>
55
56
  <S.FlagWrapper>
56
57
  <Flag name={item.locale} />
57
58
  </S.FlagWrapper>
@@ -60,6 +61,7 @@ const Item = (props: IItemProps): JSX.Element => {
60
61
  <S.StyledActionMenu icon="more" options={menuOptions} />
61
62
  </S.Component>
62
63
  <LanguagePanel isOpen={isOpen} toggleModal={toggleModal} item={item} />
64
+ <ContextMenu position={contextMenu} options={menuOptions} onClose={closeContextMenu} />
63
65
  </>
64
66
  );
65
67
  };
@@ -1,9 +1,10 @@
1
1
  import { connect } from "react-redux";
2
2
 
3
- import { FieldsBehavior, Icon, Modal, Tag, Tooltip } from "@ax/components";
3
+ import { ContextMenu, FieldsBehavior, Icon, Modal, Tag, Tooltip } from "@ax/components";
4
4
  import { appActions } from "@ax/containers/App";
5
5
  import { sitesActions } from "@ax/containers/Sites";
6
6
  import { isDevelopment } from "@ax/helpers";
7
+ import { useContextMenu } from "@ax/hooks";
7
8
  import type { IGetSitesParams, ISite } from "@ax/types";
8
9
 
9
10
  import { ItemName, ItemThumbnail, RepublishSiteModal } from "./../../atoms";
@@ -24,6 +25,7 @@ const GridSiteItem = (props: IGridSiteItemProps): JSX.Element => {
24
25
  toggleToast,
25
26
  } = props;
26
27
  const { hidden } = site;
28
+ const { contextMenu, handleContextMenu, closeContextMenu } = useContextMenu();
27
29
 
28
30
  const {
29
31
  publishedState,
@@ -60,7 +62,7 @@ const GridSiteItem = (props: IGridSiteItemProps): JSX.Element => {
60
62
 
61
63
  return (
62
64
  <>
63
- <S.SiteWrapper key={site.id} onClick={setSite} data-testid="grid-site-item">
65
+ <S.SiteWrapper key={site.id} onClick={setSite} onContextMenu={handleContextMenu} data-testid="grid-site-item">
64
66
  <S.ImageContainer>
65
67
  <Tooltip content={siteTooltip}>
66
68
  <ItemThumbnail src={site.thumbnail} height={199} />
@@ -115,6 +117,7 @@ const GridSiteItem = (props: IGridSiteItemProps): JSX.Element => {
115
117
  >
116
118
  {isOpenPublish ? <S.ModalContent data-testid="publish-modal">{content}</S.ModalContent> : null}
117
119
  </Modal>
120
+ <ContextMenu position={contextMenu} options={menuOptions} onClose={closeContextMenu} />
118
121
  <RepublishSiteModal isOpen={isOpenRepublish} toggleModal={toggleRepublishModal} onRepublish={onRepublish} />
119
122
  </>
120
123
  );
@@ -1,9 +1,10 @@
1
1
  import { connect } from "react-redux";
2
2
 
3
- import { CheckField, FieldsBehavior, Icon, Modal, Tag, Tooltip } from "@ax/components";
3
+ import { CheckField, ContextMenu, FieldsBehavior, Icon, Modal, Tag, Tooltip } from "@ax/components";
4
4
  import { appActions } from "@ax/containers/App";
5
5
  import { sitesActions } from "@ax/containers/Sites";
6
6
  import { getFormattedDateWithTimezone } from "@ax/helpers";
7
+ import { useContextMenu } from "@ax/hooks";
7
8
  import type { ICheck, IGetSitesParams, ISite } from "@ax/types";
8
9
 
9
10
  import { ItemName, ItemThumbnail, RepublishSiteModal } from "./../../atoms";
@@ -28,6 +29,7 @@ const ListSiteItem = (props: IListSiteItemProps): JSX.Element => {
28
29
  } = props;
29
30
 
30
31
  const { hidden } = site;
32
+ const { contextMenu, handleContextMenu, closeContextMenu } = useContextMenu();
31
33
 
32
34
  const {
33
35
  publishedState,
@@ -63,7 +65,7 @@ const ListSiteItem = (props: IListSiteItemProps): JSX.Element => {
63
65
 
64
66
  return (
65
67
  <>
66
- <S.SiteItemRow key={site.id} role="rowgroup" selected={isSelected} data-testid="list-site-item">
68
+ <S.SiteItemRow key={site.id} role="rowgroup" selected={isSelected} onContextMenu={handleContextMenu} data-testid="list-site-item">
67
69
  <S.CheckCell role="cell">
68
70
  <CheckField name="check" value={site.id} checked={isSelected || hoverCheck} onChange={handleOnChange} />
69
71
  </S.CheckCell>
@@ -126,6 +128,7 @@ const ListSiteItem = (props: IListSiteItemProps): JSX.Element => {
126
128
  {isOpenPublish ? <S.ModalContent data-testid="publish-modal">{content}</S.ModalContent> : null}
127
129
  </Modal>
128
130
  <RepublishSiteModal isOpen={isOpenRepublish} toggleModal={toggleRepublishModal} onRepublish={() => null} />
131
+ <ContextMenu position={contextMenu} options={menuOptions} onClose={closeContextMenu} />
129
132
  </>
130
133
  );
131
134
  };
@@ -3,6 +3,7 @@ import { connect } from "react-redux";
3
3
 
4
4
  import {
5
5
  CheckField,
6
+ ContextMenu,
6
7
  ElementsTooltip,
7
8
  Flag,
8
9
  FloatingMenu,
@@ -21,7 +22,7 @@ import {
21
22
  getStructuredDataTitle,
22
23
  trimText,
23
24
  } from "@ax/helpers";
24
- import { useModals, usePermissionsForPage } from "@ax/hooks";
25
+ import { useContextMenu, useModals, usePermissionsForPage } from "@ax/hooks";
25
26
  import type {
26
27
  IAvailableSites,
27
28
  ICheck,
@@ -95,6 +96,7 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
95
96
 
96
97
  const initValue = { title: "", slug: "" };
97
98
  const [duplicateModalState, setDuplicateModalState] = useState(initValue);
99
+ const { contextMenu, handleContextMenu, closeContextMenu } = useContextMenu();
98
100
  const { isOpen, toggleModal } = useModals(["duplicate", "delete", "unpublish"]);
99
101
  const [deleteAllVersions, setDeleteAllVersions] = useState(false);
100
102
 
@@ -386,7 +388,7 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
386
388
 
387
389
  return (
388
390
  <>
389
- <S.StructuredDataRow role="rowgroup" selected={isSelected} disabled={!isEditable}>
391
+ <S.StructuredDataRow role="rowgroup" selected={isSelected} disabled={!isEditable} onContextMenu={handleContextMenu}>
390
392
  <S.CheckCell role="cell">
391
393
  <CheckField name="check" value={globalPage.id} checked={isSelected || hoverCheck} onChange={handleOnChange} />
392
394
  </S.CheckCell>
@@ -448,6 +450,7 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
448
450
  isDeleting={isSaving}
449
451
  />
450
452
  <UnpublishModal isOpen={isOpen("unpublish")} toggleModal={() => toggleModal("unpublish")} />
453
+ <ContextMenu position={contextMenu} options={menuOptions} onClose={closeContextMenu} />
451
454
  </>
452
455
  );
453
456
  };
@@ -1,7 +1,7 @@
1
1
  import { useState } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { CheckField, Flag, FloatingMenu, Icon, LanguageMenu, Tooltip, TruncatedTooltip } from "@ax/components";
4
+ import { CheckField, ContextMenu, Flag, FloatingMenu, Icon, LanguageMenu, Tooltip, TruncatedTooltip } from "@ax/components";
5
5
  import { appActions } from "@ax/containers/App";
6
6
  import { structuredDataActions } from "@ax/containers/StructuredData";
7
7
  import {
@@ -10,7 +10,7 @@ import {
10
10
  getHumanLastModifiedDate,
11
11
  getScheduleFormatDate,
12
12
  } from "@ax/helpers";
13
- import { useModal, usePermissionsForPage } from "@ax/hooks";
13
+ import { useContextMenu, useModal, usePermissionsForPage } from "@ax/hooks";
14
14
  import type {
15
15
  ICheck,
16
16
  IColumn,
@@ -78,6 +78,7 @@ const StructuredDataItem = (props: IStructuredDataItemProps): JSX.Element => {
78
78
 
79
79
  const { isOpen: isDeleteOpen, toggleModal: toggleDeleteModal } = useModal();
80
80
  const [deleteAllVersions, setDeleteAllVersions] = useState(false);
81
+ const { contextMenu, handleContextMenu, closeContextMenu } = useContextMenu();
81
82
 
82
83
  const { locale } = lang;
83
84
 
@@ -237,7 +238,7 @@ const StructuredDataItem = (props: IStructuredDataItemProps): JSX.Element => {
237
238
 
238
239
  return (
239
240
  <>
240
- <S.StructuredDataRow role="rowgroup" selected={isSelected} disabled={!isEditable}>
241
+ <S.StructuredDataRow role="rowgroup" selected={isSelected} disabled={!isEditable} onContextMenu={handleContextMenu}>
241
242
  <S.CheckCell role="cell">
242
243
  <CheckField
243
244
  name="check"
@@ -279,6 +280,7 @@ const StructuredDataItem = (props: IStructuredDataItemProps): JSX.Element => {
279
280
  onDelete={removeItem}
280
281
  isDeleting={isSaving}
281
282
  />
283
+ <ContextMenu position={contextMenu} options={menuOptions} onClose={closeContextMenu} />
282
284
  </>
283
285
  );
284
286
  };
@@ -1,9 +1,9 @@
1
1
  import { connect } from "react-redux";
2
2
 
3
- import { Avatar, CheckField, ElementsTooltip, Tag, Toast, Tooltip, TruncatedTooltip } from "@ax/components";
3
+ import { Avatar, CheckField, ContextMenu, ElementsTooltip, Tag, Toast, Tooltip, TruncatedTooltip } from "@ax/components";
4
4
  import { usersActions } from "@ax/containers/Users";
5
5
  import { getDaysAgo } from "@ax/helpers";
6
- import { useModal, usePermission, useToast } from "@ax/hooks";
6
+ import { useContextMenu, useModal, usePermission, useToast } from "@ax/hooks";
7
7
  import type { ICheck, IRole, IRootState, ISite, IUser } from "@ax/types";
8
8
 
9
9
  import { DeleteModal } from "../atoms";
@@ -31,6 +31,7 @@ const UserItem = (props: IUserItemProps): JSX.Element => {
31
31
 
32
32
  const { isOpen, toggleModal } = useModal();
33
33
  const { isVisible, toggleToast, setIsVisible } = useToast();
34
+ const { contextMenu, handleContextMenu, closeContextMenu } = useContextMenu();
34
35
 
35
36
  const isAllowedToRemoveUsers = usePermission("usersRoles.removeUsers");
36
37
 
@@ -141,7 +142,7 @@ const UserItem = (props: IUserItemProps): JSX.Element => {
141
142
 
142
143
  return (
143
144
  <>
144
- <S.UserRow role="rowgroup" selected={isSelected} data-testid="user-item">
145
+ <S.UserRow role="rowgroup" selected={isSelected} onContextMenu={handleContextMenu} data-testid="user-item">
145
146
  <S.CheckCell role="cell">
146
147
  <CheckField
147
148
  name={user.name}
@@ -208,6 +209,7 @@ const UserItem = (props: IUserItemProps): JSX.Element => {
208
209
  isDeleting={isSaving}
209
210
  />
210
211
  {isVisible && <Toast {...toastProps} />}
212
+ <ContextMenu position={contextMenu} options={menuOptions} onClose={closeContextMenu} />
211
213
  </>
212
214
  );
213
215
  };