Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My attempt #14

Closed
wants to merge 4 commits into from
Closed

My attempt #14

wants to merge 4 commits into from

Conversation

Antik-kmsb
Copy link
Collaborator

No description provided.

@@ -0,0 +1 @@
[{"C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\index.js":"1","C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\reportWebVitals.js":"2","C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\app\\index.js":"3","C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\app\\app.js":"4","C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\login\\index.js":"5","C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\map\\index.js":"6","C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\header\\index.js":"7","C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\login\\login.js":"8","C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\header\\header.js":"9","C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\map\\map.js":"10"},{"size":511,"mtime":1606853153784,"results":"11","hashOfConfig":"12"},{"size":362,"mtime":499162500000,"results":"13","hashOfConfig":"12"},{"size":43,"mtime":1606853095997,"results":"14","hashOfConfig":"12"},{"size":423,"mtime":1606853095991,"results":"15","hashOfConfig":"12"},{"size":49,"mtime":1606853096006,"results":"16","hashOfConfig":"12"},{"size":46,"mtime":1606853096014,"results":"17","hashOfConfig":"12"},{"size":52,"mtime":1606853096004,"results":"18","hashOfConfig":"12"},{"size":5247,"mtime":1606853096008,"results":"19","hashOfConfig":"12"},{"size":1052,"mtime":1606853096003,"results":"20","hashOfConfig":"12"},{"size":201,"mtime":1606854924924,"results":"21","hashOfConfig":"12"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},"4twb1e",{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"37","messages":"38","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"39","usedDeprecatedRules":"24"},{"filePath":"40","messages":"41","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"42","messages":"43","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\index.js",[],["44","45"],"C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\reportWebVitals.js",[],"C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\app\\index.js",[],"C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\app\\app.js",[],"C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\login\\index.js",[],"C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\map\\index.js",[],"C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\header\\index.js",[],"C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\login\\login.js",["46","47"],"import React from 'react';\r\nimport Avatar from '@material-ui/core/Avatar';\r\nimport Button from '@material-ui/core/Button';\r\nimport CssBaseline from '@material-ui/core/CssBaseline';\r\nimport TextField from '@material-ui/core/TextField';\r\nimport Link from '@material-ui/core/Link';\r\nimport Grid from '@material-ui/core/Grid';\r\nimport LockOutlinedIcon from '@material-ui/icons/LockOutlined';\r\nimport Typography from '@material-ui/core/Typography';\r\nimport { makeStyles } from '@material-ui/core/styles';\r\nimport Container from '@material-ui/core/Container';\r\nimport { useState } from 'react';\r\nimport { useEffect } from 'react'\r\n \r\n const useStyles = makeStyles((theme) => ({\r\n paper: {\r\n marginTop: theme.spacing(8),\r\n display: 'flex',\r\n flexDirection: 'column',\r\n alignItems: 'center',\r\n },\r\n avatar: {\r\n margin: theme.spacing(1),\r\n backgroundColor: theme.palette.info.dark,\r\n },\r\n form: {\r\n width: '100%', \r\n marginTop: theme.spacing(1),\r\n },\r\n submit: {\r\n margin: theme.spacing(3, 0, 2),\r\n },\r\n }));\r\n \r\n\r\n const Login = () => {\r\n const classes = useStyles();\r\n \r\n const [email, setEmail] = useState('');\r\n const [password, setPassword] = useState('');\r\n const [emailDirty, setEmailDirty] = useState(false);\r\n const [passwordDirty, setPasswordDirty] = useState(false);\r\n const [emailError, setEmailError] = useState('E-mail не может быть пустым');\r\n const [passwordError, setPasswordError] = useState('Пароль не может быть пустым');\r\n const [formValid, setFormValid] = useState(false)\r\n\r\n console.log(emailDirty);\r\n console.log(emailError);\r\n\r\n useEffect( () => {\r\n if (emailError || passwordError) {\r\n setFormValid (false)\r\n } else {\r\n setFormValid (true)\r\n } \r\n }, [emailError, passwordError])\r\n\r\n\r\n const emailHandler = (e) => {\r\n setEmail(e.target.value)\r\n const re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\r\n if(!re.test(String(e.target.value).toLowerCase())) {\r\n setEmailError('Некорректный e-mail')\r\n if (!e.target.value) {\r\n setEmailError ('Пароль не может быть пустым')\r\n }\r\n } else {\r\n setEmailError('')\r\n }\r\n }\r\n\r\n const passwordHandler = (e) => {\r\n setPassword(e.target.value)\r\n if (e.target.value.length < 4) {\r\n setPasswordError('Пароль должен быть больше 4 символов')\r\n if (!e.target.value) {\r\n setPasswordError ('Пароль не может быть пустым')\r\n }\r\n } else {\r\n setPasswordError('')\r\n } \r\n }\r\n\r\n\r\n const blurHandler = (e) => {\r\n switch (e.target.name) {\r\n case 'email':\r\n setEmailDirty (true);\r\n break;\r\n case 'password':\r\n setPasswordDirty (true);\r\n break;\r\n default: \r\n }\r\n }\r\n\r\n return (\r\n <Container component=\"main\" maxWidth=\"xs\">\r\n <CssBaseline />\r\n <div className={classes.paper}>\r\n <Avatar className={classes.avatar}>\r\n <LockOutlinedIcon />\r\n </Avatar>\r\n <Typography component=\"h1\" variant=\"h5\">\r\n Войти\r\n </Typography>\r\n <form className={classes.form}>\r\n {(emailDirty && emailError) && <div style={{color: 'red'}}>{emailError}</div>}\r\n <TextField\r\n value = {email}\r\n variant=\"outlined\"\r\n margin=\"normal\"\r\n required\r\n fullWidth\r\n id=\"email\"\r\n label=\"Ваш e-mail\"\r\n name=\"email\" \r\n autoComplete=\"email\"\r\n autoFocus\r\n onChange = {e => emailHandler(e)}\r\n onBlur = {e => blurHandler(e)}\r\n />\r\n {(passwordDirty && passwordError) && <div style={{color: 'red'}}>{passwordError}</div>}\r\n <TextField\r\n value = {password}\r\n variant=\"outlined\"\r\n margin=\"normal\"\r\n required\r\n fullWidth\r\n name=\"password\"\r\n label=\"Пароль\"\r\n type=\"password\"\r\n id=\"password\"\r\n autoComplete=\"current-password\"\r\n onChange = {e => passwordHandler(e)}\r\n onBlur = {e => blurHandler(e)}\r\n />\r\n <Button\r\n type=\"submit\"\r\n fullWidth\r\n variant=\"contained\"\r\n color=\"primary\"\r\n className={classes.submit}\r\n disabled = {!formValid}\r\n >\r\n Войти\r\n </Button>\r\n <Grid container>\r\n <Grid item xs>\r\n <Link href=\"#\" variant=\"body2\">\r\n Забыли пароль?\r\n </Link>\r\n </Grid>\r\n <Grid item>\r\n <Link href=\"#\" variant=\"body2\">\r\n {\"Зарегистрироваться\"}\r\n </Link>\r\n </Grid>\r\n </Grid>\r\n </form>\r\n </div>\r\n </Container>\r\n );\r\n }\r\n\r\nexport default Login;","C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\header\\header.js",[],"C:\\Users\\vanin\\Desktop\\city-for-life\\frontend\\city-for-life\\src\\components\\map\\map.js",[],{"ruleId":"48","replacedBy":"49"},{"ruleId":"50","replacedBy":"51"},{"ruleId":"52","severity":1,"message":"53","line":61,"column":28,"nodeType":"54","messageId":"55","endLine":61,"endColumn":29,"suggestions":"56"},{"ruleId":"52","severity":1,"message":"53","line":61,"column":53,"nodeType":"54","messageId":"55","endLine":61,"endColumn":54,"suggestions":"57"},"no-native-reassign",["58"],"no-negated-in-lhs",["59"],"no-useless-escape","Unnecessary escape character: \\[.","Literal","unnecessaryEscape",["60","61"],["62","63"],"no-global-assign","no-unsafe-negation",{"messageId":"64","fix":"65","desc":"66"},{"messageId":"67","fix":"68","desc":"69"},{"messageId":"64","fix":"70","desc":"66"},{"messageId":"67","fix":"71","desc":"69"},"removeEscape",{"range":"72","text":"73"},"Remove the `\\`. This maintains the current functionality.","escapeBackslash",{"range":"74","text":"75"},"Replace the `\\` with `\\\\` to include the actual backslash character.",{"range":"76","text":"73"},{"range":"77","text":"75"},[1905,1906],"",[1905,1905],"\\",[1930,1931],[1930,1930]]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Антон, этот файл надо удалить из коммита. Тут твои локальные настройки.

@Antik-kmsb Antik-kmsb closed this Dec 9, 2020
@Antik-kmsb Antik-kmsb reopened this Dec 9, 2020
@Antik-kmsb Antik-kmsb closed this Dec 9, 2020
@Antik-kmsb Antik-kmsb deleted the my-attempt branch December 10, 2020 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants