Skip to content

Commit 01cc414

Browse files
committed
Code cleaning, errors fix
1 parent 4c3007d commit 01cc414

34 files changed

+632
-721
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"history": "4.10.1",
4040
"jsonwebtoken": "^8.5.1",
4141
"line-awesome": "^1.3.0",
42+
"lodash": "^4.17.21",
4243
"moment": "2.29.1",
4344
"mui-datatables": "^4.2.2",
4445
"query-string": "7.1.0",

src/components/App.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,16 @@ import React from 'react';
22
import { Router, Route, Switch, Redirect } from 'react-router-dom';
33
import { ConnectedRouter } from 'connected-react-router';
44
import { SnackbarProvider } from './Snackbar';
5-
import { Close as CloseIcon } from '@mui/icons-material';
6-
import useStyles from './styles';
5+
76
// components
87
import Layout from './Layout';
98
import Documentation from './Documentation/Documentation';
109

11-
1210
// pages
13-
import Starter from '../pages/starter';
1411
import Error from '../pages/error';
1512
import Login from '../pages/login';
1613
import Verify from '../pages/verify';
1714
import Reset from '../pages/reset';
18-
import Profile from '../pages/profile';
1915

2016
// context
2117
import { useUserState } from '../context/UserContext';
@@ -25,10 +21,6 @@ export default function App() {
2521
// global
2622
let { isAuthenticated } = useUserState();
2723
const isAuth = isAuthenticated();
28-
const classes = useStyles();
29-
function CloseButton({ closeToast, className }) {
30-
return <CloseIcon className={className} onClick={closeToast} />;
31-
}
3224

3325
return (
3426
<>
@@ -50,7 +42,6 @@ export default function App() {
5042

5143
<Route path='/documentation' component={Documentation} />
5244
<PrivateRoute path='/app' component={Layout} />
53-
<PublicRoute path='/starter' component={Starter} />
5445
<PublicRoute path='/login' component={Login} />
5546
<PublicRoute path='/verify-email' exact component={Verify} />
5647
<PublicRoute path='/password-reset' exact component={Reset} />
@@ -73,7 +64,7 @@ export default function App() {
7364
isAuth ? (
7465
React.createElement(component, props)
7566
) : (
76-
<Redirect to={'/starter'} />
67+
<Redirect to={'/login'} />
7768
)
7869
}
7970
/>

src/components/Documentation/Documentation.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,7 @@ const Documentation = (props) => {
5555
alignItems='center'
5656
>
5757
{structure.map((c) => {
58-
// eslint-disable-line
59-
if (
60-
!c.children &&
61-
window.location.hash.includes(c.link) &&
62-
c.link
63-
) {
58+
if (!c.children && window.location.hash.includes(c.link) && c.link) {
6459
return (
6560
<Box display='flex' alignItems='center' key={c.id}>
6661
<Breadcrumbs aria-label='breadcrumb'>
@@ -69,8 +64,8 @@ const Documentation = (props) => {
6964
</Box>
7065
);
7166
} else if (c.children) {
72-
return c.children.map((currentInner) => {
73-
// eslint-disable-line
67+
return c.children.forEach((currentInner) => {
68+
// eslint-disable-array-callback-return
7469
if (window.location.hash.includes(currentInner.link)) {
7570
return (
7671
<Breadcrumbs

src/components/Documentation/components/Sidebar/SidebarStructure.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react';
2-
31
const structure = [
42
{
53
id: 0,

src/components/FormItems/items/ImagesFormItem.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ const ImagesFormItem = (props) => {
1313
path,
1414
fileProps,
1515
max = undefined,
16-
inputProps,
17-
required = false,
16+
inputProps
1817
} = props;
1918

2019
const { label } = schema[name];

src/components/FormItems/items/InputFormItem.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Component } from 'react';
1+
import React from 'react';
22
import PropTypes from 'prop-types';
33
import FormErrors from 'components/FormItems/formErrors';
44
import { FastField } from 'formik';
@@ -9,15 +9,12 @@ const InputFormItem = (props) => {
99
name,
1010
schema,
1111
hint,
12-
size,
13-
password,
1412
placeholder,
1513
autoFocus,
1614
autoComplete,
1715
inputProps,
1816
errorMessage,
19-
multiline,
20-
required = false,
17+
multiline
2118
} = props;
2219

2320
const { label } = schema[name];
@@ -34,11 +31,6 @@ const InputFormItem = (props) => {
3431
multiline={multiline}
3532
rows={multiline && 4}
3633
onChange={(event) => {
37-
const errors = FormErrors.validateStatus(
38-
form,
39-
name,
40-
errorMessage,
41-
);
4234
form.setFieldValue(name, event.target.value);
4335
form.setFieldTouched(name);
4436
}}

src/components/FormItems/items/RadioFormItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import FormLabel from '@mui/material/FormLabel';
99
import { FastField } from 'formik';
1010

1111
const RadioFormItem = (props) => {
12-
const { name, schema, hint, errorMessage, required = false } = props;
12+
const { name, schema, hint, errorMessage } = props;
1313

1414
const { label, options } = schema[name];
1515

src/components/FormItems/items/SwitchFormItem.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Component } from 'react';
1+
import React from 'react';
22
import PropTypes from 'prop-types';
33
import FormErrors from 'components/FormItems/formErrors';
44
import { FastField } from 'formik';
@@ -8,7 +8,7 @@ import Checkbox from '@mui/material/Checkbox';
88
import FormLabel from '@mui/material/FormLabel';
99

1010
const SwitchFormItem = (props) => {
11-
const { name, schema, hint, size, inputProps, errorMessage, required } =
11+
const { name, schema, hint, errorMessage } =
1212
props;
1313

1414
const { label } = schema[name];

src/components/Header/Header.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ export default function Header(props) {
123123
alt={currentUser?.firstName}
124124
// eslint-disable-next-line no-mixed-operators
125125
src={
126-
currentUser?.avatar?.length >= 1 &&
127-
currentUser?.avatar[currentUser.avatar.length - 1].publicUrl
126+
(currentUser?.avatar?.length >= 1 &&
127+
currentUser?.avatar[currentUser.avatar.length - 1].publicUrl) || profile
128128
}
129129
classes={{ root: classes.headerIcon }}
130130
>

src/components/Layout/styles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default makeStyles((theme) => ({
1515
paddingBottom: 70,
1616
},
1717
contentShift: {
18-
width: `calc(100vw - ${240 + theme.spacing(6)}px)`,
18+
width: `calc(100vw - (240px + ${theme.spacing(8)}))`,
1919
transition: theme.transitions.create(['width', 'margin'], {
2020
easing: theme.transitions.easing.sharp,
2121
duration: theme.transitions.duration.enteringScreen,

0 commit comments

Comments
 (0)