From 9628fc823671e8aea64c3dbf943172d0a31912ff Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Tue, 19 Jan 2021 21:44:35 -0300 Subject: [PATCH 01/69] adicionado dependencias (axios, styled components, material ui e router-dom), componentes de paginas e rotas --- package-lock.json | 439 ++++++++++++++++++++++++++++ package.json | 7 +- public/index.html | 4 +- src/App.css | 38 --- src/App.js | 20 +- src/Pages/AddAddressPage/index.js | 19 ++ src/Pages/AddAddressPage/styles.js | 0 src/Pages/CartPage/index.js | 27 ++ src/Pages/CartPage/styles.js | 0 src/Pages/EditProfilePage/index.js | 18 ++ src/Pages/EditProfilePage/styles.js | 0 src/Pages/ErrorPage/index.js | 20 ++ src/Pages/HomePage/index.js | 23 ++ src/Pages/HomePage/styles.js | 0 src/Pages/LoginPage/index.js | 19 ++ src/Pages/LoginPage/styles.js | 0 src/Pages/ProfilePage/index.js | 26 ++ src/Pages/ProfilePage/styles.js | 0 src/Pages/RestaurantPage/index.js | 25 ++ src/Pages/RestaurantPage/styles.js | 0 src/Pages/SignUpPage/index.js | 19 ++ src/Pages/SignUpPage/styles.js | 0 src/Routes/Routes.js | 57 ++++ src/Routes/coordinators.js | 36 +++ src/logo.svg | 7 - 25 files changed, 739 insertions(+), 65 deletions(-) delete mode 100644 src/App.css create mode 100644 src/Pages/AddAddressPage/index.js create mode 100644 src/Pages/AddAddressPage/styles.js create mode 100644 src/Pages/CartPage/index.js create mode 100644 src/Pages/CartPage/styles.js create mode 100644 src/Pages/EditProfilePage/index.js create mode 100644 src/Pages/EditProfilePage/styles.js create mode 100644 src/Pages/ErrorPage/index.js create mode 100644 src/Pages/HomePage/index.js create mode 100644 src/Pages/HomePage/styles.js create mode 100644 src/Pages/LoginPage/index.js create mode 100644 src/Pages/LoginPage/styles.js create mode 100644 src/Pages/ProfilePage/index.js create mode 100644 src/Pages/ProfilePage/styles.js create mode 100644 src/Pages/RestaurantPage/index.js create mode 100644 src/Pages/RestaurantPage/styles.js create mode 100644 src/Pages/SignUpPage/index.js create mode 100644 src/Pages/SignUpPage/styles.js create mode 100644 src/Routes/Routes.js create mode 100644 src/Routes/coordinators.js delete mode 100644 src/logo.svg diff --git a/package-lock.json b/package-lock.json index e8c18b2..98801c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1117,6 +1117,34 @@ "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz", "integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg==" }, + "@emotion/hash": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", + "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" + }, + "@emotion/is-prop-valid": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz", + "integrity": "sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==", + "requires": { + "@emotion/memoize": "0.7.4" + } + }, + "@emotion/memoize": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz", + "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==" + }, + "@emotion/stylis": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/@emotion/stylis/-/stylis-0.8.5.tgz", + "integrity": "sha512-h6KtPihKFn3T9fuIrwvXXUOwlx3rfUvfZIcP5a6rh8Y7zjE3O06hT5Ss4S/YI1AYhuZ1kjaE/5EaOOI2NqSylQ==" + }, + "@emotion/unitless": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", + "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" + }, "@hapi/address": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", @@ -1342,6 +1370,82 @@ "@types/yargs": "^13.0.0" } }, + "@material-ui/core": { + "version": "4.11.2", + "resolved": "https://registry.npmjs.org/@material-ui/core/-/core-4.11.2.tgz", + "integrity": "sha512-/D1+AQQeYX/WhT/FUk78UCRj8ch/RCglsQLYujYTIqPSJlwZHKcvHidNeVhODXeApojeXjkl0tWdk5C9ofwOkQ==", + "requires": { + "@babel/runtime": "^7.4.4", + "@material-ui/styles": "^4.11.2", + "@material-ui/system": "^4.11.2", + "@material-ui/types": "^5.1.0", + "@material-ui/utils": "^4.11.2", + "@types/react-transition-group": "^4.2.0", + "clsx": "^1.0.4", + "hoist-non-react-statics": "^3.3.2", + "popper.js": "1.16.1-lts", + "prop-types": "^15.7.2", + "react-is": "^16.8.0 || ^17.0.0", + "react-transition-group": "^4.4.0" + } + }, + "@material-ui/icons": { + "version": "4.11.2", + "resolved": "https://registry.npmjs.org/@material-ui/icons/-/icons-4.11.2.tgz", + "integrity": "sha512-fQNsKX2TxBmqIGJCSi3tGTO/gZ+eJgWmMJkgDiOfyNaunNaxcklJQFaFogYcFl0qFuaEz1qaXYXboa/bUXVSOQ==", + "requires": { + "@babel/runtime": "^7.4.4" + } + }, + "@material-ui/styles": { + "version": "4.11.2", + "resolved": "https://registry.npmjs.org/@material-ui/styles/-/styles-4.11.2.tgz", + "integrity": "sha512-xbItf8zkfD3FuGoD9f2vlcyPf9jTEtj9YTJoNNV+NMWaSAHXgrW6geqRoo/IwBuMjqpwqsZhct13e2nUyU9Ljw==", + "requires": { + "@babel/runtime": "^7.4.4", + "@emotion/hash": "^0.8.0", + "@material-ui/types": "^5.1.0", + "@material-ui/utils": "^4.11.2", + "clsx": "^1.0.4", + "csstype": "^2.5.2", + "hoist-non-react-statics": "^3.3.2", + "jss": "^10.0.3", + "jss-plugin-camel-case": "^10.0.3", + "jss-plugin-default-unit": "^10.0.3", + "jss-plugin-global": "^10.0.3", + "jss-plugin-nested": "^10.0.3", + "jss-plugin-props-sort": "^10.0.3", + "jss-plugin-rule-value-function": "^10.0.3", + "jss-plugin-vendor-prefixer": "^10.0.3", + "prop-types": "^15.7.2" + } + }, + "@material-ui/system": { + "version": "4.11.2", + "resolved": "https://registry.npmjs.org/@material-ui/system/-/system-4.11.2.tgz", + "integrity": "sha512-BELFJEel5E+5DMiZb6XXT3peWRn6UixRvBtKwSxqntmD0+zwbbfCij6jtGwwdJhN1qX/aXrKu10zX31GBaeR7A==", + "requires": { + "@babel/runtime": "^7.4.4", + "@material-ui/utils": "^4.11.2", + "csstype": "^2.5.2", + "prop-types": "^15.7.2" + } + }, + "@material-ui/types": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@material-ui/types/-/types-5.1.0.tgz", + "integrity": "sha512-7cqRjrY50b8QzRSYyhSpx4WRw2YuO0KKIGQEVk5J8uoz2BanawykgZGoWEqKm7pVIbzFDN0SpPcVV4IhOFkl8A==" + }, + "@material-ui/utils": { + "version": "4.11.2", + "resolved": "https://registry.npmjs.org/@material-ui/utils/-/utils-4.11.2.tgz", + "integrity": "sha512-Uul8w38u+PICe2Fg2pDKCaIG7kOyhowZ9vjiC1FsVwPABTW8vPPKfF6OvxRq3IiBaI1faOJmgdvMG7rMJARBhA==", + "requires": { + "@babel/runtime": "^7.4.4", + "prop-types": "^15.7.2", + "react-is": "^16.8.0 || ^17.0.0" + } + }, "@mrmlnc/readdir-enhanced": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", @@ -1725,6 +1829,14 @@ "@types/react": "*" } }, + "@types/react-transition-group": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.0.tgz", + "integrity": "sha512-/QfLHGpu+2fQOqQaXh8MG9q03bFENooTb/it4jr5kKaZlDQfWvjqWZg48AwzPVMBHlRuTRAY7hRHCEOXz5kV6w==", + "requires": { + "@types/react": "*" + } + }, "@types/stack-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", @@ -2437,6 +2549,14 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz", "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==" }, + "axios": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "requires": { + "follow-redirects": "^1.10.0" + } + }, "axobject-query": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.1.2.tgz", @@ -2674,6 +2794,22 @@ "resolved": "https://registry.npmjs.org/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.6.tgz", "integrity": "sha512-1aGDUfL1qOOIoqk9QKGIo2lANk+C7ko/fqH0uIyC71x3PEGz0uVP8ISgfEsFuG+FKmjHTvFK/nNM8dowpmUxLA==" }, + "babel-plugin-styled-components": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/babel-plugin-styled-components/-/babel-plugin-styled-components-1.12.0.tgz", + "integrity": "sha512-FEiD7l5ZABdJPpLssKXjBUJMYqzbcNzBowfXDCdJhOpbhWiewapUaY+LZGT8R4Jg2TwOjGjG4RKeyrO5p9sBkA==", + "requires": { + "@babel/helper-annotate-as-pure": "^7.0.0", + "@babel/helper-module-imports": "^7.0.0", + "babel-plugin-syntax-jsx": "^6.18.0", + "lodash": "^4.17.11" + } + }, + "babel-plugin-syntax-jsx": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", + "integrity": "sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY=" + }, "babel-plugin-syntax-object-rest-spread": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", @@ -3343,6 +3479,11 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, + "camelize": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz", + "integrity": "sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=" + }, "caniuse-api": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", @@ -3577,6 +3718,11 @@ "shallow-clone": "^0.1.2" } }, + "clsx": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.1.tgz", + "integrity": "sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==" + }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -3970,6 +4116,11 @@ "postcss": "^7.0.5" } }, + "css-color-keywords": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz", + "integrity": "sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU=" + }, "css-color-names": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz", @@ -4060,6 +4211,16 @@ "resolved": "https://registry.npmjs.org/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz", "integrity": "sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w==" }, + "css-to-react-native": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-3.0.0.tgz", + "integrity": "sha512-Ro1yETZA813eoyUp2GDBhG2j+YggidUmzO1/v9eYBKR2EHVEniE2MI/NqpTQ954BMpTPZFsGNPm46qFB9dpaPQ==", + "requires": { + "camelize": "^1.0.0", + "css-color-keywords": "^1.0.0", + "postcss-value-parser": "^4.0.2" + } + }, "css-tree": { "version": "1.0.0-alpha.37", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.37.tgz", @@ -4076,6 +4237,15 @@ } } }, + "css-vendor": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/css-vendor/-/css-vendor-2.0.8.tgz", + "integrity": "sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ==", + "requires": { + "@babel/runtime": "^7.8.3", + "is-in-browser": "^1.0.2" + } + }, "css-what": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/css-what/-/css-what-3.3.0.tgz", @@ -4535,6 +4705,22 @@ "utila": "~0.4" } }, + "dom-helpers": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.0.tgz", + "integrity": "sha512-Ru5o9+V8CpunKnz5LGgWXkmrH/20cGKwcHwS4m73zIvs54CN9epEmT/HLqFJW3kXpakAFkEdzgy1hzlJe3E4OQ==", + "requires": { + "@babel/runtime": "^7.8.7", + "csstype": "^3.0.2" + }, + "dependencies": { + "csstype": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.6.tgz", + "integrity": "sha512-+ZAmfyWMT7TiIlzdqJgjMb7S4f1beorDbWbsocyK4RaiqA5RTX3K14bnBWmmA9QEM0gRdsjyyrEmcyga8Zsxmw==" + } + } + }, "dom-serializer": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", @@ -6241,6 +6427,19 @@ "resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz", "integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==" }, + "history": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz", + "integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==", + "requires": { + "@babel/runtime": "^7.1.2", + "loose-envify": "^1.2.0", + "resolve-pathname": "^3.0.0", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0", + "value-equal": "^1.0.1" + } + }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -6251,6 +6450,14 @@ "minimalistic-crypto-utils": "^1.0.1" } }, + "hoist-non-react-statics": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", + "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", + "requires": { + "react-is": "^16.7.0" + } + }, "hosted-git-info": { "version": "2.8.8", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", @@ -6454,6 +6661,11 @@ "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=" }, + "hyphenate-style-name": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz", + "integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==" + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -6537,6 +6749,14 @@ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" }, + "indefinite-observable": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/indefinite-observable/-/indefinite-observable-2.0.1.tgz", + "integrity": "sha512-G8vgmork+6H9S8lUAg1gtXEj2JxIQTo0g2PbFiYOdjkziSI0F7UYBiVwhZRuixhBCNGczAls34+5HJPyZysvxQ==", + "requires": { + "symbol-observable": "1.2.0" + } + }, "indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", @@ -6822,6 +7042,11 @@ "is-extglob": "^2.1.1" } }, + "is-in-browser": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/is-in-browser/-/is-in-browser-1.1.3.tgz", + "integrity": "sha1-Vv9NtoOgeMYILrldrX3GLh0E+DU=" + }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -7679,6 +7904,92 @@ "verror": "1.10.0" } }, + "jss": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/jss/-/jss-10.5.0.tgz", + "integrity": "sha512-B6151NvG+thUg3murLNHRPLxTLwQ13ep4SH5brj4d8qKtogOx/jupnpfkPGSHPqvcwKJaCLctpj2lEk+5yGwMw==", + "requires": { + "@babel/runtime": "^7.3.1", + "csstype": "^3.0.2", + "indefinite-observable": "^2.0.1", + "is-in-browser": "^1.1.3", + "tiny-warning": "^1.0.2" + }, + "dependencies": { + "csstype": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.6.tgz", + "integrity": "sha512-+ZAmfyWMT7TiIlzdqJgjMb7S4f1beorDbWbsocyK4RaiqA5RTX3K14bnBWmmA9QEM0gRdsjyyrEmcyga8Zsxmw==" + } + } + }, + "jss-plugin-camel-case": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.5.0.tgz", + "integrity": "sha512-GSjPL0adGAkuoqeYiXTgO7PlIrmjv5v8lA6TTBdfxbNYpxADOdGKJgIEkffhlyuIZHlPuuiFYTwUreLUmSn7rg==", + "requires": { + "@babel/runtime": "^7.3.1", + "hyphenate-style-name": "^1.0.3", + "jss": "10.5.0" + } + }, + "jss-plugin-default-unit": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.5.0.tgz", + "integrity": "sha512-rsbTtZGCMrbcb9beiDd+TwL991NGmsAgVYH0hATrYJtue9e+LH/Gn4yFD1ENwE+3JzF3A+rPnM2JuD9L/SIIWw==", + "requires": { + "@babel/runtime": "^7.3.1", + "jss": "10.5.0" + } + }, + "jss-plugin-global": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.5.0.tgz", + "integrity": "sha512-FZd9+JE/3D7HMefEG54fEC0XiQ9rhGtDHAT/ols24y8sKQ1D5KIw6OyXEmIdKFmACgxZV2ARQ5pAUypxkk2IFQ==", + "requires": { + "@babel/runtime": "^7.3.1", + "jss": "10.5.0" + } + }, + "jss-plugin-nested": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.5.0.tgz", + "integrity": "sha512-ejPlCLNlEGgx8jmMiDk/zarsCZk+DV0YqXfddpgzbO9Toamo0HweCFuwJ3ZO40UFOfqKwfpKMVH/3HUXgxkTMg==", + "requires": { + "@babel/runtime": "^7.3.1", + "jss": "10.5.0", + "tiny-warning": "^1.0.2" + } + }, + "jss-plugin-props-sort": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.5.0.tgz", + "integrity": "sha512-kTLRvrOetFKz5vM88FAhLNeJIxfjhCepnvq65G7xsAQ/Wgy7HwO1BS/2wE5mx8iLaAWC6Rj5h16mhMk9sKdZxg==", + "requires": { + "@babel/runtime": "^7.3.1", + "jss": "10.5.0" + } + }, + "jss-plugin-rule-value-function": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.5.0.tgz", + "integrity": "sha512-jXINGr8BSsB13JVuK274oEtk0LoooYSJqTBCGeBu2cG/VJ3+4FPs1gwLgsq24xTgKshtZ+WEQMVL34OprLidRA==", + "requires": { + "@babel/runtime": "^7.3.1", + "jss": "10.5.0", + "tiny-warning": "^1.0.2" + } + }, + "jss-plugin-vendor-prefixer": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.5.0.tgz", + "integrity": "sha512-rux3gmfwDdOKCLDx0IQjTwTm03IfBa+Rm/hs747cOw5Q7O3RaTUIMPKjtVfc31Xr/XI9Abz2XEupk1/oMQ7zRA==", + "requires": { + "@babel/runtime": "^7.3.1", + "css-vendor": "^2.0.8", + "jss": "10.5.0" + } + }, "jsx-ast-utils": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.4.1.tgz", @@ -8153,6 +8464,25 @@ "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==" }, + "mini-create-react-context": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz", + "integrity": "sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==", + "requires": { + "@babel/runtime": "^7.12.1", + "tiny-warning": "^1.0.3" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz", + "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } + }, "mini-css-extract-plugin": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.9.0.tgz", @@ -9158,6 +9488,11 @@ "ts-pnp": "^1.1.6" } }, + "popper.js": { + "version": "1.16.1-lts", + "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1-lts.tgz", + "integrity": "sha512-Kjw8nKRl1m+VrSFCoVGPph93W/qrSO7ZkqPpTf7F4bk/sqcfWK019dWBUpE/fBOsOQY1dks/Bmcbfn1heM/IsA==" + }, "portfinder": { "version": "1.0.26", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.26.tgz", @@ -10648,6 +10983,52 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "react-router": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.2.0.tgz", + "integrity": "sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw==", + "requires": { + "@babel/runtime": "^7.1.2", + "history": "^4.9.0", + "hoist-non-react-statics": "^3.1.0", + "loose-envify": "^1.3.1", + "mini-create-react-context": "^0.4.0", + "path-to-regexp": "^1.7.0", + "prop-types": "^15.6.2", + "react-is": "^16.6.0", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "path-to-regexp": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", + "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "requires": { + "isarray": "0.0.1" + } + } + } + }, + "react-router-dom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.2.0.tgz", + "integrity": "sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA==", + "requires": { + "@babel/runtime": "^7.1.2", + "history": "^4.9.0", + "loose-envify": "^1.3.1", + "prop-types": "^15.6.2", + "react-router": "5.2.0", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0" + } + }, "react-scripts": { "version": "3.4.1", "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-3.4.1.tgz", @@ -10708,6 +11089,17 @@ "workbox-webpack-plugin": "4.3.1" } }, + "react-transition-group": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.1.tgz", + "integrity": "sha512-Djqr7OQ2aPUiYurhPalTrVy9ddmFCCzwhqQmtN+J3+3DzLO209Fdr70QrN8Z3DsglWql6iY1lDWAfpFiBtuKGw==", + "requires": { + "@babel/runtime": "^7.5.5", + "dom-helpers": "^5.0.1", + "loose-envify": "^1.4.0", + "prop-types": "^15.6.2" + } + }, "read-pkg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", @@ -11051,6 +11443,11 @@ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=" }, + "resolve-pathname": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz", + "integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==" + }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -11524,6 +11921,11 @@ } } }, + "shallowequal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", + "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==" + }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -12212,6 +12614,23 @@ } } }, + "styled-components": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-5.2.1.tgz", + "integrity": "sha512-sBdgLWrCFTKtmZm/9x7jkIabjFNVzCUeKfoQsM6R3saImkUnjx0QYdLwJHBjY9ifEcmjDamJDVfknWm1yxZPxQ==", + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/traverse": "^7.4.5", + "@emotion/is-prop-valid": "^0.8.8", + "@emotion/stylis": "^0.8.4", + "@emotion/unitless": "^0.7.4", + "babel-plugin-styled-components": ">= 1", + "css-to-react-native": "^3.0.0", + "hoist-non-react-statics": "^3.0.0", + "shallowequal": "^1.1.0", + "supports-color": "^5.5.0" + } + }, "stylehacks": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.3.tgz", @@ -12267,6 +12686,11 @@ "util.promisify": "~1.0.0" } }, + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==" + }, "symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", @@ -12518,6 +12942,16 @@ "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=" }, + "tiny-invariant": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz", + "integrity": "sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw==" + }, + "tiny-warning": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", + "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" + }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -12889,6 +13323,11 @@ "spdx-expression-parse": "^3.0.0" } }, + "value-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz", + "integrity": "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==" + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/package.json b/package.json index 2d4ff44..b0f4b18 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,17 @@ "version": "0.1.0", "private": true, "dependencies": { + "@material-ui/core": "^4.11.2", + "@material-ui/icons": "^4.11.2", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", + "axios": "^0.21.1", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-scripts": "3.4.1" + "react-router-dom": "^5.2.0", + "react-scripts": "3.4.1", + "styled-components": "^5.2.1" }, "scripts": { "start": "react-scripts start", diff --git a/public/index.html b/public/index.html index aa069f2..7ecb0bb 100644 --- a/public/index.html +++ b/public/index.html @@ -1,5 +1,5 @@ - + @@ -24,7 +24,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - React App + I Future diff --git a/src/App.css b/src/App.css deleted file mode 100644 index 74b5e05..0000000 --- a/src/App.css +++ /dev/null @@ -1,38 +0,0 @@ -.App { - text-align: center; -} - -.App-logo { - height: 40vmin; - pointer-events: none; -} - -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } -} - -.App-header { - background-color: #282c34; - min-height: 100vh; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; -} - -.App-link { - color: #61dafb; -} - -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} diff --git a/src/App.js b/src/App.js index ce9cbd2..3efa802 100644 --- a/src/App.js +++ b/src/App.js @@ -1,24 +1,10 @@ import React from 'react'; -import logo from './logo.svg'; -import './App.css'; +import Routes from "./Routes/Routes"; function App() { return ( -
-
- logo -

- Edit src/App.js and save to reload. -

