aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorilyayudovin <46264063+ilyayudovin@users.noreply.github.com>2020-11-17 15:51:37 +0300
committerGitHub <noreply@github.com>2020-11-17 15:51:37 +0300
commitbd9a1b7f4222788c784c2c14366e5181da520cf9 (patch)
tree5227a935584dbbdf68f8be8278a3fdeb7b300734 /src
parentdb731f1b88fdfa95f16255767e44762211f47196 (diff)
parentfe82b4e0ef835e6921575f1927174479bea7f777 (diff)
downloadwhich-ui-bd9a1b7f4222788c784c2c14366e5181da520cf9.tar.gz
Merge pull request #109 from which-ecosystem/avatarCrop
fix: clear eslint errors
Diffstat (limited to 'src')
-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
5 files changed, 28 insertions, 23 deletions
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