-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintcache
1 lines (1 loc) · 9.19 KB
/
.eslintcache
1
[{"C:\\www\\app-marvel\\src\\index.tsx":"1","C:\\www\\app-marvel\\src\\App.tsx":"2","C:\\www\\app-marvel\\src\\styles\\global.ts":"3","C:\\www\\app-marvel\\src\\routes\\index.tsx":"4","C:\\www\\app-marvel\\src\\pages\\Home\\index.tsx":"5","C:\\www\\app-marvel\\src\\pages\\Home\\styles.ts":"6","C:\\www\\app-marvel\\src\\services\\api.ts":"7","C:\\www\\app-marvel\\src\\components\\Modal\\index.tsx":"8","C:\\www\\app-marvel\\src\\components\\Modal\\styles.ts":"9","C:\\www\\app-marvel\\src\\utils\\sendEmail.ts":"10"},{"size":198,"mtime":1615327913940,"results":"11","hashOfConfig":"12"},{"size":296,"mtime":1615340125966,"results":"13","hashOfConfig":"12"},{"size":541,"mtime":1615327913942,"results":"14","hashOfConfig":"12"},{"size":273,"mtime":1615327913941,"results":"15","hashOfConfig":"12"},{"size":5230,"mtime":1615354008419,"results":"16","hashOfConfig":"12"},{"size":3613,"mtime":1615354016387,"results":"17","hashOfConfig":"12"},{"size":284,"mtime":1615327913942,"results":"18","hashOfConfig":"12"},{"size":1607,"mtime":1615341317886,"results":"19","hashOfConfig":"12"},{"size":2604,"mtime":1615352326379,"results":"20","hashOfConfig":"12"},{"size":441,"mtime":1615345534263,"results":"21","hashOfConfig":"12"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},"jfx8mp",{"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":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":"33"},{"filePath":"34","messages":"35","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"36","messages":"37","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"38","messages":"39","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"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,"usedDeprecatedRules":"24"},"C:\\www\\app-marvel\\src\\index.tsx",[],["44","45","46","47","48"],"C:\\www\\app-marvel\\src\\App.tsx",[],"C:\\www\\app-marvel\\src\\styles\\global.ts",[],"C:\\www\\app-marvel\\src\\routes\\index.tsx",[],"C:\\www\\app-marvel\\src\\pages\\Home\\index.tsx",["49","50"],"import React, { useState, useCallback, FormEvent } from 'react';\n\nimport { FiMail, FiSend } from 'react-icons/fi';\nimport { ToastContainer, toast } from 'react-toastify';\nimport 'react-toastify/dist/ReactToastify.css';\n\nimport api from '../../services/api';\nimport Modal from '../../components/Modal';\nimport logoMarvel from '../../assets/marvel.png';\nimport sendEmail from '../../utils/sendEmail';\n\nimport { Title, Form, Comics, Error, ButtonFloat } from './styles';\n\nexport interface Comic {\n id: number;\n title: string;\n description: string;\n pageCount: number;\n images: {\n path: string;\n extension: string;\n 0: any;\n };\n thumbnail: {\n path: string;\n extension: string;\n };\n selected: boolean;\n}\n\nconst Home: React.FC = () => {\n const [inputComicName, setInputComicName] = useState('');\n const [comicsData, setComicsData] = useState<Comic[]>([]);\n const [comicsSelected, setComicsSelected] = useState<Comic[]>([]);\n const [card, setCard] = useState<Comic>();\n const [inputError, setInputError] = useState('');\n const [inputMailBox, setInputMailBox] = useState(false);\n const [show, setShow] = useState(false);\n const [userEmailValue, setUserEmailValue] = useState('');\n\n async function getComics(event: FormEvent<HTMLFormElement>): Promise<void> {\n event.preventDefault();\n\n if (!inputComicName) {\n setInputError('Digite o título do quadrinho em inglês');\n return;\n }\n try {\n const response = await api.get('v1/public/comics', {\n params: {\n titleStartsWith: inputComicName,\n },\n });\n if (response.data.data.count === 0) {\n setInputError('Nenhum quadrinho encontrado');\n return;\n }\n\n const { results } = response.data.data;\n setComicsData(results as Comic[]);\n setInputError('');\n } catch (err) {\n setInputError('Erro na busca por esse quadrinho');\n }\n }\n\n const showModal = useCallback(() => {\n setShow(!show);\n }, [show]);\n\n function handleSelectCard(comicId: number): void {\n const comicIndex = comicsData.findIndex(comic => comic.id === comicId);\n const newComic = comicsData[comicIndex];\n\n newComic.selected = !newComic.selected;\n\n const newComicList = [...comicsData, newComic];\n\n setComicsData(newComicList);\n\n if (newComic.selected) {\n setComicsSelected([newComic, ...comicsSelected]);\n } else {\n const newSelectedComics = comicsSelected.filter(\n comics => comics.id !== comicId,\n );\n\n if (newSelectedComics.length === 0) {\n setInputMailBox(false);\n }\n\n setComicsSelected(newSelectedComics);\n }\n }\n\n async function sendMailToUser(): Promise<void> {\n const message = `\n ${comicsSelected.map(\n comic =>\n `Título: ${comic.title}\n Descrição: ${comic.description}\n <img src=\"data:image/jpg;base64,${btoa(\n `${comic.thumbnail.path}.${comic.thumbnail.extension}`,\n )}\" >\n `,\n )}\n `;\n\n const response = await sendEmail(userEmailValue, message);\n\n if (response) {\n toast.success('E-mail enviado com sucesso!');\n } else {\n toast.error('Ops! Erro ao enviar o e-mail');\n }\n }\n\n const showModalWithData = useCallback(\n (data: Comic) => {\n setCard(data);\n setShow(!show);\n },\n [show],\n );\n\n return (\n <>\n <img\n src={logoMarvel}\n style={{ width: 150, height: 70, backgroundColor: '#b5b5b5' }}\n alt=\"Marvel\"\n />\n <Title>Explore os quadrinhos da Marvel</Title>\n <Form hasError={!!inputError} onSubmit={getComics}>\n <input\n onChange={event => setInputComicName(event.target.value)}\n placeholder=\"Digite o título do quadrinho\"\n type=\"text\"\n />\n\n <button type=\"submit\">Pesquisar</button>\n </Form>\n\n {inputError && <Error>{inputError}</Error>}\n\n <Comics>\n {comicsData.length !== 0 &&\n comicsData.map(result => (\n <>\n <li\n key={result.id}\n className={result.selected ? 'selected-card' : ''}\n onClick={() => handleSelectCard(result.id)}\n >\n <img\n src={`${result.images[0]?.path}.${result.images[0]?.extension}`}\n alt={result.title}\n />\n <div>\n <strong>{result.title}</strong>\n </div>\n <button type=\"button\" onClick={() => showModalWithData(result)}>\n Detalhes\n </button>\n </li>\n </>\n ))}\n </Comics>\n {comicsSelected.length > 0 && (\n <ButtonFloat\n type=\"button\"\n hasOpened={inputMailBox}\n onClick={() => setInputMailBox(true)}\n >\n <FiMail color=\"#9fdcfa\" className=\"open-box-email\" />\n <input\n type=\"text\"\n value={userEmailValue}\n onChange={event => setUserEmailValue(event.target.value)}\n />\n\n <FiSend className=\"send-email\" onClick={sendMailToUser} />\n </ButtonFloat>\n )}\n\n <ToastContainer />\n <Modal onClick={showModal} show={show} comic={card} />\n </>\n );\n};\n\nexport default Home;\n","C:\\www\\app-marvel\\src\\pages\\Home\\styles.ts",[],"C:\\www\\app-marvel\\src\\services\\api.ts",[],"C:\\www\\app-marvel\\src\\components\\Modal\\index.tsx",[],"C:\\www\\app-marvel\\src\\components\\Modal\\styles.ts",[],"C:\\www\\app-marvel\\src\\utils\\sendEmail.ts",[],{"ruleId":"51","replacedBy":"52"},{"ruleId":"53","replacedBy":"54"},{"ruleId":"55","replacedBy":"56"},{"ruleId":"57","replacedBy":"58"},{"ruleId":"59","replacedBy":"60"},{"ruleId":"61","severity":2,"message":"62","line":150,"column":15,"nodeType":"63","endLine":154,"endColumn":16},{"ruleId":"64","severity":2,"message":"65","line":150,"column":15,"nodeType":"63","endLine":154,"endColumn":16},"lines-around-directive",["66"],"global-require",[],"no-buffer-constructor",[],"no-new-require",[],"no-path-concat",[],"jsx-a11y/click-events-have-key-events","Visible, non-interactive elements with click handlers must have at least one keyboard listener.","JSXOpeningElement","jsx-a11y/no-noninteractive-element-interactions","Non-interactive elements should not be assigned mouse or keyboard event listeners.","padding-line-between-statements"]