- - Learn React - -
+
+
); } diff --git a/src/Pages/AddAddressPage/index.js b/src/Pages/AddAddressPage/index.js new file mode 100644 index 0000000..24b60df --- /dev/null +++ b/src/Pages/AddAddressPage/index.js @@ -0,0 +1,19 @@ +import React from 'react' +import { useHistory } from "react-router-dom"; +import { goBack, goToHomePage } from '../../Routes/coordinators'; + +export default function AddAddressPage() { + const history = useHistory(); + + return ( +
+ + + +
+ ) +} \ No newline at end of file diff --git a/src/Pages/AddAddressPage/styles.js b/src/Pages/AddAddressPage/styles.js new file mode 100644 index 0000000..e69de29 diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js new file mode 100644 index 0000000..67e9261 --- /dev/null +++ b/src/Pages/CartPage/index.js @@ -0,0 +1,27 @@ +import React from 'react' +import { useHistory } from "react-router-dom"; +import { goBack, goToCartPage, goToHomePage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; + + +export default function CartPage() { + const history = useHistory(); + + return ( +
+ carrinho + + + + + +
+ ) +} diff --git a/src/Pages/CartPage/styles.js b/src/Pages/CartPage/styles.js new file mode 100644 index 0000000..e69de29 diff --git a/src/Pages/EditProfilePage/index.js b/src/Pages/EditProfilePage/index.js new file mode 100644 index 0000000..481f1c8 --- /dev/null +++ b/src/Pages/EditProfilePage/index.js @@ -0,0 +1,18 @@ +import React from 'react' +import { useHistory } from "react-router-dom"; +import { goBack, goToCartPage, goToEditPage, goToHomePage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; + + +export default function EditProfilePage() { + const history = useHistory(); + + return ( +
+ Editar usuário / endereço + + +
+ ) +} diff --git a/src/Pages/EditProfilePage/styles.js b/src/Pages/EditProfilePage/styles.js new file mode 100644 index 0000000..e69de29 diff --git a/src/Pages/ErrorPage/index.js b/src/Pages/ErrorPage/index.js new file mode 100644 index 0000000..d2a3bb5 --- /dev/null +++ b/src/Pages/ErrorPage/index.js @@ -0,0 +1,20 @@ +import React from 'react' +import { useHistory } from "react-router-dom"; +import { goBack, goToHomePage } from '../../Routes/coordinators'; + + +export default function ErrorPage() { + const history = useHistory(); + + return ( +
+ ERRO 404 + + +
+ ) +} diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js new file mode 100644 index 0000000..406b3a2 --- /dev/null +++ b/src/Pages/HomePage/index.js @@ -0,0 +1,23 @@ +import React from 'react' +import { useHistory } from "react-router-dom"; +import { goToCartPage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; + +export default function HomePage() { + const history = useHistory(); + + return ( +
+ home / feed + + + + +
+ ) +} diff --git a/src/Pages/HomePage/styles.js b/src/Pages/HomePage/styles.js new file mode 100644 index 0000000..e69de29 diff --git a/src/Pages/LoginPage/index.js b/src/Pages/LoginPage/index.js new file mode 100644 index 0000000..7711d8d --- /dev/null +++ b/src/Pages/LoginPage/index.js @@ -0,0 +1,19 @@ +import React from 'react' +import { useHistory } from "react-router-dom"; +import { goToHomePage, goToSignUpPage } from '../../Routes/coordinators'; + +export default function LoginPage() { + const history = useHistory(); + + return ( +
+ login + + +
+ ) +} \ No newline at end of file diff --git a/src/Pages/LoginPage/styles.js b/src/Pages/LoginPage/styles.js new file mode 100644 index 0000000..e69de29 diff --git a/src/Pages/ProfilePage/index.js b/src/Pages/ProfilePage/index.js new file mode 100644 index 0000000..ffd3708 --- /dev/null +++ b/src/Pages/ProfilePage/index.js @@ -0,0 +1,26 @@ +import React from 'react' +import { useHistory } from "react-router-dom"; +import { goBack, goToCartPage, goToEditPage, goToHomePage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; + + +export default function ProfilePage() { + const history = useHistory(); + + return ( +
+ perfil do usuário + + + + +
+ ) +} diff --git a/src/Pages/ProfilePage/styles.js b/src/Pages/ProfilePage/styles.js new file mode 100644 index 0000000..e69de29 diff --git a/src/Pages/RestaurantPage/index.js b/src/Pages/RestaurantPage/index.js new file mode 100644 index 0000000..1328775 --- /dev/null +++ b/src/Pages/RestaurantPage/index.js @@ -0,0 +1,25 @@ +import React from 'react' +import { useHistory } from "react-router-dom"; +import { goBack, goToCartPage, goToHomePage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; + + +export default function RestaurantPage() { + const history = useHistory(); + + return ( +
+ perfil do restaurante + + + + + +
+ ) +} diff --git a/src/Pages/RestaurantPage/styles.js b/src/Pages/RestaurantPage/styles.js new file mode 100644 index 0000000..e69de29 diff --git a/src/Pages/SignUpPage/index.js b/src/Pages/SignUpPage/index.js new file mode 100644 index 0000000..ce04e76 --- /dev/null +++ b/src/Pages/SignUpPage/index.js @@ -0,0 +1,19 @@ +import React from 'react' +import { useHistory } from "react-router-dom"; +import { goBack, goToAddAddressPage } from '../../Routes/coordinators'; + +export default function SignUpPage() { + const history = useHistory(); + + return ( +
+ cadastro de usuário + + +
+ ) +} \ No newline at end of file diff --git a/src/Pages/SignUpPage/styles.js b/src/Pages/SignUpPage/styles.js new file mode 100644 index 0000000..e69de29 diff --git a/src/Routes/Routes.js b/src/Routes/Routes.js new file mode 100644 index 0000000..76576d7 --- /dev/null +++ b/src/Routes/Routes.js @@ -0,0 +1,57 @@ +import React from 'react' +import { BrowserRouter, Route, Switch } from 'react-router-dom' +import HomePage from "../Pages/HomePage"; +import AddAddressPage from "../Pages/AddAddressPage"; +import CartPage from "../Pages/CartPage"; +import EditProfilePage from "../Pages/EditProfilePage"; +import LoginPage from "../Pages/LoginPage"; +import ProfilePage from "../Pages/ProfilePage"; +import RestaurantPage from "../Pages/RestaurantPage"; +import SignUpPage from "../Pages/SignUpPage"; +import ErrorPage from "../Pages/ErrorPage"; + + + +export default function Routes() { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ) +} diff --git a/src/Routes/coordinators.js b/src/Routes/coordinators.js new file mode 100644 index 0000000..05ba057 --- /dev/null +++ b/src/Routes/coordinators.js @@ -0,0 +1,36 @@ +export const goToHomePage = (history) => { + history.push('/feed') +} + +export const goToAddAddressPage = (history) => { + history.push('/profile/add-address') +} + +export const goToCartPage = (history) => { + history.push('/cart') +} + +export const goToEditPage = (history) => { + history.push('/profile/edit') +} + +export const goToLoginPage = (history) => { + history.push('/') +} + +export const goToProfilePage = (history) => { + history.push('/profile') +} + +export const goToRestaurantsPage = (history) => { + history.push('/restaurants') +} + +export const goToSignUpPage = (history) => { + history.push('/sign-up') +} + +export const goBack = (history) => { + history.goBack() +} + diff --git a/src/logo.svg b/src/logo.svg deleted file mode 100644 index 6b60c10..0000000 --- a/src/logo.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - From 8cdcd69050b1644fdc80b247ecbb0043d9196f3a Mon Sep 17 00:00:00 2001 From: Adrielly Felix Date: Wed, 20 Jan 2021 13:30:55 -0300 Subject: [PATCH 02/69] tela inicial --- public/index.html | 2 +- src/Components/InitialScreen/index.js | 27 +++++++++++++++++++ src/Components/InitialScreen/style.js | 1 + src/Pages/HomePage/index.js | 36 ++++++++++++------------- src/Pages/LoginPage/index.js | 37 +++++++++++++++++--------- src/assets/logo-future-eats.png | Bin 0 -> 3616 bytes src/assets/logo-future-eats@2x.png | Bin 0 -> 8022 bytes src/assets/logo-future-eats@3x.png | Bin 0 -> 12749 bytes src/index.css | 6 ++--- 9 files changed, 73 insertions(+), 36 deletions(-) create mode 100644 src/Components/InitialScreen/index.js create mode 100644 src/Components/InitialScreen/style.js create mode 100644 src/assets/logo-future-eats.png create mode 100644 src/assets/logo-future-eats@2x.png create mode 100644 src/assets/logo-future-eats@3x.png diff --git a/public/index.html b/public/index.html index 7ecb0bb..f4440a4 100644 --- a/public/index.html +++ b/public/index.html @@ -1,5 +1,5 @@ - + diff --git a/src/Components/InitialScreen/index.js b/src/Components/InitialScreen/index.js new file mode 100644 index 0000000..cb05af1 --- /dev/null +++ b/src/Components/InitialScreen/index.js @@ -0,0 +1,27 @@ +import React from "react"; +import { Grid } from "@material-ui/core"; +import Logo from "../../assets/logo-future-eats@2x.png"; +import { makeStyles } from "@material-ui/core/styles"; + +const useStyles = makeStyles({ + root: { + height: "100vh", + background: "#e8222e", + }, +}); + +export default function InitialScreen() { + const classes = useStyles(); + return ( + + + logo + + + ); +} diff --git a/src/Components/InitialScreen/style.js b/src/Components/InitialScreen/style.js new file mode 100644 index 0000000..e49b151 --- /dev/null +++ b/src/Components/InitialScreen/style.js @@ -0,0 +1 @@ +import \ No newline at end of file diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index 406b3a2..a33137f 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -1,23 +1,21 @@ -import React from 'react' +import React from "react"; import { useHistory } from "react-router-dom"; -import { goToCartPage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; - +import { + goToCartPage, + goToProfilePage, + goToRestaurantsPage, +} from "../../Routes/coordinators"; export default function HomePage() { - const history = useHistory(); - - return ( -
- home / feed + const history = useHistory(); - - - -
- ) + return ( +
+ home / feed + + + +
+ ); } diff --git a/src/Pages/LoginPage/index.js b/src/Pages/LoginPage/index.js index 7711d8d..494529d 100644 --- a/src/Pages/LoginPage/index.js +++ b/src/Pages/LoginPage/index.js @@ -1,19 +1,30 @@ -import React from 'react' +import React, { useEffect, useState } from "react"; import { useHistory } from "react-router-dom"; -import { goToHomePage, goToSignUpPage } from '../../Routes/coordinators'; +import { goToHomePage, goToSignUpPage } from "../../Routes/coordinators"; +import InitialScreen from "../../Components/InitialScreen"; export default function LoginPage() { - const history = useHistory(); + const history = useHistory(); + const [exibirLogin, setExibirLogin] = useState(false); - return ( + useEffect(() => { + if (!exibirLogin) { + setTimeout(function () { + setExibirLogin(true); + }, 2000); + } + }, [exibirLogin]); + + return ( + <> + {!exibirLogin && } + {exibirLogin && (
- login - - + login + +
- ) -} \ No newline at end of file + )} + + ); +} diff --git a/src/assets/logo-future-eats.png b/src/assets/logo-future-eats.png new file mode 100644 index 0000000000000000000000000000000000000000..ea6bc1fbf0bc0e920ae29f41be4584f6b5c6e480 GIT binary patch literal 3616 zcmV+*4&U*KP)Px?+DSw~RCodH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V$$fxqgv1Q*MU9=tr#QS9%zk4*GQzao`-Aa+6$3bI|4OY&I)6k zNqjzd1Uv#B0gr%3z$4%h@CbMWJOUm8kAO$OBj6G62zUfM0v-X6fJeY1;1Tc$^b7+3 Y59c%weNmxhH~;_u07*qoM6N<$f{}5AMF0Q* literal 0 HcmV?d00001 diff --git a/src/assets/logo-future-eats@3x.png b/src/assets/logo-future-eats@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..735db17827ff4362565903d61272f6d2e63837ee GIT binary patch literal 12749 zcma)jbzIa>@HZWj2LjR@DIL-s2S|%FNJw{wAf1QgiF6;*-Abc$ADt2sM++Wx)PvvO z@89S3JpX+5^T+JY?7nAaXLe^}-)JfmJfnJsf`USz@*4CO1qC(W>HjAV*3&nhWI6Mx zLG^m8ERRw%L9>s7!XKjolGFWwdYp^B%A%Nhi4CwG@&|vOd2KsX5Q&Lt@J^PT+=!Tr zIEpO!9)BaIE%N?O8rKrT8}oT=cqk6evxe=QXut~rg$cfm1?UQKH09rVSiXwEsu*1{1AOSKDFcAn@`2%C3KR3D8du z1}%0bb;NYUbueYxq!~3G_X6B8Xu_5mHbCpU&v1fRd_@#k87qO63~>-?5swNKm=@db z;J$86y`EQM{}{gEL!)n+Ct^2?b0(>vfCiEnap-E*o-dZeZsv#VATEpMP=g1-!6|+= zUzt?a+C2{p8dT*1d<^wiy3Z+HKJob7u-B6>gcz+zy5nh_p6@5gx&FA*K24r45GMm5 z1rjIvQ*Db;$YS(>v(h5cz?nd$wlXuj=l>r+cx)&oOlOoCXHGSL_)hYYCOoj54J{h` zJDxv||HPZ(%Ks+H@B)?7G7YFdBRox}jv&5^fq8xTlKLVrxC>O*$?+ui>loQ%a30_+ zJ0sXn{O`wIajb>~)og(Xt(7maEektOGM5wAF$Yu@r?$#nB3;!_P2yPq-o(E#wizha^LvgPhdTfghHm9TR)<-gf`~*}s1}`%$@#HGt=dl{?0WLQf=| zf59_Y+8)W&wh`DNiKFb)M%$3j-?m5npO(#HpmI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+U)mw@SjxLlCSoA5I$xr7FoviKZ!zNijnEhu?%6(Y zI}zOF6T<6>BCtM2GrkHXXk=OemQIB`e1a6R-3()V2hIS%iaoK?q)&e9WAvF#fC^4s{KcChu*HBnQ(%Wip3Ja^Q^xLfig9iCw6) z3|W;j`PWtidpXIK-GIq8US1?(EBirj#9$SHKAM!ou)&1H z^2X4Fr}OD}wRhWxephf~3=W`MqJ~T&KX;%otqVen-iC`r-D#e)_ntfd9uR|xe5G)= zoRsYX2cp8L9EpS!P`W#k?noN-SswHV|0Wi{%hDpejaa1FAoK#TA*20e7(Z)(ONGat zprr^|eT{x0sYtQ)uCn;02s$lxDay#+o=)htk?j)%GNf?>&T=@$kVe*erO;qJ^TNHJ zM-OW)b>iW;qX;x{9;Jsx<=7+aY0_U_G@4~LJ6)h4qA=kJb37-!BI<$+rOL7BH>0xa0GacyhC>Ona2`3^hc^4Ng zFT&?=9z?f6Ef>Rk^61hzG0#re%&IyW54!M-Dy7C-X~Tm5Z7uZj1mc9K>bRK7rY@eZfJJk}dmp<#f$aqcC?A zKXx&)kgtRwKyWWz#YxJ_LXF#l**&p5QE!_+79`XL#~vjFH5gD7b~~&@FeQ^e$=URp z;EnWaD~GJVwL^K%wF0slYID!Q=Pm+f5jjygqYrWA&-B0G((ls`Hj(TpfJ1(lFvdk0_ z=qI;sGquoe3AT~rS|yn*o{gqv>C$w z3L|nov0XGd)aH21MgCiJkff$z(6n0iN!T`G1EIZL_`2!y>%N+F@Gr*8e;F75lVF3P zTPpj2P&ftK706n}8iD~c$;-le8*-S~9QlWAn`L{a#*j#bUP17f(K8>b(4b`%f|UAy nzE}AFc+&8HCwVI9z9Zr~7Pc*j%qDtzpMj#Hs0pf(w+R0~bc%;P literal 0 HcmV?d00001 diff --git a/src/index.css b/src/index.css index ec2585e..4a1df4d 100644 --- a/src/index.css +++ b/src/index.css @@ -1,13 +1,13 @@ body { margin: 0; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', - 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", + "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { - font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', + font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; } From d7f62277588c22dd360b01b5f045a3e42d1d048c Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Wed, 20 Jan 2021 15:02:59 -0300 Subject: [PATCH 03/69] Criando estado global e tema --- src/App.js | 9 ++++++++- src/CustomHooks/useRequestData.js | 9 +++++++++ src/Global/GlobalState.js | 25 +++++++++++++++++++++++++ src/Global/GlobalStateContext.js | 5 +++++ src/Pages/LoginPage/index.js | 3 ++- src/Tema/Tema.js | 25 +++++++++++++++++++++++++ 6 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 src/CustomHooks/useRequestData.js create mode 100644 src/Global/GlobalState.js create mode 100644 src/Global/GlobalStateContext.js create mode 100644 src/Tema/Tema.js diff --git a/src/App.js b/src/App.js index 3efa802..bb9b4c7 100644 --- a/src/App.js +++ b/src/App.js @@ -1,10 +1,17 @@ import React from 'react'; import Routes from "./Routes/Routes"; +import GlobalState from './Global/GlobalState' +import Tema from "./Tema/Tema" + function App() { return (
- + + + + +
); } diff --git a/src/CustomHooks/useRequestData.js b/src/CustomHooks/useRequestData.js new file mode 100644 index 0000000..9b2c6e8 --- /dev/null +++ b/src/CustomHooks/useRequestData.js @@ -0,0 +1,9 @@ +import React from 'react' + +export default function useRequestData() { + return ( +
+ +
+ ) +} diff --git a/src/Global/GlobalState.js b/src/Global/GlobalState.js new file mode 100644 index 0000000..1da6ad6 --- /dev/null +++ b/src/Global/GlobalState.js @@ -0,0 +1,25 @@ +import React from 'react' +import GlobalStateContext from "../Global/GlobalStateContext"; +import axios from "axios"; +import useRequestData from '../CustomHooks/useRequestData' +import {useState, useEffect} from 'react' + +export default function GlobalState(props) { + + const [carrinho, setCarrinho] = useState([]) + const [perfil, setPerfil] = useState({}) + const [restaurante, setRestaurante] = useState({}) + const [listaRestaurantes, setListaRestaurantes] = useState([]) + const [token, setToken] = useState("") + + + const states = {carrinho, perfil, restaurante, listaRestaurantes, token} + const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken} + const requests = {} + + return ( + + {props.children} + + ) +} diff --git a/src/Global/GlobalStateContext.js b/src/Global/GlobalStateContext.js new file mode 100644 index 0000000..b5406b8 --- /dev/null +++ b/src/Global/GlobalStateContext.js @@ -0,0 +1,5 @@ +import React from "react"; + +const GlobalStateContext = React.createContext() + +export default GlobalStateContext; \ No newline at end of file diff --git a/src/Pages/LoginPage/index.js b/src/Pages/LoginPage/index.js index 494529d..6eb1947 100644 --- a/src/Pages/LoginPage/index.js +++ b/src/Pages/LoginPage/index.js @@ -2,6 +2,7 @@ import React, { useEffect, useState } from "react"; import { useHistory } from "react-router-dom"; import { goToHomePage, goToSignUpPage } from "../../Routes/coordinators"; import InitialScreen from "../../Components/InitialScreen"; +import Button from '@material-ui/core/Button'; export default function LoginPage() { const history = useHistory(); @@ -21,7 +22,7 @@ export default function LoginPage() { {exibirLogin && (
login - +
)} diff --git a/src/Tema/Tema.js b/src/Tema/Tema.js new file mode 100644 index 0000000..40a7aa4 --- /dev/null +++ b/src/Tema/Tema.js @@ -0,0 +1,25 @@ +import React from "react" +import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles'; + +const theme = createMuiTheme({ + palette: { + primary: { + main: "#e8222e" + }, + secondary: { + main: "#ff6158" + } + }, +}); + + +function Tema(props) { + + return ( + + {props.children} + + ); +} + +export default Tema; From 1528236e35e0f2c85491399e7598003a746c4a6e Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Wed, 20 Jan 2021 17:14:54 -0300 Subject: [PATCH 04/69] criado CardRestaurante --- .../CardRestaurante/CardRestaurante.js | 38 +++++++++++ src/Components/CardRestaurante/styles.js | 63 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 src/Components/CardRestaurante/CardRestaurante.js create mode 100644 src/Components/CardRestaurante/styles.js diff --git a/src/Components/CardRestaurante/CardRestaurante.js b/src/Components/CardRestaurante/CardRestaurante.js new file mode 100644 index 0000000..7fb374e --- /dev/null +++ b/src/Components/CardRestaurante/CardRestaurante.js @@ -0,0 +1,38 @@ +import React from 'react' +import CardMedia from '@material-ui/core/CardMedia'; +import useStyles from './styles.js' + +export default function CardRestaurante(props) { + + const classes = useStyles(); + + return ( +
+
+
+ + +

+ {props.nome? props.nome : "Restaurante"} +

+
+

+ {props.tempoDeEntrega} min +

+

+ {props.frete? props.frete : "Frete Grátis"} +

+
+ +
+
+
+ ); + } \ No newline at end of file diff --git a/src/Components/CardRestaurante/styles.js b/src/Components/CardRestaurante/styles.js new file mode 100644 index 0000000..b8d2121 --- /dev/null +++ b/src/Components/CardRestaurante/styles.js @@ -0,0 +1,63 @@ +import { makeStyles } from '@material-ui/core/styles'; + +const useStyles = makeStyles({ + cardContainer: { + height: '12.25rem', + padding: '0.5rem 1rem 0', + }, + card: { + padding: '0 0 1rem', + borderRadius: '8px', + border: 'solid 1px #b8b8b8' + }, + imagem : { + borderTopLeftRadius: 8, + borderTopRightRadius: 8, + }, + cardTextoDiv: { + display: "flex", + justifyContent: 'space-between', + }, + nomeRestaurante: { + width: '18.5rem', + height: '1.125rem', + margin: '0.75rem 1rem 0.25rem', + fontFamily: 'Roboto', + fontSize: '1rem', + fontWeight: 'normal', + fontStretch: 'normal', + fontStyle: 'normal', + lineHeight: 'normal', + letterSpacing: '-0.39px', + color:'#e8222e', + }, + tempoDeEntrega: { + width: '9.25rem', + height: '1.125rem', + margin: '0.25rem 0.5rem 0 1rem', + fontFamily: 'Roboto', + fontSize: '1rem', + fontWeight: 'normal', + fontStretch: 'normal', + fontStyle: 'normal', + lineHeight: 'normal', + letterSpacing: '-0.39px', + color: '#b8b8b8', + }, + taxaDeEntrega: { + width: '8.75rem', + height: '1.125rem', + margin: '0.25rem 1rem 0 0.5rem', + fontFamily: 'Roboto', + fontSize: '1rem', + fontWeight:' normal', + fontStretch:' normal', + fontStyle: 'normal', + lineHeight: 'normal', + letterSpacing: '-0.39px', + textAlign: 'right', + color: '#b8b8b8', + } + }); + + export default useStyles \ No newline at end of file From 27bcea61ebd4237903bee8d19f7464a1cd029004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Wed, 20 Jan 2021 17:21:58 -0300 Subject: [PATCH 05/69] =?UTF-8?q?paginas=20de=20add=20e=20editar=20endere?= =?UTF-8?q?=C3=A7o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/Button/index.js | 13 ++++++ src/Components/Button/styles.js | 15 ++++++ src/Components/FormAdress/index.js | 72 +++++++++++++++++++++++++++++ src/Components/FormAdress/styles.js | 32 +++++++++++++ src/Pages/AddAddressPage/index.js | 6 +++ src/Pages/AddAddressPage/styles.js | 2 + src/Pages/EditAdressPage/index.js | 27 +++++++++++ src/Pages/EditAdressPage/styles.js | 2 + src/Routes/Routes.js | 5 ++ 9 files changed, 174 insertions(+) create mode 100644 src/Components/Button/index.js create mode 100644 src/Components/Button/styles.js create mode 100644 src/Components/FormAdress/index.js create mode 100644 src/Components/FormAdress/styles.js create mode 100644 src/Pages/EditAdressPage/index.js create mode 100644 src/Pages/EditAdressPage/styles.js diff --git a/src/Components/Button/index.js b/src/Components/Button/index.js new file mode 100644 index 0000000..fa950df --- /dev/null +++ b/src/Components/Button/index.js @@ -0,0 +1,13 @@ +import React from 'react'; +import Button from "@material-ui/core/Button"; +import { ContainerButton, CampoButton} from './styles' + +export default function Buttons() { + return ( + + + Salvar + + + ) +} diff --git a/src/Components/Button/styles.js b/src/Components/Button/styles.js new file mode 100644 index 0000000..74ee73f --- /dev/null +++ b/src/Components/Button/styles.js @@ -0,0 +1,15 @@ +import styled from "styled-components"; +import Button from "@material-ui/core/Button"; + +export const ContainerButton = styled(Button)` +width: 20.5rem; +display: flex; +align-items: center; + +` + +export const CampoButton = styled.div` +text-align:center; + + +` \ No newline at end of file diff --git a/src/Components/FormAdress/index.js b/src/Components/FormAdress/index.js new file mode 100644 index 0000000..9aec046 --- /dev/null +++ b/src/Components/FormAdress/index.js @@ -0,0 +1,72 @@ +import React from "react"; +// import TextField from "@material-ui/core/TextField"; +import Button from "@material-ui/core/Button"; +import { Container, CampoText, InputArea} from './styles' +import { Title } from './styles' + + +export default function FormTextFields(props) { + return ( + +
+ {props.texto} +
+ + + + + + + + + + + + + + + + + + + + +
+
+ ); +} diff --git a/src/Components/FormAdress/styles.js b/src/Components/FormAdress/styles.js new file mode 100644 index 0000000..e171b75 --- /dev/null +++ b/src/Components/FormAdress/styles.js @@ -0,0 +1,32 @@ +import styled from 'styled-components'; +import TextField from "@material-ui/core/TextField"; +import Button from "@material-ui/core/Button"; + +export const Title = styled.h1` + text-align: center; + font-size: 1rem; + font-weight: normal; + font-stretch: normal; + font-style: normal; + line-height: normal; + letter-spacing: -0.39px; +`; + +export const Container = styled.div` + display: flex; + flex-direction: column; + align-items: center; +` + +export const CampoText = styled.div` + margin: 1rem; +` + +export const InputArea = styled(TextField)` + width: 20.5rem; + height: 3.5rem; +` + +export const ContainerButton = styled(Button)` + width: 20.5rem; +` \ No newline at end of file diff --git a/src/Pages/AddAddressPage/index.js b/src/Pages/AddAddressPage/index.js index 24b60df..a35c4b5 100644 --- a/src/Pages/AddAddressPage/index.js +++ b/src/Pages/AddAddressPage/index.js @@ -1,12 +1,18 @@ import React from 'react' import { useHistory } from "react-router-dom"; import { goBack, goToHomePage } from '../../Routes/coordinators'; +import FormAdress from '../../Components/FormAdress'; +import Buttons from '../../Components/Button'; + export default function AddAddressPage() { const history = useHistory(); return (
+ + diff --git a/src/Pages/AddAddressPage/styles.js b/src/Pages/AddAddressPage/styles.js index e69de29..6450ccd 100644 --- a/src/Pages/AddAddressPage/styles.js +++ b/src/Pages/AddAddressPage/styles.js @@ -0,0 +1,2 @@ +// import styled from 'styled-components' + diff --git a/src/Pages/EditAdressPage/index.js b/src/Pages/EditAdressPage/index.js new file mode 100644 index 0000000..ed11800 --- /dev/null +++ b/src/Pages/EditAdressPage/index.js @@ -0,0 +1,27 @@ +import React from 'react' +import { useHistory } from "react-router-dom"; +import { goBack, goToHomePage } from '../../Routes/coordinators'; +import FormAdress from '../../Components/FormAdress' +import { Title } from './styles' +import Buttons from '../../Components/Button'; + +export default function EditAdressPage() { + const history = useHistory(); + + return ( +
+ + {/* Meu endereço */} + + + + + +
+ ) +} \ No newline at end of file diff --git a/src/Pages/EditAdressPage/styles.js b/src/Pages/EditAdressPage/styles.js new file mode 100644 index 0000000..6450ccd --- /dev/null +++ b/src/Pages/EditAdressPage/styles.js @@ -0,0 +1,2 @@ +// import styled from 'styled-components' + diff --git a/src/Routes/Routes.js b/src/Routes/Routes.js index 76576d7..29500b7 100644 --- a/src/Routes/Routes.js +++ b/src/Routes/Routes.js @@ -4,6 +4,7 @@ import HomePage from "../Pages/HomePage"; import AddAddressPage from "../Pages/AddAddressPage"; import CartPage from "../Pages/CartPage"; import EditProfilePage from "../Pages/EditProfilePage"; +import EditAdressPage from "../Pages/EditAdressPage" import LoginPage from "../Pages/LoginPage"; import ProfilePage from "../Pages/ProfilePage"; import RestaurantPage from "../Pages/RestaurantPage"; @@ -31,6 +32,10 @@ export default function Routes() { + + + + From 94344e73fd0d6ab4d9ee107218fd754fd137a942 Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Wed, 20 Jan 2021 17:43:36 -0300 Subject: [PATCH 06/69] adicionado componente header --- src/Components/Header/index.js | 22 ++++++++++++++++++++++ src/Components/Header/styles.js | 21 +++++++++++++++++++++ src/Global/GlobalState.js | 7 ++++--- src/Pages/CartPage/index.js | 12 ++++++++++-- src/index.css | 2 +- 5 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 src/Components/Header/index.js create mode 100644 src/Components/Header/styles.js diff --git a/src/Components/Header/index.js b/src/Components/Header/index.js new file mode 100644 index 0000000..074025f --- /dev/null +++ b/src/Components/Header/index.js @@ -0,0 +1,22 @@ +import React, { useContext } from 'react' +import { useHistory } from 'react-router-dom' +import { goBack } from '../../Routes/coordinators' +import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos'; +import { HeaderContainer } from './styles'; +import GlobalStateContext from "../../Global/GlobalStateContext"; + + +export default function Header(props) { + const history = useHistory() + const {states, setters} = useContext(GlobalStateContext) + + return ( + + {/* o estado inicial para mostrar o botão é true, caso sua tela não precise, + faça um useEffect setando o headerButton para false */} + {states.headerButton? : null} + {/* para nomear a sua página use a prop >>> pageName='nome da sua página' */} +

{props.pageName}

+
+ ) +} diff --git a/src/Components/Header/styles.js b/src/Components/Header/styles.js new file mode 100644 index 0000000..460588f --- /dev/null +++ b/src/Components/Header/styles.js @@ -0,0 +1,21 @@ +import styled from 'styled-components' + +export const HeaderContainer = styled.div ` + display: flex; + justify-content: space-between; + box-shadow: 0 0.5px 0 0 rgba(0, 0, 0, 0.25); + height: 2.75rem; +h3{ + flex-grow: 1; + text-align: center; + align-self: center; + font-size: 1rem; + font-weight: 500; + letter-spacing: -0.39px; +} +button { + margin-left: 1rem; + border: none; + background: none; +} +` \ No newline at end of file diff --git a/src/Global/GlobalState.js b/src/Global/GlobalState.js index 1da6ad6..a6616f7 100644 --- a/src/Global/GlobalState.js +++ b/src/Global/GlobalState.js @@ -11,14 +11,15 @@ export default function GlobalState(props) { const [restaurante, setRestaurante] = useState({}) const [listaRestaurantes, setListaRestaurantes] = useState([]) const [token, setToken] = useState("") + const [headerButton, setHeaderButton] = useState(true) /* Renderiza botão de voltar no header */ - const states = {carrinho, perfil, restaurante, listaRestaurantes, token} - const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken} + const states = {carrinho, perfil, restaurante, listaRestaurantes, token, headerButton} + const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken, setHeaderButton} const requests = {} return ( - + {props.children} ) diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index 67e9261..c635061 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -1,13 +1,21 @@ -import React from 'react' +import React, { useContext, useEffect } from 'react' import { useHistory } from "react-router-dom"; -import { goBack, goToCartPage, goToHomePage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; +import Header from '../../Components/Header'; +import { goBack, goToHomePage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; +import GlobalStateContext from "../../Global/GlobalStateContext"; export default function CartPage() { const history = useHistory(); + const {states, setters} = useContext(GlobalStateContext) + + useEffect(() => { + setters.setHeaderButton(false) + }, []) return (
+
carrinho - - - -
+
+ + + + Meu Perfil + + + Bruna Olivera + bruna_o@gmail.com + 333.333.333-33 + + + + Endereço cadastrado: + Rua Alessandra Vieira, 42 - Santana + + Histórico de Pedidos + + + Bullquer Vila Madalena + 23 outubro 2019 + SUBTOTAL R$67,00 + + + Vinil Burger Butantã + 30 setembro 2019 + SUBTOTAL R$89,00 + + + Bullquer Vila Madalena + 10 setembro 2019 + SUBTOTAL R$77,00 + + + + + perfil do usuário + + + + +
) } diff --git a/src/Pages/ProfilePage/styles.js b/src/Pages/ProfilePage/styles.js index e69de29..f336830 100644 --- a/src/Pages/ProfilePage/styles.js +++ b/src/Pages/ProfilePage/styles.js @@ -0,0 +1,140 @@ +import styled from 'styled-components' + +export const DivPerfil = styled.div` + width: 22.5rem; + height: 40rem; + display: flex; + flex-direction: column; + border: 1px solid black; + position: relative; +` + +export const HeaderDiv = styled.div` + width: 100%; + height: 4rem; + display: flex; + align-items: center; + justify-content: center; + border-bottom: 1px solid black; +` + +export const CaixaPerfil = styled.div` + width: 100%; + margin: 0; + padding: 1rem 0; +` + +export const CaixaInfo = styled.div` + width: 20.5rem; + height: 1.125rem; + font-size: 1rem; + letter-spacing: -0.39px; + margin: 1rem 1rem 0.5rem; + color: #000000; +` + +export const CaixaEndereco = styled.div` + width: 20.5rem; + height: 4.75rem; + padding: 0 1rem; + background-color: #eeeeee; + position: relative; +` + +export const CaixaEnd = styled.div` + width: 20.5rem; + height: 1.125rem; + margin: 0 0 0.5rem; + font-size: 1rem; + letter-spacing: -0.39px; + color: #b8b8b8; +` + +export const CaixaInfoEnd = styled.div` + width: 20.5rem; + height: 1.125rem; + margin-top: 1rem; + font-size: 1rem; + letter-spacing: -0.39px; +` + +export const CaixaHistoricoPedidos = styled.div` + width: 20.5rem; + height: 1.625rem; + margin-left: 1rem; + font-size: 1rem; + letter-spacing: -0.39px; + border-bottom: 1px solid black; +` + +export const IconePerfil = styled.img` + width: 1.5rem; + height: 1.5rem; + object-fit: contain; + position: absolute; + top: 6rem; + right: 1rem; + + :hover { + opacity: 0.5; + } + :active { + opacity: 1; + } +` + +export const IconeEndereco = styled.img` + width: 1.5rem; + height: 1.5rem; + object-fit: contain; + position: absolute; + top: 1.625rem; + right: 1rem; + + :hover { + opacity: 0.5; + } + :active { + opacity: 1; + } +` + +export const ContainerDosPedidos = styled.div` + width: 22.5rem; + height: 6.875rem; +` + +export const CaixaPedido = styled.div` + width: 20.5rem; + height: 6.375rem; + margin: 0.438rem 1rem 0 1rem; + border-radius: 8px; + border: 1px solid #B8B8B8; +` + +export const DivName = styled.div` + width: 18.5rem; + height: 1.125rem; + margin: 1rem 1rem 0 1rem; + font-size: 1rem; + letter-spacing: -0ch.39px; + color: #E8222E; +` + +export const DivData = styled.div` + width: 18.5rem; + height: 1.125rem; + margin: 0.563rem 1rem 0 1rem; + font-size: 0.75rem; + letter-spacing: -0ch.29px; +` + +export const DivTotal = styled.div` + width: 18.5rem; + height: 1.125rem; + margin: 0.438rem 1rem 0 1rem; + font-size: 1rem; + font-weight: bold; + letter-spacing: -normal.029px; +` + diff --git a/src/assets/iconelapis.png b/src/assets/iconelapis.png new file mode 100644 index 0000000000000000000000000000000000000000..b284b0d1c7e16145bea23887f4bc494b88afbd51 GIT binary patch literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjjKx9jP7LeL$-D$|c6z!vhIsJ4 zoovY0Q1M7p*XJt!bqVTAuO;LszZbP>_?KRGqAlVrpPGvGNq%pSd-G@h4GCSj zH-EuphVaZuRqqq|nC>kpzYyzhKG|(UloZn)pBXB_vFWq`lb$VXGYYVfPtk0{9 zj(*sz;m@gT{LpWbcH4ZH%%y>c8qV#U{Nxww@gooNvNxXN{v&Pr+xhNwCn2-eWCtrb zp}>;e0UM_sdZ3#4Na$#*44;GV8g1?8*%g)l|FhXuu({ur_$$u|^aO*atDnm{r-UW| DZ6jr% literal 0 HcmV?d00001 From 296610f5b6867b837c7a82a794f22378eeccfd0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Thu, 21 Jan 2021 09:41:40 -0300 Subject: [PATCH 08/69] =?UTF-8?q?inputs=20controlados=20e=20valida=C3=A7?= =?UTF-8?q?=C3=A3o=20dos=20campos=20das=20paginas=20com=20endere=C3=A7o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/Button/index.js | 11 +- src/Components/FormAdress/index.js | 167 +++++++++++++++++----------- src/Components/FormAdress/styles.js | 2 +- src/CustomHooks/useForm.js | 16 +++ src/Pages/AddAddressPage/index.js | 4 +- src/Pages/EditAdressPage/index.js | 7 +- 6 files changed, 135 insertions(+), 72 deletions(-) create mode 100644 src/CustomHooks/useForm.js diff --git a/src/Components/Button/index.js b/src/Components/Button/index.js index fa950df..9c62a4f 100644 --- a/src/Components/Button/index.js +++ b/src/Components/Button/index.js @@ -1,12 +1,15 @@ import React from 'react'; -import Button from "@material-ui/core/Button"; import { ContainerButton, CampoButton} from './styles' -export default function Buttons() { +export default function Buttons(props) { return ( - - Salvar + + {props.texto} ) diff --git a/src/Components/FormAdress/index.js b/src/Components/FormAdress/index.js index 9aec046..3056ccd 100644 --- a/src/Components/FormAdress/index.js +++ b/src/Components/FormAdress/index.js @@ -1,72 +1,115 @@ import React from "react"; +import Buttons from "../Button"; // import TextField from "@material-ui/core/TextField"; -import Button from "@material-ui/core/Button"; -import { Container, CampoText, InputArea} from './styles' -import { Title } from './styles' - +// import Button from "@material-ui/core/Button"; +import { Container, CampoText, InputArea} from './styles'; +import { Title } from './styles'; +import useForm from '../../CustomHooks/useForm' export default function FormTextFields(props) { - return ( + const [form, handleInput, resetState] = useForm({ + street:'', + number:'', + neighbourhood:'', + city: '', + state:'', + complement:'' + }) + const submitForm = (e) => { + e.preventDefault() + resetState() //resetando os inputs// + console.log(form) //----------------------------------------------// + } + + return (
- {props.texto} -
- - - - - - - - - - - - - - - - - - {props.texto} + + + + + + + - - - + value={form.number} + onChange={handleInput} + name="number" + id="outlined-disabled" + label="Número" + // defaultValue="Número" + placeholder="Número" + variant="outlined" + type="number" + /> + + + + + + + + + + + + + +
+ +
); } diff --git a/src/Components/FormAdress/styles.js b/src/Components/FormAdress/styles.js index e171b75..3947709 100644 --- a/src/Components/FormAdress/styles.js +++ b/src/Components/FormAdress/styles.js @@ -5,7 +5,7 @@ import Button from "@material-ui/core/Button"; export const Title = styled.h1` text-align: center; font-size: 1rem; - font-weight: normal; + /* font-weight: normal; */ font-stretch: normal; font-style: normal; line-height: normal; diff --git a/src/CustomHooks/useForm.js b/src/CustomHooks/useForm.js new file mode 100644 index 0000000..789ac9d --- /dev/null +++ b/src/CustomHooks/useForm.js @@ -0,0 +1,16 @@ +import { useState } from 'react' + +const useForm = (initialState) => { + const [form, setForm] = useState(initialState) + + const handleInputChange = (event) => { + const {value, name} = event.target + setForm({...form, [name]: value}) + } + const resetState = () => { + setForm(initialState) +} + return [form, handleInputChange, resetState] +} + +export default useForm \ No newline at end of file diff --git a/src/Pages/AddAddressPage/index.js b/src/Pages/AddAddressPage/index.js index a35c4b5..06f3de8 100644 --- a/src/Pages/AddAddressPage/index.js +++ b/src/Pages/AddAddressPage/index.js @@ -3,6 +3,7 @@ import { useHistory } from "react-router-dom"; import { goBack, goToHomePage } from '../../Routes/coordinators'; import FormAdress from '../../Components/FormAdress'; import Buttons from '../../Components/Button'; +import Header from '../../Components/Header'; export default function AddAddressPage() { @@ -10,9 +11,10 @@ export default function AddAddressPage() { return (
+
- + diff --git a/src/Pages/EditAdressPage/index.js b/src/Pages/EditAdressPage/index.js index ed11800..5d7be61 100644 --- a/src/Pages/EditAdressPage/index.js +++ b/src/Pages/EditAdressPage/index.js @@ -2,19 +2,18 @@ import React from 'react' import { useHistory } from "react-router-dom"; import { goBack, goToHomePage } from '../../Routes/coordinators'; import FormAdress from '../../Components/FormAdress' -import { Title } from './styles' +import Header from '../../Components/Header' import Buttons from '../../Components/Button'; export default function EditAdressPage() { const history = useHistory(); + return (
- - {/* Meu endereço */} +
- From c801c1a3cdbe3c30a5a4ac16ae1fc68187fdd923 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Thu, 21 Jan 2021 10:41:15 -0300 Subject: [PATCH 09/69] =?UTF-8?q?Estiliza=C3=A7=C3=A3o=20da=20barra=20de?= =?UTF-8?q?=20pesquisa=20feita?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/SearchBar/SearchBar.js | 19 ++++++++++++++++++ src/Components/SearchBar/styles.js | 28 +++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/Components/SearchBar/SearchBar.js create mode 100644 src/Components/SearchBar/styles.js diff --git a/src/Components/SearchBar/SearchBar.js b/src/Components/SearchBar/SearchBar.js new file mode 100644 index 0000000..7c573ac --- /dev/null +++ b/src/Components/SearchBar/SearchBar.js @@ -0,0 +1,19 @@ +import React from 'react' +import TextField from '@material-ui/core/TextField'; +import useStyles from './styles' +import InputAdornment from '@material-ui/core/InputAdornment'; +import {Search} from "@material-ui/icons" + +export default function SearchBar() { + + const classes = useStyles(); + + return ( +
+
+ + +
+
+ ) +} diff --git a/src/Components/SearchBar/styles.js b/src/Components/SearchBar/styles.js new file mode 100644 index 0000000..34ce989 --- /dev/null +++ b/src/Components/SearchBar/styles.js @@ -0,0 +1,28 @@ +import { makeStyles } from '@material-ui/core/styles'; + +const useStyles = makeStyles({ + textField: { + height: '3.5rem', + borderRadius: '2px', + border: 'solid 1px #b8b8b8', + display: 'flex', + alignItems:' center', + padding: '0 0.503rem 0 1.063rem', + margin: '0 16px', + }, + input: { + border: 'none', + fontFamily:'Roboto', + height: '3em', + width: '18em', + fontSize: '1em', + "&:focus": { + outline: 'none', + } + }, + searchIcon: { + color: "#b8b8b8" + } +}) + +export default useStyles \ No newline at end of file From 4920fe8a7bf961ce124a57b6e1251152330c2a27 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Thu, 21 Jan 2021 11:20:37 -0300 Subject: [PATCH 10/69] aplicando estado global de input da pesquisa --- src/Components/SearchBar/SearchBar.js | 18 ++++++++++++++++-- src/Global/GlobalState.js | 5 +++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Components/SearchBar/SearchBar.js b/src/Components/SearchBar/SearchBar.js index 7c573ac..a408590 100644 --- a/src/Components/SearchBar/SearchBar.js +++ b/src/Components/SearchBar/SearchBar.js @@ -1,18 +1,32 @@ -import React from 'react' +import React,{useContext} from 'react' import TextField from '@material-ui/core/TextField'; import useStyles from './styles' import InputAdornment from '@material-ui/core/InputAdornment'; import {Search} from "@material-ui/icons" +import GlobalStateContext from "../../Global/GlobalStateContext"; export default function SearchBar() { + const {states, setters} = useContext(GlobalStateContext) const classes = useStyles(); + const onChangeInput = (event) => { + + setters.setSearchInput(event.target.value) + console.log(event.target.value) + console.log(states.searchInput) + } + console.log(states) return (
- +
) diff --git a/src/Global/GlobalState.js b/src/Global/GlobalState.js index a6616f7..1c623da 100644 --- a/src/Global/GlobalState.js +++ b/src/Global/GlobalState.js @@ -12,10 +12,11 @@ export default function GlobalState(props) { const [listaRestaurantes, setListaRestaurantes] = useState([]) const [token, setToken] = useState("") const [headerButton, setHeaderButton] = useState(true) /* Renderiza botão de voltar no header */ + const [searchInput, setSearchInput] = useState("") /* Controla input da barra de pesquisa */ - const states = {carrinho, perfil, restaurante, listaRestaurantes, token, headerButton} - const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken, setHeaderButton} + const states = {carrinho, perfil, restaurante, listaRestaurantes, token, headerButton, searchInput} + const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken, setHeaderButton, setSearchInput} const requests = {} return ( From 4f477bc2307a5b37af0f3b4de467f0b90fe8db4f Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Thu, 21 Jan 2021 12:02:18 -0300 Subject: [PATCH 11/69] =?UTF-8?q?adicionando=20p=C3=A1gina=20de=20busca?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/SearchBar/SearchBar.js | 8 ++++++-- src/Pages/HomePage/index.js | 8 ++++++++ src/Pages/SearchPage/index.js | 13 +++++++++++++ src/Routes/Routes.js | 5 +++++ src/Routes/coordinators.js | 4 ++++ 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 src/Pages/SearchPage/index.js diff --git a/src/Components/SearchBar/SearchBar.js b/src/Components/SearchBar/SearchBar.js index a408590..c16a360 100644 --- a/src/Components/SearchBar/SearchBar.js +++ b/src/Components/SearchBar/SearchBar.js @@ -1,12 +1,15 @@ import React,{useContext} from 'react' +import { useHistory } from "react-router-dom"; import TextField from '@material-ui/core/TextField'; import useStyles from './styles' import InputAdornment from '@material-ui/core/InputAdornment'; import {Search} from "@material-ui/icons" import GlobalStateContext from "../../Global/GlobalStateContext"; +import {goToSearchPage} from "../../Routes/coordinators"; -export default function SearchBar() { - +export default function SearchBar(props) { + + const history = useHistory(); const {states, setters} = useContext(GlobalStateContext) const classes = useStyles(); @@ -22,6 +25,7 @@ export default function SearchBar() {
goToSearchPage(history)} value={states.searchInput} className={classes.input} placeholder={"Restaurantes"} diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index a33137f..9bf5db7 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -4,13 +4,21 @@ import { goToCartPage, goToProfilePage, goToRestaurantsPage, + goToSearchPage, } from "../../Routes/coordinators"; +import Header from "../../Components/Header/index.js" +import SearchBar from "../../Components/SearchBar/SearchBar" + export default function HomePage() { const history = useHistory(); + + return (
home / feed +
+ : null} + use a prop button com o valor "false" (string)*/} + {props.button === "false" ? null : } {/* para nomear a sua página use a prop >>> pageName='nome da sua página' */}

{props.pageName}

- ) + ) } diff --git a/src/Components/SearchBar/SearchBar.js b/src/Components/SearchBar/SearchBar.js index da8322c..b4a421e 100644 --- a/src/Components/SearchBar/SearchBar.js +++ b/src/Components/SearchBar/SearchBar.js @@ -3,7 +3,7 @@ import { useHistory } from "react-router-dom"; import useStyles from './styles' import {Search} from "@material-ui/icons" import GlobalStateContext from "../../Global/GlobalStateContext"; -import {goToSearchPage} from "../../Routes/coordinators"; +import {goToSearchPage} from "../../Routes/coordinators"; export default function SearchBar(props) { diff --git a/src/Components/SearchBar/styles.js b/src/Components/SearchBar/styles.js index 34ce989..ecec251 100644 --- a/src/Components/SearchBar/styles.js +++ b/src/Components/SearchBar/styles.js @@ -8,7 +8,7 @@ const useStyles = makeStyles({ display: 'flex', alignItems:' center', padding: '0 0.503rem 0 1.063rem', - margin: '0 16px', + margin: '0.5em 16px', }, input: { border: 'none', diff --git a/src/Global/GlobalState.js b/src/Global/GlobalState.js index 1c623da..1011acc 100644 --- a/src/Global/GlobalState.js +++ b/src/Global/GlobalState.js @@ -11,12 +11,11 @@ export default function GlobalState(props) { const [restaurante, setRestaurante] = useState({}) const [listaRestaurantes, setListaRestaurantes] = useState([]) const [token, setToken] = useState("") - const [headerButton, setHeaderButton] = useState(true) /* Renderiza botão de voltar no header */ const [searchInput, setSearchInput] = useState("") /* Controla input da barra de pesquisa */ - const states = {carrinho, perfil, restaurante, listaRestaurantes, token, headerButton, searchInput} - const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken, setHeaderButton, setSearchInput} + const states = {carrinho, perfil, restaurante, listaRestaurantes, token, searchInput} + const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken, setSearchInput} const requests = {} return ( diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index 9bf5db7..d16b7e6 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -1,4 +1,4 @@ -import React from "react"; +import React,{ useContext} from "react"; import { useHistory } from "react-router-dom"; import { goToCartPage, @@ -8,16 +8,18 @@ import { } from "../../Routes/coordinators"; import Header from "../../Components/Header/index.js" import SearchBar from "../../Components/SearchBar/SearchBar" +import GlobalStateContext from "../../Global/GlobalStateContext"; export default function HomePage() { + + const {states, setters} = useContext(GlobalStateContext) const history = useHistory(); return (
- home / feed -
+
From 7ccdec3e6ed773eb5d7d28bc4d513ff75fc0c62d Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Thu, 21 Jan 2021 13:39:32 -0300 Subject: [PATCH 14/69] iniciado mock da pagina carrinho --- src/Pages/CartPage/index.js | 55 +++++++++++++++++++++++++++++++-- src/Pages/CartPage/styles.js | 59 ++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 3 deletions(-) diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index c635061..3d84ffd 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -1,9 +1,13 @@ -import React, { useContext, useEffect } from 'react' +import React, { useContext, useEffect , useState } from 'react' import { useHistory } from "react-router-dom"; import Header from '../../Components/Header'; import { goBack, goToHomePage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; import GlobalStateContext from "../../Global/GlobalStateContext"; - +import Buttons from '../../Components/Button'; +import { ContainerCarrinho, ContainerEndereco , MensagemVazio , SubtotalContainer , StyledForm } from './styles'; +import FormControlLabel from '@material-ui/core/FormControlLabel'; +import Radio from '@material-ui/core/Radio'; +import RadioGroup from '@material-ui/core/RadioGroup'; export default function CartPage() { const history = useHistory(); @@ -13,10 +17,55 @@ export default function CartPage() { setters.setHeaderButton(false) }, []) + const frete = 5.99 /* logica para puxar o frete*/ + const subtotal = 60.99 /* logica para puxar o subtotal*/ + + + const [value, setValue] = useState('dinheiro'); + + const handleChange = (event) => { + setValue(event.target.value); + } + + return (
- carrinho + + +

Endereço de entrega

+

Rua Alessandra, 42

{/* lógica para puxar endereço */} +
+ + + Carrinho vazio {/* ternario para renderizar o carrinho */} + + + SUBTOTAL +
+ Frete R${frete} {/* logica para puxar o frete*/ } + R$ {subtotal} {/* logica para puxar o subtotal*/ } +
+
+ + +

Forma de Pagamento

+ + } label="Dinheiro" />
+ } label="Cartão de crédito" /> +
+ + +
+ +
+ + + + + + + @@ -79,6 +69,6 @@ export default function CartPage() { -
+ ) } diff --git a/src/Pages/CartPage/styles.js b/src/Pages/CartPage/styles.js index df1ce3e..023da75 100644 --- a/src/Pages/CartPage/styles.js +++ b/src/Pages/CartPage/styles.js @@ -1,6 +1,17 @@ import styled from "styled-components"; +export const CartPageContainer = styled.div ` + display: flex; + flex-direction: column; + justify-content: space-between; + min-height: 100vh; +` + + export const ContainerCarrinho = styled.div ` + display: flex; + flex-direction: column; + flex-grow: 1; margin: 0 1rem; ` @@ -47,6 +58,11 @@ span:nth-child(2) { ` export const StyledForm = styled.form ` + display: flex; + flex-direction: column; + flex-grow: 1; + justify-content: space-between; + margin-bottom: 1rem; p { border-bottom: 1px solid black; margin-bottom: 0.5rem; From b7c55d6b411ffad898395f9584e5383f2ba59ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Thu, 21 Jan 2021 16:03:13 -0300 Subject: [PATCH 16/69] layout da pagina de signUp, falta controlar os inputs --- src/Components/{Button => Buttons}/index.js | 0 src/Components/{Button => Buttons}/styles.js | 3 - src/Components/FormAdress/index.js | 4 +- src/Components/FormAdress/styles.js | 11 +- src/Pages/AddAddressPage/index.js | 4 +- src/Pages/EditAdressPage/index.js | 8 +- src/Pages/SignUpPage/SignUpForm.js | 192 +++++++++++++++++++ src/Pages/SignUpPage/index.js | 9 + src/Pages/SignUpPage/styles.js | 42 ++++ src/assets/logo-future-eats-invert.png | Bin 0 -> 4137 bytes 10 files changed, 256 insertions(+), 17 deletions(-) rename src/Components/{Button => Buttons}/index.js (100%) rename src/Components/{Button => Buttons}/styles.js (98%) create mode 100644 src/Pages/SignUpPage/SignUpForm.js create mode 100644 src/assets/logo-future-eats-invert.png diff --git a/src/Components/Button/index.js b/src/Components/Buttons/index.js similarity index 100% rename from src/Components/Button/index.js rename to src/Components/Buttons/index.js diff --git a/src/Components/Button/styles.js b/src/Components/Buttons/styles.js similarity index 98% rename from src/Components/Button/styles.js rename to src/Components/Buttons/styles.js index 74ee73f..ed81acf 100644 --- a/src/Components/Button/styles.js +++ b/src/Components/Buttons/styles.js @@ -5,11 +5,8 @@ export const ContainerButton = styled(Button)` width: 20.5rem; display: flex; align-items: center; - ` export const CampoButton = styled.div` text-align:center; - - ` \ No newline at end of file diff --git a/src/Components/FormAdress/index.js b/src/Components/FormAdress/index.js index 3056ccd..7fbd61a 100644 --- a/src/Components/FormAdress/index.js +++ b/src/Components/FormAdress/index.js @@ -1,12 +1,12 @@ import React from "react"; -import Buttons from "../Button"; +import Buttons from "../Buttons"; // import TextField from "@material-ui/core/TextField"; // import Button from "@material-ui/core/Button"; import { Container, CampoText, InputArea} from './styles'; import { Title } from './styles'; import useForm from '../../CustomHooks/useForm' -export default function FormTextFields(props) { +export default function FormAdress(props) { const [form, handleInput, resetState] = useForm({ street:'', number:'', diff --git a/src/Components/FormAdress/styles.js b/src/Components/FormAdress/styles.js index 3947709..8f148cf 100644 --- a/src/Components/FormAdress/styles.js +++ b/src/Components/FormAdress/styles.js @@ -3,6 +3,7 @@ import TextField from "@material-ui/core/TextField"; import Button from "@material-ui/core/Button"; export const Title = styled.h1` + font-family: Roboto; text-align: center; font-size: 1rem; /* font-weight: normal; */ @@ -10,23 +11,21 @@ export const Title = styled.h1` font-style: normal; line-height: normal; letter-spacing: -0.39px; -`; +` export const Container = styled.div` display: flex; flex-direction: column; align-items: center; ` - export const CampoText = styled.div` margin: 1rem; ` - export const InputArea = styled(TextField)` width: 20.5rem; height: 3.5rem; ` -export const ContainerButton = styled(Button)` - width: 20.5rem; -` \ No newline at end of file +// export const ContainerButton = styled(Button)` +// width: 20.5rem; +// ` \ No newline at end of file diff --git a/src/Pages/AddAddressPage/index.js b/src/Pages/AddAddressPage/index.js index 06f3de8..c793f5e 100644 --- a/src/Pages/AddAddressPage/index.js +++ b/src/Pages/AddAddressPage/index.js @@ -2,7 +2,7 @@ import React from 'react' import { useHistory } from "react-router-dom"; import { goBack, goToHomePage } from '../../Routes/coordinators'; import FormAdress from '../../Components/FormAdress'; -import Buttons from '../../Components/Button'; +import Buttons from '../../Components/Buttons'; import Header from '../../Components/Header'; @@ -13,7 +13,7 @@ export default function AddAddressPage() {
+ texto={"Meu endereço"}/> diff --git a/src/Pages/SignUpPage/SignUpForm.js b/src/Pages/SignUpPage/SignUpForm.js new file mode 100644 index 0000000..e43c48b --- /dev/null +++ b/src/Pages/SignUpPage/SignUpForm.js @@ -0,0 +1,192 @@ +import React from 'react'; +import Buttons from '../../Components/Buttons' +import { Container, CampoText, InputArea, Title, ContainerSignUp, Image, ContainerInputPassword} from './styles'; +import Logo from '../../assets/logo-future-eats-invert.png'; +import OutlinedInput from '@material-ui/core/OutlinedInput'; +import { IconButton, InputAdornment, InputLabel } from '@material-ui/core'; +import Visibility from '@material-ui/icons/Visibility'; +import VisibilityOff from '@material-ui/icons/VisibilityOff'; +import useForm from '../../CustomHooks/useForm'; + +export default function SignUpForm(props) { + const [form, handleInput, resetState] = useForm({ + name:'', + email:'', + cpf:'', + password: '', + }) + + const [values, setValues] = React.useState({ + password: '', + confirmPassword:'', + showPassword: false, + showConfirmPassword: false, + }); + + const handleChange = (prop) => (event) => { + setValues({ ...values, [prop]: event.target.value }); + }; + + const handleClickShowPassword = () => { + setValues( + { ...values, showPassword: !values.showPassword }); + }; + + const handleClickShowConfirmPassword = () => { + setValues( + { ...values, showConfirmPassword: !values.showConfirmPassword }); + }; + + + const handleMouseDownPassword = (event) => { + event.preventDefault(); + }; + return ( + + + + + {props.texto} +
+ + + + + + + + + + + + + Senha + + + {values.showPassword ? : } + + + } + + /> + + + + {/* */} + + + + + Confirmar + + + {values.showConfirmPassword ? : } + + + } + + /> + + + {/* */} + + + + + +
+ ) +} diff --git a/src/Pages/SignUpPage/index.js b/src/Pages/SignUpPage/index.js index ce04e76..933f462 100644 --- a/src/Pages/SignUpPage/index.js +++ b/src/Pages/SignUpPage/index.js @@ -1,12 +1,21 @@ import React from 'react' import { useHistory } from "react-router-dom"; +import Header from '../../Components/Header'; import { goBack, goToAddAddressPage } from '../../Routes/coordinators'; +import SignUpForm from './SignUpForm'; + export default function SignUpPage() { const history = useHistory(); return (
+
+ + + cadastro de usuário - -
- )} + {exibirLogin && } ); } diff --git a/src/assets/logo-future-eats-invert.svg b/src/assets/logo-future-eats-invert.svg new file mode 100644 index 0000000..1a81ffc --- /dev/null +++ b/src/assets/logo-future-eats-invert.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 20a8d52f7f2abadf657ffdf9a557208f9d6de7d1 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Thu, 21 Jan 2021 20:31:40 -0300 Subject: [PATCH 18/69] =?UTF-8?q?Adicionando=20filtros=20nas=20p=C3=A1gina?= =?UTF-8?q?s=20da=20Home?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debug.log | 1 + .../CardRestaurante/CardRestaurante.js | 2 +- src/Components/FeedMenu/FeedMenu.js | 170 ++++++++++++++++++ src/Global/GlobalState.js | 5 +- src/Pages/HomePage/index.js | 117 +++++++++++- src/Pages/SearchPage/index.js | 114 +++++++++++- 6 files changed, 403 insertions(+), 6 deletions(-) create mode 100644 debug.log create mode 100644 src/Components/FeedMenu/FeedMenu.js diff --git a/debug.log b/debug.log new file mode 100644 index 0000000..468cf86 --- /dev/null +++ b/debug.log @@ -0,0 +1 @@ +[0121/095442.888:ERROR:directory_reader_win.cc(43)] FindFirstFile: O sistema no pode encontrar o caminho especificado. (0x3) diff --git a/src/Components/CardRestaurante/CardRestaurante.js b/src/Components/CardRestaurante/CardRestaurante.js index 7fb374e..5d4cb30 100644 --- a/src/Components/CardRestaurante/CardRestaurante.js +++ b/src/Components/CardRestaurante/CardRestaurante.js @@ -27,7 +27,7 @@ export default function CardRestaurante(props) { {props.tempoDeEntrega} min

- {props.frete? props.frete : "Frete Grátis"} + {props.frete? `Frete R$ ${props.frete},00` : "Frete Grátis"}

diff --git a/src/Components/FeedMenu/FeedMenu.js b/src/Components/FeedMenu/FeedMenu.js new file mode 100644 index 0000000..afcaf8c --- /dev/null +++ b/src/Components/FeedMenu/FeedMenu.js @@ -0,0 +1,170 @@ +import React, {useState, useContext} from 'react' +import styled from "styled-components" +import GlobalStateContext from "../../Global/GlobalStateContext"; + +const Menu = styled.div` + height: 2.625rem; + margin: 0.5rem 0.5rem 0; + display: flex; + align-items: center; + overflow: auto; + ::-webkit-scrollbar { + display: none; + } + -ms-overflow-style: none; + scrollbar-width: none; + + a { + margin: 0.75em; + color: var(--black); + width: 5.438rem; + height: 1.125rem; + font-family: Roboto; + font-size: 1rem; + font-weight: 500; + font-stretch: normal; + font-style: normal; + line-height: normal; + letter-spacing: -0.39px; + text-align: center; + } + + .red { + color: #e8222e; + } + +` + +export default function FeedMenu() { + + const teste = [ + { + "id": "1", + "description": "Habib's é uma rede de restaurantes de comida rápida brasileira especializada em culinária árabe, os restaurantes vendem mais de 600 milhões de esfirras por ano. A empresa emprega 22 mil colaboradores e tem 421 unidades distribuídas em mais de cem municípios em 20 unidades federativas.", + "shipping": 6, + "address": "Rua das Margaridas, 110 - Jardim das Flores", + "name": "Habibs", + "logoUrl": "http://soter.ninja/futureFoods/logos/habibs.jpg", + "deliveryTime": 60, + "category": "Árabe" + }, + { + "id": "10", + "address": "Travessa Reginaldo Pereira, 130 - Ibitinga", + "name": "Tadashii", + "logoUrl": "http://soter.ninja/futureFoods/logos/tadashii.png", + "deliveryTime": 50, + "category": "Asiática", + "description": "Restaurante sofisticado busca o equilíbrio entre ingredientes que realçam a experiência da culinária japonesa.", + "shipping": 13 + }, + { + "id": "2", + "description": "McDonald's Corporation é a maior cadeia mundial de restaurantes de fast food de hambúrguer, servindo cerca de 68 milhões de clientes por dia em 119 países através de 37 mil pontos de venda.", + "shipping": 19, + "address": "Avenida dos Papagaios, 1350 - Sta. Efigênia", + "name": "McDonalds", + "logoUrl": "http://soter.ninja/futureFoods/logos/mcdonalds.png", + "deliveryTime": 15, + "category": "Hamburguer" + }, + { + "id": "3", + "deliveryTime": 20, + "category": "Italiana", + "description": "Restaurante Self Service e lanchonete localizado no Laboratório Nacional de Computação Científica", + "shipping": 2, + "address": "Rua Barão do Rio Branco, 98 - Centro", + "name": "Cantina Mamma Perrotta", + "logoUrl": "http://soter.ninja/futureFoods/logos/cantinamammaperrotta.jpg" + }, + { + "id": "4", + "name": "Sorveteria Bacio di Latte", + "logoUrl": "http://soter.ninja/futureFoods/logos/baciodilatte.png", + "deliveryTime": 45, + "category": "Sorvetes", + "description": "Gelatos de raízes italianas feitos artesanalmente e com ingredientes de altíssima qualidade. Confira todos os nossos deliciosos sabores!", + "shipping": 10, + "address": "Travessa Junqueira de Melo, 315 - Marginal" + }, + { + "id": "5", + "deliveryTime": 20, + "category": "Carnes", + "description": "Inaugurado em 1988 nos Estados Unidos e chegou ao Brasil 9 anos depois. Hoje, o restaurante marca presença em 20 cidades em todo o país, com um estilo casual que vai fazer você se sentir no Outback Australiano", + "shipping": 18, + "address": "Alameda dos Marsupiais, 505 - Humaitá", + "name": "Outback Steakhouse", + "logoUrl": "http://soter.ninja/futureFoods/logos/outback.png" + }, + { + "id": "6", + "description": "Culinária baiana, como caldinho de sururu e acarajé, empório nordestino e bar com 400 rótulos de cachaça.", + "shipping": 4, + "address": "Rua Dorival Caymmi, 149 - Alto dos Ibirás", + "name": "Sotero Cozinha Original", + "logoUrl": "http://soter.ninja/futureFoods/logos/sotero.jpg", + "deliveryTime": 40, + "category": "Baiana" + }, + { + "id": "7", + "name": "Boteco de Portal", + "logoUrl": "http://soter.ninja/futureFoods/logos/botecodeportal.jpg", + "deliveryTime": 20, + "category": "Petiscos", + "description": "O bar tem um cardápio recheado de petiscos que acompanham o chope para o bate-papo num ambiente agradável.Amigos e amigas, temos o prazer de convidar vocês para conhecer nosso espaço!", + "shipping": 18, + "address": "Avenida das Andorinhas, 333 - Sta. Efigênia" + }, + { + "id": "8", + "name": "Chun-Li", + "logoUrl": "http://soter.ninja/futureFoods/logos/chun-li.jpg", + "deliveryTime": 30, + "category": "Asiática", + "description": "Restaurante chinês com pratos típicos em diversos tamanhos, bebidas, ambiente moderno e opções para levar.", + "shipping": 17, + "address": "Rua Visconde de Mauá, 990 - Centro" + }, + { + "id": "9", + "name": "Mexicaníssimo", + "logoUrl": "http://soter.ninja/futureFoods/logos/mexicanissimo.png", + "deliveryTime": 20, + "category": "Mexicana", + "description": "Falar em Mexicaníssimo é falar em comer uma comida tradicional e original mexicana! Diferentemente dos restaurantes tex-mex, aqui você encontra um menu completo tradicionalmente mexicano e com opções para vegetarianos e veganos.", + "shipping": 3, + "address": "Largo dos Jaguarés, 12 - Nova Bragança" + } + ] + + const {states, setters} = useContext(GlobalStateContext) + + const changeCategory = (value) => { + if (states.filter !== value) { + setters.setFilter(value) + } else if (states.filter === value) { + setters.setFilter("") + } + } + + const [categoriesArray, setCategoriesArray] = useState([]) + + teste.map(e=> { + const position = categoriesArray.findIndex((item) => item === e.category) + + if (position === -1) { + setCategoriesArray([...categoriesArray, e.category]) + } + }) + + return ( + + {categoriesArray.map(e => { + return changeCategory(e)}>{e} + })} + + ) +} diff --git a/src/Global/GlobalState.js b/src/Global/GlobalState.js index 1011acc..81dd879 100644 --- a/src/Global/GlobalState.js +++ b/src/Global/GlobalState.js @@ -12,10 +12,11 @@ export default function GlobalState(props) { const [listaRestaurantes, setListaRestaurantes] = useState([]) const [token, setToken] = useState("") const [searchInput, setSearchInput] = useState("") /* Controla input da barra de pesquisa */ + const [filter, setFilter] = useState("") /* Controla o filtro do menu do feed */ - const states = {carrinho, perfil, restaurante, listaRestaurantes, token, searchInput} - const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken, setSearchInput} + const states = {carrinho, perfil, restaurante, listaRestaurantes, token, searchInput, filter} + const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken, setSearchInput, setFilter} const requests = {} return ( diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index d16b7e6..5096ec3 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -8,19 +8,134 @@ import { } from "../../Routes/coordinators"; import Header from "../../Components/Header/index.js" import SearchBar from "../../Components/SearchBar/SearchBar" +import CardRestaurante from "../../Components/CardRestaurante/CardRestaurante" +import FeedMenu from "../../Components/FeedMenu/FeedMenu" import GlobalStateContext from "../../Global/GlobalStateContext"; export default function HomePage() { const {states, setters} = useContext(GlobalStateContext) const history = useHistory(); - + const teste = [ + { + "id": "1", + "description": "Habib's é uma rede de restaurantes de comida rápida brasileira especializada em culinária árabe, os restaurantes vendem mais de 600 milhões de esfirras por ano. A empresa emprega 22 mil colaboradores e tem 421 unidades distribuídas em mais de cem municípios em 20 unidades federativas.", + "shipping": 6, + "address": "Rua das Margaridas, 110 - Jardim das Flores", + "name": "Habibs", + "logoUrl": "http://soter.ninja/futureFoods/logos/habibs.jpg", + "deliveryTime": 60, + "category": "Árabe" + }, + { + "id": "10", + "address": "Travessa Reginaldo Pereira, 130 - Ibitinga", + "name": "Tadashii", + "logoUrl": "http://soter.ninja/futureFoods/logos/tadashii.png", + "deliveryTime": 50, + "category": "Asiática", + "description": "Restaurante sofisticado busca o equilíbrio entre ingredientes que realçam a experiência da culinária japonesa.", + "shipping": 13 + }, + { + "id": "2", + "description": "McDonald's Corporation é a maior cadeia mundial de restaurantes de fast food de hambúrguer, servindo cerca de 68 milhões de clientes por dia em 119 países através de 37 mil pontos de venda.", + "shipping": 19, + "address": "Avenida dos Papagaios, 1350 - Sta. Efigênia", + "name": "McDonalds", + "logoUrl": "http://soter.ninja/futureFoods/logos/mcdonalds.png", + "deliveryTime": 15, + "category": "Hamburguer" + }, + { + "id": "3", + "deliveryTime": 20, + "category": "Italiana", + "description": "Restaurante Self Service e lanchonete localizado no Laboratório Nacional de Computação Científica", + "shipping": 2, + "address": "Rua Barão do Rio Branco, 98 - Centro", + "name": "Cantina Mamma Perrotta", + "logoUrl": "http://soter.ninja/futureFoods/logos/cantinamammaperrotta.jpg" + }, + { + "id": "4", + "name": "Sorveteria Bacio di Latte", + "logoUrl": "http://soter.ninja/futureFoods/logos/baciodilatte.png", + "deliveryTime": 45, + "category": "Sorvetes", + "description": "Gelatos de raízes italianas feitos artesanalmente e com ingredientes de altíssima qualidade. Confira todos os nossos deliciosos sabores!", + "shipping": 10, + "address": "Travessa Junqueira de Melo, 315 - Marginal" + }, + { + "id": "5", + "deliveryTime": 20, + "category": "Carnes", + "description": "Inaugurado em 1988 nos Estados Unidos e chegou ao Brasil 9 anos depois. Hoje, o restaurante marca presença em 20 cidades em todo o país, com um estilo casual que vai fazer você se sentir no Outback Australiano", + "shipping": 18, + "address": "Alameda dos Marsupiais, 505 - Humaitá", + "name": "Outback Steakhouse", + "logoUrl": "http://soter.ninja/futureFoods/logos/outback.png" + }, + { + "id": "6", + "description": "Culinária baiana, como caldinho de sururu e acarajé, empório nordestino e bar com 400 rótulos de cachaça.", + "shipping": 4, + "address": "Rua Dorival Caymmi, 149 - Alto dos Ibirás", + "name": "Sotero Cozinha Original", + "logoUrl": "http://soter.ninja/futureFoods/logos/sotero.jpg", + "deliveryTime": 40, + "category": "Baiana" + }, + { + "id": "7", + "name": "Boteco de Portal", + "logoUrl": "http://soter.ninja/futureFoods/logos/botecodeportal.jpg", + "deliveryTime": 20, + "category": "Petiscos", + "description": "O bar tem um cardápio recheado de petiscos que acompanham o chope para o bate-papo num ambiente agradável.Amigos e amigas, temos o prazer de convidar vocês para conhecer nosso espaço!", + "shipping": 18, + "address": "Avenida das Andorinhas, 333 - Sta. Efigênia" + }, + { + "id": "8", + "name": "Chun-Li", + "logoUrl": "http://soter.ninja/futureFoods/logos/chun-li.jpg", + "deliveryTime": 30, + "category": "Asiática", + "description": "Restaurante chinês com pratos típicos em diversos tamanhos, bebidas, ambiente moderno e opções para levar.", + "shipping": 17, + "address": "Rua Visconde de Mauá, 990 - Centro" + }, + { + "id": "9", + "name": "Mexicaníssimo", + "logoUrl": "http://soter.ninja/futureFoods/logos/mexicanissimo.png", + "deliveryTime": 20, + "category": "Mexicana", + "description": "Falar em Mexicaníssimo é falar em comer uma comida tradicional e original mexicana! Diferentemente dos restaurantes tex-mex, aqui você encontra um menu completo tradicionalmente mexicano e com opções para vegetarianos e veganos.", + "shipping": 3, + "address": "Largo dos Jaguarés, 12 - Nova Bragança" + } + ] + + const filteredArray = teste.filter(e => { + return e.category === states.filter + }) + return (
+ + {states.filter === "" ? teste.map(e => { + return + }) + : filteredArray.map(e => { + return + }) } + + +
+ ) +} diff --git a/src/Components/FooterMenu/styles.js b/src/Components/FooterMenu/styles.js new file mode 100644 index 0000000..296f7ef --- /dev/null +++ b/src/Components/FooterMenu/styles.js @@ -0,0 +1,5 @@ +import styled from "styled-components"; + +export const FooterContainer = styled.div ` + +` \ No newline at end of file From 9fc90936173597121cc105fe97c6bafdc2b900bb Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Fri, 22 Jan 2021 09:55:35 -0300 Subject: [PATCH 20/69] =?UTF-8?q?resolvido=20conflitos=20de=20endere=C3=A7?= =?UTF-8?q?ado=20do=20component=20Buttons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/FormLogin/index.js | 2 +- src/Pages/CartPage/index.js | 2 +- src/Pages/LoginPage/index.js | 2 +- src/assets/avatar.svg | 6 ++++++ src/assets/homepage.svg | 6 ++++++ src/assets/shopping-cart.svg | 3 +++ 6 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 src/assets/avatar.svg create mode 100644 src/assets/homepage.svg create mode 100644 src/assets/shopping-cart.svg diff --git a/src/Components/FormLogin/index.js b/src/Components/FormLogin/index.js index 62dc75b..955c2ce 100644 --- a/src/Components/FormLogin/index.js +++ b/src/Components/FormLogin/index.js @@ -1,5 +1,5 @@ import React, { useState } from "react"; -import Buttons from "../Button"; +import Buttons from "../Buttons"; // import TextField from "@material-ui/core/TextField"; // import Button from "@material-ui/core/Button"; import { Container, CampoText, InputArea } from "./styles"; diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index e3033d5..9b855ce 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -3,7 +3,7 @@ import { useHistory } from "react-router-dom"; import Header from '../../Components/Header'; import { goBack, goToHomePage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; import GlobalStateContext from "../../Global/GlobalStateContext"; -import Buttons from '../../Components/Button'; +import Buttons from '../../Components/Buttons'; import { ContainerCarrinho, ContainerEndereco , MensagemVazio , SubtotalContainer , StyledForm , CartPageContainer } from './styles'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import Radio from '@material-ui/core/Radio'; diff --git a/src/Pages/LoginPage/index.js b/src/Pages/LoginPage/index.js index 9d4b534..d266a73 100644 --- a/src/Pages/LoginPage/index.js +++ b/src/Pages/LoginPage/index.js @@ -3,7 +3,7 @@ import { useHistory } from "react-router-dom"; import { goBack, goToHomePage } from "../../Routes/coordinators"; import FormLogin from "../../Components/FormLogin"; import Header from "../../Components/Header"; -import Buttons from "../../Components/Button"; +import Buttons from "../../Components/Buttons"; import InitialScreen from "../../Components/InitialScreen"; export default function LoginPage() { diff --git a/src/assets/avatar.svg b/src/assets/avatar.svg new file mode 100644 index 0000000..dca6583 --- /dev/null +++ b/src/assets/avatar.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/assets/homepage.svg b/src/assets/homepage.svg new file mode 100644 index 0000000..c6ec4cf --- /dev/null +++ b/src/assets/homepage.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/assets/shopping-cart.svg b/src/assets/shopping-cart.svg new file mode 100644 index 0000000..1c66586 --- /dev/null +++ b/src/assets/shopping-cart.svg @@ -0,0 +1,3 @@ + + + From 8a73232a3dc8e2f010f64dae071efc3761f47793 Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Fri, 22 Jan 2021 11:59:01 -0300 Subject: [PATCH 21/69] finalizado componente FooterMenu --- src/Components/FooterMenu/index.js | 46 +++++++++++++++---- src/Components/FooterMenu/styles.js | 13 +++++- src/Pages/CartPage/index.js | 10 +++- src/assets/{ => footerMenuIcons}/avatar.svg | 4 +- src/assets/{ => footerMenuIcons}/homepage.svg | 3 +- .../{ => footerMenuIcons}/shopping-cart.svg | 4 +- 6 files changed, 65 insertions(+), 15 deletions(-) rename src/assets/{ => footerMenuIcons}/avatar.svg (96%) rename src/assets/{ => footerMenuIcons}/homepage.svg (93%) rename src/assets/{ => footerMenuIcons}/shopping-cart.svg (96%) diff --git a/src/Components/FooterMenu/index.js b/src/Components/FooterMenu/index.js index 373f4e9..a03a039 100644 --- a/src/Components/FooterMenu/index.js +++ b/src/Components/FooterMenu/index.js @@ -1,17 +1,47 @@ -import React from 'react' +import React, { useState } from 'react' import { useHistory } from 'react-router-dom' import { goToCartPage, goToHomePage, goToProfilePage } from '../../Routes/coordinators' -import HomeOutlinedIcon from '@material-ui/icons/HomeOutlined'; - +import { ReactComponent as AvatarIcon} from "../../assets/footerMenuIcons/avatar.svg"; +import { ReactComponent as HomeIcon } from "../../assets/footerMenuIcons/homepage.svg"; +import { ReactComponent as CartIcon } from "../../assets/footerMenuIcons/shopping-cart.svg"; +import { FooterContainer } from './styles'; export default function FooterMenu() { const history = useHistory() + const [fill, setFill] = useState({ + home: "#B8B8B8", + cart: "#B8B8B8" , + avatar: "#B8B8B8" + }) + + const selectHomeIcon = () => { + setFill({home: "#E8222E", cart: "#B8B8B8" , avatar: "#B8B8B8"}) + goToHomePage(history) + } + + const selectCartIcon = () => { + setFill({home: "#B8B8B8", cart: "#E8222E" , avatar: "#B8B8B8"}) + goToCartPage(history) + } + + const selectAvatarIcon = () => { + setFill({home: "#B8B8B8", cart: "#B8B8B8" , avatar: "#E8222E"}) + goToProfilePage(history) + } return ( -
- - - -
+ + + + + + + ) } diff --git a/src/Components/FooterMenu/styles.js b/src/Components/FooterMenu/styles.js index 296f7ef..9ce589c 100644 --- a/src/Components/FooterMenu/styles.js +++ b/src/Components/FooterMenu/styles.js @@ -1,5 +1,16 @@ import styled from "styled-components"; export const FooterContainer = styled.div ` - + display: flex; + width: 100vw; + justify-content: space-evenly; + box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); + height: 3rem; +button { + flex-grow: 1; + padding: 0; + height: 3rem; + border: none; + background: none; +} ` \ No newline at end of file diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index 9b855ce..74a6f22 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -8,6 +8,7 @@ import { ContainerCarrinho, ContainerEndereco , MensagemVazio , SubtotalContaine import FormControlLabel from '@material-ui/core/FormControlLabel'; import Radio from '@material-ui/core/Radio'; import RadioGroup from '@material-ui/core/RadioGroup'; +import FooterMenu from '../../Components/FooterMenu'; export default function CartPage() { const history = useHistory(); @@ -56,8 +57,13 @@ export default function CartPage() { + - + */} ) } diff --git a/src/assets/avatar.svg b/src/assets/footerMenuIcons/avatar.svg similarity index 96% rename from src/assets/avatar.svg rename to src/assets/footerMenuIcons/avatar.svg index dca6583..47e02c9 100644 --- a/src/assets/avatar.svg +++ b/src/assets/footerMenuIcons/avatar.svg @@ -1,5 +1,7 @@ +import + - + diff --git a/src/assets/homepage.svg b/src/assets/footerMenuIcons/homepage.svg similarity index 93% rename from src/assets/homepage.svg rename to src/assets/footerMenuIcons/homepage.svg index c6ec4cf..12ee619 100644 --- a/src/assets/homepage.svg +++ b/src/assets/footerMenuIcons/homepage.svg @@ -1,6 +1,7 @@ - + + diff --git a/src/assets/shopping-cart.svg b/src/assets/footerMenuIcons/shopping-cart.svg similarity index 96% rename from src/assets/shopping-cart.svg rename to src/assets/footerMenuIcons/shopping-cart.svg index 1c66586..0d122ee 100644 --- a/src/assets/shopping-cart.svg +++ b/src/assets/footerMenuIcons/shopping-cart.svg @@ -1,3 +1,3 @@ - - + + \ No newline at end of file From c491917e458f501341e2c7554cf971c3691f1011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Fri, 22 Jan 2021 16:22:20 -0300 Subject: [PATCH 22/69] layout e inputs controlados pagina de sugnUp --- src/Pages/SignUpPage/SignUpForm.js | 189 ++++++++++++----------------- src/Pages/SignUpPage/index.js | 5 +- src/Pages/SignUpPage/styles.js | 17 ++- 3 files changed, 91 insertions(+), 120 deletions(-) diff --git a/src/Pages/SignUpPage/SignUpForm.js b/src/Pages/SignUpPage/SignUpForm.js index e43c48b..0ad7d97 100644 --- a/src/Pages/SignUpPage/SignUpForm.js +++ b/src/Pages/SignUpPage/SignUpForm.js @@ -1,63 +1,57 @@ import React from 'react'; import Buttons from '../../Components/Buttons' -import { Container, CampoText, InputArea, Title, ContainerSignUp, Image, ContainerInputPassword} from './styles'; +import { Container, CampoText, InputArea, Title, ContainerSignUp, Image, ContainerInputPassword } from './styles'; import Logo from '../../assets/logo-future-eats-invert.png'; import OutlinedInput from '@material-ui/core/OutlinedInput'; import { IconButton, InputAdornment, InputLabel } from '@material-ui/core'; import Visibility from '@material-ui/icons/Visibility'; import VisibilityOff from '@material-ui/icons/VisibilityOff'; import useForm from '../../CustomHooks/useForm'; +import { useHistory } from "react-router-dom"; +import { goToAddAddressPage } from '../../Routes/coordinators'; export default function SignUpForm(props) { + const history = useHistory(); const [form, handleInput, resetState] = useForm({ - name:'', - email:'', - cpf:'', + name: '', + email: '', + cpf: '', password: '', - }) + passwordConfirm: '', + }) - const [values, setValues] = React.useState({ - password: '', - confirmPassword:'', - showPassword: false, - showConfirmPassword: false, - }); - - const handleChange = (prop) => (event) => { - setValues({ ...values, [prop]: event.target.value }); - }; - - const handleClickShowPassword = () => { - setValues( - { ...values, showPassword: !values.showPassword }); - }; - - const handleClickShowConfirmPassword = () => { - setValues( - { ...values, showConfirmPassword: !values.showConfirmPassword }); - }; + const [showSenha, setShowSenha] = React.useState(false); + + + const handleClickShowPassword = () => { + setShowSenha(!showSenha); + }; - - const handleMouseDownPassword = (event) => { + const handleMouseDownPassword = (event) => { event.preventDefault(); - }; + }; + + const submitForm = (e) => { + e.preventDefault() + resetState() //resetando os inputs// + console.log(form) //----------------------------------------------// + } + return ( - + - {props.texto} -
+ { props.texto } + + + + - - Senha - - {values.showPassword ? : } + {showSenha ? : } - } - - /> - + ), + }} + /> + - - {/* + */} - - - - - Confirmar - - {values.showConfirmPassword ? : } + {showSenha ? : } - } - - /> - - - {/* */} + ), + }} + /> + texto={"Criar"} + submeter = {() => goToAddAddressPage(history)} + + />
) diff --git a/src/Pages/SignUpPage/index.js b/src/Pages/SignUpPage/index.js index 933f462..d0b6213 100644 --- a/src/Pages/SignUpPage/index.js +++ b/src/Pages/SignUpPage/index.js @@ -1,5 +1,6 @@ import React from 'react' import { useHistory } from "react-router-dom"; +import FooterMenu from '../../Components/FooterMenu'; import Header from '../../Components/Header'; import { goBack, goToAddAddressPage } from '../../Routes/coordinators'; import SignUpForm from './SignUpForm'; @@ -16,13 +17,15 @@ export default function SignUpPage() { texto={"Cadastrar"} /> + +{/* cadastro de usuário + */}
) } \ No newline at end of file diff --git a/src/Pages/SignUpPage/styles.js b/src/Pages/SignUpPage/styles.js index f0cd3b6..935bd8d 100644 --- a/src/Pages/SignUpPage/styles.js +++ b/src/Pages/SignUpPage/styles.js @@ -4,15 +4,20 @@ import FormControl from "@material-ui/core/FormControl"; export const ContainerSignUp = styled.div` - + display: flex; + flex-direction: column; + /* justify-content:center; */ + align-items: center; + + ` export const ContainerInputPassword = styled(FormControl)` - width:20.5rem; + /* width:20.5rem; */ ` export const Image = styled.div` -text-align: center; -margin:2.5rem 0 1.75rem 0; + text-align: center; + margin:2.5rem 0 1.75rem 0; ` export const Title = styled.h1` font-family: Roboto; @@ -27,13 +32,13 @@ export const Title = styled.h1` export const Container = styled.div` display: flex; + width: 20.5rem; flex-direction: column; align-items: center; - margin: 0.5rem; ` export const CampoText = styled.div` - margin: 0.5rem; + margin: 1rem; ` export const InputArea = styled(TextField)` From e586d021d0d8b1f54ea681e81d266da6dffc6c76 Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Fri, 22 Jan 2021 17:08:22 -0300 Subject: [PATCH 23/69] criado mock do card de pratos do restaurante --- src/Components/ItemCard/ItemCard.js | 22 +++++++ src/Components/ItemCard/styles.js | 97 +++++++++++++++++++++++++++++ src/Pages/CartPage/index.js | 27 +++----- src/Pages/CartPage/styles.js | 2 + 4 files changed, 130 insertions(+), 18 deletions(-) create mode 100644 src/Components/ItemCard/ItemCard.js create mode 100644 src/Components/ItemCard/styles.js diff --git a/src/Components/ItemCard/ItemCard.js b/src/Components/ItemCard/ItemCard.js new file mode 100644 index 0000000..c019641 --- /dev/null +++ b/src/Components/ItemCard/ItemCard.js @@ -0,0 +1,22 @@ +import React from 'react' +import { CardContainer, InfoContainer, HeaderContainer, FooterContainer, RemoveBtn, AddBtn } from './styles' + +export default function ItemCard() { + return ( + + + + +

Nome do Prato

+ +
+

Ingredientes do prato

+ + R$46,00 + adicionar {/*ternario para alterar botões quanto necessário*/} + {/* remover */} + +
+
+ ) +} diff --git a/src/Components/ItemCard/styles.js b/src/Components/ItemCard/styles.js new file mode 100644 index 0000000..ecad65c --- /dev/null +++ b/src/Components/ItemCard/styles.js @@ -0,0 +1,97 @@ +import styled from "styled-components"; + +export const CardContainer = styled.div ` + display: flex; + border-radius: 8px; + border: solid 1px #b8b8b8; + height: 7rem; + margin-bottom: 0.5rem; +img { + width: 6rem; + height: calc(7rem + 2px); + margin-top: -1px; + margin-right: 1rem; + margin-bottom:-1px; + margin-left:-1px; + border-radius: 8px 0 0 8px +} +` + +export const InfoContainer = styled.div ` + width: 100%; + display: flex; + flex-direction: column; +p { + margin: 0; + height: 1.875rem; + font-size: 0.75rem; + letter-spacing: -0.29px; + color: #b8b8b8; +} +` + +export const HeaderContainer = styled.div ` + display: flex; + justify-content: space-between; + height: 2.75rem; +h3 { + font-size: 1rem; + letter-spacing: -0.39px; + color: #e8222e; + font-weight: 500; +} +button { + height: 2rem; + width: 2rem; + border: none; + background: none; + border-radius: 0 8px 0 8px; + border: solid 1px #e8222e; + color: #e8222e; + font-weight: 500; + font-size: 1rem; + margin-top: -1px; + margin-right: -1px; +} +` + +export const FooterContainer = styled.div ` + display: flex; + justify-content: space-between; + align-items: flex-end; + height: 2.375rem; + +span { + letter-spacing: -0.39px; + font-size: 1rem; + font-weight: 500; + margin-bottom: 1rem; +} +` + +export const AddBtn = styled.button ` + height: 2rem; + width: 5.625rem; + border: none; + background: none; + border-radius: 8px 0 8px 0; + border: solid 1px black; + font-weight: 500; + font-size: 0.75rem; + margin-right: -1px; + margin-bottom: -1px; +` + +export const RemoveBtn = styled.button ` + height: 2rem; + width: 5.625rem; + border: none; + background: none; + border-radius: 8px 0 8px 0; + border: solid 1px #e8222e; + color: #e8222e; + font-weight: 500; + font-size: 0.75rem; + margin-right: -1px; + margin-bottom: -1px; +` \ No newline at end of file diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index 74a6f22..fc854e6 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -9,6 +9,7 @@ import FormControlLabel from '@material-ui/core/FormControlLabel'; import Radio from '@material-ui/core/Radio'; import RadioGroup from '@material-ui/core/RadioGroup'; import FooterMenu from '../../Components/FooterMenu'; +import ItemCard from '../../Components/ItemCard/ItemCard'; export default function CartPage() { const history = useHistory(); @@ -35,7 +36,14 @@ export default function CartPage() { - Carrinho vazio {/* ternario para renderizar o carrinho */} + + {/* ternario para renderizar itens ou mensagem vazio */} + + {/* Carrinho vazio */} + + {/* map nos itens do carrinho para renderizar os cards */} + + SUBTOTAL @@ -58,23 +66,6 @@ export default function CartPage() { - - - - - - {/* - - - */} ) } diff --git a/src/Pages/CartPage/styles.js b/src/Pages/CartPage/styles.js index 023da75..64c417a 100644 --- a/src/Pages/CartPage/styles.js +++ b/src/Pages/CartPage/styles.js @@ -18,6 +18,7 @@ export const ContainerCarrinho = styled.div ` export const ContainerEndereco = styled.div ` background-color: #eeeeee; padding: 0.5rem; + margin-bottom: 1rem; p { margin: 0.5rem; color: #b8b8b8; @@ -41,6 +42,7 @@ export const SubtotalContainer = styled.div ` display: flex; align-items: flex-end; justify-content: space-between; + margin-top: 0.5rem; span { display: block; font-size: 1rem; From f95eb558bedbc6e49aac90818f49a3532b3c2c85 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Fri, 22 Jan 2021 17:56:49 -0300 Subject: [PATCH 24/69] =?UTF-8?q?adicionando=20footer=20=C3=A0=20home?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/FooterMenu/styles.js | 4 +++- src/Pages/HomePage/index.js | 7 ++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Components/FooterMenu/styles.js b/src/Components/FooterMenu/styles.js index 9ce589c..18c9b37 100644 --- a/src/Components/FooterMenu/styles.js +++ b/src/Components/FooterMenu/styles.js @@ -1,6 +1,8 @@ import styled from "styled-components"; export const FooterContainer = styled.div ` + position: fixed; + bottom: 0; display: flex; width: 100vw; justify-content: space-evenly; @@ -11,6 +13,6 @@ button { padding: 0; height: 3rem; border: none; - background: none; + background-color: white; } ` \ No newline at end of file diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index 5096ec3..613a1d2 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -10,6 +10,7 @@ import Header from "../../Components/Header/index.js" import SearchBar from "../../Components/SearchBar/SearchBar" import CardRestaurante from "../../Components/CardRestaurante/CardRestaurante" import FeedMenu from "../../Components/FeedMenu/FeedMenu" +import FooterMenu from "../../Components/FooterMenu/index" import GlobalStateContext from "../../Global/GlobalStateContext"; export default function HomePage() { @@ -136,11 +137,7 @@ export default function HomePage() { : filteredArray.map(e => { return }) } - - - +
); } From 92793ef13601188bcf1a73296417181aa6682204 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Fri, 22 Jan 2021 18:49:59 -0300 Subject: [PATCH 25/69] Criado componente Pedido em Andamento e ajustes de css --- public/index.html | 2 + src/Components/CardRestaurante/styles.js | 1 - src/Components/FooterMenu/styles.js | 1 - src/Components/PedidoEmAndamento/index.js | 18 +++++++ src/Components/PedidoEmAndamento/style.js | 66 +++++++++++++++++++++++ src/Pages/HomePage/index.js | 8 +-- 6 files changed, 88 insertions(+), 8 deletions(-) create mode 100644 src/Components/PedidoEmAndamento/index.js create mode 100644 src/Components/PedidoEmAndamento/style.js diff --git a/public/index.html b/public/index.html index f4440a4..9bc4146 100644 --- a/public/index.html +++ b/public/index.html @@ -24,6 +24,8 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> + + I Future diff --git a/src/Components/CardRestaurante/styles.js b/src/Components/CardRestaurante/styles.js index b8d2121..d22093c 100644 --- a/src/Components/CardRestaurante/styles.js +++ b/src/Components/CardRestaurante/styles.js @@ -19,7 +19,6 @@ const useStyles = makeStyles({ justifyContent: 'space-between', }, nomeRestaurante: { - width: '18.5rem', height: '1.125rem', margin: '0.75rem 1rem 0.25rem', fontFamily: 'Roboto', diff --git a/src/Components/FooterMenu/styles.js b/src/Components/FooterMenu/styles.js index 18c9b37..3057916 100644 --- a/src/Components/FooterMenu/styles.js +++ b/src/Components/FooterMenu/styles.js @@ -7,7 +7,6 @@ export const FooterContainer = styled.div ` width: 100vw; justify-content: space-evenly; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); - height: 3rem; button { flex-grow: 1; padding: 0; diff --git a/src/Components/PedidoEmAndamento/index.js b/src/Components/PedidoEmAndamento/index.js new file mode 100644 index 0000000..a806148 --- /dev/null +++ b/src/Components/PedidoEmAndamento/index.js @@ -0,0 +1,18 @@ +import React from 'react' +import AccessTimeIcon from '@material-ui/icons/AccessTime'; +import Rectangle from "./style.js" + +export default function index(props) { + return ( + +
+ +
+
+

Pedido em Andamento

+

{props.restaurante? props.restaurente: "TESTE"}

+

SUBTOTAL R${props.valor}

+
+
+ ) +} diff --git a/src/Components/PedidoEmAndamento/style.js b/src/Components/PedidoEmAndamento/style.js new file mode 100644 index 0000000..dc03c0b --- /dev/null +++ b/src/Components/PedidoEmAndamento/style.js @@ -0,0 +1,66 @@ +import styled from "styled-components" + + +const Rectangle = styled.div ` + width: 100vw; + height: 7.375rem; + background-color: #e8222e; + position: fixed; + bottom: 48px; + display: flex; + align-items: center; + justify-content: center; + + .clock { + width: 2rem; + height: 2rem; + color: white; + } + + .infoDiv { + width: 17rem; + } + + .whiteP { + width: 16rem; + height: 1.125rem; + margin: 0 0 0.125rem 1.5rem; + font-family: Montserrat; + font-size: 1rem; + font-weight: normal; + font-stretch: normal; + font-style: normal; + line-height: normal; + letter-spacing: -0.39px; + color: #ffffff; + } + + .nomeRestaurante { + width: 16rem; + height: 1.125rem; + margin: 0.5rem 0 0.5rem 1.5rem; + font-family: Montserrat; + font-size: 1rem; + font-weight: normal; + font-stretch: normal; + font-style: normal; + line-height: normal; + letter-spacing: -0.39px; + color: var(--black); + } + + .subtotal { + width: 16rem; + height: 1.125rem; + margin: 0.5rem 0 0 1.5rem; + font-family: Montserrat; + font-size: 1rem; + font-weight: bold; + font-stretch: normal; + font-style: normal; + line-height: normal; + letter-spacing: -0.39px; + color: var(--black); + } +` +export default Rectangle; diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index 613a1d2..5a31238 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -1,16 +1,11 @@ import React,{ useContext} from "react"; import { useHistory } from "react-router-dom"; -import { - goToCartPage, - goToProfilePage, - goToRestaurantsPage, - goToSearchPage, -} from "../../Routes/coordinators"; import Header from "../../Components/Header/index.js" import SearchBar from "../../Components/SearchBar/SearchBar" import CardRestaurante from "../../Components/CardRestaurante/CardRestaurante" import FeedMenu from "../../Components/FeedMenu/FeedMenu" import FooterMenu from "../../Components/FooterMenu/index" +import PedidoEmAndamento from "../../Components/PedidoEmAndamento/index" import GlobalStateContext from "../../Global/GlobalStateContext"; export default function HomePage() { @@ -137,6 +132,7 @@ export default function HomePage() { : filteredArray.map(e => { return }) } + {/* ternário verificando se há pedido para renderizar */}
); From 15b720b04061808696279ddefcd4beac1de83d81 Mon Sep 17 00:00:00 2001 From: Adrielly Felix Date: Fri, 22 Jan 2021 19:28:22 -0300 Subject: [PATCH 26/69] validando login --- package-lock.json | 83 +++++++++++++++++++++++++++ package.json | 5 +- src/Components/FormLogin/index.js | 91 +++++++++++++++++++++++------- src/Components/FormLogin/styles.js | 14 ++++- src/CustomHooks/useForm.js | 26 +++++---- 5 files changed, 186 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 98801c5..f7528d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1787,6 +1787,11 @@ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.5.tgz", "integrity": "sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==" }, + "@types/lodash": { + "version": "4.14.168", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.168.tgz", + "integrity": "sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==" + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -2003,6 +2008,19 @@ } } }, + "@unform/core": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@unform/core/-/core-2.1.3.tgz", + "integrity": "sha512-d6xQJWFrLfEyfN7f5t2IdYBLJE/OrvPKILCzGKPSoAmY3+vAnEc4CPE5l6zB+LxWSfMn69QhsqzI20tIRNT7EA==", + "requires": { + "dot-object": "^2.1.2" + } + }, + "@unform/web": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@unform/web/-/web-2.1.3.tgz", + "integrity": "sha512-yiY6r3TAinphVxyQ5iKDrKJQkg21oRlYe0WfIoXxs9VKiFPSZ5xb1pz3Kti3kTgOP9BYLVX5ovcCwuVWCrjHYg==" + }, "@webassemblyjs/ast": { "version": "1.8.5", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz", @@ -4781,6 +4799,22 @@ "tslib": "^1.10.0" } }, + "dot-object": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/dot-object/-/dot-object-2.1.4.tgz", + "integrity": "sha512-7FXnyyCLFawNYJ+NhkqyP9Wd2yzuo+7n9pGiYpkmXCTYa8Ci2U0eUNDVg5OuO5Pm6aFXI2SWN8/N/w7SJWu1WA==", + "requires": { + "commander": "^4.0.0", + "glob": "^7.1.5" + }, + "dependencies": { + "commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==" + } + } + }, "dot-prop": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz", @@ -8167,6 +8201,11 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, + "lodash-es": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.20.tgz", + "integrity": "sha512-JD1COMZsq8maT6mnuz1UMV0jvYD0E0aUsSOdrr1/nAG3dhqQXwRRgeW0cSqH1U43INKcqxaiVIQNOUDld7gRDA==" + }, "lodash._reinterpolate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", @@ -8664,6 +8703,11 @@ "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==", "optional": true }, + "nanoclone": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz", + "integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==" + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -10537,6 +10581,11 @@ "react-is": "^16.8.1" } }, + "property-expr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.4.tgz", + "integrity": "sha512-sFPkHQjVKheDNnPvotjQmm3KD3uk1fWKUN7CrpdbwmUx3CrG3QiM8QpTSimvig5vTXmTvjz7+TDvXOI9+4rkcg==" + }, "proxy-addr": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", @@ -13008,6 +13057,11 @@ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" }, + "toposort": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz", + "integrity": "sha1-riF2gXXRVZ1IvvNUILL0li8JwzA=" + }, "tough-cookie": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", @@ -14468,6 +14522,35 @@ "camelcase": "^5.0.0", "decamelize": "^1.2.0" } + }, + "yup": { + "version": "0.32.8", + "resolved": "https://registry.npmjs.org/yup/-/yup-0.32.8.tgz", + "integrity": "sha512-SZulv5FIZ9d5H99EN5tRCRPXL0eyoYxWIP1AacCrjC9d4DfP13J1dROdKGfpfRHT3eQB6/ikBl5jG21smAfCkA==", + "requires": { + "@babel/runtime": "^7.10.5", + "@types/lodash": "^4.14.165", + "lodash": "^4.17.20", + "lodash-es": "^4.17.11", + "nanoclone": "^0.2.1", + "property-expr": "^2.0.4", + "toposort": "^2.0.2" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz", + "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" + } + } } } } diff --git a/package.json b/package.json index b0f4b18..102ecd7 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,15 @@ "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", + "@unform/core": "^2.1.3", + "@unform/web": "^2.1.3", "axios": "^0.21.1", "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "^5.2.0", "react-scripts": "3.4.1", - "styled-components": "^5.2.1" + "styled-components": "^5.2.1", + "yup": "^0.32.8" }, "scripts": { "start": "react-scripts start", diff --git a/src/Components/FormLogin/index.js b/src/Components/FormLogin/index.js index 955c2ce..5d78080 100644 --- a/src/Components/FormLogin/index.js +++ b/src/Components/FormLogin/index.js @@ -1,14 +1,20 @@ -import React, { useState } from "react"; -import Buttons from "../Buttons"; -// import TextField from "@material-ui/core/TextField"; -// import Button from "@material-ui/core/Button"; -import { Container, CampoText, InputArea } from "./styles"; -import { Title } from "./styles"; -import useForm from "../../CustomHooks/useForm"; +import React, { useState, useRef, useCallback } from "react"; +import * as Yup from "yup"; +import { makeStyles } from "@material-ui/core/styles"; import { Grid, InputAdornment, IconButton } from "@material-ui/core"; import { Visibility, VisibilityOff } from "@material-ui/icons"; +import { Form } from "@unform/web"; + +import { + Container, + CampoText, + InputArea, + ContainerButton, + CampoButton, +} from "./styles"; +import { Title } from "./styles"; +import useForm from "../../CustomHooks/useForm"; import Logo from "../../assets/logo-future-eats-invert.svg"; -import { makeStyles } from "@material-ui/core/styles"; const useStyles = makeStyles({ root: { @@ -23,17 +29,52 @@ const useStyles = makeStyles({ }); const FormLogin = () => { const classes = useStyles(); + const formRef = useRef(null); const [showSenha, setShowSenha] = useState(false); - const [form, handleInput, resetState] = useForm({ - email: "", - senha: "", + const [form, handleInput, resetState, handleFormErrors] = useForm({ + email: undefined, + password: undefined, + errors: { + email: null, + password: null, + }, }); - const submitForm = (e) => { - e.preventDefault(); - resetState(); //resetando os inputs// - console.log(form); //----------------------------------------------// + const getValidationErrors = (err) => { + const validationErrors = {}; + + err.inner.forEach((error) => { + validationErrors[error.path] = error.message; + }); + + return validationErrors; }; + + const submitForm = async () => { + try { + handleFormErrors({}); + const schema = Yup.object().shape({ + email: Yup.string() + .email("Precisamos de um email válido.") + .required("O e-mail é obrigatório."), + password: Yup.string() + .min(6, "Mínimo de 6 dígitos.") + .required("A senha é obrigatória."), + }); + + await schema.validate(form, { + abortEarly: false, + }); + + resetState(); + // await api.post('/sessions', form); + } catch (err) { + const errors = getValidationErrors(err); + handleFormErrors(errors); + console.log(errors); + } + }; + const handleClickShowPassword = () => { setShowSenha(!showSenha); }; @@ -52,32 +93,36 @@ const FormLogin = () => { logo
Entrar -
+ @@ -94,8 +139,12 @@ const FormLogin = () => { /> - - + + + Entrar + + + ); diff --git a/src/Components/FormLogin/styles.js b/src/Components/FormLogin/styles.js index 90a51e0..e0d35c2 100644 --- a/src/Components/FormLogin/styles.js +++ b/src/Components/FormLogin/styles.js @@ -28,5 +28,17 @@ export const InputArea = styled(TextField)` `; export const ContainerButton = styled(Button)` - width: 20.5rem; + width: 100%; + display: flex; + align-items: center; + color: #000; + font-weight: bold; + font-size: 1rem; + letter-spacing: -0.39px; + text-transform: capitalize; +`; + +export const CampoButton = styled.div` + text-align: center; + margin: 1rem; `; diff --git a/src/CustomHooks/useForm.js b/src/CustomHooks/useForm.js index 789ac9d..11f6df5 100644 --- a/src/CustomHooks/useForm.js +++ b/src/CustomHooks/useForm.js @@ -1,16 +1,22 @@ -import { useState } from 'react' +import { useState } from "react"; const useForm = (initialState) => { - const [form, setForm] = useState(initialState) + const [form, setForm] = useState(initialState); const handleInputChange = (event) => { - const {value, name} = event.target - setForm({...form, [name]: value}) - } + const { value, name } = event.target; + setForm({ ...form, [name]: value }); + }; + const resetState = () => { - setForm(initialState) -} - return [form, handleInputChange, resetState] -} + setForm(initialState); + }; + + const handleFormErrors = (errors) => { + setForm({ ...form, errors }); + }; + + return [form, handleInputChange, resetState, handleFormErrors]; +}; -export default useForm \ No newline at end of file +export default useForm; From c943919c48e18349d3947eb64913ddc8cf8cc58d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Fri, 22 Jan 2021 21:07:33 -0300 Subject: [PATCH 27/69] layout pagina de editar perfil, com os inputs controlados --- src/Components/FormAdress/index.js | 19 +++-- src/Components/FormAdress/styles.js | 19 +++-- src/Pages/EditProfilePage/EditProfileForm.js | 79 ++++++++++++++++++++ src/Pages/EditProfilePage/index.js | 15 ++-- src/Pages/EditProfilePage/styles.js | 46 ++++++++++++ src/Pages/SignUpPage/SignUpForm.js | 16 ++-- src/Pages/SignUpPage/styles.js | 8 +- 7 files changed, 167 insertions(+), 35 deletions(-) create mode 100644 src/Pages/EditProfilePage/EditProfileForm.js diff --git a/src/Components/FormAdress/index.js b/src/Components/FormAdress/index.js index 7fbd61a..1bff966 100644 --- a/src/Components/FormAdress/index.js +++ b/src/Components/FormAdress/index.js @@ -1,12 +1,14 @@ import React from "react"; import Buttons from "../Buttons"; -// import TextField from "@material-ui/core/TextField"; -// import Button from "@material-ui/core/Button"; -import { Container, CampoText, InputArea} from './styles'; +import { Container, CampoText, InputArea, ContainerFormAddress } from './styles'; import { Title } from './styles'; import useForm from '../../CustomHooks/useForm' +import { useHistory } from "react-router-dom"; +import { goToHomePage } from '../../Routes/coordinators'; export default function FormAdress(props) { + + const history = useHistory(); const [form, handleInput, resetState] = useForm({ street:'', number:'', @@ -23,9 +25,9 @@ export default function FormAdress(props) { } return ( -
+ {props.texto} -
+ + + texto={"salvar"} + submeter = {() => goToHomePage(history)} // trocar pela funçao de requisiçao na api. assim os inputs não estão controlados + /> -
+ ); } diff --git a/src/Components/FormAdress/styles.js b/src/Components/FormAdress/styles.js index 8f148cf..516e447 100644 --- a/src/Components/FormAdress/styles.js +++ b/src/Components/FormAdress/styles.js @@ -1,6 +1,14 @@ import styled from 'styled-components'; import TextField from "@material-ui/core/TextField"; -import Button from "@material-ui/core/Button"; +// import Button from "@material-ui/core/Button"; + + +export const ContainerFormAddress = styled.div` + display: flex; + flex-direction: column; + align-items: center; +` + export const Title = styled.h1` font-family: Roboto; @@ -17,15 +25,14 @@ export const Container = styled.div` display: flex; flex-direction: column; align-items: center; + width: 20.5rem; ` + export const CampoText = styled.div` margin: 1rem; ` + export const InputArea = styled(TextField)` - width: 20.5rem; + width: 20.5rem; height: 3.5rem; ` - -// export const ContainerButton = styled(Button)` -// width: 20.5rem; -// ` \ No newline at end of file diff --git a/src/Pages/EditProfilePage/EditProfileForm.js b/src/Pages/EditProfilePage/EditProfileForm.js new file mode 100644 index 0000000..9c6008e --- /dev/null +++ b/src/Pages/EditProfilePage/EditProfileForm.js @@ -0,0 +1,79 @@ +import React from 'react'; +import Buttons from '../../Components/Buttons' +import { Container, CampoText, InputArea, ContainerEditProfile } from './styles'; +import useForm from '../../CustomHooks/useForm' +import { useHistory } from "react-router-dom"; +import { goToProfilePage } from '../../Routes/coordinators'; + +export default function EditProfileForm() { + + const history = useHistory(); + const [form, handleInput, resetState] = useForm({ + name: '', + email: '', + cpf: '', + }) + + + const submitForm = (e) => { + e.preventDefault() + resetState() //resetando os inputs// + console.log(form) //----------------------------------------------// + } + + return ( + +
+ + + + + + + + + + + + + + goToProfilePage(history)}// trocar pela funçao de requisiçao na api. assim os inputs não estão controlados + /> + +
+ ) +} \ No newline at end of file diff --git a/src/Pages/EditProfilePage/index.js b/src/Pages/EditProfilePage/index.js index 481f1c8..cc70c0c 100644 --- a/src/Pages/EditProfilePage/index.js +++ b/src/Pages/EditProfilePage/index.js @@ -1,18 +1,17 @@ import React from 'react' -import { useHistory } from "react-router-dom"; -import { goBack, goToCartPage, goToEditPage, goToHomePage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; - +import EditProfileForm from './EditProfileForm' +import Header from '../../Components/Header' export default function EditProfilePage() { - const history = useHistory(); return (
- Editar usuário / endereço +
- + +
) } diff --git a/src/Pages/EditProfilePage/styles.js b/src/Pages/EditProfilePage/styles.js index e69de29..ef66cd1 100644 --- a/src/Pages/EditProfilePage/styles.js +++ b/src/Pages/EditProfilePage/styles.js @@ -0,0 +1,46 @@ +import styled from 'styled-components'; +import TextField from "@material-ui/core/TextField"; +import FormControl from "@material-ui/core/FormControl"; + + +export const ContainerEditProfile = styled.div` + display: flex; + flex-direction: column; + align-items: center; + margin-top: 1rem; +` + +export const ContainerInputPassword = styled(FormControl)` + /* width:20.5rem; */ + ` + +export const Image = styled.div` + text-align: center; + margin:2.5rem 0 1.75rem 0; +` +export const Title = styled.h1` + font-family: Roboto; + text-align: center; + font-size: 1rem; + /* font-weight: normal; */ + font-stretch: normal; + font-style: normal; + line-height: normal; + letter-spacing: -0.39px; +` + +export const Container = styled.div` + display: flex; + width: 20.5rem; + flex-direction: column; + align-items: center; +` + +export const CampoText = styled.div` + margin: 1rem; +` + +export const InputArea = styled(TextField)` + width: 20.5rem; + height: 3.5rem; +` \ No newline at end of file diff --git a/src/Pages/SignUpPage/SignUpForm.js b/src/Pages/SignUpPage/SignUpForm.js index 0ad7d97..8f35794 100644 --- a/src/Pages/SignUpPage/SignUpForm.js +++ b/src/Pages/SignUpPage/SignUpForm.js @@ -1,8 +1,7 @@ import React from 'react'; import Buttons from '../../Components/Buttons' -import { Container, CampoText, InputArea, Title, ContainerSignUp, Image, ContainerInputPassword } from './styles'; +import { Container, CampoText, InputArea, Title, ContainerSignUp, Image } from './styles'; import Logo from '../../assets/logo-future-eats-invert.png'; -import OutlinedInput from '@material-ui/core/OutlinedInput'; import { IconButton, InputAdornment, InputLabel } from '@material-ui/core'; import Visibility from '@material-ui/icons/Visibility'; import VisibilityOff from '@material-ui/icons/VisibilityOff'; @@ -49,8 +48,8 @@ export default function SignUpForm(props) { goToAddAddressPage(history)} - /> diff --git a/src/Pages/SignUpPage/styles.js b/src/Pages/SignUpPage/styles.js index 935bd8d..5bfc8ad 100644 --- a/src/Pages/SignUpPage/styles.js +++ b/src/Pages/SignUpPage/styles.js @@ -6,11 +6,9 @@ import FormControl from "@material-ui/core/FormControl"; export const ContainerSignUp = styled.div` display: flex; flex-direction: column; - /* justify-content:center; */ - align-items: center; - - + align-items: center; ` + export const ContainerInputPassword = styled(FormControl)` /* width:20.5rem; */ ` @@ -19,7 +17,7 @@ export const Image = styled.div` text-align: center; margin:2.5rem 0 1.75rem 0; ` -export const Title = styled.h1` +export const Title = styled.h3` font-family: Roboto; text-align: center; font-size: 1rem; From 69ec4ba783619eada0bfc0c7fa4da87729cf6f1d Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Fri, 22 Jan 2021 23:21:05 -0300 Subject: [PATCH 28/69] adicionado componente popUp quantidade --- src/Components/ItemCard/ItemCard.js | 17 +++++++++--- src/Components/ItemCard/styles.js | 2 +- src/Components/PopUpQuantidade/index.js | 33 ++++++++++++++++++++++++ src/Components/PopUpQuantidade/styles.js | 18 +++++++++++++ src/Pages/CartPage/index.js | 18 +++++++++++-- src/Pages/CartPage/styles.js | 21 +++++++++++++++ 6 files changed, 102 insertions(+), 7 deletions(-) create mode 100644 src/Components/PopUpQuantidade/index.js create mode 100644 src/Components/PopUpQuantidade/styles.js diff --git a/src/Components/ItemCard/ItemCard.js b/src/Components/ItemCard/ItemCard.js index c019641..744a91e 100644 --- a/src/Components/ItemCard/ItemCard.js +++ b/src/Components/ItemCard/ItemCard.js @@ -1,14 +1,23 @@ -import React from 'react' -import { CardContainer, InfoContainer, HeaderContainer, FooterContainer, RemoveBtn, AddBtn } from './styles' +import React, { useState } from 'react' +import { + CardContainer, + InfoContainer, + HeaderContainer, + FooterContainer, + RemoveBtn, + AddBtn, +} from './styles' + +export default function ItemCard(props) { + /* todas tags devem ser preenchidas por props quando for adicionar a lógica */ -export default function ItemCard() { return (

Nome do Prato

- +

Ingredientes do prato

diff --git a/src/Components/ItemCard/styles.js b/src/Components/ItemCard/styles.js index ecad65c..5ce3e75 100644 --- a/src/Components/ItemCard/styles.js +++ b/src/Components/ItemCard/styles.js @@ -94,4 +94,4 @@ export const RemoveBtn = styled.button ` font-size: 0.75rem; margin-right: -1px; margin-bottom: -1px; -` \ No newline at end of file +` diff --git a/src/Components/PopUpQuantidade/index.js b/src/Components/PopUpQuantidade/index.js new file mode 100644 index 0000000..7447e42 --- /dev/null +++ b/src/Components/PopUpQuantidade/index.js @@ -0,0 +1,33 @@ +import React from 'react' +import { PopUpContainer, PopUpCard } from './styles' + + +export default function PopUpQuantidade() { + const renderOptions = () => { + for (let i = 0; i < 10; i++) { + return ( + + ) + } + } + + const handleSelect = (event) => { + setQuantidade(event.target.value) + } + + const addQuantidade = () => { + setPopUp(false) + } + + return ( + + +

Selecione a quantidade desejada

+ + +
+
+ ) +} diff --git a/src/Components/PopUpQuantidade/styles.js b/src/Components/PopUpQuantidade/styles.js new file mode 100644 index 0000000..9ebd30a --- /dev/null +++ b/src/Components/PopUpQuantidade/styles.js @@ -0,0 +1,18 @@ +import styled from "styled-components"; + +export const PopUpContainer = styled.div ` +margin: 0; +position: fixed; +width: 100vw; +height: 100vh; +background-color: rgba(0, 0, 0, 0.5); +z-index: 10; +` + +export const PopUpCard = styled.div ` +display: flex; +flex-direction: column; +justify-content: center; +align-items: center; +background-color: #ffffff +` \ No newline at end of file diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index fc854e6..0259aaa 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -4,7 +4,15 @@ import Header from '../../Components/Header'; import { goBack, goToHomePage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; import GlobalStateContext from "../../Global/GlobalStateContext"; import Buttons from '../../Components/Buttons'; -import { ContainerCarrinho, ContainerEndereco , MensagemVazio , SubtotalContainer , StyledForm , CartPageContainer } from './styles'; +import { + ContainerCarrinho, + ContainerEndereco , + MensagemVazio , + SubtotalContainer , + StyledForm , + CartPageContainer, + ContainerRestaurante +} from './styles'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import Radio from '@material-ui/core/Radio'; import RadioGroup from '@material-ui/core/RadioGroup'; @@ -35,6 +43,13 @@ export default function CartPage() {

Rua Alessandra, 42

{/* lógica para puxar endereço */} + {/* lógica para renderizar restaurante */} + +

Nome restaurante

+

Endereço restaurante

+

tempo entrega

+
+ {/* ternario para renderizar itens ou mensagem vazio */} @@ -43,7 +58,6 @@ export default function CartPage() { {/* map nos itens do carrinho para renderizar os cards */} - SUBTOTAL diff --git a/src/Pages/CartPage/styles.js b/src/Pages/CartPage/styles.js index 64c417a..07c1a3c 100644 --- a/src/Pages/CartPage/styles.js +++ b/src/Pages/CartPage/styles.js @@ -1,6 +1,7 @@ import styled from "styled-components"; export const CartPageContainer = styled.div ` + width: 100vw !important; display: flex; flex-direction: column; justify-content: space-between; @@ -31,6 +32,26 @@ p:nth-child(2) { } ` +export const ContainerRestaurante = styled.div ` + margin: 0 1rem 0.5rem 1rem; +h2 { + margin: 0; + margin-bottom: 0.5rem; + font-size: 1rem; + letter-spacing: -0.39px; + color: #e8222e; + font-weight: 500; +} +p { + margin: 0; + font-size: 1rem; + margin-bottom: 0.5rem; + letter-spacing: -0.39px; + color: #b8b8b8; +} +` + + export const MensagemVazio = styled.div ` text-align: center; margin-top: 1.25rem; From aebe0d6b7d1ebb1bcf46ee16a8e59bf2c9a6046c Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Sat, 23 Jan 2021 00:32:15 -0300 Subject: [PATCH 29/69] =?UTF-8?q?finalizado=20componente=20pop=20up,=20sel?= =?UTF-8?q?ect=20n=C3=A3o=20funciona?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/ItemCard/ItemCard.js | 12 +++- src/Components/PopUpQuantidade/index.js | 28 ++++++--- src/Components/PopUpQuantidade/styles.js | 55 +++++++++++++---- src/Global/GlobalState.js | 5 +- src/Pages/CartPage/index.js | 78 +++++++++++++----------- src/Pages/CartPage/styles.js | 8 +++ 6 files changed, 123 insertions(+), 63 deletions(-) diff --git a/src/Components/ItemCard/ItemCard.js b/src/Components/ItemCard/ItemCard.js index 744a91e..a9fdfc7 100644 --- a/src/Components/ItemCard/ItemCard.js +++ b/src/Components/ItemCard/ItemCard.js @@ -1,4 +1,5 @@ -import React, { useState } from 'react' +import React, { useState, useContext } from 'react' +import GlobalStateContext from "../../Global/GlobalStateContext"; import { CardContainer, InfoContainer, @@ -9,15 +10,20 @@ import { } from './styles' export default function ItemCard(props) { - /* todas tags devem ser preenchidas por props quando for adicionar a lógica */ + const {states, setters} = useContext(GlobalStateContext) + const addQuantidade = () => { + setters.setPopUp(true) + } + + /* todas tags devem ser preenchidas por props quando for adicionar a lógica */ return (

Nome do Prato

- +

Ingredientes do prato

diff --git a/src/Components/PopUpQuantidade/index.js b/src/Components/PopUpQuantidade/index.js index 7447e42..4538577 100644 --- a/src/Components/PopUpQuantidade/index.js +++ b/src/Components/PopUpQuantidade/index.js @@ -1,32 +1,40 @@ -import React from 'react' -import { PopUpContainer, PopUpCard } from './styles' +import React, {useContext} from 'react' +import { PopUpContainer, PopUpCard, ButtonContainer } from './styles' +import GlobalStateContext from "../../Global/GlobalStateContext"; export default function PopUpQuantidade() { + const {states, setters} = useContext(GlobalStateContext) + + const renderOptions = () => { for (let i = 0; i < 10; i++) { return ( - + ) } } - - const handleSelect = (event) => { - setQuantidade(event.target.value) - } + + // const handleSelect = (event) => { + // setQuantidade(event.target.value) + // } const addQuantidade = () => { - setPopUp(false) + setters.setPopUp(false) } return (

Selecione a quantidade desejada

- {renderOptions()} - + + +
) diff --git a/src/Components/PopUpQuantidade/styles.js b/src/Components/PopUpQuantidade/styles.js index 9ebd30a..d57306a 100644 --- a/src/Components/PopUpQuantidade/styles.js +++ b/src/Components/PopUpQuantidade/styles.js @@ -1,18 +1,51 @@ import styled from "styled-components"; export const PopUpContainer = styled.div ` -margin: 0; -position: fixed; -width: 100vw; -height: 100vh; -background-color: rgba(0, 0, 0, 0.5); -z-index: 10; + display: flex; + justify-content: center; + align-items: center; + margin: 0; + position: fixed; + width: 100vw; + height: 100vh; + background-color: rgba(0, 0, 0, 0.5); + z-index: 10; ` export const PopUpCard = styled.div ` -display: flex; -flex-direction: column; -justify-content: center; -align-items: center; -background-color: #ffffff + width: calc(100% - 2rem); + height: 13.5rem; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin: 0 1rem; + background-color: #ffffff; +p { + font-size: 1rem; + letter-spacing: -0.39px; + margin-bottom: 2rem; +} +select { + border: solid 1px #b8b8b8; + border-radius: 4px; + width: calc(100% - 2rem); + height: 3.5rem; + font-size: 1rem; + margin-bottom: 1.75rem; +} +` +export const ButtonContainer = styled.div ` + width: 100%; + display: flex; + justify-content: flex-end; +button { + padding: 6px 0; + margin-right: 1rem; + border: none; + background: none; + font-size: 1rem; + letter-spacing: -0.39px; + color: #4f81a8; +} ` \ No newline at end of file diff --git a/src/Global/GlobalState.js b/src/Global/GlobalState.js index 81dd879..2151680 100644 --- a/src/Global/GlobalState.js +++ b/src/Global/GlobalState.js @@ -13,10 +13,11 @@ export default function GlobalState(props) { const [token, setToken] = useState("") const [searchInput, setSearchInput] = useState("") /* Controla input da barra de pesquisa */ const [filter, setFilter] = useState("") /* Controla o filtro do menu do feed */ + const [popUp, setPopUp] = useState(false) - const states = {carrinho, perfil, restaurante, listaRestaurantes, token, searchInput, filter} - const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken, setSearchInput, setFilter} + const states = {carrinho, perfil, restaurante, listaRestaurantes, token, searchInput, filter, popUp} + const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken, setSearchInput, setFilter, setPopUp} const requests = {} return ( diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index 0259aaa..335855d 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -4,6 +4,7 @@ import Header from '../../Components/Header'; import { goBack, goToHomePage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; import GlobalStateContext from "../../Global/GlobalStateContext"; import Buttons from '../../Components/Buttons'; +import PopUpQuantidade from "../../Components/PopUpQuantidade"; import { ContainerCarrinho, ContainerEndereco , @@ -11,7 +12,8 @@ import { SubtotalContainer , StyledForm , CartPageContainer, - ContainerRestaurante + ContainerRestaurante, + ScrollSection } from './styles'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import Radio from '@material-ui/core/Radio'; @@ -36,49 +38,51 @@ export default function CartPage() { return ( + {states.popUp ? : null}
+ + +

Endereço de entrega

+

Rua Alessandra, 42

{/* lógica para puxar endereço */} +
- -

Endereço de entrega

-

Rua Alessandra, 42

{/* lógica para puxar endereço */} -
+ {/* lógica para renderizar restaurante */} + +

Nome restaurante

+

Endereço restaurante

+

tempo entrega

+
- {/* lógica para renderizar restaurante */} - -

Nome restaurante

-

Endereço restaurante

-

tempo entrega

-
+ + + {/* ternario para renderizar itens ou mensagem vazio */} + + {/* Carrinho vazio */} - - - {/* ternario para renderizar itens ou mensagem vazio */} - - {/* Carrinho vazio */} + {/* map nos itens do carrinho para renderizar os cards */} + - {/* map nos itens do carrinho para renderizar os cards */} - + + SUBTOTAL +
+ Frete R${frete} {/* logica para puxar o frete*/ } + R$ {subtotal} {/* logica para puxar o subtotal*/ } +
+
- - SUBTOTAL -
- Frete R${frete} {/* logica para puxar o frete*/ } - R$ {subtotal} {/* logica para puxar o subtotal*/ } -
-
+ +
+

Forma de Pagamento

+ + } label="Dinheiro" /> + } label="Cartão de crédito" /> + +
+ +
- -
-

Forma de Pagamento

- - } label="Dinheiro" /> - } label="Cartão de crédito" /> - -
- -
- -
+
+
) diff --git a/src/Pages/CartPage/styles.js b/src/Pages/CartPage/styles.js index 07c1a3c..87a245f 100644 --- a/src/Pages/CartPage/styles.js +++ b/src/Pages/CartPage/styles.js @@ -8,6 +8,14 @@ export const CartPageContainer = styled.div ` min-height: 100vh; ` +export const ScrollSection = styled.div ` + display: flex; + flex-direction: column; + justify-content: space-between; + overflow: auto; + margin-bottom: 3rem; +` + export const ContainerCarrinho = styled.div ` display: flex; From 8e126a2c3a9b4527a911481d421fb1e5b9d33c08 Mon Sep 17 00:00:00 2001 From: Adrielly Felix Date: Sat, 23 Jan 2021 13:19:16 -0300 Subject: [PATCH 30/69] consumindo api de login --- package-lock.json | 10 ++++++ package.json | 1 + src/App.js | 18 +++++----- src/Components/FormLogin/index.js | 49 ++++++++++++++++++++------- src/Components/InitialScreen/index.js | 2 +- src/Service/api.js | 7 ++++ 6 files changed, 65 insertions(+), 22 deletions(-) create mode 100644 src/Service/api.js diff --git a/package-lock.json b/package-lock.json index f7528d1..c57d610 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11138,6 +11138,16 @@ "workbox-webpack-plugin": "4.3.1" } }, + "react-toastify": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-6.2.0.tgz", + "integrity": "sha512-XpjFrcBhQ0/nBOL4syqgP/TywFnOyxmstYLWgSQWcj39qpp+WU4vPt3C/ayIDx7RFyxRWfzWTdR2qOcDGo7G0w==", + "requires": { + "clsx": "^1.1.1", + "prop-types": "^15.7.2", + "react-transition-group": "^4.4.1" + } + }, "react-transition-group": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.1.tgz", diff --git a/package.json b/package.json index 102ecd7..16d11ec 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "react-dom": "^16.13.1", "react-router-dom": "^5.2.0", "react-scripts": "3.4.1", + "react-toastify": "^6.2.0", "styled-components": "^5.2.1", "yup": "^0.32.8" }, diff --git a/src/App.js b/src/App.js index bb9b4c7..71e2d5f 100644 --- a/src/App.js +++ b/src/App.js @@ -1,17 +1,19 @@ -import React from 'react'; +import React from "react"; import Routes from "./Routes/Routes"; -import GlobalState from './Global/GlobalState' -import Tema from "./Tema/Tema" - +import GlobalState from "./Global/GlobalState"; +import Tema from "./Tema/Tema"; +import { ToastContainer } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; function App() { return (
- - - - + + + + +
); } diff --git a/src/Components/FormLogin/index.js b/src/Components/FormLogin/index.js index 5d78080..841c0aa 100644 --- a/src/Components/FormLogin/index.js +++ b/src/Components/FormLogin/index.js @@ -1,10 +1,12 @@ -import React, { useState, useRef, useCallback } from "react"; +import React, { useState, useRef, useContext } from "react"; import * as Yup from "yup"; import { makeStyles } from "@material-ui/core/styles"; import { Grid, InputAdornment, IconButton } from "@material-ui/core"; import { Visibility, VisibilityOff } from "@material-ui/icons"; import { Form } from "@unform/web"; - +import api from "../../Service/api"; +import { goToHomePage, goToSignUpPage } from "../../Routes/coordinators"; +import { useHistory } from "react-router-dom"; import { Container, CampoText, @@ -15,6 +17,8 @@ import { import { Title } from "./styles"; import useForm from "../../CustomHooks/useForm"; import Logo from "../../assets/logo-future-eats-invert.svg"; +import { toast } from "react-toastify"; +import GlobalStateContext from "../../Global/GlobalStateContext"; const useStyles = makeStyles({ root: { @@ -29,11 +33,13 @@ const useStyles = makeStyles({ }); const FormLogin = () => { const classes = useStyles(); + const history = useHistory(); + const { setters } = useContext(GlobalStateContext); const formRef = useRef(null); const [showSenha, setShowSenha] = useState(false); - const [form, handleInput, resetState, handleFormErrors] = useForm({ - email: undefined, - password: undefined, + const [form, handleInput, handleFormErrors] = useForm({ + email: "", + password: "", errors: { email: null, password: null, @@ -66,12 +72,29 @@ const FormLogin = () => { abortEarly: false, }); - resetState(); - // await api.post('/sessions', form); + const response = await api.post("/login", form); + window.localStorage.setItem("token", response.data.token); + setters.setToken(response.data.token); + setters.setPerfil(response.data.user); + goToHomePage(history); } catch (err) { - const errors = getValidationErrors(err); - handleFormErrors(errors); - console.log(errors); + if (err.inner) { + const errors = getValidationErrors(err); + handleFormErrors(errors); + return; + } + if (err.response) { + if (err.response.data.message === "Usuário não encontrado") { + toast.error("Usuário não encontrado"); + + goToSignUpPage(history); + } + if (err.response.data.message === "Senha inválida") { + toast.error("Senha inválida"); + } + } + + throw err; } }; @@ -88,7 +111,7 @@ const FormLogin = () => { justify="center" alignItems="center" > - +
logo
@@ -99,7 +122,7 @@ const FormLogin = () => { { - + logo diff --git a/src/Service/api.js b/src/Service/api.js new file mode 100644 index 0000000..4343ec4 --- /dev/null +++ b/src/Service/api.js @@ -0,0 +1,7 @@ +import axios from "axios"; + +const api = axios.create({ + baseURL: "https://us-central1-missao-newton.cloudfunctions.net/fourFoodA/", +}); + +export default api; From 068cf311468047ee10b7aa5007ed2e281c086ceb Mon Sep 17 00:00:00 2001 From: Adrielly Felix Date: Sat, 23 Jan 2021 13:36:34 -0300 Subject: [PATCH 31/69] corrigindo validacao de email e senha --- src/Components/FormLogin/index.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Components/FormLogin/index.js b/src/Components/FormLogin/index.js index 841c0aa..461cace 100644 --- a/src/Components/FormLogin/index.js +++ b/src/Components/FormLogin/index.js @@ -37,9 +37,9 @@ const FormLogin = () => { const { setters } = useContext(GlobalStateContext); const formRef = useRef(null); const [showSenha, setShowSenha] = useState(false); - const [form, handleInput, handleFormErrors] = useForm({ - email: "", - password: "", + const [form, handleInput, resetState, handleFormErrors] = useForm({ + email: undefined, + password: undefined, errors: { email: null, password: null, @@ -73,11 +73,14 @@ const FormLogin = () => { }); const response = await api.post("/login", form); + window.localStorage.setItem("token", response.data.token); setters.setToken(response.data.token); setters.setPerfil(response.data.user); + goToHomePage(history); } catch (err) { + console.log(err.inner); if (err.inner) { const errors = getValidationErrors(err); handleFormErrors(errors); @@ -92,6 +95,7 @@ const FormLogin = () => { if (err.response.data.message === "Senha inválida") { toast.error("Senha inválida"); } + return; } throw err; @@ -102,7 +106,9 @@ const FormLogin = () => { setShowSenha(!showSenha); }; - const handleMouseDownPassword = () => {}; + const handleMouseDownPassword = (event) => { + event.preventDefault(); + }; return ( { { Date: Sat, 23 Jan 2021 13:43:48 -0300 Subject: [PATCH 32/69] corrigindo validacao de senha incorreta --- src/Components/FormLogin/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Components/FormLogin/index.js b/src/Components/FormLogin/index.js index 461cace..94b1b0c 100644 --- a/src/Components/FormLogin/index.js +++ b/src/Components/FormLogin/index.js @@ -80,7 +80,6 @@ const FormLogin = () => { goToHomePage(history); } catch (err) { - console.log(err.inner); if (err.inner) { const errors = getValidationErrors(err); handleFormErrors(errors); @@ -88,12 +87,12 @@ const FormLogin = () => { } if (err.response) { if (err.response.data.message === "Usuário não encontrado") { - toast.error("Usuário não encontrado"); + toast.error("Usuário não cadastrado"); goToSignUpPage(history); } - if (err.response.data.message === "Senha inválida") { - toast.error("Senha inválida"); + if (err.response.data.message === "Senha incorreta") { + toast.error("Senha incorreta"); } return; } From c6e3ce94455a5e209d16d665bb42dc1597805bbe Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Mon, 25 Jan 2021 11:19:41 -0300 Subject: [PATCH 33/69] =?UTF-8?q?estiliza=C3=A7=C3=A3o=20da=20pagina=20de?= =?UTF-8?q?=20restaurantes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Pages/CartPage/styles.js | 2 ++ src/Pages/RestaurantPage/index.js | 26 +++++++++++++++-- src/Pages/RestaurantPage/styles.js | 45 ++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 2 deletions(-) diff --git a/src/Pages/CartPage/styles.js b/src/Pages/CartPage/styles.js index 87a245f..2485dc7 100644 --- a/src/Pages/CartPage/styles.js +++ b/src/Pages/CartPage/styles.js @@ -104,3 +104,5 @@ p { } ` + + diff --git a/src/Pages/RestaurantPage/index.js b/src/Pages/RestaurantPage/index.js index 1328775..b60acce 100644 --- a/src/Pages/RestaurantPage/index.js +++ b/src/Pages/RestaurantPage/index.js @@ -1,15 +1,37 @@ import React from 'react' import { useHistory } from "react-router-dom"; import { goBack, goToCartPage, goToHomePage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; +import Header from "../../Components/Header"; +import ItemCard from "../../Components/ItemCard/ItemCard"; +import { RestaurantInfo, MealsContainer, TypeTitle } from './styles'; export default function RestaurantPage() { const history = useHistory(); return (
- perfil do restaurante +
+ + +

Nome do Restaurante

+

Tipo de cozinha

+
+ tempo de entrega + valor do frete +
+

endereço

+
+ + {/* map para renderizar categorias */} + + categoria do prato + {/* map para renderizar pratos da categoria */} + + + +{/* @@ -18,7 +40,7 @@ export default function RestaurantPage() { + */}
) diff --git a/src/Pages/RestaurantPage/styles.js b/src/Pages/RestaurantPage/styles.js index e69de29..9dea736 100644 --- a/src/Pages/RestaurantPage/styles.js +++ b/src/Pages/RestaurantPage/styles.js @@ -0,0 +1,45 @@ +import styled from "styled-components"; + +export const RestaurantInfo = styled.div ` + margin: 1rem; + height: 15.5rem; + font-size: 1rem; + letter-spacing: -0.29px; + color: #b8b8b8; +h2 { + margin: 0; + margin-top: 0.75rem; + font-size: 1rem; + letter-spacing: -0.39px; + color: #e8222e; + font-weight: 500; +} +p { + margin: 0.5rem 0; +} +span { + margin-right: 0.5rem; +} +img { + margin: 0; + width: 100%; + height: 7.5rem; + object-fit: cover; + border-radius: 8px 8px 0 0; +} +` + +export const MealsContainer = styled.div ` + margin: 0 1rem; + margin-bottom: 0.5rem; +` + +export const TypeTitle = styled.p ` + margin: 0; + border-bottom: 1px solid black; + margin-bottom: 0.5rem; + padding-bottom: 0.5rem; + font-size: 1rem; + letter-spacing: -0.39px; + font-weight: 500; +` \ No newline at end of file From 78d143711f00e5017d1a64540821f8449a5a0ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Mon, 25 Jan 2021 12:04:53 -0300 Subject: [PATCH 34/69] =?UTF-8?q?in=C3=ADcio=20da=20l=C3=B3gica=20de=20val?= =?UTF-8?q?ida=C3=A7=C3=A3o=20na=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Pages/SignUpPage/SignUpForm.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Pages/SignUpPage/SignUpForm.js b/src/Pages/SignUpPage/SignUpForm.js index 8f35794..f0a9a61 100644 --- a/src/Pages/SignUpPage/SignUpForm.js +++ b/src/Pages/SignUpPage/SignUpForm.js @@ -1,4 +1,5 @@ import React from 'react'; +import axios from 'axios'; import Buttons from '../../Components/Buttons' import { Container, CampoText, InputArea, Title, ContainerSignUp, Image } from './styles'; import Logo from '../../assets/logo-future-eats-invert.png'; @@ -9,6 +10,8 @@ import useForm from '../../CustomHooks/useForm'; import { useHistory } from "react-router-dom"; import { goToAddAddressPage } from '../../Routes/coordinators'; + + export default function SignUpForm(props) { const history = useHistory(); const [form, handleInput, resetState] = useForm({ @@ -19,6 +22,7 @@ export default function SignUpForm(props) { passwordConfirm: '', }) + const [showSenha, setShowSenha] = React.useState(false); @@ -32,8 +36,21 @@ export default function SignUpForm(props) { const submitForm = (e) => { e.preventDefault() - resetState() //resetando os inputs// - console.log(form) //----------------------------------------------// + + const body = { + name: form.name, + email: form.email, + cpf: form.cpf, + password: form.password + } + console.log(body);//-------------------------------------------------// + axios.post('https://us-central1-missao-newton.cloudfunctions.net/fourFoodA/signup', body) + .then((response) =>{ + console.log(response.data.token);// token da criação do novo usuario + }) + .catch((error) => { + console.log(error); + }) } return ( @@ -93,6 +110,7 @@ export default function SignUpForm(props) { required value={form.password || undefined} onChange={handleInput} + // inputProps={{ pattern: "(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$" }} name="password" id="outlined-disabled" label="Senha" @@ -145,7 +163,7 @@ export default function SignUpForm(props) { goToAddAddressPage(history)} + submeter = {submitForm} /> From 7ad218a82f47eb7d721b095f4c5dbe9a798b9e64 Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Mon, 25 Jan 2021 13:54:32 -0300 Subject: [PATCH 35/69] adicionado hook useProtectedPage --- src/CustomHooks/useProtectedPage.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/CustomHooks/useProtectedPage.js diff --git a/src/CustomHooks/useProtectedPage.js b/src/CustomHooks/useProtectedPage.js new file mode 100644 index 0000000..6b45c27 --- /dev/null +++ b/src/CustomHooks/useProtectedPage.js @@ -0,0 +1,16 @@ +import { useEffect } from "react"; +import { useHistory } from "react-router-dom"; + +const useProtectedPage = () => { + const history = useHistory(); + +//Assim que a pagina abre realiza a verificação + useEffect(() => { + const token = localStorage.getItem("token"); + if (!token) { + history.push("/"); //Caso não esteja autorizado retorna a LoginPage + } + }, [history]); +}; + +export default useProtectedPage; \ No newline at end of file From 6c591e1a888c509528fbb1485cb0dc2fb3095d0a Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Mon, 25 Jan 2021 16:40:26 -0300 Subject: [PATCH 36/69] =?UTF-8?q?revis=C3=A3o=20e=20pequenos=20acertos=20d?= =?UTF-8?q?e=20layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/FormLogin/styles.js | 1 + src/Components/ItemCard/ItemCard.js | 4 ++-- src/Pages/HomePage/index.js | 3 ++- src/Pages/ProfilePage/index.js | 21 ++++++--------------- src/Service/api.js | 2 +- src/index.css | 4 ++-- 6 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/Components/FormLogin/styles.js b/src/Components/FormLogin/styles.js index e0d35c2..6e67e40 100644 --- a/src/Components/FormLogin/styles.js +++ b/src/Components/FormLogin/styles.js @@ -13,6 +13,7 @@ export const Title = styled.h1` `; export const Container = styled.div` + width: 100vw; display: flex; flex-direction: column; align-items: center; diff --git a/src/Components/ItemCard/ItemCard.js b/src/Components/ItemCard/ItemCard.js index a9fdfc7..3c7c051 100644 --- a/src/Components/ItemCard/ItemCard.js +++ b/src/Components/ItemCard/ItemCard.js @@ -28,8 +28,8 @@ export default function ItemCard(props) {

Ingredientes do prato

R$46,00 - adicionar {/*ternario para alterar botões quanto necessário*/} - {/* remover */} + {/* adicionar ternario para alterar botões quanto necessário */} + remover diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index 5a31238..538cc35 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -132,7 +132,8 @@ export default function HomePage() { : filteredArray.map(e => { return }) } - {/* ternário verificando se há pedido para renderizar */} + {/* ternário verificando se há pedido para renderizar */} + {/* */}
); diff --git a/src/Pages/ProfilePage/index.js b/src/Pages/ProfilePage/index.js index fa375bd..52ad7c9 100644 --- a/src/Pages/ProfilePage/index.js +++ b/src/Pages/ProfilePage/index.js @@ -18,6 +18,8 @@ import { DivPerfil, DivTotal } from './styles' import icon from '../../assets/iconelapis.png' +import Header from '../../Components/Header'; +import FooterMenu from '../../Components/FooterMenu'; export default function ProfilePage() { const history = useHistory(); @@ -26,9 +28,10 @@ export default function ProfilePage() {
- +
+ {/* Meu Perfil - + */} Bruna Olivera bruna_o@gmail.com @@ -59,19 +62,7 @@ export default function ProfilePage() { - perfil do usuário - - - - +
) } diff --git a/src/Service/api.js b/src/Service/api.js index 4343ec4..9437f53 100644 --- a/src/Service/api.js +++ b/src/Service/api.js @@ -4,4 +4,4 @@ const api = axios.create({ baseURL: "https://us-central1-missao-newton.cloudfunctions.net/fourFoodA/", }); -export default api; +export default api; \ No newline at end of file diff --git a/src/index.css b/src/index.css index c144ade..c834afb 100644 --- a/src/index.css +++ b/src/index.css @@ -1,6 +1,6 @@ body { margin: 0; - font-family: -apple-system, BlinkMacSystemFont, "Roboto", "Segoe UI", "Oxygen", + font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; @@ -10,4 +10,4 @@ body { code { font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; -} +} \ No newline at end of file From d9a9fa0eeb25a63cbddf1ba51a76896cd5e4c795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Tue, 26 Jan 2021 06:21:37 -0300 Subject: [PATCH 37/69] =?UTF-8?q?signup=20e=20endere=C3=A7o=20funcionando?= =?UTF-8?q?=20sem=20valida=C3=A7=C3=B5es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/FormAdress/index.js | 4 +++- src/Constants/urls.js | 1 + src/Pages/SignUpPage/SignUpForm.js | 17 +++++++++------- src/Service/user.js | 32 ++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 src/Constants/urls.js create mode 100644 src/Service/user.js diff --git a/src/Components/FormAdress/index.js b/src/Components/FormAdress/index.js index 1bff966..b750dfe 100644 --- a/src/Components/FormAdress/index.js +++ b/src/Components/FormAdress/index.js @@ -5,6 +5,7 @@ import { Title } from './styles'; import useForm from '../../CustomHooks/useForm' import { useHistory } from "react-router-dom"; import { goToHomePage } from '../../Routes/coordinators'; +import { addAddress } from "../../Service/user"; export default function FormAdress(props) { @@ -22,6 +23,7 @@ export default function FormAdress(props) { e.preventDefault() resetState() //resetando os inputs// console.log(form) //----------------------------------------------// + addAddress(form, history) } return ( @@ -112,7 +114,7 @@ export default function FormAdress(props) { goToHomePage(history)} // trocar pela funçao de requisiçao na api. assim os inputs não estão controlados + submeter = {submitForm} /> diff --git a/src/Constants/urls.js b/src/Constants/urls.js new file mode 100644 index 0000000..6fa2114 --- /dev/null +++ b/src/Constants/urls.js @@ -0,0 +1 @@ +export const BASE_URL = 'https://us-central1-missao-newton.cloudfunctions.net/fourFoodA' \ No newline at end of file diff --git a/src/Pages/SignUpPage/SignUpForm.js b/src/Pages/SignUpPage/SignUpForm.js index f0a9a61..8f761b0 100644 --- a/src/Pages/SignUpPage/SignUpForm.js +++ b/src/Pages/SignUpPage/SignUpForm.js @@ -9,6 +9,7 @@ import VisibilityOff from '@material-ui/icons/VisibilityOff'; import useForm from '../../CustomHooks/useForm'; import { useHistory } from "react-router-dom"; import { goToAddAddressPage } from '../../Routes/coordinators'; +import { signUp } from '../../Service/user'; @@ -44,13 +45,15 @@ export default function SignUpForm(props) { password: form.password } console.log(body);//-------------------------------------------------// - axios.post('https://us-central1-missao-newton.cloudfunctions.net/fourFoodA/signup', body) - .then((response) =>{ - console.log(response.data.token);// token da criação do novo usuario - }) - .catch((error) => { - console.log(error); - }) + signUp(body, history) + + // axios.post('https://us-central1-missao-newton.cloudfunctions.net/fourFoodA/signup', body) + // .then((response) =>{ + // console.log(response.data.token);// token da criação do novo usuario + // }) + // .catch((error) => { + // console.log(error); + // }) } return ( diff --git a/src/Service/user.js b/src/Service/user.js new file mode 100644 index 0000000..72e180d --- /dev/null +++ b/src/Service/user.js @@ -0,0 +1,32 @@ +import axios from 'axios'; +import {BASE_URL} from '../Constants/urls' +import { goToAddAddressPage, goToHomePage } from '../Routes/coordinators'; + +export const signUp = (body, history) => { + axios.post(`${BASE_URL}/signup`, body) + .then((response) => { + localStorage.setItem('token', response.data.token)// token da criação do novo usuario + goToAddAddressPage(history) + }) + .catch((error) => { + console.log(error); + }) +} + + +export const addAddress = (body, history) => { + const headers ={ + headers:{ + auth:localStorage.getItem('token') + } + } + axios.put(`${BASE_URL}/address`, body, headers) + .then((response) => { + console.log(response.data.token); + localStorage.setItem('token', response.data.token)// token da criação do endereço + goToHomePage(history) + }) + .catch((error) => { + console.log(error); + }) +} \ No newline at end of file From b1c085d31e1db6f2bc82abedd61309aa2004acdb Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Tue, 26 Jan 2021 14:13:04 -0300 Subject: [PATCH 38/69] arrumando o search placeholder --- src/Pages/SearchPage/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Pages/SearchPage/index.js b/src/Pages/SearchPage/index.js index a023cd5..02acd0d 100644 --- a/src/Pages/SearchPage/index.js +++ b/src/Pages/SearchPage/index.js @@ -115,6 +115,10 @@ export default function SearchPage() { const filteredArray = teste.filter(e => { return e.name.toLowerCase().includes(states.searchInput.toLowerCase()) || e.category.toLowerCase().includes(states.searchInput.toLowerCase()) }) + + const arrayMap = filteredArray.map(e => { + return + }) return ( @@ -122,9 +126,7 @@ export default function SearchPage() {
{states.searchInput === "" ?

Busque por nome de Restaurante

- : filteredArray.map(e => { - return - }) } + : (arrayMap[0]? arrayMap :

Não encontramos :(

) }
) } From fb8cc5c391bb9f065789aa299905359fbc030d0f Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Tue, 26 Jan 2021 14:15:38 -0300 Subject: [PATCH 39/69] importando roboto pelo google fonts no index.html --- public/index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/index.html b/public/index.html index 9bc4146..1cdb51c 100644 --- a/public/index.html +++ b/public/index.html @@ -26,6 +26,8 @@ --> + + I Future From 6894068c672a02fca0f24f994e2d7dd49cca2e90 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Tue, 26 Jan 2021 14:33:01 -0300 Subject: [PATCH 40/69] =?UTF-8?q?resolvendo=20cor=20dos=20bot=C3=B5es=20do?= =?UTF-8?q?=20footer=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/FooterMenu/index.js | 17 +++++++++++++++-- src/Pages/CartPage/index.js | 2 +- src/Pages/HomePage/index.js | 2 +- src/Pages/ProfilePage/index.js | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Components/FooterMenu/index.js b/src/Components/FooterMenu/index.js index a03a039..440454f 100644 --- a/src/Components/FooterMenu/index.js +++ b/src/Components/FooterMenu/index.js @@ -1,4 +1,4 @@ -import React, { useState } from 'react' +import React, { useState, useEffect } from 'react' import { useHistory } from 'react-router-dom' import { goToCartPage, goToHomePage, goToProfilePage } from '../../Routes/coordinators' import { ReactComponent as AvatarIcon} from "../../assets/footerMenuIcons/avatar.svg"; @@ -6,7 +6,7 @@ import { ReactComponent as HomeIcon } from "../../assets/footerMenuIcons/homepag import { ReactComponent as CartIcon } from "../../assets/footerMenuIcons/shopping-cart.svg"; import { FooterContainer } from './styles'; -export default function FooterMenu() { +export default function FooterMenu(props) { const history = useHistory() const [fill, setFill] = useState({ home: "#B8B8B8", @@ -14,6 +14,19 @@ export default function FooterMenu() { avatar: "#B8B8B8" }) + useEffect(() => { + if( props.page === "home") { + setFill({home: "#E8222E", cart: "#B8B8B8" , avatar: "#B8B8B8"}) + } else if (props.page === "cart") { + setFill({home: "#B8B8B8", cart: "#E8222E" , avatar: "#B8B8B8"}) + } else if (props.page === "profile") { + setFill({home: "#B8B8B8", cart: "#B8B8B8" , avatar: "#E8222E"}) + } + + },[] ) + + + const selectHomeIcon = () => { setFill({home: "#E8222E", cart: "#B8B8B8" , avatar: "#B8B8B8"}) goToHomePage(history) diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index 335855d..b85d6af 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -83,7 +83,7 @@ export default function CartPage() { - + ) } diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index 538cc35..8120d6b 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -134,7 +134,7 @@ export default function HomePage() { }) } {/* ternário verificando se há pedido para renderizar */} {/* */} - +
); } diff --git a/src/Pages/ProfilePage/index.js b/src/Pages/ProfilePage/index.js index 52ad7c9..1cf87ff 100644 --- a/src/Pages/ProfilePage/index.js +++ b/src/Pages/ProfilePage/index.js @@ -62,7 +62,7 @@ export default function ProfilePage() { - + ) } From 76c81bd6889bbd27a1e8ca5f4b2d93df6d7ba304 Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Tue, 26 Jan 2021 14:46:51 -0300 Subject: [PATCH 41/69] =?UTF-8?q?corrigido=20select=20do=20popUpQuantidade?= =?UTF-8?q?=20e=20centraliza=C3=A7=C3=A3o=20do=20Header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/Header/index.js | 14 ++++++++------ src/Components/Header/styles.js | 7 +++++-- src/Components/PopUpQuantidade/index.js | 22 +++++++++++++--------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/Components/Header/index.js b/src/Components/Header/index.js index 6765db7..1d1b7f4 100644 --- a/src/Components/Header/index.js +++ b/src/Components/Header/index.js @@ -2,7 +2,7 @@ import React from 'react' import { useHistory } from 'react-router-dom' import { goBack } from '../../Routes/coordinators' import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos'; -import { HeaderContainer } from './styles'; +import { HeaderContainer , BackButton } from './styles'; @@ -11,12 +11,14 @@ export default function Header(props) { return ( - +
+ + {/* para nomear a sua página use a prop >>> pageName='nome da sua página' */} +

{props.pageName}

+
{/* o estado inicial para mostrar o botão é true, caso sua tela não precise, use a prop button com o valor "false" (string)*/} - {props.button === "false" ? null : } - {/* para nomear a sua página use a prop >>> pageName='nome da sua página' */} -

{props.pageName}

- + {props.button === "false" ? null : goBack(history)}>} +
) } diff --git a/src/Components/Header/styles.js b/src/Components/Header/styles.js index 460588f..f76bfc7 100644 --- a/src/Components/Header/styles.js +++ b/src/Components/Header/styles.js @@ -13,9 +13,12 @@ h3{ font-weight: 500; letter-spacing: -0.39px; } -button { +` + +export const BackButton = styled.button ` + position: absolute; + margin-top: -35px; margin-left: 1rem; border: none; background: none; -} ` \ No newline at end of file diff --git a/src/Components/PopUpQuantidade/index.js b/src/Components/PopUpQuantidade/index.js index 4538577..8d8d853 100644 --- a/src/Components/PopUpQuantidade/index.js +++ b/src/Components/PopUpQuantidade/index.js @@ -7,16 +7,20 @@ export default function PopUpQuantidade() { const {states, setters} = useContext(GlobalStateContext) - const renderOptions = () => { - for (let i = 0; i < 10; i++) { - return ( - - ) - } + let quantity = [] + for (let i = 0; i < 11; i++) { + quantity.push(i) } + const renderOptions = quantity.map((item) => { + return ( + + ) + }) + + // const handleSelect = (event) => { // setQuantidade(event.target.value) // } @@ -30,7 +34,7 @@ export default function PopUpQuantidade() {

Selecione a quantidade desejada

From 1cce1964ecf8221b6b3f1e3cd3f4f116eeef686b Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Tue, 26 Jan 2021 15:22:20 -0300 Subject: [PATCH 42/69] useRequestData criado, request de restaurantes funcionando com token colocado manualmente --- src/CustomHooks/useRequestData.js | 20 ++++++++++++++------ src/Global/GlobalState.js | 6 +++++- src/Pages/HomePage/index.js | 9 +++++++-- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/CustomHooks/useRequestData.js b/src/CustomHooks/useRequestData.js index 9b2c6e8..49917c0 100644 --- a/src/CustomHooks/useRequestData.js +++ b/src/CustomHooks/useRequestData.js @@ -1,9 +1,17 @@ import React from 'react' +import {useEffect, useState} from "react" +import axios from 'axios' -export default function useRequestData() { - return ( -
- -
- ) +export default function useRequestData(url,header, initialState) { + const [data, setData] = useState(initialState) + + useEffect(()=> { + axios.get(url,header).then((response) => { + setData(response.data) + }).catch((error) => { + console.log(error.message) + }) + }, [url]) + + return data } diff --git a/src/Global/GlobalState.js b/src/Global/GlobalState.js index 2151680..ec0f5a9 100644 --- a/src/Global/GlobalState.js +++ b/src/Global/GlobalState.js @@ -3,6 +3,7 @@ import GlobalStateContext from "../Global/GlobalStateContext"; import axios from "axios"; import useRequestData from '../CustomHooks/useRequestData' import {useState, useEffect} from 'react' +import {BASE_URL} from '../Constants/urls.js' export default function GlobalState(props) { @@ -14,11 +15,14 @@ export default function GlobalState(props) { const [searchInput, setSearchInput] = useState("") /* Controla input da barra de pesquisa */ const [filter, setFilter] = useState("") /* Controla o filtro do menu do feed */ const [popUp, setPopUp] = useState(false) + // const token = localStorage.getItem('token') + const tokenTeste = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IkN1QVc2SjQ1bjhpYW9ESVJXT202IiwibmFtZSI6IkFzdHJvZGV2IiwiZW1haWwiOiJhc3Ryb2RldkBmdXR1cmU0LmNvbSIsImNwZiI6IjExMS4xMTEuMTExLTExIiwiaGFzQWRkcmVzcyI6dHJ1ZSwiYWRkcmVzcyI6IlJ1YSBkb3MgY2FuYWxoYSwgMTIzNCwgMTIzIC0gT2xpbmRhIiwiaWF0IjoxNjExNjg0MTg0fQ.nRWQ2d5GRx8qGHzMNrAUaWY-_fzbgSxDBhve5hTLnLg" + const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {headers: {"auth": `${tokenTeste}`, "Content-Type": "application/json"}}, {}) const states = {carrinho, perfil, restaurante, listaRestaurantes, token, searchInput, filter, popUp} const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken, setSearchInput, setFilter, setPopUp} - const requests = {} + const requests = {listaDeRestaurantes} return ( diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index 8120d6b..92c08e6 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -10,7 +10,7 @@ import GlobalStateContext from "../../Global/GlobalStateContext"; export default function HomePage() { - const {states, setters} = useContext(GlobalStateContext) + const {states, setters, requests} = useContext(GlobalStateContext) const history = useHistory(); const teste = [ @@ -116,7 +116,12 @@ export default function HomePage() { } ] - const filteredArray = teste.filter(e => { + + if (!requests.listaDeRestaurantes.restaurants) { + return
Loading...
+ } + + const filteredArray = requests.listaDeRestaurantes.restaurants.filter(e => { return e.category === states.filter }) From 043f418ba1f8003a0b9c9861efd3a7ff9d2b4201 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Tue, 26 Jan 2021 15:31:42 -0300 Subject: [PATCH 43/69] =?UTF-8?q?cria=C3=A7=C3=A3o=20da=20fun=C3=A7=C3=A3o?= =?UTF-8?q?=20onClick=20levando=20para=20a=20p=C3=A1gina=20do=20restaurant?= =?UTF-8?q?e,=20path=20params=20criado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CardRestaurante/CardRestaurante.js | 8 +- src/Pages/HomePage/index.js | 113 +----------------- src/Routes/Routes.js | 2 +- 3 files changed, 14 insertions(+), 109 deletions(-) diff --git a/src/Components/CardRestaurante/CardRestaurante.js b/src/Components/CardRestaurante/CardRestaurante.js index 5d4cb30..b4072d4 100644 --- a/src/Components/CardRestaurante/CardRestaurante.js +++ b/src/Components/CardRestaurante/CardRestaurante.js @@ -1,13 +1,19 @@ import React from 'react' import CardMedia from '@material-ui/core/CardMedia'; import useStyles from './styles.js' +import { useHistory } from "react-router-dom"; export default function CardRestaurante(props) { const classes = useStyles(); + const history = useHistory(); + + const onClickCardRestaurante = (name) => { + history.push(`/restaurants/${name}`) + } return ( -
+
onClickCardRestaurante(props.nome)} className={classes.cardContainer}>
Loading...
} @@ -125,17 +21,20 @@ export default function HomePage() { return e.category === states.filter }) + const onClickCardRestaurante = (name) => { + history.push(`/restaurants/${name}`) + } return (
- {states.filter === "" ? teste.map(e => { - return + {states.filter === "" ? requests.listaDeRestaurantes.restaurants.map(e => { + return onClickCardRestaurante(e.name)} key={e.id} img={e.logoUrl} nome={e.name} tempoDeEntrega={e.deliveryTime} frete={e.shipping}/> }) : filteredArray.map(e => { - return + return onClickCardRestaurante(e.name)} key={e.id} img={e.logoUrl} nome={e.name} tempoDeEntrega={e.deliveryTime} frete={e.shipping}/> }) } {/* ternário verificando se há pedido para renderizar */} {/* */} diff --git a/src/Routes/Routes.js b/src/Routes/Routes.js index 0113d2e..e0a262c 100644 --- a/src/Routes/Routes.js +++ b/src/Routes/Routes.js @@ -45,7 +45,7 @@ export default function Routes() { - + From 1a739e228f92bbcc5ac7f425075305609bba9503 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Tue, 26 Jan 2021 15:33:10 -0300 Subject: [PATCH 44/69] =?UTF-8?q?removendo=20c=C3=B3digo=20n=C3=A3o=20util?= =?UTF-8?q?izado=20na=20Home?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Pages/HomePage/index.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index 15a2f51..ebd6082 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -21,9 +21,6 @@ export default function HomePage() { return e.category === states.filter }) - const onClickCardRestaurante = (name) => { - history.push(`/restaurants/${name}`) - } return (
@@ -31,10 +28,10 @@ export default function HomePage() { {states.filter === "" ? requests.listaDeRestaurantes.restaurants.map(e => { - return onClickCardRestaurante(e.name)} key={e.id} img={e.logoUrl} nome={e.name} tempoDeEntrega={e.deliveryTime} frete={e.shipping}/> + return }) : filteredArray.map(e => { - return onClickCardRestaurante(e.name)} key={e.id} img={e.logoUrl} nome={e.name} tempoDeEntrega={e.deliveryTime} frete={e.shipping}/> + return }) } {/* ternário verificando se há pedido para renderizar */} {/* */} From 95cabf79442ebbbeea18f24c80b4fd347a6ee141 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Tue, 26 Jan 2021 16:01:40 -0300 Subject: [PATCH 45/69] =?UTF-8?q?adicionando=20lista=20de=20restaurantes?= =?UTF-8?q?=20=C3=A0=20p=C3=A1gina=20de=20busca?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Pages/SearchPage/index.js | 110 ++-------------------------------- 1 file changed, 6 insertions(+), 104 deletions(-) diff --git a/src/Pages/SearchPage/index.js b/src/Pages/SearchPage/index.js index 02acd0d..49b5333 100644 --- a/src/Pages/SearchPage/index.js +++ b/src/Pages/SearchPage/index.js @@ -7,112 +7,14 @@ import CardRestaurante from "../../Components/CardRestaurante/CardRestaurante" export default function SearchPage() { - const {states, setters} = useContext(GlobalStateContext) + const {states, setters, requests} = useContext(GlobalStateContext) const classes = useStyles() - const teste = [ - { - "id": "1", - "description": "Habib's é uma rede de restaurantes de comida rápida brasileira especializada em culinária árabe, os restaurantes vendem mais de 600 milhões de esfirras por ano. A empresa emprega 22 mil colaboradores e tem 421 unidades distribuídas em mais de cem municípios em 20 unidades federativas.", - "shipping": 6, - "address": "Rua das Margaridas, 110 - Jardim das Flores", - "name": "Habibs", - "logoUrl": "http://soter.ninja/futureFoods/logos/habibs.jpg", - "deliveryTime": 60, - "category": "Árabe" - }, - { - "id": "10", - "address": "Travessa Reginaldo Pereira, 130 - Ibitinga", - "name": "Tadashii", - "logoUrl": "http://soter.ninja/futureFoods/logos/tadashii.png", - "deliveryTime": 50, - "category": "Asiática", - "description": "Restaurante sofisticado busca o equilíbrio entre ingredientes que realçam a experiência da culinária japonesa.", - "shipping": 13 - }, - { - "id": "2", - "description": "McDonald's Corporation é a maior cadeia mundial de restaurantes de fast food de hambúrguer, servindo cerca de 68 milhões de clientes por dia em 119 países através de 37 mil pontos de venda.", - "shipping": 19, - "address": "Avenida dos Papagaios, 1350 - Sta. Efigênia", - "name": "McDonalds", - "logoUrl": "http://soter.ninja/futureFoods/logos/mcdonalds.png", - "deliveryTime": 15, - "category": "Hamburguer" - }, - { - "id": "3", - "deliveryTime": 20, - "category": "Italiana", - "description": "Restaurante Self Service e lanchonete localizado no Laboratório Nacional de Computação Científica", - "shipping": 2, - "address": "Rua Barão do Rio Branco, 98 - Centro", - "name": "Cantina Mamma Perrotta", - "logoUrl": "http://soter.ninja/futureFoods/logos/cantinamammaperrotta.jpg" - }, - { - "id": "4", - "name": "Sorveteria Bacio di Latte", - "logoUrl": "http://soter.ninja/futureFoods/logos/baciodilatte.png", - "deliveryTime": 45, - "category": "Sorvetes", - "description": "Gelatos de raízes italianas feitos artesanalmente e com ingredientes de altíssima qualidade. Confira todos os nossos deliciosos sabores!", - "shipping": 10, - "address": "Travessa Junqueira de Melo, 315 - Marginal" - }, - { - "id": "5", - "deliveryTime": 20, - "category": "Carnes", - "description": "Inaugurado em 1988 nos Estados Unidos e chegou ao Brasil 9 anos depois. Hoje, o restaurante marca presença em 20 cidades em todo o país, com um estilo casual que vai fazer você se sentir no Outback Australiano", - "shipping": 18, - "address": "Alameda dos Marsupiais, 505 - Humaitá", - "name": "Outback Steakhouse", - "logoUrl": "http://soter.ninja/futureFoods/logos/outback.png" - }, - { - "id": "6", - "description": "Culinária baiana, como caldinho de sururu e acarajé, empório nordestino e bar com 400 rótulos de cachaça.", - "shipping": 4, - "address": "Rua Dorival Caymmi, 149 - Alto dos Ibirás", - "name": "Sotero Cozinha Original", - "logoUrl": "http://soter.ninja/futureFoods/logos/sotero.jpg", - "deliveryTime": 40, - "category": "Baiana" - }, - { - "id": "7", - "name": "Boteco de Portal", - "logoUrl": "http://soter.ninja/futureFoods/logos/botecodeportal.jpg", - "deliveryTime": 20, - "category": "Petiscos", - "description": "O bar tem um cardápio recheado de petiscos que acompanham o chope para o bate-papo num ambiente agradável.Amigos e amigas, temos o prazer de convidar vocês para conhecer nosso espaço!", - "shipping": 18, - "address": "Avenida das Andorinhas, 333 - Sta. Efigênia" - }, - { - "id": "8", - "name": "Chun-Li", - "logoUrl": "http://soter.ninja/futureFoods/logos/chun-li.jpg", - "deliveryTime": 30, - "category": "Asiática", - "description": "Restaurante chinês com pratos típicos em diversos tamanhos, bebidas, ambiente moderno e opções para levar.", - "shipping": 17, - "address": "Rua Visconde de Mauá, 990 - Centro" - }, - { - "id": "9", - "name": "Mexicaníssimo", - "logoUrl": "http://soter.ninja/futureFoods/logos/mexicanissimo.png", - "deliveryTime": 20, - "category": "Mexicana", - "description": "Falar em Mexicaníssimo é falar em comer uma comida tradicional e original mexicana! Diferentemente dos restaurantes tex-mex, aqui você encontra um menu completo tradicionalmente mexicano e com opções para vegetarianos e veganos.", - "shipping": 3, - "address": "Largo dos Jaguarés, 12 - Nova Bragança" - } - ] + + if (!requests.listaDeRestaurantes.restaurants) { + return
Loading...
+ } - const filteredArray = teste.filter(e => { + const filteredArray = requests.listaDeRestaurantes.restaurants.filter(e => { return e.name.toLowerCase().includes(states.searchInput.toLowerCase()) || e.category.toLowerCase().includes(states.searchInput.toLowerCase()) }) From 0596c11a39ab316325b66a7f9202d4bc712875d8 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Tue, 26 Jan 2021 16:20:44 -0300 Subject: [PATCH 46/69] =?UTF-8?q?colocando=20o=20token=20da=20aplica=C3=A7?= =?UTF-8?q?=C3=A3o=20no=20Request=20dos=20restaurantes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CustomHooks/useRequestData.js | 2 +- src/Global/GlobalState.js | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/CustomHooks/useRequestData.js b/src/CustomHooks/useRequestData.js index 49917c0..95ce320 100644 --- a/src/CustomHooks/useRequestData.js +++ b/src/CustomHooks/useRequestData.js @@ -11,7 +11,7 @@ export default function useRequestData(url,header, initialState) { }).catch((error) => { console.log(error.message) }) - }, [url]) + }, [url,header]) return data } diff --git a/src/Global/GlobalState.js b/src/Global/GlobalState.js index ec0f5a9..9a195e4 100644 --- a/src/Global/GlobalState.js +++ b/src/Global/GlobalState.js @@ -15,11 +15,12 @@ export default function GlobalState(props) { const [searchInput, setSearchInput] = useState("") /* Controla input da barra de pesquisa */ const [filter, setFilter] = useState("") /* Controla o filtro do menu do feed */ const [popUp, setPopUp] = useState(false) - // const token = localStorage.getItem('token') - const tokenTeste = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IkN1QVc2SjQ1bjhpYW9ESVJXT202IiwibmFtZSI6IkFzdHJvZGV2IiwiZW1haWwiOiJhc3Ryb2RldkBmdXR1cmU0LmNvbSIsImNwZiI6IjExMS4xMTEuMTExLTExIiwiaGFzQWRkcmVzcyI6dHJ1ZSwiYWRkcmVzcyI6IlJ1YSBkb3MgY2FuYWxoYSwgMTIzNCwgMTIzIC0gT2xpbmRhIiwiaWF0IjoxNjExNjg0MTg0fQ.nRWQ2d5GRx8qGHzMNrAUaWY-_fzbgSxDBhve5hTLnLg" - - const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {headers: {"auth": `${tokenTeste}`, "Content-Type": "application/json"}}, {}) + + useEffect(() => { + setToken(localStorage.getItem("token")) + }, []) + const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {headers: {"auth": `${token}`, "Content-Type": "application/json"}}, {}) const states = {carrinho, perfil, restaurante, listaRestaurantes, token, searchInput, filter, popUp} const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken, setSearchInput, setFilter, setPopUp} const requests = {listaDeRestaurantes} From 25c83ab229323821009b9ba6da91d73682a818ed Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Tue, 26 Jan 2021 16:23:59 -0300 Subject: [PATCH 47/69] =?UTF-8?q?adicionando=20margin=20no=20final=20da=20?= =?UTF-8?q?home=20para=20dar=20espa=C3=A7o=20para=20o=20footer=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Pages/HomePage/index.js | 5 +++-- src/Pages/HomePage/styles.js | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index ebd6082..d18cb48 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -7,6 +7,7 @@ import FeedMenu from "../../Components/FeedMenu/FeedMenu" import FooterMenu from "../../Components/FooterMenu/index" import PedidoEmAndamento from "../../Components/PedidoEmAndamento/index" import GlobalStateContext from "../../Global/GlobalStateContext"; +import HomeDiv from "./styles" export default function HomePage() { @@ -23,7 +24,7 @@ export default function HomePage() { return ( -
+
@@ -36,6 +37,6 @@ export default function HomePage() { {/* ternário verificando se há pedido para renderizar */} {/* */} -
+ ); } diff --git a/src/Pages/HomePage/styles.js b/src/Pages/HomePage/styles.js index e69de29..3c4da61 100644 --- a/src/Pages/HomePage/styles.js +++ b/src/Pages/HomePage/styles.js @@ -0,0 +1,9 @@ +import styled from 'styled-components' + +const HomeDiv = styled.div` + margin: 0 0 56px 0; + +` + +export default HomeDiv; + From 27b290394322ea26f9c66006c0626faec911c488 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Tue, 26 Jan 2021 16:32:51 -0300 Subject: [PATCH 48/69] trocando pathParams de Nome para ID do restaurante --- src/Components/CardRestaurante/CardRestaurante.js | 6 +++--- src/Pages/HomePage/index.js | 4 ++-- src/Pages/SearchPage/index.js | 2 +- src/Routes/Routes.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Components/CardRestaurante/CardRestaurante.js b/src/Components/CardRestaurante/CardRestaurante.js index b4072d4..da7f692 100644 --- a/src/Components/CardRestaurante/CardRestaurante.js +++ b/src/Components/CardRestaurante/CardRestaurante.js @@ -8,12 +8,12 @@ export default function CardRestaurante(props) { const classes = useStyles(); const history = useHistory(); - const onClickCardRestaurante = (name) => { - history.push(`/restaurants/${name}`) + const onClickCardRestaurante = (id) => { + history.push(`/restaurants/${id}`) } return ( -
onClickCardRestaurante(props.nome)} className={classes.cardContainer}> +
onClickCardRestaurante(props.id)} className={classes.cardContainer}>
{states.filter === "" ? requests.listaDeRestaurantes.restaurants.map(e => { - return + return }) : filteredArray.map(e => { - return + return }) } {/* ternário verificando se há pedido para renderizar */} {/* */} diff --git a/src/Pages/SearchPage/index.js b/src/Pages/SearchPage/index.js index 49b5333..4ce6bcc 100644 --- a/src/Pages/SearchPage/index.js +++ b/src/Pages/SearchPage/index.js @@ -19,7 +19,7 @@ export default function SearchPage() { }) const arrayMap = filteredArray.map(e => { - return + return }) diff --git a/src/Routes/Routes.js b/src/Routes/Routes.js index e0a262c..0dde7e8 100644 --- a/src/Routes/Routes.js +++ b/src/Routes/Routes.js @@ -45,7 +45,7 @@ export default function Routes() { - + From ad556c9bf4f9584223ca21fc1637629189d9661f Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Tue, 26 Jan 2021 16:41:25 -0300 Subject: [PATCH 49/69] minor changes --- src/Pages/RestaurantPage/index.js | 25 +++++++++---------------- src/Routes/Routes.js | 2 +- src/Routes/coordinators.js | 4 ++-- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/Pages/RestaurantPage/index.js b/src/Pages/RestaurantPage/index.js index b60acce..ec2df12 100644 --- a/src/Pages/RestaurantPage/index.js +++ b/src/Pages/RestaurantPage/index.js @@ -1,13 +1,18 @@ -import React from 'react' -import { useHistory } from "react-router-dom"; -import { goBack, goToCartPage, goToHomePage, goToProfilePage, goToRestaurantsPage } from '../../Routes/coordinators'; +import React,{ useContext } from 'react' +import { useHistory, useParams } from "react-router-dom"; import Header from "../../Components/Header"; import ItemCard from "../../Components/ItemCard/ItemCard"; - import { RestaurantInfo, MealsContainer, TypeTitle } from './styles'; +import GlobalStateContext from "../../Global/GlobalStateContext"; + export default function RestaurantPage() { + const {states, setters} = useContext(GlobalStateContext) + const history = useHistory(); + const params = useParams() + + return (
@@ -30,18 +35,6 @@ export default function RestaurantPage() { {/* map para renderizar pratos da categoria */} - -{/* - - - */} -
) } diff --git a/src/Routes/Routes.js b/src/Routes/Routes.js index 0113d2e..ec1dd20 100644 --- a/src/Routes/Routes.js +++ b/src/Routes/Routes.js @@ -45,7 +45,7 @@ export default function Routes() {
- + diff --git a/src/Routes/coordinators.js b/src/Routes/coordinators.js index 913e378..5acff3d 100644 --- a/src/Routes/coordinators.js +++ b/src/Routes/coordinators.js @@ -22,8 +22,8 @@ export const goToProfilePage = (history) => { history.push('/profile') } -export const goToRestaurantsPage = (history) => { - history.push('/restaurants') +export const goToRestaurantsPage = (history, id) => { + history.push(`/restaurants/${id}`) } export const goToSignUpPage = (history) => { From 64b94edb23bc181632418f610f02e71ab91fafbe Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Tue, 26 Jan 2021 20:28:00 -0300 Subject: [PATCH 50/69] =?UTF-8?q?adicionada=20requisi=C3=A7=C3=A3o,=20cate?= =?UTF-8?q?goria=20dos=20pratos=20e=20info=20do=20restaurante=20na=20respe?= =?UTF-8?q?ctiva=20pagina?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Global/GlobalState.js | 2 +- src/Pages/RestaurantPage/index.js | 60 ++++++++++++++++++++++++------- src/Routes/Routes.js | 2 +- 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/src/Global/GlobalState.js b/src/Global/GlobalState.js index 9a195e4..93b6e39 100644 --- a/src/Global/GlobalState.js +++ b/src/Global/GlobalState.js @@ -20,7 +20,7 @@ export default function GlobalState(props) { setToken(localStorage.getItem("token")) }, []) - const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {headers: {"auth": `${token}`, "Content-Type": "application/json"}}, {}) + const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {headers: {"auth": localStorage.getItem('token'), "Content-Type": "application/json"}}, {}) const states = {carrinho, perfil, restaurante, listaRestaurantes, token, searchInput, filter, popUp} const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken, setSearchInput, setFilter, setPopUp} const requests = {listaDeRestaurantes} diff --git a/src/Pages/RestaurantPage/index.js b/src/Pages/RestaurantPage/index.js index ec2df12..67dc176 100644 --- a/src/Pages/RestaurantPage/index.js +++ b/src/Pages/RestaurantPage/index.js @@ -1,40 +1,74 @@ -import React,{ useContext } from 'react' +import React,{ useContext, useEffect, useState } from 'react' import { useHistory, useParams } from "react-router-dom"; import Header from "../../Components/Header"; import ItemCard from "../../Components/ItemCard/ItemCard"; import { RestaurantInfo, MealsContainer, TypeTitle } from './styles'; import GlobalStateContext from "../../Global/GlobalStateContext"; +import useRequestData from '../../CustomHooks/useRequestData'; +import { BASE_URL } from '../../Constants/urls'; +import axios from 'axios'; export default function RestaurantPage() { const {states, setters} = useContext(GlobalStateContext) + const [categorias, setCategorias] = useState([]) const history = useHistory(); const params = useParams() + const data = useRequestData(`${BASE_URL}/restaurants/${params.id}`,{headers: {"auth": localStorage.getItem('token')}},{}) + + useEffect(() => { + setters.setRestaurante(data.restaurant) + if (states.restaurante && states.restaurante.products) { + let arrayMap = states.restaurante.products.map((item) => { + return item.category + }) + const uniqueSet = new Set(arrayMap) + arrayMap = [...uniqueSet] + setCategorias(arrayMap) + } - return ( -
-
+ }, [data, states.restaurante]) + + console.log(states.restaurante) + console.log(categorias) + const renderRestaurantInfo = () => { + const frete = Number(states.restaurante.shipping).toFixed(2) + return ( - -

Nome do Restaurante

-

Tipo de cozinha

+ {`${states.restaurante.name} +

{states.restaurante.name}

+

{states.restaurante.category}

- tempo de entrega - valor do frete + {`${states.restaurante.deliveryTime} min`} + {`Frete R$${frete}`}
-

endereço

+

{states.restaurante.address}

- - {/* map para renderizar categorias */} + ) + } + + const renderCategory = categorias.map(item => { + return ( - categoria do prato + {item} {/* map para renderizar pratos da categoria */} + ) + }) + + return ( +
+
+ + {states.restaurante ? renderRestaurantInfo() :

Carregando...

} + + {states.restaurante && states.restaurante.products ? renderCategory : null } +
) } diff --git a/src/Routes/Routes.js b/src/Routes/Routes.js index 0dde7e8..ec1dd20 100644 --- a/src/Routes/Routes.js +++ b/src/Routes/Routes.js @@ -45,7 +45,7 @@ export default function Routes() { - + From 7b4a4f5088aa1880d3488c90ea9ded3941f48988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Wed, 27 Jan 2021 09:50:20 -0300 Subject: [PATCH 51/69] =?UTF-8?q?valida=C3=A7=C3=A3o=20de=20dados=20da=20p?= =?UTF-8?q?agina=20signup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Pages/SignUpPage/SignUpForm.js | 42 ++++++++++++------------------ src/Pages/SignUpPage/index.js | 10 ------- src/Pages/SignUpPage/styles.js | 10 +++++-- 3 files changed, 24 insertions(+), 38 deletions(-) diff --git a/src/Pages/SignUpPage/SignUpForm.js b/src/Pages/SignUpPage/SignUpForm.js index 8f761b0..8462e18 100644 --- a/src/Pages/SignUpPage/SignUpForm.js +++ b/src/Pages/SignUpPage/SignUpForm.js @@ -1,21 +1,21 @@ import React from 'react'; -import axios from 'axios'; import Buttons from '../../Components/Buttons' -import { Container, CampoText, InputArea, Title, ContainerSignUp, Image } from './styles'; +import { Container, CampoText, InputArea, Title, ContainerSignUp, Image, AlertPassword } from './styles'; import Logo from '../../assets/logo-future-eats-invert.png'; import { IconButton, InputAdornment, InputLabel } from '@material-ui/core'; import Visibility from '@material-ui/icons/Visibility'; import VisibilityOff from '@material-ui/icons/VisibilityOff'; import useForm from '../../CustomHooks/useForm'; import { useHistory } from "react-router-dom"; -import { goToAddAddressPage } from '../../Routes/coordinators'; import { signUp } from '../../Service/user'; export default function SignUpForm(props) { + const [showSenha, setShowSenha] = React.useState(false) + const [showAlert, setShowAlert] = React.useState (false) const history = useHistory(); - const [form, handleInput, resetState] = useForm({ + const [form, handleInput ] = useForm({ name: '', email: '', cpf: '', @@ -23,37 +23,26 @@ export default function SignUpForm(props) { passwordConfirm: '', }) - - const [showSenha, setShowSenha] = React.useState(false); - - const handleClickShowPassword = () => { setShowSenha(!showSenha); - }; + } const handleMouseDownPassword = (event) => { event.preventDefault(); - }; + } const submitForm = (e) => { e.preventDefault() - + if(form.password !== form.passwordConfirm){ + setShowAlert(!showAlert) + } const body = { name: form.name, email: form.email, cpf: form.cpf, password: form.password } - console.log(body);//-------------------------------------------------// signUp(body, history) - - // axios.post('https://us-central1-missao-newton.cloudfunctions.net/fourFoodA/signup', body) - // .then((response) =>{ - // console.log(response.data.token);// token da criação do novo usuario - // }) - // .catch((error) => { - // console.log(error); - // }) } return ( @@ -73,7 +62,6 @@ export default function SignUpForm(props) { name="name" label="Nome" placeholder="Nome e sobrenome" - // defaultValue="Nome" variant="outlined" type="text" /> @@ -87,7 +75,6 @@ export default function SignUpForm(props) { name="email" id="outlined-disabled" label="E-mail" - // defaultValue="Email" placeholder="email@email.com" variant="outlined" type="email" @@ -113,14 +100,14 @@ export default function SignUpForm(props) { required value={form.password || undefined} onChange={handleInput} - // inputProps={{ pattern: "(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$" }} + inputProps={{ pattern: "(.){6,}" }} name="password" id="outlined-disabled" label="Senha" placeholder="Mínimo de 6 caracteres" variant="outlined" type={showSenha ? "text" : "password"} - InputProps={{ + InputProps={{ endAdornment: ( - + + {showAlert && Deve ser a mesma que a anterior} diff --git a/src/Pages/SignUpPage/index.js b/src/Pages/SignUpPage/index.js index d0b6213..3112366 100644 --- a/src/Pages/SignUpPage/index.js +++ b/src/Pages/SignUpPage/index.js @@ -7,7 +7,6 @@ import SignUpForm from './SignUpForm'; export default function SignUpPage() { - const history = useHistory(); return (
@@ -17,15 +16,6 @@ export default function SignUpPage() { texto={"Cadastrar"} /> - -{/* - cadastro de usuário - - */}
) } \ No newline at end of file diff --git a/src/Pages/SignUpPage/styles.js b/src/Pages/SignUpPage/styles.js index 5bfc8ad..0d1386c 100644 --- a/src/Pages/SignUpPage/styles.js +++ b/src/Pages/SignUpPage/styles.js @@ -15,7 +15,7 @@ export const ContainerInputPassword = styled(FormControl)` export const Image = styled.div` text-align: center; - margin:2.5rem 0 1.75rem 0; + margin: 1.5rem 0 1.75rem 0; ` export const Title = styled.h3` font-family: Roboto; @@ -36,10 +36,16 @@ export const Container = styled.div` ` export const CampoText = styled.div` - margin: 1rem; + margin:0.5rem 0; ` export const InputArea = styled(TextField)` width: 20.5rem; height: 3.5rem; ` +export const AlertPassword = styled.p` + color:#e02020; + font-size: 0.75rem; + letter-spacing: -0.29px; + margin:0 0 0.75rem 1rem; +` \ No newline at end of file From ac3838d8dde2a02061bb1fbafdbee50167f156cd Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Wed, 27 Jan 2021 11:52:21 -0300 Subject: [PATCH 52/69] Resolvendo loop infinito --- src/Components/FormLogin/index.js | 1 - src/CustomHooks/useRequestData.js | 6 +++--- src/Global/GlobalState.js | 13 ++++--------- src/Pages/HomePage/index.js | 14 ++++++++++---- src/Pages/RestaurantPage/index.js | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Components/FormLogin/index.js b/src/Components/FormLogin/index.js index 94b1b0c..8a1c1d4 100644 --- a/src/Components/FormLogin/index.js +++ b/src/Components/FormLogin/index.js @@ -75,7 +75,6 @@ const FormLogin = () => { const response = await api.post("/login", form); window.localStorage.setItem("token", response.data.token); - setters.setToken(response.data.token); setters.setPerfil(response.data.user); goToHomePage(history); diff --git a/src/CustomHooks/useRequestData.js b/src/CustomHooks/useRequestData.js index 95ce320..66ab141 100644 --- a/src/CustomHooks/useRequestData.js +++ b/src/CustomHooks/useRequestData.js @@ -2,16 +2,16 @@ import React from 'react' import {useEffect, useState} from "react" import axios from 'axios' -export default function useRequestData(url,header, initialState) { +export default function useRequestData(url, initialState) { const [data, setData] = useState(initialState) - + const header = {headers: {"auth": localStorage.getItem('token')}} useEffect(()=> { axios.get(url,header).then((response) => { setData(response.data) }).catch((error) => { console.log(error.message) }) - }, [url,header]) + }, [url]) return data } diff --git a/src/Global/GlobalState.js b/src/Global/GlobalState.js index 93b6e39..a9dee29 100644 --- a/src/Global/GlobalState.js +++ b/src/Global/GlobalState.js @@ -11,19 +11,14 @@ export default function GlobalState(props) { const [perfil, setPerfil] = useState({}) const [restaurante, setRestaurante] = useState({}) const [listaRestaurantes, setListaRestaurantes] = useState([]) - const [token, setToken] = useState("") + // const [token, setToken] = useState("") const [searchInput, setSearchInput] = useState("") /* Controla input da barra de pesquisa */ const [filter, setFilter] = useState("") /* Controla o filtro do menu do feed */ const [popUp, setPopUp] = useState(false) - useEffect(() => { - setToken(localStorage.getItem("token")) - }, []) - - const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {headers: {"auth": localStorage.getItem('token'), "Content-Type": "application/json"}}, {}) - const states = {carrinho, perfil, restaurante, listaRestaurantes, token, searchInput, filter, popUp} - const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setToken, setSearchInput, setFilter, setPopUp} - const requests = {listaDeRestaurantes} + const states = {carrinho, perfil, restaurante, listaRestaurantes, searchInput, filter, popUp} + const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setSearchInput, setFilter, setPopUp} + const requests = {} return ( diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index e681888..398b9c8 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -1,4 +1,4 @@ -import React,{ useContext} from "react"; +import React,{ useContext, useEffect} from "react"; import { useHistory } from "react-router-dom"; import Header from "../../Components/Header/index.js" import SearchBar from "../../Components/SearchBar/SearchBar" @@ -8,17 +8,23 @@ import FooterMenu from "../../Components/FooterMenu/index" import PedidoEmAndamento from "../../Components/PedidoEmAndamento/index" import GlobalStateContext from "../../Global/GlobalStateContext"; import HomeDiv from "./styles" +import useRequestData from '../../CustomHooks/useRequestData'; +import { BASE_URL } from '../../Constants/urls'; export default function HomePage() { + const {states, setters, requests} = useContext(GlobalStateContext) const history = useHistory(); - if (!requests.listaDeRestaurantes.restaurants) { + +const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {}) + + if (!listaDeRestaurantes.restaurants) { return
Loading...
} - const filteredArray = requests.listaDeRestaurantes.restaurants.filter(e => { + const filteredArray = listaDeRestaurantes.restaurants.filter(e => { return e.category === states.filter }) @@ -28,7 +34,7 @@ export default function HomePage() {
- {states.filter === "" ? requests.listaDeRestaurantes.restaurants.map(e => { + {states.filter === "" ? listaDeRestaurantes.restaurants.map(e => { return }) : filteredArray.map(e => { diff --git a/src/Pages/RestaurantPage/index.js b/src/Pages/RestaurantPage/index.js index 67dc176..297fb1c 100644 --- a/src/Pages/RestaurantPage/index.js +++ b/src/Pages/RestaurantPage/index.js @@ -16,7 +16,7 @@ export default function RestaurantPage() { const history = useHistory(); const params = useParams() - const data = useRequestData(`${BASE_URL}/restaurants/${params.id}`,{headers: {"auth": localStorage.getItem('token')}},{}) + const data = useRequestData(`${BASE_URL}/restaurants/${params.id}`,{}) useEffect(() => { setters.setRestaurante(data.restaurant) From 70a16a377590dce24731cc6b211b0bbccf388ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Wed, 27 Jan 2021 12:21:15 -0300 Subject: [PATCH 53/69] =?UTF-8?q?valida=C3=A7=C3=B5es=20de=20signUp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/FormAdress/index.js | 12 +++++------ src/Components/FormAdress/styles.js | 1 - src/Pages/AddAddressPage/index.js | 11 ---------- src/Pages/EditProfilePage/EditProfileForm.js | 6 ++---- src/Pages/SignUpPage/SignUpForm.js | 21 ++++++++++---------- src/Pages/SignUpPage/index.js | 9 ++++++--- src/Pages/SignUpPage/styles.js | 9 +++------ src/Service/user.js | 5 ++++- 8 files changed, 31 insertions(+), 43 deletions(-) diff --git a/src/Components/FormAdress/index.js b/src/Components/FormAdress/index.js index b750dfe..f66c304 100644 --- a/src/Components/FormAdress/index.js +++ b/src/Components/FormAdress/index.js @@ -22,7 +22,6 @@ export default function FormAdress(props) { const submitForm = (e) => { e.preventDefault() resetState() //resetando os inputs// - console.log(form) //----------------------------------------------// addAddress(form, history) } @@ -40,11 +39,11 @@ export default function FormAdress(props) { name="street" label="Rua/Av." placeholder="Rua/Av." - // defaultValue="Rua/Av." variant="outlined" type="text" /> + + + + +
- - - -
) } \ No newline at end of file diff --git a/src/Pages/EditProfilePage/EditProfileForm.js b/src/Pages/EditProfilePage/EditProfileForm.js index 9c6008e..dca6cd6 100644 --- a/src/Pages/EditProfilePage/EditProfileForm.js +++ b/src/Pages/EditProfilePage/EditProfileForm.js @@ -34,7 +34,6 @@ export default function EditProfileForm() { name="name" label="Nome" placeholder="Nome e sobrenome" - // defaultValue="Nome" variant="outlined" type="text" /> @@ -48,7 +47,6 @@ export default function EditProfileForm() { name="email" id="outlined-disabled" label="E-mail" - // defaultValue="Email" placeholder="email@email.com" variant="outlined" type="email" @@ -62,10 +60,10 @@ export default function EditProfileForm() { onChange={handleInput} name="cpf" label="CPF" - // defaultValue="Apt / Bloco" + inputProps={{ pattern: "[0-9]{3}\.?[0-9]{3}\.?[0-9]{3}\-?[0-9]{2}" }} placeholder="000.000.000-00" variant="outlined" - type="number" + // type="number" /> diff --git a/src/Pages/SignUpPage/SignUpForm.js b/src/Pages/SignUpPage/SignUpForm.js index 8462e18..2b3ca21 100644 --- a/src/Pages/SignUpPage/SignUpForm.js +++ b/src/Pages/SignUpPage/SignUpForm.js @@ -8,13 +8,16 @@ import VisibilityOff from '@material-ui/icons/VisibilityOff'; import useForm from '../../CustomHooks/useForm'; import { useHistory } from "react-router-dom"; import { signUp } from '../../Service/user'; - +import CircularProgress from '@material-ui/core/CircularProgress'; export default function SignUpForm(props) { - const [showSenha, setShowSenha] = React.useState(false) - const [showAlert, setShowAlert] = React.useState (false) + const [ showSenha, setShowSenha ] = React.useState(false) + const [ showAlert, setShowAlert ] = React.useState (false) + const [ loading, setLoading ] = React.useState(false) + const history = useHistory(); + const [form, handleInput ] = useForm({ name: '', email: '', @@ -42,7 +45,7 @@ export default function SignUpForm(props) { cpf: form.cpf, password: form.password } - signUp(body, history) + signUp(body, history, setLoading)// funçao está em service/user } return ( @@ -88,10 +91,10 @@ export default function SignUpForm(props) { onChange={ handleInput } name="cpf" label="CPF" - // defaultValue="Apt / Bloco" + inputProps={{ pattern: "[0-9]{3}\.?[0-9]{3}\.?[0-9]{3}\-?[0-9]{2}" }} placeholder="000.000.000-00" variant="outlined" - type="number" + // type="number" /> @@ -149,14 +152,12 @@ export default function SignUpForm(props) { ), }} /> - - + {showAlert && Deve ser a mesma que a anterior} : 'criar' } /> diff --git a/src/Pages/SignUpPage/index.js b/src/Pages/SignUpPage/index.js index 3112366..94c9a9f 100644 --- a/src/Pages/SignUpPage/index.js +++ b/src/Pages/SignUpPage/index.js @@ -4,18 +4,21 @@ import FooterMenu from '../../Components/FooterMenu'; import Header from '../../Components/Header'; import { goBack, goToAddAddressPage } from '../../Routes/coordinators'; import SignUpForm from './SignUpForm'; +import styled from 'styled-components' - +export const Container = styled.div` + margin: 1rem; +` export default function SignUpPage() { return ( -
+
-
+ ) } \ No newline at end of file diff --git a/src/Pages/SignUpPage/styles.js b/src/Pages/SignUpPage/styles.js index 0d1386c..ad64750 100644 --- a/src/Pages/SignUpPage/styles.js +++ b/src/Pages/SignUpPage/styles.js @@ -1,18 +1,14 @@ import styled from 'styled-components'; import TextField from "@material-ui/core/TextField"; -import FormControl from "@material-ui/core/FormControl"; export const ContainerSignUp = styled.div` display: flex; flex-direction: column; - align-items: center; + align-items: center; + max-width: 100vw; ` -export const ContainerInputPassword = styled(FormControl)` - /* width:20.5rem; */ - ` - export const Image = styled.div` text-align: center; margin: 1.5rem 0 1.75rem 0; @@ -43,6 +39,7 @@ export const InputArea = styled(TextField)` width: 20.5rem; height: 3.5rem; ` + export const AlertPassword = styled.p` color:#e02020; font-size: 0.75rem; diff --git a/src/Service/user.js b/src/Service/user.js index 72e180d..1a2de79 100644 --- a/src/Service/user.js +++ b/src/Service/user.js @@ -2,14 +2,17 @@ import axios from 'axios'; import {BASE_URL} from '../Constants/urls' import { goToAddAddressPage, goToHomePage } from '../Routes/coordinators'; -export const signUp = (body, history) => { +export const signUp = (body, history, setLoading) => { + setLoading(true) axios.post(`${BASE_URL}/signup`, body) .then((response) => { localStorage.setItem('token', response.data.token)// token da criação do novo usuario + setLoading(false) goToAddAddressPage(history) }) .catch((error) => { console.log(error); + // setLoading(false) }) } From dba0cc219fd0c2250782f89993f5a40ebb7c7436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Wed, 27 Jan 2021 16:31:17 -0300 Subject: [PATCH 54/69] resolvendo CSS dos forms --- src/Components/FormAdress/index.js | 12 ++++++----- src/Components/FormAdress/styles.js | 16 +++++---------- src/Pages/EditAdressPage/index.js | 14 +------------ src/Pages/EditProfilePage/EditProfileForm.js | 14 ++++++------- src/Pages/EditProfilePage/styles.js | 21 ++++++-------------- src/Pages/SignUpPage/SignUpForm.js | 4 ++-- src/Pages/SignUpPage/styles.js | 14 ++++--------- src/Service/editUser.js | 19 ++++++++++++++++++ src/Service/user.js | 12 +++++++---- 9 files changed, 59 insertions(+), 67 deletions(-) create mode 100644 src/Service/editUser.js diff --git a/src/Components/FormAdress/index.js b/src/Components/FormAdress/index.js index f66c304..df4ee7a 100644 --- a/src/Components/FormAdress/index.js +++ b/src/Components/FormAdress/index.js @@ -4,12 +4,12 @@ import { Container, CampoText, InputArea, ContainerFormAddress } from './styles' import { Title } from './styles'; import useForm from '../../CustomHooks/useForm' import { useHistory } from "react-router-dom"; -import { goToHomePage } from '../../Routes/coordinators'; import { addAddress } from "../../Service/user"; +import { CircularProgress } from "@material-ui/core"; -export default function FormAdress(props) { - const history = useHistory(); +export default function FormAdress(props) { + const [loading, setLoading] = React.useState(false) const [form, handleInput, resetState] = useForm({ street:'', number:'', @@ -18,11 +18,12 @@ export default function FormAdress(props) { state:'', complement:'' }) + const history = useHistory(); const submitForm = (e) => { e.preventDefault() resetState() //resetando os inputs// - addAddress(form, history) + addAddress(form, history, setLoading)//função está em service/user } return ( @@ -111,7 +112,8 @@ export default function FormAdress(props) { : 'Salvar' } submeter = {submitForm} /> diff --git a/src/Components/FormAdress/styles.js b/src/Components/FormAdress/styles.js index 22e85ae..266d28c 100644 --- a/src/Components/FormAdress/styles.js +++ b/src/Components/FormAdress/styles.js @@ -1,12 +1,9 @@ import styled from 'styled-components'; import TextField from "@material-ui/core/TextField"; -// import Button from "@material-ui/core/Button"; export const ContainerFormAddress = styled.div` - display: flex; - flex-direction: column; - align-items: center; + margin: 1rem; ` export const Title = styled.h1` @@ -21,17 +18,14 @@ export const Title = styled.h1` ` export const Container = styled.div` - display: flex; - flex-direction: column; - align-items: center; - width: 20.5rem; + ` export const CampoText = styled.div` - margin: 1rem; + margin: 1rem 0; ` export const InputArea = styled(TextField)` - width: 20.5rem; - height: 3.5rem; + width: 100%; + height:3.5rem; ` diff --git a/src/Pages/EditAdressPage/index.js b/src/Pages/EditAdressPage/index.js index 737c472..7e61837 100644 --- a/src/Pages/EditAdressPage/index.js +++ b/src/Pages/EditAdressPage/index.js @@ -1,26 +1,14 @@ import React from 'react' -import { useHistory } from "react-router-dom"; -import { goBack, goToHomePage } from '../../Routes/coordinators'; import FormAdress from '../../Components/FormAdress' import Header from '../../Components/Header' -import Buttons from '../../Components/Buttons'; export default function EditAdressPage() { - const history = useHistory(); - - + return (
- - -
) } \ No newline at end of file diff --git a/src/Pages/EditProfilePage/EditProfileForm.js b/src/Pages/EditProfilePage/EditProfileForm.js index dca6cd6..a14e815 100644 --- a/src/Pages/EditProfilePage/EditProfileForm.js +++ b/src/Pages/EditProfilePage/EditProfileForm.js @@ -3,22 +3,22 @@ import Buttons from '../../Components/Buttons' import { Container, CampoText, InputArea, ContainerEditProfile } from './styles'; import useForm from '../../CustomHooks/useForm' import { useHistory } from "react-router-dom"; -import { goToProfilePage } from '../../Routes/coordinators'; +import { editProfile } from '../../Service/editUser'; +import { CircularProgress } from '@material-ui/core'; export default function EditProfileForm() { - - const history = useHistory(); + const [loading, setLoading] = React.useState(false) const [form, handleInput, resetState] = useForm({ name: '', email: '', cpf: '', }) - + const history = useHistory(); const submitForm = (e) => { e.preventDefault() resetState() //resetando os inputs// - console.log(form) //----------------------------------------------// + editProfile(form, history, setLoading)//funçao está em service/user } return ( @@ -68,8 +68,8 @@ export default function EditProfileForm() { goToProfilePage(history)}// trocar pela funçao de requisiçao na api. assim os inputs não estão controlados + // texto={"Salvar"} + texto={ loading ? : 'Salvar' } /> diff --git a/src/Pages/EditProfilePage/styles.js b/src/Pages/EditProfilePage/styles.js index ef66cd1..9c58b2b 100644 --- a/src/Pages/EditProfilePage/styles.js +++ b/src/Pages/EditProfilePage/styles.js @@ -1,19 +1,13 @@ import styled from 'styled-components'; import TextField from "@material-ui/core/TextField"; -import FormControl from "@material-ui/core/FormControl"; +// import FormControl from "@material-ui/core/FormControl"; export const ContainerEditProfile = styled.div` - display: flex; - flex-direction: column; - align-items: center; - margin-top: 1rem; + + margin:1rem; ` -export const ContainerInputPassword = styled(FormControl)` - /* width:20.5rem; */ - ` - export const Image = styled.div` text-align: center; margin:2.5rem 0 1.75rem 0; @@ -30,17 +24,14 @@ export const Title = styled.h1` ` export const Container = styled.div` - display: flex; - width: 20.5rem; - flex-direction: column; - align-items: center; + ` export const CampoText = styled.div` - margin: 1rem; + margin: 1rem 0; ` export const InputArea = styled(TextField)` - width: 20.5rem; height: 3.5rem; + width: 100%; ` \ No newline at end of file diff --git a/src/Pages/SignUpPage/SignUpForm.js b/src/Pages/SignUpPage/SignUpForm.js index 2b3ca21..a72a2c7 100644 --- a/src/Pages/SignUpPage/SignUpForm.js +++ b/src/Pages/SignUpPage/SignUpForm.js @@ -156,8 +156,8 @@ export default function SignUpForm(props) { {showAlert && Deve ser a mesma que a anterior} : 'criar' } + // texto={"Criar"} + texto={ loading ? : 'Criar' } /> diff --git a/src/Pages/SignUpPage/styles.js b/src/Pages/SignUpPage/styles.js index ad64750..df2b2ba 100644 --- a/src/Pages/SignUpPage/styles.js +++ b/src/Pages/SignUpPage/styles.js @@ -3,10 +3,7 @@ import TextField from "@material-ui/core/TextField"; export const ContainerSignUp = styled.div` - display: flex; - flex-direction: column; - align-items: center; - max-width: 100vw; + margin: 1rem; ` export const Image = styled.div` @@ -25,18 +22,15 @@ export const Title = styled.h3` ` export const Container = styled.div` - display: flex; - width: 20.5rem; - flex-direction: column; - align-items: center; + ` export const CampoText = styled.div` - margin:0.5rem 0; + margin: 1rem 0; ` export const InputArea = styled(TextField)` - width: 20.5rem; + width:100%; height: 3.5rem; ` diff --git a/src/Service/editUser.js b/src/Service/editUser.js new file mode 100644 index 0000000..4be7ed0 --- /dev/null +++ b/src/Service/editUser.js @@ -0,0 +1,19 @@ +import axios from 'axios' +import {BASE_URL} from '../Constants/urls' +import { goToProfilePage } from '../Routes/coordinators' + +export const editProfile = (body, history) => { + const headers ={ + headers:{ + auth:localStorage.getItem('token') + } + } + axios.put(`${BASE_URL}/profile`, body, headers) + .then((response)=>{ + goToProfilePage(history) + console.log(response); + }) + .catch((error) => { + alert(error) + }) +} \ No newline at end of file diff --git a/src/Service/user.js b/src/Service/user.js index 1a2de79..4096118 100644 --- a/src/Service/user.js +++ b/src/Service/user.js @@ -1,6 +1,6 @@ -import axios from 'axios'; +import axios from 'axios' import {BASE_URL} from '../Constants/urls' -import { goToAddAddressPage, goToHomePage } from '../Routes/coordinators'; +import { goToAddAddressPage, goToHomePage } from '../Routes/coordinators' export const signUp = (body, history, setLoading) => { setLoading(true) @@ -12,24 +12,28 @@ export const signUp = (body, history, setLoading) => { }) .catch((error) => { console.log(error); - // setLoading(false) + // alert(error) + setLoading(false) }) } -export const addAddress = (body, history) => { +export const addAddress = (body, history, setLoading) => { const headers ={ headers:{ auth:localStorage.getItem('token') } } + setLoading(true) axios.put(`${BASE_URL}/address`, body, headers) .then((response) => { console.log(response.data.token); localStorage.setItem('token', response.data.token)// token da criação do endereço + setLoading(false) goToHomePage(history) }) .catch((error) => { console.log(error); + setLoading(false) }) } \ No newline at end of file From 796cc3e36d786f6a0a7d087735cc67be1e3c4d83 Mon Sep 17 00:00:00 2001 From: Davi Garcia de Souza Date: Wed, 27 Jan 2021 23:01:29 -0300 Subject: [PATCH 55/69] =?UTF-8?q?criando=20l=C3=B3gica=20de=20adicionar=20?= =?UTF-8?q?ao=20carrinho?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/ItemCard/ItemCard.js | 28 +++++++--- src/Components/ItemCard/styles.js | 3 +- src/Components/PopUpQuantidade/index.js | 28 +++++++--- src/Global/GlobalState.js | 13 ++++- src/Pages/CartPage/index.js | 74 +++++++++++++------------ src/Pages/RestaurantPage/index.js | 55 ++++++++++++++---- 6 files changed, 132 insertions(+), 69 deletions(-) diff --git a/src/Components/ItemCard/ItemCard.js b/src/Components/ItemCard/ItemCard.js index 3c7c051..90bf4d8 100644 --- a/src/Components/ItemCard/ItemCard.js +++ b/src/Components/ItemCard/ItemCard.js @@ -12,24 +12,34 @@ import { export default function ItemCard(props) { const {states, setters} = useContext(GlobalStateContext) - const addQuantidade = () => { + const addCarrinho = () => { + console.log(props.idPedido) + setters.setIdPedido(props.idPedido) setters.setPopUp(true) + console.log(states.idPedido) } - + + const renderQuantidade = states.carrinho.pedido ? states.carrinho.pedido.filter(item => { + if (item.id === props.idPedido) { + return item.quantidade + }}) : 0 + console.log(renderQuantidade) + /* todas tags devem ser preenchidas por props quando for adicionar a lógica */ return ( - + -

Nome do Prato

- +

{props.name}

+ {renderQuantidade[0] ? : null}
-

Ingredientes do prato

+

{props.ingredientes}

- R$46,00 - {/* adicionar ternario para alterar botões quanto necessário */} - remover + R${props.valor} + {renderQuantidade[0] ? + remover + : addCarrinho()}>adicionar }
diff --git a/src/Components/ItemCard/styles.js b/src/Components/ItemCard/styles.js index 5ce3e75..5f29342 100644 --- a/src/Components/ItemCard/styles.js +++ b/src/Components/ItemCard/styles.js @@ -13,7 +13,8 @@ img { margin-right: 1rem; margin-bottom:-1px; margin-left:-1px; - border-radius: 8px 0 0 8px + border-radius: 8px 0 0 8px; + object-fit: cover; } ` diff --git a/src/Components/PopUpQuantidade/index.js b/src/Components/PopUpQuantidade/index.js index 8d8d853..aa10f48 100644 --- a/src/Components/PopUpQuantidade/index.js +++ b/src/Components/PopUpQuantidade/index.js @@ -21,19 +21,31 @@ export default function PopUpQuantidade() { }) - // const handleSelect = (event) => { - // setQuantidade(event.target.value) - // } + const handleSelect = (event) => { + setters.setQuantidade(event.target.value) + } + + const addQuantidade = () => { + setters.setPopUp(false) + const pedido = !states.carrinho.pedido ? states.restaurante.products.map(item => { + if (item.id === states.idPedido) { + return {...item, "quantidade": states.quantidade } + } + return item + }) : states.carrinho.pedido.map(item => { + if (item.id === states.idPedido) { + return {...item, "quantidade": states.quantidade } + } + return item + }) + setters.setCarrinho({"restaurante": states.restaurante, "pedido": pedido}) + } - const addQuantidade = () => { - setters.setPopUp(false) - } - return (

Selecione a quantidade desejada

- handleSelect(event)}> {renderOptions} diff --git a/src/Global/GlobalState.js b/src/Global/GlobalState.js index a9dee29..937a7ac 100644 --- a/src/Global/GlobalState.js +++ b/src/Global/GlobalState.js @@ -7,7 +7,7 @@ import {BASE_URL} from '../Constants/urls.js' export default function GlobalState(props) { - const [carrinho, setCarrinho] = useState([]) + const [carrinho, setCarrinho] = useState({}) const [perfil, setPerfil] = useState({}) const [restaurante, setRestaurante] = useState({}) const [listaRestaurantes, setListaRestaurantes] = useState([]) @@ -15,9 +15,12 @@ export default function GlobalState(props) { const [searchInput, setSearchInput] = useState("") /* Controla input da barra de pesquisa */ const [filter, setFilter] = useState("") /* Controla o filtro do menu do feed */ const [popUp, setPopUp] = useState(false) + const [quantidade, setQuantidade] = useState(0) + const [idPedido, setIdPedido] = useState("") + - const states = {carrinho, perfil, restaurante, listaRestaurantes, searchInput, filter, popUp} - const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setSearchInput, setFilter, setPopUp} + const states = {carrinho, perfil, restaurante, listaRestaurantes, searchInput, filter, popUp, quantidade, idPedido} + const setters = {setCarrinho, setPerfil, setRestaurante, setListaRestaurantes, setSearchInput, setFilter, setPopUp, setQuantidade, setIdPedido} const requests = {} return ( @@ -26,3 +29,7 @@ export default function GlobalState(props) { ) } + + + + diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index b85d6af..e0f17dd 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -24,18 +24,18 @@ import ItemCard from '../../Components/ItemCard/ItemCard'; export default function CartPage() { const history = useHistory(); const {states, setters} = useContext(GlobalStateContext) - - const frete = 5.99 /* logica para puxar o frete*/ + const subtotal = 60.99 /* logica para puxar o subtotal*/ - - + + const [value, setValue] = useState('dinheiro'); const handleChange = (event) => { setValue(event.target.value); } - + console.log(states.carrinho) + return ( {states.popUp ? : null} @@ -46,42 +46,44 @@ export default function CartPage() {

Rua Alessandra, 42

{/* lógica para puxar endereço */} - {/* lógica para renderizar restaurante */} - -

Nome restaurante

-

Endereço restaurante

-

tempo entrega

-
+ {states.carrinho.restaurante === undefined ? + Carrinho vazio + : +
+ +

Nome restaurante

+

Endereço restaurante

+

tempo entrega

+
- - - {/* ternario para renderizar itens ou mensagem vazio */} - - {/* Carrinho vazio */} + + - {/* map nos itens do carrinho para renderizar os cards */} - + {/* map nos itens do carrinho para renderizar os cards */} + - - SUBTOTAL -
- Frete R${frete} {/* logica para puxar o frete*/ } - R$ {subtotal} {/* logica para puxar o subtotal*/ } -
-
+ + SUBTOTAL +
+ Frete R${Number(states.carrinho.restaurante.shipping).toFixed(2)} + R$ {subtotal} +
+
- -
-

Forma de Pagamento

- - } label="Dinheiro" /> - } label="Cartão de crédito" /> - -
- -
+ +
+

Forma de Pagamento

+ + } label="Dinheiro" /> + } label="Cartão de crédito" /> + +
+ +
-
+
+
+ }
diff --git a/src/Pages/RestaurantPage/index.js b/src/Pages/RestaurantPage/index.js index 297fb1c..1c12ab3 100644 --- a/src/Pages/RestaurantPage/index.js +++ b/src/Pages/RestaurantPage/index.js @@ -6,8 +6,8 @@ import { RestaurantInfo, MealsContainer, TypeTitle } from './styles'; import GlobalStateContext from "../../Global/GlobalStateContext"; import useRequestData from '../../CustomHooks/useRequestData'; import { BASE_URL } from '../../Constants/urls'; -import axios from 'axios'; - +import PopUpQuantidade from '../../Components/PopUpQuantidade'; +import axios from 'axios' export default function RestaurantPage() { const {states, setters} = useContext(GlobalStateContext) @@ -16,11 +16,28 @@ export default function RestaurantPage() { const history = useHistory(); const params = useParams() - const data = useRequestData(`${BASE_URL}/restaurants/${params.id}`,{}) + // const data = useRequestData(`${BASE_URL}/restaurants/${params.id}`,{}) useEffect(() => { - setters.setRestaurante(data.restaurant) + axios.get(`${BASE_URL}/restaurants/${params.id}`,{headers: {"auth": localStorage.getItem('token')}}) + .then((response) => { + setters.setRestaurante(response.data.restaurant) + }).catch((error) => { + console.log(error.message) + }) + + // if (states.restaurante && states.restaurante.products) { + // let arrayMap = states.restaurante.products.map((item) => { + // return item.category + // }) + // const uniqueSet = new Set(arrayMap) + // arrayMap = [...uniqueSet] + // setCategorias(arrayMap) + // } + }, [ params.id]) + + useEffect(() => { if (states.restaurante && states.restaurante.products) { let arrayMap = states.restaurante.products.map((item) => { return item.category @@ -29,11 +46,8 @@ export default function RestaurantPage() { arrayMap = [...uniqueSet] setCategorias(arrayMap) } - - }, [data, states.restaurante]) - - console.log(states.restaurante) - console.log(categorias) + }, [states.restaurante]) + // states.restaurante, params.id const renderRestaurantInfo = () => { const frete = Number(states.restaurante.shipping).toFixed(2) @@ -51,18 +65,35 @@ export default function RestaurantPage() { ) } + // console.log(states.restaurante) + const renderCategory = categorias.map(item => { + const categoria = item return ( - {item} - {/* map para renderizar pratos da categoria */} - + {categoria} + {(states.restaurante.products).map(item => { + if (item.category === categoria) { + return ( + + ) + } + })} ) }) return (
+ {states.popUp ? : null} +
{states.restaurante ? renderRestaurantInfo() :

Carregando...

} From 54336366b61255bd9bcb9aeb8d22ca33aaa3438c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Thu, 28 Jan 2021 15:20:09 -0300 Subject: [PATCH 56/69] pagina de erro --- src/Pages/ErrorPage/index.js | 26 +++++++++++++++----------- src/Pages/ErrorPage/styles.js | 29 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 src/Pages/ErrorPage/styles.js diff --git a/src/Pages/ErrorPage/index.js b/src/Pages/ErrorPage/index.js index d2a3bb5..e3300f8 100644 --- a/src/Pages/ErrorPage/index.js +++ b/src/Pages/ErrorPage/index.js @@ -1,20 +1,24 @@ import React from 'react' -import { useHistory } from "react-router-dom"; -import { goBack, goToHomePage } from '../../Routes/coordinators'; - +import Header from '../../Components/Header' +import FooterMenu from '../../Components/FooterMenu'; +import Image from '../../assets/logo-future-eats-invert.svg' +import { Container, ContainerImage } from './styles' +import SentimentVeryDissatisfiedIcon from '@material-ui/icons/SentimentVeryDissatisfied'; export default function ErrorPage() { - const history = useHistory(); return (
- ERRO 404 - - +
+ + + + +

Algo deu errado

+ +

Confira se você digitou o endereço correto. Pode ser que o endereço não esteja mais disponível.

+
+
) } diff --git a/src/Pages/ErrorPage/styles.js b/src/Pages/ErrorPage/styles.js new file mode 100644 index 0000000..2aa295f --- /dev/null +++ b/src/Pages/ErrorPage/styles.js @@ -0,0 +1,29 @@ +import styled from 'styled-components' + +export const Container = styled.section` +display: flex; +flex-direction: column; +justify-content: center; +align-items: center; +margin: 1rem; +h2{ + font-family: Roboto; + letter-spacing: -0.29px; + font-weight: normal; +} +p{ + letter-spacing: -0.29px; + font-family: Roboto; + text-align: center; + font-size: 1rem; + font-weight: normal; + font-stretch: normal; + font-style: normal; + line-height: normal; +} +` + +export const ContainerImage = styled.div` +margin: 2rem 0 2rem 0; +` + From 5d9451b2277ce0ec622d7de2292e4d74faf32cda Mon Sep 17 00:00:00 2001 From: Adrielly Felix Date: Fri, 29 Jan 2021 00:55:24 -0300 Subject: [PATCH 57/69] Corrigindo responsividade --- src/Components/FormLogin/index.js | 136 +++++++++++++++++------------ src/Components/FormLogin/styles.js | 12 +-- 2 files changed, 82 insertions(+), 66 deletions(-) diff --git a/src/Components/FormLogin/index.js b/src/Components/FormLogin/index.js index 8a1c1d4..6286e9e 100644 --- a/src/Components/FormLogin/index.js +++ b/src/Components/FormLogin/index.js @@ -1,19 +1,13 @@ import React, { useState, useRef, useContext } from "react"; import * as Yup from "yup"; import { makeStyles } from "@material-ui/core/styles"; -import { Grid, InputAdornment, IconButton } from "@material-ui/core"; +import { Grid, InputAdornment, IconButton, Link } from "@material-ui/core"; import { Visibility, VisibilityOff } from "@material-ui/icons"; import { Form } from "@unform/web"; import api from "../../Service/api"; import { goToHomePage, goToSignUpPage } from "../../Routes/coordinators"; import { useHistory } from "react-router-dom"; -import { - Container, - CampoText, - InputArea, - ContainerButton, - CampoButton, -} from "./styles"; +import { CampoText, InputArea, ContainerButton, CampoButton } from "./styles"; import { Title } from "./styles"; import useForm from "../../CustomHooks/useForm"; import Logo from "../../assets/logo-future-eats-invert.svg"; @@ -29,6 +23,20 @@ const useStyles = makeStyles({ justifyContent: "center", alignItems: "center", flexDirection: "column", + margin: "1rem", + padding: "1rem", + }, + btCadastro: { + display: "flex", + justifyContent: "center", + textTransform: "initial", + fontSize: "1rem", + }, + form: { + width: "100%", + display: "flex", + flexDirection: "column", + justifyContent: "center", }, }); const FormLogin = () => { @@ -115,62 +123,78 @@ const FormLogin = () => { justify="center" alignItems="center" > - +
logo
Entrar -
- - - - - - - - {showSenha ? : } - - - ), - }} - /> - - + + + + + + + + {showSenha ? : } + + + ), + }} + /> + - + Entrar + { + goToSignUpPage(history); + }} + > + Não possui cadastro? Clique aqui. +
diff --git a/src/Components/FormLogin/styles.js b/src/Components/FormLogin/styles.js index 6e67e40..090fc60 100644 --- a/src/Components/FormLogin/styles.js +++ b/src/Components/FormLogin/styles.js @@ -12,19 +12,11 @@ export const Title = styled.h1` letter-spacing: -0.39px; `; -export const Container = styled.div` - width: 100vw; - display: flex; - flex-direction: column; - align-items: center; -`; - export const CampoText = styled.div` - margin: 1rem; + margin: 1rem 0; `; export const InputArea = styled(TextField)` - width: 20.5rem; height: 3.5rem; `; @@ -41,5 +33,5 @@ export const ContainerButton = styled(Button)` export const CampoButton = styled.div` text-align: center; - margin: 1rem; + margin: 1rem 0; `; From aa3a483bd16d3c72fda752b13919024f8a3e8c73 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Fri, 29 Jan 2021 20:56:59 -0300 Subject: [PATCH 58/69] =?UTF-8?q?Arrumando=20fun=C3=A7=C3=A3o=20de=20adici?= =?UTF-8?q?onar=20ao=20carrinho,=20Adicionando=20fun=C3=A7=C3=A3o=20de=20R?= =?UTF-8?q?emover,=20ajustando=20renderiza=C3=A7=C3=A3o=20da=20p=C3=A1gina?= =?UTF-8?q?=20do=20carrinho?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 6 ++-- src/Components/ItemCard/ItemCard.js | 17 +++++++--- src/Components/PopUpQuantidade/index.js | 32 ++++++++++++------- src/Pages/CartPage/index.js | 42 ++++++++++++++++++------- src/Pages/CartPage/styles.js | 1 - 5 files changed, 67 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index c57d610..372b2cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3514,9 +3514,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001081", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001081.tgz", - "integrity": "sha512-iZdh3lu09jsUtLE6Bp8NAbJskco4Y3UDtkR3GTCJGsbMowBU5IWDFF79sV2ws7lSqTzWyKazxam2thasHymENQ==" + "version": "1.0.30001181", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001181.tgz", + "integrity": "sha512-m5ul/ARCX50JB8BSNM+oiPmQrR5UmngaQ3QThTTp5HcIIQGP/nPBs82BYLE+tigzm3VW+F4BJIhUyaVtEweelQ==" }, "capture-exit": { "version": "2.0.0", diff --git a/src/Components/ItemCard/ItemCard.js b/src/Components/ItemCard/ItemCard.js index 90bf4d8..2d2256d 100644 --- a/src/Components/ItemCard/ItemCard.js +++ b/src/Components/ItemCard/ItemCard.js @@ -13,17 +13,26 @@ export default function ItemCard(props) { const {states, setters} = useContext(GlobalStateContext) const addCarrinho = () => { - console.log(props.idPedido) setters.setIdPedido(props.idPedido) setters.setPopUp(true) - console.log(states.idPedido) + } + + const removerCarrinho = () => { + const novoPedido = states.carrinho.pedido.filter(item => { + return item.id !== props.idPedido + }) + if(!novoPedido[0]) { + setters.setCarrinho({}) + return null + } + setters.setCarrinho({"restaurante": states.restaurante, "pedido": novoPedido}) } const renderQuantidade = states.carrinho.pedido ? states.carrinho.pedido.filter(item => { if (item.id === props.idPedido) { return item.quantidade }}) : 0 - console.log(renderQuantidade) + /* todas tags devem ser preenchidas por props quando for adicionar a lógica */ return ( @@ -38,7 +47,7 @@ export default function ItemCard(props) { R${props.valor} {renderQuantidade[0] ? - remover + removerCarrinho()}>remover : addCarrinho()}>adicionar } diff --git a/src/Components/PopUpQuantidade/index.js b/src/Components/PopUpQuantidade/index.js index aa10f48..3eab8f1 100644 --- a/src/Components/PopUpQuantidade/index.js +++ b/src/Components/PopUpQuantidade/index.js @@ -27,18 +27,28 @@ export default function PopUpQuantidade() { const addQuantidade = () => { setters.setPopUp(false) - const pedido = !states.carrinho.pedido ? states.restaurante.products.map(item => { - if (item.id === states.idPedido) { - return {...item, "quantidade": states.quantidade } - } - return item - }) : states.carrinho.pedido.map(item => { - if (item.id === states.idPedido) { - return {...item, "quantidade": states.quantidade } - } - return item + + + if (states.quantidade <= 0 || states.restaurante === {} && states.restaurante !== states.carrinho.restaurante) { + return null + } + + const pedido = states.restaurante.products.filter(item => { + + if ( item.id === states.idPedido) { + item.quantidade = states.quantidade + return item + } + }) - setters.setCarrinho({"restaurante": states.restaurante, "pedido": pedido}) + + if (!states.carrinho.pedido) { + setters.setCarrinho({"restaurante": states.restaurante, "pedido": pedido}) + } else { + + setters.setCarrinho({"restaurante": states.restaurante, "pedido": [...pedido,...states.carrinho.pedido]}) + } + } return ( diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index e0f17dd..c931cce 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -25,7 +25,7 @@ export default function CartPage() { const history = useHistory(); const {states, setters} = useContext(GlobalStateContext) - const subtotal = 60.99 /* logica para puxar o subtotal*/ + const [value, setValue] = useState('dinheiro'); @@ -34,8 +34,16 @@ export default function CartPage() { setValue(event.target.value); } - console.log(states.carrinho) + const pedidosFiltrados = states.carrinho.pedido ? states.carrinho.pedido.filter(item => {return item.quantidade }) : null + + const frete = states.carrinho.restaurante ? Number(states.carrinho.restaurante.shipping) : 0 + + const subtotal = pedidosFiltrados? frete + pedidosFiltrados.reduce((resultado, item) => { + return (item.quantidade * item.price) + resultado; + }, 0): 0 + + return ( {states.popUp ? : null} @@ -51,22 +59,33 @@ export default function CartPage() { :
-

Nome restaurante

-

Endereço restaurante

-

tempo entrega

+ {console.log(states.carrinho)} +

{states.carrinho.restaurante.name}

+

{states.carrinho.restaurante.address}

+

{states.carrinho.restaurante.deliveryTime} min

- - {/* map nos itens do carrinho para renderizar os cards */} - + {pedidosFiltrados.map(item => { + return + })} +
+ } + SUBTOTAL
- Frete R${Number(states.carrinho.restaurante.shipping).toFixed(2)} - R$ {subtotal} + Frete R${frete.toFixed(2)} + R$ {subtotal.toFixed(2)}
@@ -82,8 +101,7 @@ export default function CartPage() {
-
- } + diff --git a/src/Pages/CartPage/styles.js b/src/Pages/CartPage/styles.js index 2485dc7..8227613 100644 --- a/src/Pages/CartPage/styles.js +++ b/src/Pages/CartPage/styles.js @@ -5,7 +5,6 @@ export const CartPageContainer = styled.div ` display: flex; flex-direction: column; justify-content: space-between; - min-height: 100vh; ` export const ScrollSection = styled.div ` From 79653da17f1cbb91d640ba78b0ce490ccdce5d33 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Fri, 29 Jan 2021 21:07:55 -0300 Subject: [PATCH 59/69] =?UTF-8?q?removendo=20c=C3=B3digo=20n=C3=A3o=20util?= =?UTF-8?q?izado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Pages/CartPage/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index c931cce..9e5d614 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -34,11 +34,11 @@ export default function CartPage() { setValue(event.target.value); } - const pedidosFiltrados = states.carrinho.pedido ? states.carrinho.pedido.filter(item => {return item.quantidade }) : null + const pedidos = states.carrinho.pedido ? states.carrinho.pedido : null const frete = states.carrinho.restaurante ? Number(states.carrinho.restaurante.shipping) : 0 - const subtotal = pedidosFiltrados? frete + pedidosFiltrados.reduce((resultado, item) => { + const subtotal = pedidos? frete + pedidos.reduce((resultado, item) => { return (item.quantidade * item.price) + resultado; }, 0): 0 @@ -67,7 +67,7 @@ export default function CartPage() { - {pedidosFiltrados.map(item => { + {pedidos.map(item => { return Date: Sat, 30 Jan 2021 09:18:44 -0300 Subject: [PATCH 60/69] =?UTF-8?q?endere=C3=A7o=20do=20usuario=20no=20carri?= =?UTF-8?q?nho=20e=20pedido=20em=20andamento?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Pages/CartPage/index.js | 21 +++++++++++++++++++-- src/Pages/EditProfilePage/index.js | 1 - src/Pages/HomePage/index.js | 28 ++++++++++++++++++++++++++-- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index 9e5d614..e987092 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -20,6 +20,8 @@ import Radio from '@material-ui/core/Radio'; import RadioGroup from '@material-ui/core/RadioGroup'; import FooterMenu from '../../Components/FooterMenu'; import ItemCard from '../../Components/ItemCard/ItemCard'; +import useRequestData from '../../CustomHooks/useRequestData'; +import { BASE_URL } from '../../Constants/urls'; export default function CartPage() { const history = useHistory(); @@ -27,7 +29,6 @@ export default function CartPage() { - const [value, setValue] = useState('dinheiro'); const handleChange = (event) => { @@ -42,6 +43,22 @@ export default function CartPage() { return (item.quantidade * item.price) + resultado; }, 0): 0 + const endereco = useRequestData(`${BASE_URL}/profile/address`, {})//pegando endereco na API + + // console.log(pedidos); + + // const body = { + // "products": [{ + // "id": "CnKdjU6CyKakQDGHzNln", + // "quantity": 10 + // }, { + // "quantity": 1, + // "id": "KJqMl2DxeShkSBevKVre" + // }], + // "paymentMethod": "creditcard" + // } + + return ( @@ -51,7 +68,7 @@ export default function CartPage() {

Endereço de entrega

-

Rua Alessandra, 42

{/* lógica para puxar endereço */} +

{endereco.address?endereco.address.street:null}, {endereco.address?endereco.address.number:null}

{states.carrinho.restaurante === undefined ? diff --git a/src/Pages/EditProfilePage/index.js b/src/Pages/EditProfilePage/index.js index cc70c0c..137c8ee 100644 --- a/src/Pages/EditProfilePage/index.js +++ b/src/Pages/EditProfilePage/index.js @@ -11,7 +11,6 @@ export default function EditProfilePage() { /> -
) } diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index 398b9c8..d8a9df3 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -1,4 +1,4 @@ -import React,{ useContext, useEffect} from "react"; +import React,{ useContext, useEffect, useState} from "react"; import { useHistory } from "react-router-dom"; import Header from "../../Components/Header/index.js" import SearchBar from "../../Components/SearchBar/SearchBar" @@ -10,11 +10,13 @@ import GlobalStateContext from "../../Global/GlobalStateContext"; import HomeDiv from "./styles" import useRequestData from '../../CustomHooks/useRequestData'; import { BASE_URL } from '../../Constants/urls'; +import axios from "axios"; export default function HomePage() { const {states, setters, requests} = useContext(GlobalStateContext) + const [emAndamento, setEmAndamento] =useState({}) const history = useHistory(); @@ -27,7 +29,28 @@ const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {}) const filteredArray = listaDeRestaurantes.restaurants.filter(e => { return e.category === states.filter }) + + //verificando se existe pedido em andamento na API + const pedidoAndamento =() =>{ + const headers ={ + headers:{ + auth:localStorage.getItem('token') + } + } + axios.get(`${BASE_URL}/active-order`, headers) + .then((response) =>{ + console.log(response.data.order);//---------------------------------- + setEmAndamento(response.data.order) + + }) + .catch((error) =>{ + console.log(error); + }) + } + pedidoAndamento() + //verificando se existe pedido em andamento na API + return ( @@ -40,8 +63,9 @@ const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {}) : filteredArray.map(e => { return }) } + {/* ternário verificando se há pedido para renderizar */} - {/* */} + {emAndamento !== null && } ); From fbe717efae9c61ae1f24c8add944452d635743e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Sat, 30 Jan 2021 13:33:38 -0300 Subject: [PATCH 61/69] submeter pedido status 200 --- src/Pages/CartPage/index.js | 47 ++++++++++++++++++++++------------ src/Pages/HomePage/index.js | 43 +++++++++++++++++-------------- src/Pages/SignUpPage/styles.js | 1 + src/Service/user.js | 20 +++++++++++++++ 4 files changed, 76 insertions(+), 35 deletions(-) diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index e987092..347bd4e 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -22,13 +22,14 @@ import FooterMenu from '../../Components/FooterMenu'; import ItemCard from '../../Components/ItemCard/ItemCard'; import useRequestData from '../../CustomHooks/useRequestData'; import { BASE_URL } from '../../Constants/urls'; +import { order } from '../../Service/user' export default function CartPage() { const history = useHistory(); const {states, setters} = useContext(GlobalStateContext) - + const [loading, setLoading] = React.useState(false) const [value, setValue] = useState('dinheiro'); const handleChange = (event) => { @@ -45,20 +46,32 @@ export default function CartPage() { const endereco = useRequestData(`${BASE_URL}/profile/address`, {})//pegando endereco na API - // console.log(pedidos); - - // const body = { - // "products": [{ - // "id": "CnKdjU6CyKakQDGHzNln", - // "quantity": 10 - // }, { - // "quantity": 1, - // "id": "KJqMl2DxeShkSBevKVre" - // }], - // "paymentMethod": "creditcard" - // } - + console.log(pedidos); + + let body = {} + if (pedidos) { + body = { + "products": pedidos.map((item) => { + return { "id": item.id, "quantity": item.quantidade } + } + ), + "paymentMethod": "creditcard" + } + } + console.log(body); + + + let idRestaurante = "" + if(states.carrinho.restaurante !== undefined){ + idRestaurante = states.carrinho.restaurante.id + console.log(idRestaurante); + } + + const submitOrder = (e) => { + e.preventDefault() + order(body, history, setLoading, idRestaurante)//função está no service/user + } return ( @@ -76,7 +89,7 @@ export default function CartPage() { :
- {console.log(states.carrinho)} + {/* {console.log(states.carrinho)} */}

{states.carrinho.restaurante.name}

{states.carrinho.restaurante.address}

{states.carrinho.restaurante.deliveryTime} min

@@ -114,7 +127,9 @@ export default function CartPage() { } label="Cartão de crédito" />
- + diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index d8a9df3..1c24c5e 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -30,26 +30,31 @@ const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {}) return e.category === states.filter }) +// useEffect (() =>{ +// pedidoAndamento() +// }, []) + + - //verificando se existe pedido em andamento na API - const pedidoAndamento =() =>{ - const headers ={ - headers:{ - auth:localStorage.getItem('token') - } - } - axios.get(`${BASE_URL}/active-order`, headers) - .then((response) =>{ - console.log(response.data.order);//---------------------------------- - setEmAndamento(response.data.order) +// //verificando se existe pedido em andamento na API +// const pedidoAndamento =() =>{ +// const headers ={ +// headers:{ +// auth:localStorage.getItem('token') +// } +// } +// axios.get(`${BASE_URL}/active-order`, headers) +// .then((response) =>{ +// console.log(response.data.order);//---------------------------------- +// setEmAndamento(response.data.order) - }) - .catch((error) =>{ - console.log(error); - }) - } - pedidoAndamento() - //verificando se existe pedido em andamento na API +// }) +// .catch((error) =>{ +// console.log(error); +// }) +// } +// pedidoAndamento() +// //verificando se existe pedido em andamento na API return ( @@ -65,7 +70,7 @@ const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {}) }) } {/* ternário verificando se há pedido para renderizar */} - {emAndamento !== null && } + {/* {emAndamento !== null && } */} ); diff --git a/src/Pages/SignUpPage/styles.js b/src/Pages/SignUpPage/styles.js index df2b2ba..e9723fa 100644 --- a/src/Pages/SignUpPage/styles.js +++ b/src/Pages/SignUpPage/styles.js @@ -10,6 +10,7 @@ export const Image = styled.div` text-align: center; margin: 1.5rem 0 1.75rem 0; ` + export const Title = styled.h3` font-family: Roboto; text-align: center; diff --git a/src/Service/user.js b/src/Service/user.js index 4096118..7c369f1 100644 --- a/src/Service/user.js +++ b/src/Service/user.js @@ -36,4 +36,24 @@ export const addAddress = (body, history, setLoading) => { console.log(error); setLoading(false) }) +} + + +export const order = (body, history, setLoading, id) =>{ + const headers ={ + headers:{ + auth:localStorage.getItem('token') + } + } + setLoading(true) + axios.post(`${BASE_URL}/restaurants/${id}/order`, body, headers) + .then((response) => { + console.log(response); + setLoading(false) + goToHomePage(history) + }) + .catch((error) => { + console.log(error); + setLoading(false) + }) } \ No newline at end of file From 6ea48f1cf40ae694c39c33b9853ec3255ba07083 Mon Sep 17 00:00:00 2001 From: rjuliuz Date: Sat, 30 Jan 2021 13:39:19 -0300 Subject: [PATCH 62/69] =?UTF-8?q?Finaliza=C3=A7=C3=A3o=20da=20P=C3=A1gina?= =?UTF-8?q?=20Perfil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Pages/ProfilePage/index.js | 88 ++++++++++++++++++++++----------- src/Pages/ProfilePage/styles.js | 43 +++++++++------- src/Routes/coordinators.js | 4 ++ 3 files changed, 86 insertions(+), 49 deletions(-) diff --git a/src/Pages/ProfilePage/index.js b/src/Pages/ProfilePage/index.js index 1cf87ff..4cfbed8 100644 --- a/src/Pages/ProfilePage/index.js +++ b/src/Pages/ProfilePage/index.js @@ -1,6 +1,6 @@ -import React from 'react' +import React, { useEffect, useState, useContext } from 'react' import { useHistory } from "react-router-dom"; -import { goBack, goToCartPage, goToEditPage, goToHomePage } from '../../Routes/coordinators'; +import { goToEditPage, goToEditAddressPage } from '../../Routes/coordinators'; import { DivPerfil, HeaderDiv, CaixaInfo, @@ -15,50 +15,78 @@ import { DivPerfil, CaixaPedido, DivName, DivData, - DivTotal + DivTotal, + DivSemPedidos } from './styles' -import icon from '../../assets/iconelapis.png' +import icon from '../../assets/iconelapis.png'; import Header from '../../Components/Header'; import FooterMenu from '../../Components/FooterMenu'; +import GlobalStateContext from '../../Global/GlobalStateContext'; +import axios from 'axios'; +import { BASE_URL } from '../../Constants/urls'; export default function ProfilePage() { const history = useHistory(); + const {states} = useContext(GlobalStateContext) + const [orders, setOrders] = useState([]) + + useEffect(() => { + const headers ={ + headers:{ + auth:localStorage.getItem('token') + } + } + + axios.get(`${BASE_URL}/orders/history`, headers) + .then((response) => { + setOrders(response.data.orders) + }) + .catch((error) => { + console.log(error) + }) + }, []); + function timeConverter(UNIX_timestamp){ + let a = new Date(UNIX_timestamp); + let months = ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Augusto','Setembro','Outubro','Novembro','Dezembro']; + let year = a.getFullYear(); + let month = months[a.getMonth()]; + let date = a.getDate(); + let time = date + ' ' + month + ' ' + year + ' '; + return time; + } + + console.log(orders) + return (
- -
- {/* - Meu Perfil - */} + goToEditPage(history)} src={icon} /> +
- Bruna Olivera - bruna_o@gmail.com - 333.333.333-33 + {states.perfil.name} + {states.perfil.email} + {states.perfil.cpf} - + goToEditAddressPage(history)} src={icon} /> Endereço cadastrado: - Rua Alessandra Vieira, 42 - Santana + {states.perfil.address} Histórico de Pedidos - - - Bullquer Vila Madalena - 23 outubro 2019 - SUBTOTAL R$67,00 - - - Vinil Burger Butantã - 30 setembro 2019 - SUBTOTAL R$89,00 - - - Bullquer Vila Madalena - 10 setembro 2019 - SUBTOTAL R$77,00 - + + {orders !== [] ? orders.map((item) => { + return ( + + {item.restaurantName} + {timeConverter(item.createdAt)} + {`SUBTOTAL R$${item.totalPrice}`} + + ) + } + ) : Você não realizou nenhum pedido } + + diff --git a/src/Pages/ProfilePage/styles.js b/src/Pages/ProfilePage/styles.js index f336830..8ac6772 100644 --- a/src/Pages/ProfilePage/styles.js +++ b/src/Pages/ProfilePage/styles.js @@ -1,23 +1,14 @@ import styled from 'styled-components' export const DivPerfil = styled.div` - width: 22.5rem; - height: 40rem; + width: 100vw; + height: 100vh; display: flex; flex-direction: column; border: 1px solid black; position: relative; ` -export const HeaderDiv = styled.div` - width: 100%; - height: 4rem; - display: flex; - align-items: center; - justify-content: center; - border-bottom: 1px solid black; -` - export const CaixaPerfil = styled.div` width: 100%; margin: 0; @@ -34,15 +25,15 @@ export const CaixaInfo = styled.div` ` export const CaixaEndereco = styled.div` - width: 20.5rem; - height: 4.75rem; + max-width: 100vw; + height: 4.75rem; padding: 0 1rem; background-color: #eeeeee; position: relative; ` export const CaixaEnd = styled.div` - width: 20.5rem; + max-width: 100vw; height: 1.125rem; margin: 0 0 0.5rem; font-size: 1rem; @@ -59,9 +50,11 @@ export const CaixaInfoEnd = styled.div` ` export const CaixaHistoricoPedidos = styled.div` - width: 20.5rem; + max-width: 100vw; height: 1.625rem; - margin-left: 1rem; + margin-top: 1rem; + margin-left: 1rem; + margin-right: 1rem; font-size: 1rem; letter-spacing: -0.39px; border-bottom: 1px solid black; @@ -100,12 +93,14 @@ export const IconeEndereco = styled.img` ` export const ContainerDosPedidos = styled.div` - width: 22.5rem; - height: 6.875rem; + max-width: 100vw; + height: 100%; + overflow: auto; + scrollbar-width: none; ` export const CaixaPedido = styled.div` - width: 20.5rem; + max-width: 100vw; height: 6.375rem; margin: 0.438rem 1rem 0 1rem; border-radius: 8px; @@ -138,3 +133,13 @@ export const DivTotal = styled.div` letter-spacing: -normal.029px; ` +export const DivSemPedidos = styled.div` + width: 100%; + opacity: 0.89; + font-family: 'Roboto', sans-serif; + font-size: 1rem; + color: #000; + margin-top: 1.75rem; + text-align: center; +` + diff --git a/src/Routes/coordinators.js b/src/Routes/coordinators.js index 5acff3d..975aa4e 100644 --- a/src/Routes/coordinators.js +++ b/src/Routes/coordinators.js @@ -14,6 +14,10 @@ export const goToEditPage = (history) => { history.push('/profile/edit') } +export const goToEditAddressPage = (history) => { + history.push('/profile/edit/address') +} + export const goToLoginPage = (history) => { history.push('/') } From 9f4883ecfa9d304c61ed8c93bc14583013c03a31 Mon Sep 17 00:00:00 2001 From: rjuliuz Date: Sat, 30 Jan 2021 13:57:13 -0300 Subject: [PATCH 63/69] =?UTF-8?q?Finaliza=C3=A7=C3=A3o=20da=20P=C3=A1gina?= =?UTF-8?q?=20Perfil=20com=20tern=C3=A1rio=20funcionando?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Pages/ProfilePage/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pages/ProfilePage/index.js b/src/Pages/ProfilePage/index.js index 4cfbed8..9a57637 100644 --- a/src/Pages/ProfilePage/index.js +++ b/src/Pages/ProfilePage/index.js @@ -75,7 +75,7 @@ export default function ProfilePage() { Histórico de Pedidos - {orders !== [] ? orders.map((item) => { + {orders.length !== 0 ? orders.map((item) => { return ( {item.restaurantName} From 7458aadf1041a92c3c271cdebd27ab2af627bf2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Sat, 30 Jan 2021 15:48:09 -0300 Subject: [PATCH 64/69] finalizando o pedido em andamento --- src/Components/PedidoEmAndamento/index.js | 2 +- src/Pages/HomePage/index.js | 71 ++++++++++++++--------- 2 files changed, 44 insertions(+), 29 deletions(-) diff --git a/src/Components/PedidoEmAndamento/index.js b/src/Components/PedidoEmAndamento/index.js index a806148..5f32d78 100644 --- a/src/Components/PedidoEmAndamento/index.js +++ b/src/Components/PedidoEmAndamento/index.js @@ -10,7 +10,7 @@ export default function index(props) {

Pedido em Andamento

-

{props.restaurante? props.restaurente: "TESTE"}

+

{props.restaurante}

SUBTOTAL R${props.valor}

diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index 1c24c5e..94519fc 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -16,10 +16,48 @@ export default function HomePage() { const {states, setters, requests} = useContext(GlobalStateContext) - const [emAndamento, setEmAndamento] =useState({}) + const [emAndamento, setEmAndamento] =useState() const history = useHistory(); + // const pedidoEmAndamento = useRequestData(`${BASE_URL}/active-order`, {}) + // setEmAndamento(pedidoEmAndamento) + + + useEffect (() =>{ + + + + const headers ={ + headers:{ + auth:localStorage.getItem('token') + } + } + axios.get(`${BASE_URL}/active-order`, headers) + .then((response) =>{ + console.log(response.data);//---------------------------------- + if(response.data){ + console.log(response.data); + setEmAndamento(response.data) + } + }) + .catch((error) =>{ + console.log(error); + }) + + }, []) + +let nomeRestaurante = '' +let totalDoPedido = 0 +if(emAndamento){ + nomeRestaurante = emAndamento.order.restaurantName + totalDoPedido = emAndamento.order.totalPrice +} +console.log(nomeRestaurante); +console.log(totalDoPedido); +// const nomeRestaurante = emAndamento.order.restaurantName + console.log(emAndamento); + const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {}) if (!listaDeRestaurantes.restaurants) { @@ -30,32 +68,6 @@ const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {}) return e.category === states.filter }) -// useEffect (() =>{ -// pedidoAndamento() -// }, []) - - - -// //verificando se existe pedido em andamento na API -// const pedidoAndamento =() =>{ -// const headers ={ -// headers:{ -// auth:localStorage.getItem('token') -// } -// } -// axios.get(`${BASE_URL}/active-order`, headers) -// .then((response) =>{ -// console.log(response.data.order);//---------------------------------- -// setEmAndamento(response.data.order) - -// }) -// .catch((error) =>{ -// console.log(error); -// }) -// } -// pedidoAndamento() -// //verificando se existe pedido em andamento na API - return ( @@ -70,7 +82,10 @@ const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {}) }) } {/* ternário verificando se há pedido para renderizar */} - {/* {emAndamento !== null && } */} + {emAndamento !== null && } ); From 04ed34f774e38d7455bbd6dc04db57a078f6ef3e Mon Sep 17 00:00:00 2001 From: Asoaresdev <57377698+Asoaresdev@users.noreply.github.com> Date: Sun, 31 Jan 2021 06:39:21 -0300 Subject: [PATCH 65/69] Update README.md --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 54ef094..91daed7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,23 @@ +# IFUTURE + +Nome dos integrantes: +- Adrielly Costa +- Andréa Soares +- Davi Souza +- David Biolchini +- Rafael Julio + + +Link do Surge: + + +### 🛠 Tecnologias +- React +- Styled-components +- Material-UI + + + This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts From 6897024c23a65b10e0ed8b9696ac544572df90e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9a=20Soares?= Date: Sun, 31 Jan 2021 07:34:45 -0300 Subject: [PATCH 66/69] limpando consoles e usando usePortectedPage --- src/Components/FormAdress/index.js | 2 +- src/Components/ItemCard/ItemCard.js | 2 +- src/Components/PedidoEmAndamento/index.js | 2 +- src/Pages/CartPage/index.js | 2 + src/Pages/EditAdressPage/index.js | 3 +- src/Pages/EditProfilePage/EditProfileForm.js | 2 +- src/Pages/EditProfilePage/index.js | 8 ++-- src/Pages/ErrorPage/index.js | 3 +- src/Pages/HomePage/index.js | 45 ++++++++------------ src/Pages/ProfilePage/index.js | 2 + src/Pages/RestaurantPage/index.js | 5 ++- src/Pages/SearchPage/index.js | 3 +- src/Pages/SignUpPage/SignUpForm.js | 3 +- src/Service/user.js | 10 ++--- 14 files changed, 44 insertions(+), 48 deletions(-) diff --git a/src/Components/FormAdress/index.js b/src/Components/FormAdress/index.js index df4ee7a..f14cc35 100644 --- a/src/Components/FormAdress/index.js +++ b/src/Components/FormAdress/index.js @@ -112,7 +112,7 @@ export default function FormAdress(props) { : 'Salvar' } submeter = {submitForm} /> diff --git a/src/Components/ItemCard/ItemCard.js b/src/Components/ItemCard/ItemCard.js index 2d2256d..27df59b 100644 --- a/src/Components/ItemCard/ItemCard.js +++ b/src/Components/ItemCard/ItemCard.js @@ -37,7 +37,7 @@ export default function ItemCard(props) { /* todas tags devem ser preenchidas por props quando for adicionar a lógica */ return ( - + {props.name}

{props.name}

diff --git a/src/Components/PedidoEmAndamento/index.js b/src/Components/PedidoEmAndamento/index.js index 5f32d78..64136a1 100644 --- a/src/Components/PedidoEmAndamento/index.js +++ b/src/Components/PedidoEmAndamento/index.js @@ -11,7 +11,7 @@ export default function index(props) {

Pedido em Andamento

{props.restaurante}

-

SUBTOTAL R${props.valor}

+

SUBTOTAL R$ {props.valor}

) diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index 347bd4e..94bdecb 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -23,8 +23,10 @@ import ItemCard from '../../Components/ItemCard/ItemCard'; import useRequestData from '../../CustomHooks/useRequestData'; import { BASE_URL } from '../../Constants/urls'; import { order } from '../../Service/user' +import useProtectPage from '../../CustomHooks/useProtectedPage' export default function CartPage() { + useProtectPage() const history = useHistory(); const {states, setters} = useContext(GlobalStateContext) diff --git a/src/Pages/EditAdressPage/index.js b/src/Pages/EditAdressPage/index.js index 7e61837..9bca7ef 100644 --- a/src/Pages/EditAdressPage/index.js +++ b/src/Pages/EditAdressPage/index.js @@ -1,9 +1,10 @@ import React from 'react' import FormAdress from '../../Components/FormAdress' import Header from '../../Components/Header' +import useProtectedPage from '../../CustomHooks/useProtectedPage' export default function EditAdressPage() { - + useProtectedPage() return (
: 'Salvar' } /> diff --git a/src/Pages/EditProfilePage/index.js b/src/Pages/EditProfilePage/index.js index 137c8ee..0f7ced6 100644 --- a/src/Pages/EditProfilePage/index.js +++ b/src/Pages/EditProfilePage/index.js @@ -1,15 +1,13 @@ import React from 'react' import EditProfileForm from './EditProfileForm' import Header from '../../Components/Header' +import useProtectPage from '../../CustomHooks/useProtectedPage' export default function EditProfilePage() { - + useProtectPage() return (
-
- +
) diff --git a/src/Pages/ErrorPage/index.js b/src/Pages/ErrorPage/index.js index e3300f8..24ef9a2 100644 --- a/src/Pages/ErrorPage/index.js +++ b/src/Pages/ErrorPage/index.js @@ -4,9 +4,10 @@ import FooterMenu from '../../Components/FooterMenu'; import Image from '../../assets/logo-future-eats-invert.svg' import { Container, ContainerImage } from './styles' import SentimentVeryDissatisfiedIcon from '@material-ui/icons/SentimentVeryDissatisfied'; +import useProtectedPage from '../../CustomHooks/useProtectedPage'; export default function ErrorPage() { - + useProtectedPage() return (
diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index 94519fc..227e590 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -11,23 +11,19 @@ import HomeDiv from "./styles" import useRequestData from '../../CustomHooks/useRequestData'; import { BASE_URL } from '../../Constants/urls'; import axios from "axios"; +import useProtectedPage from '../../CustomHooks/useProtectedPage' export default function HomePage() { - + useProtectedPage() const {states, setters, requests} = useContext(GlobalStateContext) - const [emAndamento, setEmAndamento] =useState() + const [emAndamento, setEmAndamento] = useState('') const history = useHistory(); - // const pedidoEmAndamento = useRequestData(`${BASE_URL}/active-order`, {}) - // setEmAndamento(pedidoEmAndamento) - useEffect (() =>{ - - const headers ={ headers:{ auth:localStorage.getItem('token') @@ -35,28 +31,21 @@ export default function HomePage() { } axios.get(`${BASE_URL}/active-order`, headers) .then((response) =>{ - console.log(response.data);//---------------------------------- if(response.data){ - console.log(response.data); setEmAndamento(response.data) } }) .catch((error) =>{ - console.log(error); }) }, []) let nomeRestaurante = '' let totalDoPedido = 0 -if(emAndamento){ +if(emAndamento.order){ nomeRestaurante = emAndamento.order.restaurantName totalDoPedido = emAndamento.order.totalPrice } -console.log(nomeRestaurante); -console.log(totalDoPedido); -// const nomeRestaurante = emAndamento.order.restaurantName - console.log(emAndamento); const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {}) @@ -71,22 +60,22 @@ const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {}) return ( -
- - +
+ + {states.filter === "" ? listaDeRestaurantes.restaurants.map(e => { - return - }) + return + }) : filteredArray.map(e => { - return - }) } + return + })} - {/* ternário verificando se há pedido para renderizar */} - {emAndamento !== null && } - + {/* Verificando se há pedido para renderizar */} + {emAndamento.order !== null && } + ); } diff --git a/src/Pages/ProfilePage/index.js b/src/Pages/ProfilePage/index.js index 9a57637..2f77557 100644 --- a/src/Pages/ProfilePage/index.js +++ b/src/Pages/ProfilePage/index.js @@ -24,8 +24,10 @@ import FooterMenu from '../../Components/FooterMenu'; import GlobalStateContext from '../../Global/GlobalStateContext'; import axios from 'axios'; import { BASE_URL } from '../../Constants/urls'; +import useProtectedPage from '../../CustomHooks/useProtectedPage'; export default function ProfilePage() { + useProtectedPage() const history = useHistory(); const {states} = useContext(GlobalStateContext) const [orders, setOrders] = useState([]) diff --git a/src/Pages/RestaurantPage/index.js b/src/Pages/RestaurantPage/index.js index 1c12ab3..972991c 100644 --- a/src/Pages/RestaurantPage/index.js +++ b/src/Pages/RestaurantPage/index.js @@ -8,8 +8,10 @@ import useRequestData from '../../CustomHooks/useRequestData'; import { BASE_URL } from '../../Constants/urls'; import PopUpQuantidade from '../../Components/PopUpQuantidade'; import axios from 'axios' +import useProtectedPage from '../../CustomHooks/useProtectedPage' export default function RestaurantPage() { + useProtectedPage() const {states, setters} = useContext(GlobalStateContext) const [categorias, setCategorias] = useState([]) @@ -66,12 +68,13 @@ export default function RestaurantPage() { } // console.log(states.restaurante) - + console.log(states.restaurante.products); const renderCategory = categorias.map(item => { const categoria = item return ( {categoria} + {(states.restaurante.products).map(item => { if (item.category === categoria) { return ( diff --git a/src/Pages/SearchPage/index.js b/src/Pages/SearchPage/index.js index 4ce6bcc..c127a06 100644 --- a/src/Pages/SearchPage/index.js +++ b/src/Pages/SearchPage/index.js @@ -4,9 +4,10 @@ import Header from "../../Components/Header/index" import GlobalStateContext from "../../Global/GlobalStateContext"; import useStyles from './styles' import CardRestaurante from "../../Components/CardRestaurante/CardRestaurante" +import useProtectedPage from '../../CustomHooks/useProtectedPage'; export default function SearchPage() { - + useProtectedPage() const {states, setters, requests} = useContext(GlobalStateContext) const classes = useStyles() diff --git a/src/Pages/SignUpPage/SignUpForm.js b/src/Pages/SignUpPage/SignUpForm.js index a72a2c7..f484375 100644 --- a/src/Pages/SignUpPage/SignUpForm.js +++ b/src/Pages/SignUpPage/SignUpForm.js @@ -18,7 +18,7 @@ export default function SignUpForm(props) { const history = useHistory(); - const [form, handleInput ] = useForm({ + const [ form, handleInput ] = useForm({ name: '', email: '', cpf: '', @@ -156,7 +156,6 @@ export default function SignUpForm(props) { {showAlert && Deve ser a mesma que a anterior} : 'Criar' } /> diff --git a/src/Service/user.js b/src/Service/user.js index 7c369f1..c9f2cd2 100644 --- a/src/Service/user.js +++ b/src/Service/user.js @@ -11,7 +11,7 @@ export const signUp = (body, history, setLoading) => { goToAddAddressPage(history) }) .catch((error) => { - console.log(error); + // alert(error) setLoading(false) }) @@ -27,13 +27,13 @@ export const addAddress = (body, history, setLoading) => { setLoading(true) axios.put(`${BASE_URL}/address`, body, headers) .then((response) => { - console.log(response.data.token); + localStorage.setItem('token', response.data.token)// token da criação do endereço setLoading(false) goToHomePage(history) }) .catch((error) => { - console.log(error); + setLoading(false) }) } @@ -48,12 +48,12 @@ export const order = (body, history, setLoading, id) =>{ setLoading(true) axios.post(`${BASE_URL}/restaurants/${id}/order`, body, headers) .then((response) => { - console.log(response); + setLoading(false) goToHomePage(history) }) .catch((error) => { - console.log(error); + setLoading(false) }) } \ No newline at end of file From 39e133a20ddc99018815648253289a355deaa144 Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Sun, 31 Jan 2021 17:11:53 -0300 Subject: [PATCH 67/69] arrumando detalhes antes da entrega --- src/Components/Loading/index.js | 28 +++++++++++++++++++++++++ src/Components/PopUpQuantidade/index.js | 7 +++++-- src/Pages/CartPage/index.js | 2 +- src/Pages/HomePage/index.js | 3 ++- src/Pages/HomePage/styles.js | 3 +-- src/Pages/LoginPage/index.js | 7 ++++++- src/Pages/ProfilePage/index.js | 19 +++++++++++++---- src/Pages/ProfilePage/styles.js | 2 +- src/Pages/RestaurantPage/index.js | 3 ++- src/Pages/SearchPage/index.js | 11 +++++++--- src/Service/user.js | 9 +++++--- 11 files changed, 75 insertions(+), 19 deletions(-) create mode 100644 src/Components/Loading/index.js diff --git a/src/Components/Loading/index.js b/src/Components/Loading/index.js new file mode 100644 index 0000000..5d1215d --- /dev/null +++ b/src/Components/Loading/index.js @@ -0,0 +1,28 @@ +import React from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import CircularProgress from '@material-ui/core/CircularProgress'; + +const useStyles = makeStyles((theme) => ({ + root: { + display: 'flex', + width: '100vw', + height: '90vh', + alignItems: 'center', + display: 'flex', + justifyContent: 'center', + '& > * + *': { + marginLeft: theme.spacing(2), + }, + }, +})); + +export default function Loading() { + + const classes = useStyles(); + + return ( +
+ +
+ ) +} diff --git a/src/Components/PopUpQuantidade/index.js b/src/Components/PopUpQuantidade/index.js index 3eab8f1..dd6a297 100644 --- a/src/Components/PopUpQuantidade/index.js +++ b/src/Components/PopUpQuantidade/index.js @@ -29,7 +29,7 @@ export default function PopUpQuantidade() { setters.setPopUp(false) - if (states.quantidade <= 0 || states.restaurante === {} && states.restaurante !== states.carrinho.restaurante) { + if (states.quantidade <= 0 || states.restaurante === {}) { return null } @@ -44,11 +44,14 @@ export default function PopUpQuantidade() { if (!states.carrinho.pedido) { setters.setCarrinho({"restaurante": states.restaurante, "pedido": pedido}) - } else { + } else if (states.restaurante === states.carrinho.restaurante) { setters.setCarrinho({"restaurante": states.restaurante, "pedido": [...pedido,...states.carrinho.pedido]}) + } else if (states.restaurante !== states.carrinho.restaurante) { + alert("Você tem itens de outro restaurante no Carrinho. \n Termine seu pedido ou exclua os itens antes de continuar") } + setters.setQuantidade(0) } return ( diff --git a/src/Pages/CartPage/index.js b/src/Pages/CartPage/index.js index 94bdecb..682ce90 100644 --- a/src/Pages/CartPage/index.js +++ b/src/Pages/CartPage/index.js @@ -72,7 +72,7 @@ export default function CartPage() { const submitOrder = (e) => { e.preventDefault() - order(body, history, setLoading, idRestaurante)//função está no service/user + order(body, history, setLoading, idRestaurante, setters.setCarrinho)//função está no service/user } diff --git a/src/Pages/HomePage/index.js b/src/Pages/HomePage/index.js index 227e590..700582c 100644 --- a/src/Pages/HomePage/index.js +++ b/src/Pages/HomePage/index.js @@ -12,6 +12,7 @@ import useRequestData from '../../CustomHooks/useRequestData'; import { BASE_URL } from '../../Constants/urls'; import axios from "axios"; import useProtectedPage from '../../CustomHooks/useProtectedPage' +import Loading from '../../Components/Loading/index' export default function HomePage() { useProtectedPage() @@ -50,7 +51,7 @@ if(emAndamento.order){ const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {}) if (!listaDeRestaurantes.restaurants) { - return
Loading...
+ return } const filteredArray = listaDeRestaurantes.restaurants.filter(e => { diff --git a/src/Pages/HomePage/styles.js b/src/Pages/HomePage/styles.js index 3c4da61..e9dee6f 100644 --- a/src/Pages/HomePage/styles.js +++ b/src/Pages/HomePage/styles.js @@ -1,8 +1,7 @@ import styled from 'styled-components' const HomeDiv = styled.div` - margin: 0 0 56px 0; - + margin: 0 0 164px 0; ` export default HomeDiv; diff --git a/src/Pages/LoginPage/index.js b/src/Pages/LoginPage/index.js index d266a73..923701f 100644 --- a/src/Pages/LoginPage/index.js +++ b/src/Pages/LoginPage/index.js @@ -11,11 +11,16 @@ export default function LoginPage() { const [exibirLogin, setExibirLogin] = useState(false); useEffect(() => { - if (!exibirLogin) { + if (localStorage.getItem('token') !== "") { + setTimeout(function () { + history.push('/feed') + }, 2000); + } else if (!exibirLogin) { setTimeout(function () { setExibirLogin(true); }, 2000); } + }, [exibirLogin]); return ( diff --git a/src/Pages/ProfilePage/index.js b/src/Pages/ProfilePage/index.js index 2f77557..751c1d1 100644 --- a/src/Pages/ProfilePage/index.js +++ b/src/Pages/ProfilePage/index.js @@ -25,12 +25,16 @@ import GlobalStateContext from '../../Global/GlobalStateContext'; import axios from 'axios'; import { BASE_URL } from '../../Constants/urls'; import useProtectedPage from '../../CustomHooks/useProtectedPage'; +import useRequestData from '../../CustomHooks/useRequestData' +import Loading from "../../Components/Loading/index" export default function ProfilePage() { useProtectedPage() const history = useHistory(); const {states} = useContext(GlobalStateContext) const [orders, setOrders] = useState([]) + + const perfil = useRequestData(`${BASE_URL}/profile`, {}) useEffect(() => { const headers ={ @@ -59,22 +63,29 @@ export default function ProfilePage() { } console.log(orders) + + if(!perfil.user) { + return + } return (
goToEditPage(history)} src={icon} />
+ - {states.perfil.name} - {states.perfil.email} - {states.perfil.cpf} + {perfil.user.name} + {perfil.user.email} + {perfil.user.cpf} + goToEditAddressPage(history)} src={icon} /> Endereço cadastrado: - {states.perfil.address} + {perfil.user.address} + Histórico de Pedidos {orders.length !== 0 ? orders.map((item) => { diff --git a/src/Pages/ProfilePage/styles.js b/src/Pages/ProfilePage/styles.js index 8ac6772..17dc22e 100644 --- a/src/Pages/ProfilePage/styles.js +++ b/src/Pages/ProfilePage/styles.js @@ -5,7 +5,6 @@ export const DivPerfil = styled.div` height: 100vh; display: flex; flex-direction: column; - border: 1px solid black; position: relative; ` @@ -93,6 +92,7 @@ export const IconeEndereco = styled.img` ` export const ContainerDosPedidos = styled.div` + margin-bottom: 5rem; max-width: 100vw; height: 100%; overflow: auto; diff --git a/src/Pages/RestaurantPage/index.js b/src/Pages/RestaurantPage/index.js index 972991c..241c381 100644 --- a/src/Pages/RestaurantPage/index.js +++ b/src/Pages/RestaurantPage/index.js @@ -9,6 +9,7 @@ import { BASE_URL } from '../../Constants/urls'; import PopUpQuantidade from '../../Components/PopUpQuantidade'; import axios from 'axios' import useProtectedPage from '../../CustomHooks/useProtectedPage' +import Loading from '../../Components/Loading'; export default function RestaurantPage() { useProtectedPage() @@ -99,7 +100,7 @@ export default function RestaurantPage() {
- {states.restaurante ? renderRestaurantInfo() :

Carregando...

} + {states.restaurante.id === params.id ? renderRestaurantInfo() : } {states.restaurante && states.restaurante.products ? renderCategory : null } diff --git a/src/Pages/SearchPage/index.js b/src/Pages/SearchPage/index.js index c127a06..300c90f 100644 --- a/src/Pages/SearchPage/index.js +++ b/src/Pages/SearchPage/index.js @@ -5,17 +5,22 @@ import GlobalStateContext from "../../Global/GlobalStateContext"; import useStyles from './styles' import CardRestaurante from "../../Components/CardRestaurante/CardRestaurante" import useProtectedPage from '../../CustomHooks/useProtectedPage'; +import useRequestData from "../../CustomHooks/useRequestData" +import { BASE_URL } from '../../Constants/urls'; +import Loading from '../../Components/Loading/index' export default function SearchPage() { useProtectedPage() const {states, setters, requests} = useContext(GlobalStateContext) const classes = useStyles() + + const listaDeRestaurantes = useRequestData(`${BASE_URL}/restaurants`, {}) - if (!requests.listaDeRestaurantes.restaurants) { - return
Loading...
+ if (!listaDeRestaurantes.restaurants) { + return } - const filteredArray = requests.listaDeRestaurantes.restaurants.filter(e => { + const filteredArray = listaDeRestaurantes.restaurants.filter(e => { return e.name.toLowerCase().includes(states.searchInput.toLowerCase()) || e.category.toLowerCase().includes(states.searchInput.toLowerCase()) }) diff --git a/src/Service/user.js b/src/Service/user.js index c9f2cd2..e0ab581 100644 --- a/src/Service/user.js +++ b/src/Service/user.js @@ -39,7 +39,7 @@ export const addAddress = (body, history, setLoading) => { } -export const order = (body, history, setLoading, id) =>{ +export const order = (body, history, setLoading, id, setCarrinho) =>{ const headers ={ headers:{ auth:localStorage.getItem('token') @@ -50,10 +50,13 @@ export const order = (body, history, setLoading, id) =>{ .then((response) => { setLoading(false) + setCarrinho({}) goToHomePage(history) }) .catch((error) => { - - setLoading(false) + if ( error.message === "Request failed with status code 409") { + alert("Já existe um pedido em andamento") + } + setLoading(false) }) } \ No newline at end of file From 6882072a207a1b496c1d6455d733960bc70431ce Mon Sep 17 00:00:00 2001 From: David Biolchini Date: Sun, 31 Jan 2021 20:51:33 -0300 Subject: [PATCH 68/69] =?UTF-8?q?tirando=20verifica=C3=A7=C3=A3o=20de=20to?= =?UTF-8?q?ken=20que=20n=C3=A3o=20deu=20certo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Pages/LoginPage/index.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Pages/LoginPage/index.js b/src/Pages/LoginPage/index.js index 923701f..5eb50f8 100644 --- a/src/Pages/LoginPage/index.js +++ b/src/Pages/LoginPage/index.js @@ -8,14 +8,11 @@ import InitialScreen from "../../Components/InitialScreen"; export default function LoginPage() { const history = useHistory(); - const [exibirLogin, setExibirLogin] = useState(false); + const [exibirLogin, setExibirLogin] = useState(false); useEffect(() => { - if (localStorage.getItem('token') !== "") { - setTimeout(function () { - history.push('/feed') - }, 2000); - } else if (!exibirLogin) { + + if (!exibirLogin) { setTimeout(function () { setExibirLogin(true); }, 2000); @@ -23,6 +20,7 @@ export default function LoginPage() { }, [exibirLogin]); + return ( <> {!exibirLogin && } From 9a008f357144a87ce9174d23d0f4f7f843b5fcb8 Mon Sep 17 00:00:00 2001 From: Asoaresdev <57377698+Asoaresdev@users.noreply.github.com> Date: Sun, 31 Jan 2021 21:39:09 -0300 Subject: [PATCH 69/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 91daed7..49bab17 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Nome dos integrantes: - Rafael Julio -Link do Surge: +Link do Surge: http://fat-leather.surge.sh/ ### 🛠 Tecnologias