|
| 1 | +/* eslint-disable @typescript-eslint/ban-ts-comment */ |
| 2 | +// @ts-nocheck |
| 3 | + |
1 | 4 | import React from 'react';
|
2 | 5 | import { useRouter } from 'next/router';
|
3 | 6 | import Typography from '@material-ui/core/Typography';
|
@@ -60,41 +63,45 @@ export default function Upload() {
|
60 | 63 | }
|
61 | 64 | };
|
62 | 65 |
|
| 66 | + const snack = ( |
| 67 | + <Snackbar |
| 68 | + anchorOrigin={{ |
| 69 | + vertical: 'top', |
| 70 | + horizontal: 'center' |
| 71 | + }} |
| 72 | + open={alertOpen} |
| 73 | + autoHideDuration={6000} |
| 74 | + onClose={() => setAlertOpen(false)} |
| 75 | + > |
| 76 | + <Alert severity={alertSev} variant='filled'> |
| 77 | + {alertMsg} |
| 78 | + </Alert> |
| 79 | + </Snackbar> |
| 80 | + ); |
| 81 | + |
63 | 82 | if (typeof window === 'undefined') return <UIPlaceholder />;
|
64 | 83 | if (!state.loggedIn) router.push('/user/login');
|
65 | 84 | else {
|
66 | 85 | return (
|
67 | 86 | <UI>
|
68 |
| - <Snackbar |
69 |
| - anchorOrigin={{ |
70 |
| - vertical: 'top', |
71 |
| - horizontal: 'center' |
72 |
| - }} |
73 |
| - open={alertOpen} |
74 |
| - autoHideDuration={6000} |
75 |
| - onClose={() => setAlertOpen(false)} |
76 |
| - > |
77 |
| - {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */} |
78 |
| - {/* @ts-ignore */} |
79 |
| - <Alert severity={alertSev} variant='filled'> |
80 |
| - {alertMsg} |
81 |
| - </Alert> |
82 |
| - </Snackbar> |
83 |
| - <Paper elevation={3} className={classes.padding}> |
84 |
| - <Typography variant='h5'> |
85 |
| - Upload |
86 |
| - </Typography> |
87 |
| - <Box m={1}> |
88 |
| - <DropzoneArea |
89 |
| - acceptedFiles={['image/*']} |
90 |
| - dropzoneText={'Drag an image or click to upload an image.'} |
91 |
| - onChange={f => setFiles(f)} |
92 |
| - filesLimit={1} |
93 |
| - maxFileSize={1073741824} // 1gb in byte |
94 |
| - /> |
95 |
| - </Box> |
96 |
| - <Button onClick={handleFileUpload}>Upload</Button> |
97 |
| - </Paper> |
| 87 | + <> |
| 88 | + {snack} |
| 89 | + <Paper elevation={3} className={classes.padding}> |
| 90 | + <Typography variant='h5'> |
| 91 | + Upload |
| 92 | + </Typography> |
| 93 | + <Box m={1}> |
| 94 | + <DropzoneArea |
| 95 | + acceptedFiles={['image/*']} |
| 96 | + dropzoneText={'Drag an image or click to upload an image.'} |
| 97 | + onChange={f => setFiles(f)} |
| 98 | + filesLimit={1} |
| 99 | + maxFileSize={1073741824} // 1gb in byte |
| 100 | + /> |
| 101 | + </Box> |
| 102 | + <Button onClick={handleFileUpload}>Upload</Button> |
| 103 | + </Paper> |
| 104 | + </> |
98 | 105 | </UI>
|
99 | 106 | );
|
100 | 107 | }
|
|
0 commit comments