@griddo/ax 11.14.1 → 11.14.2-rc.1
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/config/jest/reactEasyCropMock.js +15 -0
- package/config/jest/reactTimezoneMock.js +13 -0
- package/package.json +221 -219
- package/public/img/welcome.svg +127 -0
- package/src/__tests__/components/Browser/Browser.test.tsx +27 -51
- package/src/__tests__/components/CategoryCell/CategoryCell.test.tsx +10 -5
- package/src/__tests__/components/ElementsTooltip/ElementsTooltip.test.tsx +27 -14
- package/src/__tests__/components/HeadingsPreviewModal/ErrorsBanner/ErrorItem/ErrorItem.test.tsx +2 -0
- package/src/__tests__/components/HeadingsPreviewModal/HeadingsPreviewModal.utils.test.tsx +138 -1
- package/src/__tests__/components/ImageDragAndDrop/CropStep/CropStep.test.tsx +84 -0
- package/src/__tests__/components/ImageDragAndDrop/ImageDragAndDrop.test.tsx +169 -0
- package/src/__tests__/components/ProfileImage/ProfileImage.test.tsx +120 -0
- package/src/__tests__/components/ResizePanel/ResizePanel.test.tsx +8 -0
- package/src/__tests__/components/UserRolesAndSites/RoleItem/RoleItem.test.tsx +190 -0
- package/src/__tests__/components/UserRolesAndSites/UserRolesAndSites.test.tsx +471 -0
- package/src/__tests__/modules/FramePreview/HeadingsOverlay/HeadingsOverlay.test.tsx +15 -2
- package/src/__tests__/modules/Sites/Sites.test.tsx +68 -224
- package/src/__tests__/modules/Sites/SitesList/ListView/BulkHeader/BulkHeader.test.tsx +21 -17
- package/src/__tests__/modules/Sites/SitesList/SitesList.test.tsx +65 -565
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/DataStep/DataStep.test.tsx +109 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/FinalStep/FinalStep.test.tsx +157 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/ImageStep/CropView/CropView.test.tsx +51 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/ImageStep/ImageStep.test.tsx +70 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/ImageStep/UploadView/UploadView.test.tsx +92 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/TimezoneStep/TimezoneStep.test.tsx +94 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/WelcomeModal.test.tsx +78 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/WelcomeStep/WelcomeStep.test.tsx +39 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/utils.test.ts +55 -0
- package/src/api/sites.tsx +4 -4
- package/src/components/Avatar/index.tsx +26 -5
- package/src/components/Avatar/style.tsx +20 -10
- package/src/components/Browser/index.tsx +7 -1
- package/src/components/ConfigPanel/index.tsx +5 -4
- package/src/components/ElementsTooltip/index.tsx +96 -34
- package/src/components/ElementsTooltip/style.tsx +12 -1
- package/src/components/Fields/FileField/index.tsx +16 -17
- package/src/components/Fields/HeadingField/index.tsx +1 -1
- package/src/components/Fields/ImageField/index.tsx +9 -38
- package/src/components/Fields/ImageField/style.tsx +12 -1
- package/src/components/Fields/ToggleField/index.tsx +1 -1
- package/src/components/Fields/Wysiwyg/index.tsx +25 -20
- package/src/components/FileGallery/GalleryPanel/index.tsx +15 -7
- package/src/components/FileGallery/index.tsx +33 -28
- package/src/components/Gallery/GalleryPanel/index.tsx +5 -16
- package/src/components/Gallery/index.tsx +0 -2
- package/src/components/HeadingsPreviewModal/ErrorsBanner/ErrorItem/index.tsx +11 -2
- package/src/components/HeadingsPreviewModal/ErrorsBanner/index.tsx +21 -3
- package/src/components/HeadingsPreviewModal/ErrorsBanner/style.tsx +2 -2
- package/src/components/HeadingsPreviewModal/index.tsx +13 -3
- package/src/components/HeadingsPreviewModal/style.tsx +18 -0
- package/src/components/HeadingsPreviewModal/utils.tsx +31 -3
- package/src/components/Image/index.tsx +2 -2
- package/src/components/ImageDragAndDrop/CropStep/index.tsx +95 -0
- package/src/components/ImageDragAndDrop/CropStep/style.tsx +101 -0
- package/src/{modules/MediaGallery → components}/ImageDragAndDrop/index.tsx +103 -40
- package/src/{modules/MediaGallery → components}/ImageDragAndDrop/style.tsx +14 -2
- package/src/components/ProfileImage/index.tsx +55 -0
- package/src/components/ProfileImage/style.tsx +58 -0
- package/src/components/ResizePanel/ResizeHandle/index.tsx +44 -6
- package/src/components/ResizePanel/ResizeHandle/style.tsx +7 -0
- package/src/components/ResizePanel/index.tsx +25 -4
- package/src/components/Tabs/style.tsx +1 -1
- package/src/components/Tag/index.tsx +0 -1
- package/src/components/UserRolesAndSites/RoleItem/index.tsx +42 -0
- package/src/components/UserRolesAndSites/RoleItem/style.tsx +29 -0
- package/src/components/UserRolesAndSites/index.tsx +102 -0
- package/src/components/UserRolesAndSites/style.tsx +67 -0
- package/src/components/index.tsx +6 -0
- package/src/constants/index.ts +13 -1
- package/src/containers/App/actions.tsx +8 -1
- package/src/containers/Sites/actions.tsx +26 -0
- package/src/containers/Sites/constants.tsx +1 -0
- package/src/containers/Sites/interfaces.tsx +6 -0
- package/src/containers/Sites/reducer.tsx +5 -1
- package/src/containers/Users/reducer.tsx +6 -5
- package/src/guards/routeLeaving/index.tsx +9 -11
- package/src/helpers/images.tsx +50 -3
- package/src/helpers/index.tsx +2 -1
- package/src/hooks/forms.tsx +45 -48
- package/src/hooks/modals.tsx +4 -3
- package/src/modules/ActivityLog/ItemLogUser/UserItem/index.tsx +1 -1
- package/src/modules/App/Routing/Logout/index.tsx +3 -5
- package/src/modules/App/Routing/NavMenu/NavItem/index.tsx +73 -52
- package/src/modules/App/Routing/NavMenu/NavItem/style.tsx +21 -7
- package/src/modules/App/Routing/NavMenu/index.tsx +59 -54
- package/src/modules/App/Routing/NavMenu/style.tsx +13 -11
- package/src/modules/CreatePass/index.tsx +1 -1
- package/src/modules/FileDrive/FileDragAndDrop/index.tsx +11 -8
- package/src/modules/FileDrive/FileModal/index.tsx +8 -9
- package/src/modules/FileDrive/index.tsx +1 -18
- package/src/modules/Forms/FormEditor/index.tsx +1 -1
- package/src/modules/FramePreview/HeadingsOverlay/index.tsx +22 -11
- package/src/modules/FramePreview/HeadingsOverlay/style.tsx +1 -1
- package/src/modules/MediaGallery/ImageModal/index.tsx +1 -5
- package/src/modules/MediaGallery/index.tsx +1 -3
- package/src/modules/Settings/Globals/constants.tsx +942 -106
- package/src/modules/Sites/SitesList/AllSitesHeader/index.tsx +33 -0
- package/src/modules/Sites/SitesList/AllSitesHeader/style.tsx +35 -0
- package/src/modules/Sites/SitesList/GridView/GridHeaderFilter/index.tsx +5 -5
- package/src/modules/Sites/SitesList/GridView/GridSiteItem/index.tsx +23 -119
- package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/index.tsx +4 -4
- package/src/modules/Sites/SitesList/ListView/BulkHeader/index.tsx +4 -3
- package/src/modules/Sites/SitesList/ListView/ListSiteItem/index.tsx +23 -120
- package/src/modules/Sites/SitesList/{RecentSiteItem → RecentSites/RecentSiteItem}/index.tsx +4 -5
- package/src/modules/Sites/SitesList/RecentSites/index.tsx +49 -0
- package/src/modules/Sites/SitesList/RecentSites/style.tsx +92 -0
- package/src/modules/Sites/SitesList/SiteModal/index.tsx +8 -7
- package/src/modules/Sites/SitesList/WelcomeModal/DataStep/index.tsx +72 -0
- package/src/modules/Sites/SitesList/WelcomeModal/DataStep/style.tsx +59 -0
- package/src/modules/Sites/SitesList/WelcomeModal/FinalStep/constants.tsx +78 -0
- package/src/modules/Sites/SitesList/WelcomeModal/FinalStep/index.tsx +78 -0
- package/src/modules/Sites/SitesList/WelcomeModal/FinalStep/style.tsx +141 -0
- package/src/modules/Sites/SitesList/WelcomeModal/ImageStep/CropView/index.tsx +93 -0
- package/src/modules/Sites/SitesList/WelcomeModal/ImageStep/CropView/style.tsx +77 -0
- package/src/modules/Sites/SitesList/WelcomeModal/ImageStep/UploadView/index.tsx +100 -0
- package/src/modules/Sites/SitesList/WelcomeModal/ImageStep/UploadView/style.tsx +94 -0
- package/src/modules/Sites/SitesList/WelcomeModal/ImageStep/index.tsx +44 -0
- package/src/modules/Sites/SitesList/WelcomeModal/ImageStep/style.tsx +31 -0
- package/src/modules/Sites/SitesList/WelcomeModal/TimezoneStep/index.tsx +51 -0
- package/src/modules/Sites/SitesList/WelcomeModal/TimezoneStep/style.tsx +52 -0
- package/src/modules/Sites/SitesList/WelcomeModal/WelcomeStep/index.tsx +40 -0
- package/src/modules/Sites/SitesList/WelcomeModal/WelcomeStep/style.tsx +53 -0
- package/src/modules/Sites/SitesList/WelcomeModal/index.tsx +215 -0
- package/src/modules/Sites/SitesList/WelcomeModal/style.tsx +12 -0
- package/src/modules/Sites/SitesList/WelcomeModal/utils.ts +26 -0
- package/src/modules/Sites/SitesList/atoms.tsx +4 -4
- package/src/modules/Sites/SitesList/hooks.tsx +149 -16
- package/src/modules/Sites/SitesList/index.tsx +127 -125
- package/src/modules/Sites/SitesList/style.tsx +1 -117
- package/src/modules/Sites/SitesList/utils.tsx +9 -2
- package/src/modules/Sites/index.tsx +19 -8
- package/src/modules/Users/Profile/index.tsx +169 -31
- package/src/modules/Users/Profile/style.tsx +81 -1
- package/src/modules/Users/Roles/RoleItem/index.tsx +2 -2
- package/src/modules/Users/UserCreate/SiteItem/index.tsx +11 -14
- package/src/modules/Users/UserForm/atoms.tsx +3 -3
- package/src/modules/Users/UserForm/index.tsx +25 -29
- package/src/modules/Users/UserForm/style.tsx +15 -2
- package/src/modules/Users/UserList/UserItem/index.tsx +4 -4
- package/src/routes/index.tsx +1 -0
- package/src/types/index.tsx +2 -0
- /package/src/modules/Sites/SitesList/{RecentSiteItem → RecentSites/RecentSiteItem}/style.tsx +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const NavLink = styled.a`
|
|
4
4
|
display: flex;
|
|
5
5
|
align-items: center;
|
|
6
6
|
overflow: hidden;
|
|
@@ -9,12 +9,12 @@ export const NavLink = styled.a`
|
|
|
9
9
|
width: 100%;
|
|
10
10
|
`;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const GoBack = styled.div`
|
|
13
13
|
display: none;
|
|
14
14
|
width: auto;
|
|
15
15
|
`;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const Home = styled.div<{ type: string; isSite: boolean; isOpened: boolean; siteSelector: boolean }>`
|
|
18
18
|
padding: ${(p) => `${p.theme.spacing.xs} 12px`};
|
|
19
19
|
background-color: ${(p) =>
|
|
20
20
|
p.type === "multisite" ? p.theme.color.uiMainMenuBackground : p.theme.color.uiBarBackground};
|
|
@@ -41,7 +41,7 @@ export const Home = styled.div<{ type: string; isSite: boolean; isOpened: boolea
|
|
|
41
41
|
}
|
|
42
42
|
`;
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
const Logo = styled.img`
|
|
45
45
|
max-height: 40px;
|
|
46
46
|
height: 100%;
|
|
47
47
|
width: auto;
|
|
@@ -52,7 +52,7 @@ export const Logo = styled.img`
|
|
|
52
52
|
left: 0;
|
|
53
53
|
`;
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
const LogoSite = styled.img`
|
|
56
56
|
display: block;
|
|
57
57
|
max-height: 40px;
|
|
58
58
|
height: 100%;
|
|
@@ -64,7 +64,7 @@ export const LogoSite = styled.img`
|
|
|
64
64
|
left: 0;
|
|
65
65
|
`;
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
const LogoSiteMini = styled.img`
|
|
68
68
|
margin: 0 auto;
|
|
69
69
|
max-height: 40px;
|
|
70
70
|
height: 100%;
|
|
@@ -74,7 +74,7 @@ export const LogoSiteMini = styled.img`
|
|
|
74
74
|
opacity: 1;
|
|
75
75
|
`;
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
const Title = styled.span`
|
|
78
78
|
bottom: -3px;
|
|
79
79
|
position: relative;
|
|
80
80
|
display: flex;
|
|
@@ -83,7 +83,7 @@ export const Title = styled.span`
|
|
|
83
83
|
color: ${(p) => p.theme.color.textHighEmphasisInverse};
|
|
84
84
|
`;
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
const NavWrapper = styled.nav<{ type: string; isOpened: boolean }>`
|
|
87
87
|
${(p) => p.theme.textStyle.uiL};
|
|
88
88
|
position: relative;
|
|
89
89
|
width: ${(p) => (p.isOpened ? `calc(${p.theme.spacing.l} * 5)` : `calc(${p.theme.spacing.m} * 3)`)};
|
|
@@ -107,7 +107,7 @@ export const NavWrapper = styled.nav<{ type: string; isOpened: boolean }>`
|
|
|
107
107
|
}
|
|
108
108
|
`;
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
const Lists = styled.div`
|
|
111
111
|
display: flex;
|
|
112
112
|
flex-direction: column;
|
|
113
113
|
justify-content: space-between;
|
|
@@ -115,9 +115,11 @@ export const Lists = styled.div`
|
|
|
115
115
|
padding-top: ${(p) => p.theme.spacing.s};
|
|
116
116
|
`;
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
const List = styled.ul``;
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
const Separator = styled.li`
|
|
121
121
|
border-bottom: 1px solid ${(p) => p.theme.color.uiLineInverse};
|
|
122
122
|
margin: ${(p) => `${p.theme.spacing.s} 0`};
|
|
123
123
|
`;
|
|
124
|
+
|
|
125
|
+
export { NavLink, GoBack, Home, Logo, LogoSite, LogoSiteMini, Title, NavWrapper, Lists, List, Separator };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import { memo, useRef, useState } from "react";
|
|
2
3
|
import { connect } from "react-redux";
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
5
|
+
import { DragAndDrop, Icon, ProgressBar } from "@ax/components";
|
|
6
|
+
import { VALID_DOCUMENT_FORMATS, VALID_FILE_FORMATS } from "@ax/constants";
|
|
6
7
|
import { fileDriveActions } from "@ax/containers/FileDrive";
|
|
8
|
+
import type { IFile, IRootState } from "@ax/types";
|
|
7
9
|
|
|
8
10
|
import * as S from "./style";
|
|
9
11
|
|
|
10
12
|
const FileDragAndDrop = (props: IProps) => {
|
|
11
13
|
const {
|
|
12
|
-
|
|
14
|
+
customFormats,
|
|
13
15
|
isUploading,
|
|
14
16
|
isSuccess,
|
|
15
17
|
isError,
|
|
@@ -27,8 +29,9 @@ const FileDragAndDrop = (props: IProps) => {
|
|
|
27
29
|
resetError,
|
|
28
30
|
} = props;
|
|
29
31
|
|
|
32
|
+
const validFormats = customFormats ? customFormats : VALID_FILE_FORMATS;
|
|
30
33
|
const validExtensions = validFormats.map((format) => `.${format}`).join(",");
|
|
31
|
-
const
|
|
34
|
+
const validFormatsText = customFormats ? customFormats.join(", ") : `${VALID_DOCUMENT_FORMATS.join(", ")} and videos`;
|
|
32
35
|
const filesInputRef = useRef<any>(null);
|
|
33
36
|
const filesButtonRef = useRef<any>(null);
|
|
34
37
|
const [inDropZone, setInDropZone] = useState(false);
|
|
@@ -169,7 +172,7 @@ const FileDragAndDrop = (props: IProps) => {
|
|
|
169
172
|
Select files
|
|
170
173
|
</S.FilesButton>
|
|
171
174
|
<S.DragSubtitle>
|
|
172
|
-
Valid formats: {
|
|
175
|
+
Valid formats: {validFormatsText}.
|
|
173
176
|
<br />
|
|
174
177
|
Max. size: 50MB
|
|
175
178
|
</S.DragSubtitle>
|
|
@@ -180,7 +183,7 @@ const FileDragAndDrop = (props: IProps) => {
|
|
|
180
183
|
</S.DropIcon>
|
|
181
184
|
<S.DragTitle>Drop your file</S.DragTitle>
|
|
182
185
|
<S.DragSubtitle>
|
|
183
|
-
Valid formats: {
|
|
186
|
+
Valid formats: {validFormatsText}.
|
|
184
187
|
<br />
|
|
185
188
|
Max. size: 50MB
|
|
186
189
|
</S.DragSubtitle>
|
|
@@ -249,7 +252,7 @@ const FileDragAndDrop = (props: IProps) => {
|
|
|
249
252
|
};
|
|
250
253
|
|
|
251
254
|
interface IProps {
|
|
252
|
-
|
|
255
|
+
customFormats?: string[];
|
|
253
256
|
isUploading: boolean;
|
|
254
257
|
isSuccess: boolean;
|
|
255
258
|
isError: boolean;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
|
|
3
3
|
import { Button, FloatingMenu, IconAction, Toast, Tooltip } from "@ax/components";
|
|
4
|
-
import { useModal, useToast } from "@ax/hooks";
|
|
5
4
|
import { getFileIcon } from "@ax/helpers";
|
|
6
|
-
import
|
|
5
|
+
import { useModal, useToast } from "@ax/hooks";
|
|
6
|
+
import type { IFile } from "@ax/types";
|
|
7
|
+
|
|
8
|
+
import type { IFileFormState } from "..";
|
|
7
9
|
import { NotSavedModal } from "../atoms";
|
|
10
|
+
import FileDragAndDrop from "../FileDragAndDrop";
|
|
8
11
|
import DetailPanel from "./DetailPanel";
|
|
9
|
-
import { IFileFormState } from "..";
|
|
10
12
|
|
|
11
13
|
import * as S from "./style";
|
|
12
14
|
|
|
@@ -38,8 +40,6 @@ const FileModal = (props: IProps) => {
|
|
|
38
40
|
const iconUrl = `/img/icons/${getFileIcon(fileType)}`;
|
|
39
41
|
const index = items.indexOf(file.id);
|
|
40
42
|
|
|
41
|
-
const validFormats = ["pdf", "doc", "docx", "xls", "xlsx", "zip", "mov", "mp4", "wmv", "avi", "webm", "mkv"];
|
|
42
|
-
|
|
43
43
|
const handleArrowClick = (isPrev: boolean) => () => {
|
|
44
44
|
if (isDirty) {
|
|
45
45
|
setIsArrowPrev(isPrev);
|
|
@@ -117,10 +117,9 @@ const FileModal = (props: IProps) => {
|
|
|
117
117
|
{isDNDVisible && (
|
|
118
118
|
<S.DragAndDropWrapper>
|
|
119
119
|
<FileDragAndDrop
|
|
120
|
-
validFormats={validFormats}
|
|
121
120
|
handleUpload={handleUpload}
|
|
122
121
|
inverse={true}
|
|
123
|
-
replaceData={{ fileID: id, keepURL: replaceType
|
|
122
|
+
replaceData={{ fileID: id, keepURL: replaceType !== "full" }}
|
|
124
123
|
siteID={site || "global"}
|
|
125
124
|
/>
|
|
126
125
|
</S.DragAndDropWrapper>
|
|
@@ -19,9 +19,9 @@ import {
|
|
|
19
19
|
Toast,
|
|
20
20
|
Tooltip,
|
|
21
21
|
} from "@ax/components";
|
|
22
|
+
import { VALID_FILE_FORMATS } from "@ax/constants";
|
|
22
23
|
import { fileDriveActions } from "@ax/containers/FileDrive";
|
|
23
24
|
import { useBulkSelection, useIsDirty, useModal, usePermission, useResizable, useToast } from "@ax/hooks";
|
|
24
|
-
import { LOCALE, pluralize } from "@ax/locales";
|
|
25
25
|
import type {
|
|
26
26
|
IBulkAction,
|
|
27
27
|
IFile,
|
|
@@ -126,22 +126,6 @@ const FileDrive = (props: IProps) => {
|
|
|
126
126
|
const hasFolders = !!folders.length;
|
|
127
127
|
const isRoot = !breadcrumb.length;
|
|
128
128
|
const isGrid = displayMode === "grid";
|
|
129
|
-
const validFormats = [
|
|
130
|
-
"pdf",
|
|
131
|
-
"doc",
|
|
132
|
-
"docx",
|
|
133
|
-
"xls",
|
|
134
|
-
"xlsx",
|
|
135
|
-
"zip",
|
|
136
|
-
"csv",
|
|
137
|
-
"txt",
|
|
138
|
-
"mov",
|
|
139
|
-
"mp4",
|
|
140
|
-
"wmv",
|
|
141
|
-
"avi",
|
|
142
|
-
"webm",
|
|
143
|
-
"mkv",
|
|
144
|
-
];
|
|
145
129
|
|
|
146
130
|
const allowedToAccessGlobalFromSite = usePermission("mediaGallery.accessToGlobalFileDriveFromSite");
|
|
147
131
|
|
|
@@ -752,7 +736,6 @@ const FileDrive = (props: IProps) => {
|
|
|
752
736
|
<Modal isOpen={isUploadOpen} hide={toggleUploadModal} size="XL" title="Upload file">
|
|
753
737
|
{isUploadOpen && (
|
|
754
738
|
<FileDragAndDrop
|
|
755
|
-
validFormats={validFormats}
|
|
756
739
|
folderID={currentFolderID}
|
|
757
740
|
handleUpload={handleUpload}
|
|
758
741
|
handleMultipleUpload={handleMultipleUpload}
|
|
@@ -83,7 +83,7 @@ const FormEditor = (props: IProps) => {
|
|
|
83
83
|
const { isOpen: isUseOpen, toggleModal: toggleUseModal } = useModal();
|
|
84
84
|
const { isOpen: isUpdateOpen, toggleModal: toggleUpdateModal } = useModal();
|
|
85
85
|
|
|
86
|
-
const { isDirty, setIsDirty } = useShouldBeSaved(formContent
|
|
86
|
+
const { isDirty, setIsDirty } = useShouldBeSaved(formContent);
|
|
87
87
|
const browserRef = useRef<HTMLDivElement>(null);
|
|
88
88
|
|
|
89
89
|
const deleteFormPermission = isSiteView ? "forms.deleteForms" : "global.forms.deleteForms";
|
|
@@ -25,7 +25,9 @@ const isEffectivelyVisible = (el: HTMLElement): boolean => {
|
|
|
25
25
|
|
|
26
26
|
const HeadingsOverlay = ({ headingFilter }: IHeadingsOverlayProps) => {
|
|
27
27
|
const [boxes, setBoxes] = useState<HeadingBox[]>([]);
|
|
28
|
+
const [, setTick] = useState(0);
|
|
28
29
|
const rafRef = useRef<number>(0);
|
|
30
|
+
const frameRef = useRef<number>(0);
|
|
29
31
|
|
|
30
32
|
useEffect(() => {
|
|
31
33
|
const update = () => {
|
|
@@ -33,8 +35,6 @@ const HeadingsOverlay = ({ headingFilter }: IHeadingsOverlayProps) => {
|
|
|
33
35
|
rafRef.current = requestAnimationFrame(() => {
|
|
34
36
|
const selector = headingFilter || "h1, h2, h3, h4, h5, h6";
|
|
35
37
|
const headings = Array.from(document.querySelectorAll<HTMLElement>(selector));
|
|
36
|
-
const scrollX = window.scrollX;
|
|
37
|
-
const scrollY = window.scrollY;
|
|
38
38
|
const boxes: HeadingBox[] = [];
|
|
39
39
|
for (let i = 0; i < headings.length; i++) {
|
|
40
40
|
const el = headings[i];
|
|
@@ -44,9 +44,6 @@ const HeadingsOverlay = ({ headingFilter }: IHeadingsOverlayProps) => {
|
|
|
44
44
|
boxes.push({
|
|
45
45
|
id: el.dataset.griddoid || `heading-${i}`,
|
|
46
46
|
tag: el.tagName.toLowerCase(),
|
|
47
|
-
rect,
|
|
48
|
-
scrollX,
|
|
49
|
-
scrollY,
|
|
50
47
|
});
|
|
51
48
|
}
|
|
52
49
|
setBoxes(boxes);
|
|
@@ -73,9 +70,26 @@ const HeadingsOverlay = ({ headingFilter }: IHeadingsOverlayProps) => {
|
|
|
73
70
|
};
|
|
74
71
|
}, [headingFilter]);
|
|
75
72
|
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
const updateFrame = () => {
|
|
75
|
+
frameRef.current = requestAnimationFrame(() => {
|
|
76
|
+
setTick((t) => t + 1);
|
|
77
|
+
updateFrame();
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
updateFrame();
|
|
82
|
+
|
|
83
|
+
return () => cancelAnimationFrame(frameRef.current);
|
|
84
|
+
}, []);
|
|
85
|
+
|
|
76
86
|
return createPortal(
|
|
77
87
|
<div data-testid="headings-overlay">
|
|
78
|
-
{boxes.map(({ id, tag
|
|
88
|
+
{boxes.map(({ id, tag }) => {
|
|
89
|
+
const el = document.querySelector<HTMLElement>(`[data-griddoid="${id}"]`) ||
|
|
90
|
+
document.querySelector(tag);
|
|
91
|
+
if (!el) return null;
|
|
92
|
+
const rect = el.getBoundingClientRect();
|
|
79
93
|
const color = headColors[tag];
|
|
80
94
|
if (!color) return null;
|
|
81
95
|
const labelAbove = rect.left < 30;
|
|
@@ -84,8 +98,8 @@ const HeadingsOverlay = ({ headingFilter }: IHeadingsOverlayProps) => {
|
|
|
84
98
|
key={id}
|
|
85
99
|
$color={color}
|
|
86
100
|
style={{
|
|
87
|
-
top: rect.top
|
|
88
|
-
left: rect.left
|
|
101
|
+
top: rect.top,
|
|
102
|
+
left: rect.left,
|
|
89
103
|
width: rect.width,
|
|
90
104
|
height: rect.height,
|
|
91
105
|
}}
|
|
@@ -104,9 +118,6 @@ const HeadingsOverlay = ({ headingFilter }: IHeadingsOverlayProps) => {
|
|
|
104
118
|
interface HeadingBox {
|
|
105
119
|
id: string;
|
|
106
120
|
tag: string;
|
|
107
|
-
rect: DOMRect;
|
|
108
|
-
scrollX: number;
|
|
109
|
-
scrollY: number;
|
|
110
121
|
}
|
|
111
122
|
|
|
112
123
|
export interface IHeadingsOverlayProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
|
|
3
|
-
import { Button, ErrorToast, IconAction, Loader, Toast, Tooltip } from "@ax/components";
|
|
3
|
+
import { Button, ErrorToast, IconAction, ImageDragAndDrop, Loader, Toast, Tooltip } from "@ax/components";
|
|
4
4
|
import { useModal, useToast } from "@ax/hooks";
|
|
5
5
|
import type { IGetFolderParams, IImage } from "@ax/types";
|
|
6
6
|
|
|
@@ -8,7 +8,6 @@ import { type Fields, GriddoImageExp } from "@griddo/core";
|
|
|
8
8
|
|
|
9
9
|
import type { IImageFormState } from "..";
|
|
10
10
|
import { NotSavedModal } from "../atoms";
|
|
11
|
-
import ImageDragAndDrop from "../ImageDragAndDrop";
|
|
12
11
|
import DetailPanel from "./DetailPanel";
|
|
13
12
|
|
|
14
13
|
import * as S from "./style";
|
|
@@ -39,8 +38,6 @@ const ImageModal = (props: IProps) => {
|
|
|
39
38
|
|
|
40
39
|
const index = items.indexOf(image.id);
|
|
41
40
|
|
|
42
|
-
const validFormats = ["jpeg", "jpg", "png", "svg", "gif"];
|
|
43
|
-
|
|
44
41
|
const handleArrowClick = (isPrev: boolean) => () => {
|
|
45
42
|
if (isDirty) {
|
|
46
43
|
setIsArrowPrev(isPrev);
|
|
@@ -101,7 +98,6 @@ const ImageModal = (props: IProps) => {
|
|
|
101
98
|
{isDNDVisible && (
|
|
102
99
|
<S.DragAndDropWrapper>
|
|
103
100
|
<ImageDragAndDrop
|
|
104
|
-
validFormats={validFormats}
|
|
105
101
|
handleUpload={handleUpload}
|
|
106
102
|
inverse={true}
|
|
107
103
|
replaceData={{ fileID: id }}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
FilterTagsBar,
|
|
10
10
|
Icon,
|
|
11
11
|
IconAction,
|
|
12
|
+
ImageDragAndDrop,
|
|
12
13
|
Loading,
|
|
13
14
|
MainWrapper,
|
|
14
15
|
Modal,
|
|
@@ -41,7 +42,6 @@ import FolderItem from "./FolderItem";
|
|
|
41
42
|
import FolderTree from "./FolderTree";
|
|
42
43
|
import GridItem from "./GridItem";
|
|
43
44
|
import { useFilterQuery, useSortedListStatus } from "./hooks";
|
|
44
|
-
import ImageDragAndDrop from "./ImageDragAndDrop";
|
|
45
45
|
import Orientation from "./ImageFilters/Orientation";
|
|
46
46
|
import SortBy from "./ImageFilters/SortBy";
|
|
47
47
|
import Type from "./ImageFilters/Type";
|
|
@@ -129,7 +129,6 @@ const MediaGallery = (props: IProps) => {
|
|
|
129
129
|
const hasFolders = !!folders?.length;
|
|
130
130
|
const isRoot = !breadcrumb?.length;
|
|
131
131
|
const isGrid = displayMode === "grid";
|
|
132
|
-
const validFormats = ["jpeg", "jpg", "png", "svg", "gif"];
|
|
133
132
|
|
|
134
133
|
const allowedToAccessGlobalFromSite = usePermission("mediaGallery.accessToGlobalGalleryFromSite");
|
|
135
134
|
|
|
@@ -813,7 +812,6 @@ const MediaGallery = (props: IProps) => {
|
|
|
813
812
|
<Modal isOpen={isUploadOpen} hide={toggleUploadModal} size="XL" title="Upload media">
|
|
814
813
|
{isUploadOpen && (
|
|
815
814
|
<ImageDragAndDrop
|
|
816
|
-
validFormats={validFormats}
|
|
817
815
|
folderID={currentFolderID}
|
|
818
816
|
handleUpload={handleUpload}
|
|
819
817
|
handleMultipleUpload={handleMultipleUpload}
|