diff --git a/.eslintrc.json b/.eslintrc.json index c38f6d5..2e19d6b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -97,6 +97,7 @@ "@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/no-unused-vars": "warn", "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/ban-types": "off", "array-bracket-spacing": ["warn", "never"], "block-spacing": ["warn", "never"], "brace-style": ["warn", "1tbs", {"allowSingleLine": true}], diff --git a/src/app/components/both-menu/BothMenu.tsx b/src/app/components/both-menu/BothMenu.tsx index 59440a8..d1d8a14 100644 --- a/src/app/components/both-menu/BothMenu.tsx +++ b/src/app/components/both-menu/BothMenu.tsx @@ -10,19 +10,19 @@ import {NavLink} from 'react-router-dom'; import {ROUTES} from '_consts/common'; import ToggleMenu from '../toggle-menu'; import {BOTH_MENU_LINKS} from '../../consts'; -import PopupList from '../popup-list/PopupList'; +import PopupList from '../popup-list'; const useStyles = makeStyles((theme: Theme) => createStyles({ iconRight: { - marginRight: theme.spacing(2), + marginRight: theme.spacing(2) }, appBar: { top: 'auto', - bottom: 0, + bottom: 0 }, grow: { - flexGrow: 1, + flexGrow: 1 }, fabButton: { position: 'absolute', @@ -30,9 +30,9 @@ const useStyles = makeStyles((theme: Theme) => top: -30, left: 0, right: 0, - margin: '0 auto', - }, - }), + margin: '0 auto' + } + }) ); type Props = { @@ -44,58 +44,37 @@ const BothMenu: React.FC = ({trigger}) => { return ( - + - + - + - +
- + - + - + ); }; diff --git a/src/app/components/create-task-modal/CreateTaskModal.tsx b/src/app/components/create-task-modal/CreateTaskModal.tsx index d9b7bbc..a8fd0e3 100644 --- a/src/app/components/create-task-modal/CreateTaskModal.tsx +++ b/src/app/components/create-task-modal/CreateTaskModal.tsx @@ -1,4 +1,5 @@ -import React, {FC, memo} from 'react'; +import React, {FC, memo, useCallback} from 'react'; +import {useHistory} from 'react-router-dom'; import {format} from 'date-fns'; import {useFormik} from 'formik'; import Dialog from '@material-ui/core/Dialog'; @@ -7,6 +8,8 @@ import DialogContent from '@material-ui/core/DialogContent'; import DialogTitle from '@material-ui/core/DialogTitle'; import {Task} from '_types/common'; import {VIEW_DATE_TIME} from '_consts/common'; +import {buildPath} from '_utils/buildPath'; +import {PageType} from '_enums/common'; import {Button, TextField} from '@material-ui/core'; import {LABELS} from '../../consts'; @@ -17,18 +20,23 @@ type Props = { const now = format(new Date(), VIEW_DATE_TIME); const CreateTaskModal: FC = ({isOpen}) => { + const history = useHistory(); const form = useFormik>({ initialValues: { title: '', body: '', start_at: now, - end_at: '', + end_at: '' }, onSubmit: () => { // В аргументах приходят values. Ждем задачи со сторами для формы - }, + } }); + const handleClose = useCallback(() => { + history.push(buildPath({pageType: PageType.Main})); + }, [history]); + return (
@@ -61,7 +69,7 @@ const CreateTaskModal: FC = ({isOpen}) => { onChange={form.handleChange} margin="dense" InputLabelProps={{ - shrink: true, + shrink: true }} fullWidth /> @@ -73,13 +81,13 @@ const CreateTaskModal: FC = ({isOpen}) => { onChange={form.handleChange} margin="dense" InputLabelProps={{ - shrink: true, + shrink: true }} fullWidth /> -