aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilyayudovin <ilyayudovin123@gmail.com>2020-11-17 15:49:05 +0300
committerilyayudovin <ilyayudovin123@gmail.com>2020-11-17 15:49:05 +0300
commitfe82b4e0ef835e6921575f1927174479bea7f777 (patch)
tree5227a935584dbbdf68f8be8278a3fdeb7b300734
parent99b4e4aa53d3ade389fc270f9ba9b02904da93f6 (diff)
downloadwhich-ui-fe82b4e0ef835e6921575f1927174479bea7f777.tar.gz
fix: clear eslint errors
-rw-r--r--package-lock.json26
-rw-r--r--package.json2
-rw-r--r--src/components/ImageCropAreaSelect/ImageCropAreaSelect.tsx19
-rw-r--r--src/components/ModalScreen/ModalScreen.tsx4
-rw-r--r--src/containers/AvatarCropModal/AvatarCropModal.tsx8
-rw-r--r--src/containers/PollCreation/PollCreation.tsx4
-rw-r--r--src/containers/Profile/ProfileInfo.tsx16
7 files changed, 52 insertions, 27 deletions
diff --git a/package-lock.json b/package-lock.json
index 7b9db26..d236486 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6405,6 +6405,14 @@
"resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz",
"integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ=="
},
+ "history": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/history/-/history-5.0.0.tgz",
+ "integrity": "sha512-3NyRMKIiFSJmIPdq7FxkNMJkQ7ZEtVblOQ38VtKaA0zZMW1Eo6Q6W8oDKEflr1kNNTItSnk4JMCO1deeSgbLLg==",
+ "requires": {
+ "@babel/runtime": "^7.7.6"
+ }
+ },
"hmac-drbg": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
@@ -8425,12 +8433,22 @@
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="
},
"mini-create-react-context": {
- "version": "0.4.0",
- "resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.0.tgz",
- "integrity": "sha512-b0TytUgFSbgFJGzJqXPKCFCBWigAjpjo+Fl7Vf7ZbKRDptszpppKxXH6DRXEABZ/gcEQczeb0iZ7JvL8e8jjCA==",
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz",
+ "integrity": "sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==",
"requires": {
- "@babel/runtime": "^7.5.5",
+ "@babel/runtime": "^7.12.1",
"tiny-warning": "^1.0.3"
+ },
+ "dependencies": {
+ "@babel/runtime": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz",
+ "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==",
+ "requires": {
+ "regenerator-runtime": "^0.13.4"
+ }
+ }
}
},
"mini-css-extract-plugin": {
diff --git a/package.json b/package.json
index 6a58a9c..fafb806 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,7 @@
"bluebird": "^3.7.2",
"compressorjs": "^1.0.6",
"formik": "^2.1.5",
+ "history": "^5.0.0",
"lodash": "^4.17.15",
"notistack": "^0.9.17",
"react": "^16.13.1",
@@ -17,6 +18,7 @@
"react-easy-crop": "^3.2.2",
"react-error-boundary": "^2.3.1",
"react-icons": "^3.10.0",
+ "react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"react-virtualized": "^9.21.2",
diff --git a/src/components/ImageCropAreaSelect/ImageCropAreaSelect.tsx b/src/components/ImageCropAreaSelect/ImageCropAreaSelect.tsx
index b4540da..07d1534 100644
--- a/src/components/ImageCropAreaSelect/ImageCropAreaSelect.tsx
+++ b/src/components/ImageCropAreaSelect/ImageCropAreaSelect.tsx
@@ -1,7 +1,7 @@
-import React, {useCallback, useState} from 'react';
+import React, { useCallback, useState } from 'react';
import Cropper from 'react-easy-crop';
-import {makeStyles} from '@material-ui/core/styles';
-import {Slider} from "@material-ui/core";
+import { makeStyles } from '@material-ui/core/styles';
+import { Slider } from '@material-ui/core';
interface Area {
x: number;
@@ -22,17 +22,18 @@ const useStyles = makeStyles(theme => ({
height: 'calc(100vh - 130px)',
background: '#333',
[theme.breakpoints.up('sm')]: {
- height: 400,
+ height: 400
}
},
sliderContainer: {
- padding: 20,
+ padding: 20
}
}));
-const ImageCropAreaSelect: React.FC<PropTypes> = ({image, setArea}) => {
+const ImageCropAreaSelect: React.FC<PropTypes> = ({ image, setArea }) => {
const classes = useStyles();
- const [crop, setCrop] = useState({x: 0, y: 0});
+ const [crop, setCrop] = useState({ x: 0, y: 0 });
+ // eslint-disable-next-line
const [zoom, setZoom] = useState<any>(1);
const onCropComplete = useCallback((areaPercentage: Area, areaPixels: Area): void => {
@@ -62,11 +63,11 @@ const ImageCropAreaSelect: React.FC<PropTypes> = ({image, setArea}) => {
max={3}
step={0.01}
aria-labelledby="Zoom"
- onChange={(e, zoom) => setZoom(zoom)}
+ onChange={() => setZoom(zoom)}
/>
</div>
</div>
- )
+ );
};
export default ImageCropAreaSelect;
diff --git a/src/components/ModalScreen/ModalScreen.tsx b/src/components/ModalScreen/ModalScreen.tsx
index b71c2c8..3d0db34 100644
--- a/src/components/ModalScreen/ModalScreen.tsx
+++ b/src/components/ModalScreen/ModalScreen.tsx
@@ -42,7 +42,9 @@ const Transition = React.forwardRef((
ref: React.Ref<unknown>
) => <Slide direction="left" ref={ref} {...props} />);
-const ModalScreen: React.FC<PropTypes> = ({ title, actionIcon, handleAction, isActionDisabled, handleCloseModal, children }) => {
+const ModalScreen: React.FC<PropTypes> = (
+ { title, actionIcon, handleAction, isActionDisabled, handleCloseModal, children }
+) => {
const [isOpen, setIsOpen] = useState<boolean>(true);
const classes = useStyles();
const theme = useTheme();
diff --git a/src/containers/AvatarCropModal/AvatarCropModal.tsx b/src/containers/AvatarCropModal/AvatarCropModal.tsx
index 4decdfb..e5fcc08 100644
--- a/src/containers/AvatarCropModal/AvatarCropModal.tsx
+++ b/src/containers/AvatarCropModal/AvatarCropModal.tsx
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { makeStyles } from '@material-ui/core/styles';
-import SendIcon from "@material-ui/icons/Send";
-import { getCroppedImg } from './canvasUtils'
+import SendIcon from '@material-ui/icons/Send';
+import { getCroppedImg } from './canvasUtils';
import ImageCropAreaSelect from '../../components/ImageCropAreaSelect/ImageCropAreaSelect';
import ModalScreen from '../../components/ModalScreen/ModalScreen';
@@ -26,7 +26,7 @@ const useStyles = makeStyles(theme => ({
// background: '#333',
[theme.breakpoints.up('sm')]: {
// height: 400,
- },
+ }
}
}));
@@ -51,7 +51,7 @@ const AvatarCropModal: React.FC<PropTypes> = ({ avatar, callback }) => {
/>
</div>
</ModalScreen>
- )
+ );
};
export default AvatarCropModal;
diff --git a/src/containers/PollCreation/PollCreation.tsx b/src/containers/PollCreation/PollCreation.tsx
index 46ab28d..0a7e78d 100644
--- a/src/containers/PollCreation/PollCreation.tsx
+++ b/src/containers/PollCreation/PollCreation.tsx
@@ -1,9 +1,10 @@
-import React, {ChangeEvent, useState, useMemo, useCallback} from 'react';
+import React, { ChangeEvent, useState, useMemo, useCallback } from 'react';
import Bluebird from 'bluebird';
import { makeStyles } from '@material-ui/core/styles';
import { Card, Container, LinearProgress, InputBase, Typography } from '@material-ui/core';
import SendIcon from '@material-ui/icons/Send';
import { useSnackbar } from 'notistack';
+import { useHistory } from 'react-router';
import useS3Preupload from './useS3Preupload';
import ImageInput from './ImageInput';
@@ -13,7 +14,6 @@ import UserStrip from '../../components/UserStrip/UserStrip';
import { post } from '../../requests';
import { useFeed, useProfile } from '../../hooks/APIClient';
import { useAuth } from '../../hooks/useAuth';
-import {useHistory} from "react-router";
const useStyles = makeStyles(theme => ({
images: {
diff --git a/src/containers/Profile/ProfileInfo.tsx b/src/containers/Profile/ProfileInfo.tsx
index 4c9f17e..777a779 100644
--- a/src/containers/Profile/ProfileInfo.tsx
+++ b/src/containers/Profile/ProfileInfo.tsx
@@ -112,21 +112,23 @@ const ProfileInfo: React.FC<PropTypes> = ({
const dateSince = useMemo(() => formatDate(userInfo?.createdAt), [userInfo]);
const handleUpdateAvatar = useCallback(async (file: File) => {
- if (user) uploadFileToS3(file, 0.8, setProgress)
- .then(avatarUrl => patch(`/users/${user._id}`, { avatarUrl }))
- .then(response => setUserInfo(response.data))
- .then(() => setProgress(0));
+ if (user) {
+ uploadFileToS3(file, 0.8, setProgress)
+ .then(avatarUrl => patch(`/users/${user._id}`, { avatarUrl }))
+ .then(response => setUserInfo(response.data))
+ .then(() => setProgress(0));
+ }
}, [user, setUserInfo]);
- const handleCropAvatar = useCallback( async(file: File) => {
+ const handleCropAvatar = useCallback(async (file: File) => {
const imageSrc = URL.createObjectURL(file);
setAvatarToCrop(imageSrc);
- },[]);
+ }, []);
return (
<div className={classes.root}>
{
- avatarToCrop && <AvatarCropModal avatar={avatarToCrop} callback={handleUpdateAvatar}/>
+ avatarToCrop && <AvatarCropModal avatar={avatarToCrop} callback={handleUpdateAvatar} />
}
{
!userInfo