@griddo/ax 1.57.12 → 1.57.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/components/Gallery/GalleryPanel/GalleryDragAndDrop/index.tsx +11 -20
- package/src/components/Gallery/index.tsx +4 -1
- package/src/components/Modal/style.tsx +1 -0
- package/src/containers/Gallery/actions.tsx +5 -5
- package/src/modules/Sites/SitesList/SiteModal/style.tsx +2 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "1.57.
|
|
4
|
+
"version": "1.57.13",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -241,5 +241,5 @@
|
|
|
241
241
|
"publishConfig": {
|
|
242
242
|
"access": "public"
|
|
243
243
|
},
|
|
244
|
-
"gitHead": "
|
|
244
|
+
"gitHead": "6e011bce3d0578bfa5be5639fecf513689b3e22a"
|
|
245
245
|
}
|
|
@@ -8,7 +8,8 @@ import { Icon, DragAndDrop } from "@ax/components";
|
|
|
8
8
|
import * as S from "./style";
|
|
9
9
|
|
|
10
10
|
const GalleryDragAndDrop = (props: IProps) => {
|
|
11
|
-
const {
|
|
11
|
+
const {
|
|
12
|
+
isImageSelected,
|
|
12
13
|
validFormats,
|
|
13
14
|
site,
|
|
14
15
|
allowUpload,
|
|
@@ -65,7 +66,7 @@ const GalleryDragAndDrop = (props: IProps) => {
|
|
|
65
66
|
const handleUploadFile = async (files: Array<any>) => {
|
|
66
67
|
if (files[0]) {
|
|
67
68
|
if (!checkType(files[0].type)) {
|
|
68
|
-
uploadError("Invalid format");
|
|
69
|
+
uploadError(true, "Invalid format");
|
|
69
70
|
} else {
|
|
70
71
|
try {
|
|
71
72
|
const newImage = await uploadImage(files[0], site);
|
|
@@ -81,6 +82,7 @@ const GalleryDragAndDrop = (props: IProps) => {
|
|
|
81
82
|
|
|
82
83
|
const handleTryAgain = () => {
|
|
83
84
|
setInDropZone(false);
|
|
85
|
+
uploadError(false);
|
|
84
86
|
};
|
|
85
87
|
|
|
86
88
|
const handleFileClick = () => {
|
|
@@ -130,25 +132,14 @@ const GalleryDragAndDrop = (props: IProps) => {
|
|
|
130
132
|
</S.DragIcon>
|
|
131
133
|
<S.DragTitle>Select an image to see details</S.DragTitle>
|
|
132
134
|
</S.StatusWrapper>
|
|
133
|
-
|
|
134
135
|
);
|
|
135
136
|
|
|
136
137
|
return (
|
|
137
138
|
<S.Wrapper hidden={isImageSelected}>
|
|
138
|
-
<S.DragAndDropWrapper
|
|
139
|
-
inDropZone={inDropZone}
|
|
140
|
-
uploading={isUploading}
|
|
141
|
-
success={isSuccess}
|
|
142
|
-
error={isError}
|
|
143
|
-
>
|
|
139
|
+
<S.DragAndDropWrapper inDropZone={inDropZone} uploading={isUploading} success={isSuccess} error={isError}>
|
|
144
140
|
{allowUpload ? renderDragAndDrop() : renderPlaceholder()}
|
|
145
141
|
</S.DragAndDropWrapper>
|
|
146
|
-
<S.UploadingWrapper
|
|
147
|
-
inDropZone={inDropZone}
|
|
148
|
-
uploading={isUploading}
|
|
149
|
-
success={isSuccess}
|
|
150
|
-
error={isError}
|
|
151
|
-
>
|
|
142
|
+
<S.UploadingWrapper inDropZone={inDropZone} uploading={isUploading} success={isSuccess} error={isError}>
|
|
152
143
|
<S.StatusWrapper>
|
|
153
144
|
<S.UploadingStatus>
|
|
154
145
|
<S.DragIcon>
|
|
@@ -184,9 +175,9 @@ interface IGalleryDragAndDropProps {
|
|
|
184
175
|
site: number | string;
|
|
185
176
|
allowUpload: boolean;
|
|
186
177
|
refreshImages: () => Promise<void>;
|
|
187
|
-
isUploading: boolean
|
|
188
|
-
isSuccess: boolean
|
|
189
|
-
isError: boolean
|
|
178
|
+
isUploading: boolean;
|
|
179
|
+
isSuccess: boolean;
|
|
180
|
+
isError: boolean;
|
|
190
181
|
errorMsg: string;
|
|
191
182
|
}
|
|
192
183
|
|
|
@@ -200,7 +191,7 @@ const mapStateToProps = (state: IRootState) => ({
|
|
|
200
191
|
interface IDispatchProps {
|
|
201
192
|
getSiteImages(params: IGetSiteImages): Promise<void>;
|
|
202
193
|
selectImage(item: IImage): void;
|
|
203
|
-
uploadError: (error: string) => Promise<void>;
|
|
194
|
+
uploadError: (error: boolean, msg?: string) => Promise<void>;
|
|
204
195
|
uploadImage: (imageFile: File, site: number | string) => Promise<IImage>;
|
|
205
196
|
}
|
|
206
197
|
|
|
@@ -213,4 +204,4 @@ const mapDispatchToProps = {
|
|
|
213
204
|
|
|
214
205
|
type IProps = IGalleryDragAndDropProps & IDispatchProps;
|
|
215
206
|
|
|
216
|
-
export default connect(mapStateToProps, mapDispatchToProps)(memo(GalleryDragAndDrop));
|
|
207
|
+
export default connect(mapStateToProps, mapDispatchToProps)(memo(GalleryDragAndDrop));
|
|
@@ -17,7 +17,7 @@ const itemsPerPage = 50;
|
|
|
17
17
|
const firstPage = 1;
|
|
18
18
|
|
|
19
19
|
const Gallery = (props: IProps): JSX.Element => {
|
|
20
|
-
const { data, isLoading, getSiteImages, selectImage, getImageSelected, toggleModal, site } = props;
|
|
20
|
+
const { data, isLoading, getSiteImages, selectImage, getImageSelected, toggleModal, site, uploadError } = props;
|
|
21
21
|
|
|
22
22
|
const tabs = [];
|
|
23
23
|
if (site) tabs.unshift(...["Local", "Global"]);
|
|
@@ -48,6 +48,7 @@ const Gallery = (props: IProps): JSX.Element => {
|
|
|
48
48
|
pageRef.current = getParams().page;
|
|
49
49
|
|
|
50
50
|
useEffect(() => {
|
|
51
|
+
uploadError(false);
|
|
51
52
|
const params = getParams();
|
|
52
53
|
getSiteImages({ ...params, page: firstPage });
|
|
53
54
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -220,11 +221,13 @@ const mapStateToProps = (state: IRootState) => ({
|
|
|
220
221
|
interface IDispatchProps {
|
|
221
222
|
getSiteImages(params: IGetSiteImages): Promise<void>;
|
|
222
223
|
selectImage(item: IImage): void;
|
|
224
|
+
uploadError: (error: boolean, msg?: string) => Promise<void>;
|
|
223
225
|
}
|
|
224
226
|
|
|
225
227
|
const mapDispatchToProps = {
|
|
226
228
|
getSiteImages: galleryActions.getSiteImages,
|
|
227
229
|
selectImage: galleryActions.selectImage,
|
|
230
|
+
uploadError: galleryActions.uploadError,
|
|
228
231
|
};
|
|
229
232
|
|
|
230
233
|
type IProps = IGalleryProps & IDispatchProps;
|
|
@@ -47,8 +47,8 @@ function setUploadSuccess(isSuccess: boolean): ISetUploadSuccess {
|
|
|
47
47
|
return { type: SET_UPLOAD_SUCCESS, payload: { isUploading: false, isSuccess } };
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
function setUploadError(errorMsg = ""): ISetUploadError {
|
|
51
|
-
return { type: SET_UPLOAD_ERROR, payload: { inDropZone: false, isUploading: false, isError
|
|
50
|
+
function setUploadError(isError: boolean, errorMsg = ""): ISetUploadError {
|
|
51
|
+
return { type: SET_UPLOAD_ERROR, payload: { inDropZone: false, isUploading: false, isError, errorMsg } };
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
function getSiteImages(props: IGetSiteImages): (dispatch: Dispatch, getState: () => IRootState) => Promise<void> {
|
|
@@ -110,7 +110,7 @@ function uploadImage(imageFile: File, site: number | string): (dispatch: Dispatc
|
|
|
110
110
|
// dispatch(setInDropZone(false));
|
|
111
111
|
return { ...result.data, file: image };
|
|
112
112
|
} else {
|
|
113
|
-
dispatch(setUploadError("Error uploading image"));
|
|
113
|
+
dispatch(setUploadError(true, "Error uploading image"));
|
|
114
114
|
}
|
|
115
115
|
} catch (e) {
|
|
116
116
|
console.log(e);
|
|
@@ -118,9 +118,9 @@ function uploadImage(imageFile: File, site: number | string): (dispatch: Dispatc
|
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
function uploadError(error: string): (dispatch: Dispatch) => Promise<void> {
|
|
121
|
+
function uploadError(error: boolean, msg?: string): (dispatch: Dispatch) => Promise<void> {
|
|
122
122
|
return async (dispatch) => {
|
|
123
|
-
dispatch(setUploadError(error));
|
|
123
|
+
dispatch(setUploadError(error, msg));
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -4,8 +4,9 @@ export const Form = styled.div`
|
|
|
4
4
|
display: flex;
|
|
5
5
|
height: 100%;
|
|
6
6
|
width: 100%;
|
|
7
|
-
padding: ${(p) => p.theme.spacing.m};
|
|
7
|
+
padding: ${(p) => `${p.theme.spacing.m} ${p.theme.spacing.m} 0 ${p.theme.spacing.m}`};
|
|
8
8
|
flex-direction: column;
|
|
9
|
+
overflow: auto;
|
|
9
10
|
`;
|
|
10
11
|
|
|
11
12
|
export const FieldsWrapper = styled.div`
|