@blerp/design 1.2.74 → 1.2.76
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/dist/cjs/Blerp/BlerpImageRow.js +167 -0
- package/dist/cjs/Blerp/BlerpSavePopup.js +157 -0
- package/dist/cjs/Blerp/BlerpTitleRow.js +116 -0
- package/dist/cjs/Blerp/BlerpTopRow.js +246 -0
- package/dist/cjs/Blerp.js +239 -0
- package/dist/cjs/BlerpAudioContextProvider.js +141 -0
- package/dist/cjs/BlerpListView.js +357 -0
- package/dist/cjs/BlerpListViewPremium.js +404 -0
- package/dist/cjs/BlerpListViewSkeleton.js +27 -0
- package/dist/cjs/BlerpSkeleton.js +23 -0
- package/dist/cjs/CollectionCard.js +402 -0
- package/dist/cjs/CollectionListViewPremium.js +368 -0
- package/dist/cjs/CollectionSkeleton.js +28 -0
- package/dist/cjs/Dropdown.js +283 -0
- package/dist/cjs/EllipsisLoader.js +51 -0
- package/dist/cjs/GroupCard.js +172 -0
- package/dist/cjs/Icons/Icons.js +606 -0
- package/dist/cjs/ImageUploadModal.js +278 -0
- package/dist/cjs/Lotties/JiggleLock.json.js +2762 -0
- package/dist/cjs/Lotties/LottieAnimation.js +32 -0
- package/dist/cjs/NewBlerp.js +740 -0
- package/dist/cjs/NewBlerpTest.js +808 -0
- package/dist/cjs/NewCollectionModal.js +403 -0
- package/dist/cjs/PremiumCollectionCard.js +511 -0
- package/dist/cjs/PurchaseModals/CheckoutModal.js +39 -0
- package/dist/cjs/PurchaseModals/PremiumBlerpCheckoutModal.js +39 -0
- package/dist/cjs/PurchaseModals/PremiumCollectionCheckoutModal.js +39 -0
- package/dist/cjs/PurchaseModals/PremiumSubscriptionCheckoutModal.js +39 -0
- package/dist/cjs/ReactionButtons.js +65 -0
- package/dist/cjs/ScreenSizeHook.js +34 -0
- package/dist/cjs/SnackbarContextProvider.js +166 -0
- package/dist/cjs/Theme.js +255 -0
- package/dist/cjs/Toggle.js +59 -0
- package/dist/cjs/UserCard.js +141 -0
- package/dist/cjs/UserPage/LibraryControls.js +315 -0
- package/dist/cjs/UserPage/UserLibraryHeader.js +93 -0
- package/dist/cjs/UserPage/UserProfileHeader.js +283 -0
- package/dist/cjs/UsernameWithPopout.js +93 -0
- package/dist/cjs/colors.js +368 -0
- package/dist/cjs/icons.js +161 -0
- package/dist/cjs/index.js +449 -0
- package/dist/esm/Blerp/BlerpImageRow.js +157 -0
- package/dist/esm/Blerp/BlerpSavePopup.js +147 -0
- package/dist/esm/Blerp/BlerpTitleRow.js +108 -0
- package/dist/esm/Blerp/BlerpTopRow.js +236 -0
- package/dist/esm/Blerp.js +230 -0
- package/dist/esm/BlerpAudioContextProvider.js +132 -0
- package/dist/esm/BlerpListView.js +344 -0
- package/dist/esm/BlerpListViewPremium.js +391 -0
- package/dist/esm/BlerpListViewSkeleton.js +17 -0
- package/dist/esm/BlerpSkeleton.js +13 -0
- package/dist/esm/CollectionCard.js +392 -0
- package/dist/esm/CollectionListViewPremium.js +354 -0
- package/dist/esm/CollectionSkeleton.js +18 -0
- package/dist/esm/Dropdown.js +273 -0
- package/dist/esm/EllipsisLoader.js +41 -0
- package/dist/esm/GroupCard.js +162 -0
- package/dist/esm/Icons/Icons.js +571 -0
- package/dist/esm/ImageUploadModal.js +265 -0
- package/dist/esm/Lotties/JiggleLock.json.js +2747 -0
- package/dist/esm/Lotties/LottieAnimation.js +25 -0
- package/dist/esm/NewBlerp.js +719 -0
- package/dist/esm/NewBlerpTest.js +787 -0
- package/dist/esm/NewCollectionModal.js +391 -0
- package/dist/esm/PremiumCollectionCard.js +498 -0
- package/dist/esm/PurchaseModals/CheckoutModal.js +33 -0
- package/dist/esm/PurchaseModals/PremiumBlerpCheckoutModal.js +33 -0
- package/dist/esm/PurchaseModals/PremiumCollectionCheckoutModal.js +33 -0
- package/dist/esm/PurchaseModals/PremiumSubscriptionCheckoutModal.js +33 -0
- package/dist/esm/ReactionButtons.js +57 -0
- package/dist/esm/ScreenSizeHook.js +30 -0
- package/dist/esm/SnackbarContextProvider.js +154 -0
- package/dist/esm/Theme.js +246 -0
- package/dist/esm/Toggle.js +49 -0
- package/dist/esm/UserCard.js +133 -0
- package/dist/esm/UserPage/LibraryControls.js +301 -0
- package/dist/esm/UserPage/UserLibraryHeader.js +87 -0
- package/dist/esm/UserPage/UserProfileHeader.js +268 -0
- package/dist/esm/UsernameWithPopout.js +85 -0
- package/dist/esm/colors.js +360 -0
- package/dist/esm/icons.js +159 -0
- package/dist/esm/index.js +336 -0
- package/package.json +2 -1
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
|
|
3
|
+
import { Stack, Text, Button } from './index.js';
|
|
4
|
+
import React, { useState, useEffect, createRef } from 'react';
|
|
5
|
+
import AvatarEditor from 'react-avatar-editor';
|
|
6
|
+
import Dropzone from 'react-dropzone';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import InsertPhotoRoundedIcon from '@mui/icons-material/InsertPhotoRounded';
|
|
9
|
+
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
|
|
10
|
+
import { useWindowSize } from './ScreenSizeHook.js';
|
|
11
|
+
|
|
12
|
+
var _templateObject, _templateObject2;
|
|
13
|
+
const Slider = styled.input(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n -webkit-appearance: none;\n align-self: center;\n width: 80%;\n height: 5px;\n border-radius: 5px;\n background: #d3d3d3;\n outline: none;\n opacity: 0.7;\n -webkit-transition: 0.2s;\n transition: opacity 0.2s;\n\n &:focus {\n border: 0px !important;\n }\n\n &:hover {\n opacity: 1;\n }\n\n &::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 25px;\n height: 25px;\n border-radius: 50%;\n background: ", ";\n border: 2px solid ", ";\n cursor: pointer;\n }\n\n &::-moz-range-thumb {\n width: 25px;\n height: 25px;\n border-radius: 50%;\n background: ", ";\n border: 2px solid ", ";\n cursor: pointer;\n }\n"])), props => props.theme.colors.ibisRed, props => props.theme.colors.waxwing, props => props.theme.colors.ibisRed, props => props.theme.colors.waxwing);
|
|
14
|
+
const ZoomIcon = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-image: url(\"https://cdn.blerp.com/blerp_products/Web/Account/zoom%20icon.svg?folder=true&organizationId=true\");\n background-repeat: no-repeat;\n background-position: left;\n background-size: cover;\n width: 20px;\n height: 20px;\n"])));
|
|
15
|
+
|
|
16
|
+
const ImageUploadModal = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
prevImage,
|
|
19
|
+
updateImage,
|
|
20
|
+
onClose,
|
|
21
|
+
title,
|
|
22
|
+
isCircularImage,
|
|
23
|
+
isSquareImage,
|
|
24
|
+
sizeInfo
|
|
25
|
+
} = _ref;
|
|
26
|
+
const [image, setImage] = useState(prevImage);
|
|
27
|
+
const [zoom, setZoom] = useState(50);
|
|
28
|
+
const [loading, setLoading] = useState(false);
|
|
29
|
+
const [dropzoneHovered, setDropzoneHovered] = useState(false);
|
|
30
|
+
const size = useWindowSize();
|
|
31
|
+
|
|
32
|
+
const urlToObject = async img => {
|
|
33
|
+
const response = await fetch(img); // here image is url/location of image
|
|
34
|
+
|
|
35
|
+
const blob = await response.blob();
|
|
36
|
+
const file = new File([blob], img, {
|
|
37
|
+
type: blob.type,
|
|
38
|
+
size: blob.type
|
|
39
|
+
});
|
|
40
|
+
setImage(file);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (prevImage) {
|
|
45
|
+
urlToObject(prevImage);
|
|
46
|
+
}
|
|
47
|
+
}, [prevImage]);
|
|
48
|
+
const imageEditorRef = /*#__PURE__*/createRef();
|
|
49
|
+
|
|
50
|
+
const handleImageDrop = acceptedFiles => {
|
|
51
|
+
if (acceptedFiles[0].type === "image/gif") {
|
|
52
|
+
console.log("hit dat GIF in IF");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
setImage(acceptedFiles[0]);
|
|
56
|
+
setDropzoneHovered(false);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const handleGifUpload = async () => {
|
|
60
|
+
if (image.name !== prevImage) {
|
|
61
|
+
console.log("does not equal");
|
|
62
|
+
updateImage(image);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
onClose();
|
|
66
|
+
}; // This is called when there is a non-gif photo ready to be uploaded
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const handleUploadClick = async () => {
|
|
70
|
+
// check image exists
|
|
71
|
+
if (!image) {
|
|
72
|
+
alert("You must upload a valid image");
|
|
73
|
+
return;
|
|
74
|
+
} // check image size
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
if (image.size > 8842038) {
|
|
78
|
+
alert("You must update with a valid image less then 7mb");
|
|
79
|
+
return;
|
|
80
|
+
} // create a dom element for the photo and creates a data URL (URI)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
setLoading(true);
|
|
84
|
+
const canvas = imageEditorRef.current.getImage().toDataURL();
|
|
85
|
+
let file;
|
|
86
|
+
await fetch(canvas) // canvas res is the URL data of the photo. Now the .blob() method reads that data URL (URI), and creates a new Blob (file-like object of immutable data)
|
|
87
|
+
.then(res => res.blob()).then(blob => {
|
|
88
|
+
// assign the blob data to the DOM STRING of the DOM element
|
|
89
|
+
window.URL.createObjectURL(blob); // create an image file using the data from the blob, assign the file a name, assign the file type
|
|
90
|
+
// Adding ".JPG" is totally janky, but since the database currently reads the file type from the name of the file (not the image.type), and since we are changing the image.name to match the url of the image, an error will be thrown if we do not declare a file type at the end.
|
|
91
|
+
|
|
92
|
+
file = new File([blob], image.name, {
|
|
93
|
+
type: image.type,
|
|
94
|
+
size: image.size
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
await updateImage(file);
|
|
98
|
+
setLoading(false);
|
|
99
|
+
onClose();
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
return /*#__PURE__*/React.createElement(Stack, {
|
|
103
|
+
sx: {
|
|
104
|
+
minHeight: "580px"
|
|
105
|
+
},
|
|
106
|
+
alignItems: "center",
|
|
107
|
+
justifyContent: "space-between"
|
|
108
|
+
}, /*#__PURE__*/React.createElement(CloseRoundedIcon, {
|
|
109
|
+
sx: {
|
|
110
|
+
position: "absolute",
|
|
111
|
+
cursor: "pointer",
|
|
112
|
+
top: "20px",
|
|
113
|
+
right: "20px"
|
|
114
|
+
},
|
|
115
|
+
onClick: () => onClose()
|
|
116
|
+
}), /*#__PURE__*/React.createElement(Stack, {
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
sx: {
|
|
119
|
+
position: "relative"
|
|
120
|
+
}
|
|
121
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
122
|
+
sx: {
|
|
123
|
+
fontSize: "32px",
|
|
124
|
+
marginbottom: "16px"
|
|
125
|
+
}
|
|
126
|
+
}, title), /*#__PURE__*/React.createElement(Text, {
|
|
127
|
+
color: "grey4",
|
|
128
|
+
sx: {
|
|
129
|
+
fontWeight: "lighter",
|
|
130
|
+
marginBottom: "2px"
|
|
131
|
+
}
|
|
132
|
+
}, "Adjust your image below."), /*#__PURE__*/React.createElement(Text, {
|
|
133
|
+
color: "grey4",
|
|
134
|
+
sx: {
|
|
135
|
+
fontWeight: "lighter",
|
|
136
|
+
marginBottom: "2px"
|
|
137
|
+
}
|
|
138
|
+
}, sizeInfo)), loading ? /*#__PURE__*/React.createElement("div", {
|
|
139
|
+
style: {
|
|
140
|
+
width: "100%",
|
|
141
|
+
height: "300px"
|
|
142
|
+
}
|
|
143
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Loading...")) : /*#__PURE__*/React.createElement(Stack, {
|
|
144
|
+
sx: {
|
|
145
|
+
minWidth: "300px",
|
|
146
|
+
margin: "0px 0",
|
|
147
|
+
position: "relative",
|
|
148
|
+
backgroundColor: "waxwing.main",
|
|
149
|
+
maxHeight: "250px",
|
|
150
|
+
overflow: "hidden",
|
|
151
|
+
justifyContent: "center",
|
|
152
|
+
alignItems: "center"
|
|
153
|
+
}
|
|
154
|
+
}, image ? image.type !== "image/gif" ? isCircularImage ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AvatarEditor, {
|
|
155
|
+
ref: imageEditorRef,
|
|
156
|
+
width: 250,
|
|
157
|
+
height: 250,
|
|
158
|
+
borderRadius: 125,
|
|
159
|
+
image: image,
|
|
160
|
+
scale: zoom / 50,
|
|
161
|
+
crossOrigin: "anonymous"
|
|
162
|
+
})) : isSquareImage ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AvatarEditor, {
|
|
163
|
+
ref: imageEditorRef,
|
|
164
|
+
width: 250,
|
|
165
|
+
height: 250,
|
|
166
|
+
borderRadius: 0,
|
|
167
|
+
image: image,
|
|
168
|
+
scale: zoom / 50,
|
|
169
|
+
crossOrigin: "anonymous"
|
|
170
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AvatarEditor, {
|
|
171
|
+
ref: imageEditorRef,
|
|
172
|
+
width: 650,
|
|
173
|
+
height: 225,
|
|
174
|
+
image: image,
|
|
175
|
+
scale: zoom / 50,
|
|
176
|
+
crossorigin: "anonymous"
|
|
177
|
+
})) : /*#__PURE__*/React.createElement("img", {
|
|
178
|
+
src: URL.createObjectURL(image) || image.name,
|
|
179
|
+
width: "250px",
|
|
180
|
+
height: "auto",
|
|
181
|
+
style: {
|
|
182
|
+
alignSelf: "center"
|
|
183
|
+
}
|
|
184
|
+
}) : /*#__PURE__*/React.createElement(Dropzone, {
|
|
185
|
+
onDragEnter: () => setDropzoneHovered(true),
|
|
186
|
+
onDragLeave: () => setDropzoneHovered(false),
|
|
187
|
+
onDrop: acceptedFiles => handleImageDrop(acceptedFiles)
|
|
188
|
+
}, _ref2 => {
|
|
189
|
+
let {
|
|
190
|
+
getRootProps,
|
|
191
|
+
getInputProps
|
|
192
|
+
} = _ref2;
|
|
193
|
+
return /*#__PURE__*/React.createElement(Stack, {
|
|
194
|
+
sx: {
|
|
195
|
+
width: "100%",
|
|
196
|
+
height: size.width > 600 ? "300px" : "200px",
|
|
197
|
+
cursor: "pointer",
|
|
198
|
+
box: "borderBox",
|
|
199
|
+
justifyContent: "center"
|
|
200
|
+
}
|
|
201
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
202
|
+
style: {
|
|
203
|
+
height: "100%",
|
|
204
|
+
display: "flex"
|
|
205
|
+
}
|
|
206
|
+
}, getRootProps()), /*#__PURE__*/React.createElement("input", getInputProps()), dropzoneHovered ? /*#__PURE__*/React.createElement(Stack, {
|
|
207
|
+
color: "grey3",
|
|
208
|
+
style: {
|
|
209
|
+
justifyContent: "center",
|
|
210
|
+
alignItems: "center",
|
|
211
|
+
width: "100%"
|
|
212
|
+
}
|
|
213
|
+
}, /*#__PURE__*/React.createElement(InsertPhotoRoundedIcon, {
|
|
214
|
+
style: {
|
|
215
|
+
color: "white",
|
|
216
|
+
height: "90%",
|
|
217
|
+
width: "90%"
|
|
218
|
+
}
|
|
219
|
+
})) : /*#__PURE__*/React.createElement(Text, {
|
|
220
|
+
sx: {
|
|
221
|
+
flexWrap: "wrap",
|
|
222
|
+
width: "80%",
|
|
223
|
+
alignSelf: "center",
|
|
224
|
+
textAlign: "center",
|
|
225
|
+
verticalAlign: "center",
|
|
226
|
+
margin: "auto"
|
|
227
|
+
}
|
|
228
|
+
}, "Click or drop image here to upload.")));
|
|
229
|
+
})), /*#__PURE__*/React.createElement(Stack, {
|
|
230
|
+
alignItems: "center"
|
|
231
|
+
}, image && image.type !== "image/gif" ? /*#__PURE__*/React.createElement(Stack, {
|
|
232
|
+
direction: "row",
|
|
233
|
+
style: {
|
|
234
|
+
justifyContent: "space-around"
|
|
235
|
+
}
|
|
236
|
+
}, /*#__PURE__*/React.createElement(ZoomIcon, null), /*#__PURE__*/React.createElement(Slider, {
|
|
237
|
+
type: "range",
|
|
238
|
+
min: "35",
|
|
239
|
+
max: "100",
|
|
240
|
+
value: zoom,
|
|
241
|
+
onChange: e => setZoom(e.target.value)
|
|
242
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(Button, {
|
|
243
|
+
variant: "text",
|
|
244
|
+
color: "notBlack",
|
|
245
|
+
sx: {
|
|
246
|
+
textDecoration: "none",
|
|
247
|
+
textTransform: "none",
|
|
248
|
+
cursor: "pointer",
|
|
249
|
+
textDecoration: "underline",
|
|
250
|
+
margin: "20px 0"
|
|
251
|
+
},
|
|
252
|
+
onClick: () => setImage(image ? null : () => {
|
|
253
|
+
urlToObject(prevImage);
|
|
254
|
+
return image;
|
|
255
|
+
})
|
|
256
|
+
}, image ? "Change Image" : "Cancel"), /*#__PURE__*/React.createElement(Button, {
|
|
257
|
+
variant: "contained",
|
|
258
|
+
disableElevation: true,
|
|
259
|
+
onClick: () => {
|
|
260
|
+
image.type === "image/gif" ? handleGifUpload() : handleUploadClick();
|
|
261
|
+
}
|
|
262
|
+
}, "Save Image")));
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export default ImageUploadModal;
|