From a280c8a81ab42a0f919a6ef35dc8865c5dcc2652 Mon Sep 17 00:00:00 2001 From: Nouamane Tazi Date: Fri, 15 Oct 2021 14:34:57 +0200 Subject: [PATCH 01/11] update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2fa78e71..a3d9a4f4 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo In the project directory, you can run: + ### `yarn start` Runs the app in the development mode.
From 6851b191ae34f11120c9dae157a7dcdb6a9c80f9 Mon Sep 17 00:00:00 2001 From: Nouamane Tazi Date: Fri, 15 Oct 2021 14:36:03 +0200 Subject: [PATCH 02/11] update readme --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index a3d9a4f4..2fa78e71 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo In the project directory, you can run: - ### `yarn start` Runs the app in the development mode.
From bc29d91c08ac389fa588949695d1e6abe63bc930 Mon Sep 17 00:00:00 2001 From: Nouamane Tazi Date: Fri, 15 Oct 2021 14:40:11 +0200 Subject: [PATCH 03/11] update config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 75e5d76d..6a792080 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,7 +23,7 @@ jobs: - node_modules key: v1-dependencies-{{ checksum "package.json" }} - # run tests! + # run tests! - run: yarn test - run: yarn build From 59d6772e8b279a398ec999dd81e17feb74806a78 Mon Sep 17 00:00:00 2001 From: Nouamane Tazi Date: Fri, 15 Oct 2021 15:00:42 +0200 Subject: [PATCH 04/11] add circleci status badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2fa78e71..435f4a81 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +[![CircleCI](https://circleci.com/gh/NouamaneTazi/japcalculator/tree/master.svg?style=svg)](https://circleci.com/gh/NouamaneTazi/japcalculator/tree/master) ## Available Scripts In the project directory, you can run: From f63ea5da42c314d43a9b934d7475937ed7a624ad Mon Sep 17 00:00:00 2001 From: Nouamane Tazi Date: Fri, 15 Oct 2021 15:09:51 +0200 Subject: [PATCH 05/11] update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 435f4a81..3c336252 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + [![CircleCI](https://circleci.com/gh/NouamaneTazi/japcalculator/tree/master.svg?style=svg)](https://circleci.com/gh/NouamaneTazi/japcalculator/tree/master) ## Available Scripts From 004d2795780c98f7d6f7fa8f76b1d080d88f85ed Mon Sep 17 00:00:00 2001 From: Nouamane Tazi Date: Fri, 15 Oct 2021 15:13:16 +0200 Subject: [PATCH 06/11] update readdd --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3c336252..62c78cfe 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo [![CircleCI](https://circleci.com/gh/NouamaneTazi/japcalculator/tree/master.svg?style=svg)](https://circleci.com/gh/NouamaneTazi/japcalculator/tree/master) + ## Available Scripts In the project directory, you can run: From 1e154eb28da759ca46b70c0d5feb4e1b10c6f9bf Mon Sep 17 00:00:00 2001 From: Nouamane Tazi Date: Fri, 15 Oct 2021 15:15:12 +0200 Subject: [PATCH 07/11] add big title --- src/App.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index 80911c81..37be6579 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,10 +1,12 @@ -import React from "react"; import "./App.css"; + import { CalculatorPage } from "./pages"; +import React from "react"; const App = () => { return (
+

Big title

); From d561bc8b093cc96fbd79070f25e95daa39e6ab7f Mon Sep 17 00:00:00 2001 From: Nouamane Tazi Date: Fri, 15 Oct 2021 16:13:08 +0200 Subject: [PATCH 08/11] add sentry --- package.json | 2 ++ src/index.tsx | 24 ++++++++++++---- yarn.lock | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 97 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 93c94ff5..278630d1 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,8 @@ "dependencies": { "@material-ui/core": "^4.9.2", "@material-ui/icons": "^4.9.1", + "@sentry/react": "^6.13.3", + "@sentry/tracing": "^6.13.3", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", diff --git a/src/index.tsx b/src/index.tsx index 9f4071c5..a2770e49 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,15 +1,29 @@ -import React from "react"; -import ReactDOM from "react-dom"; import "./index.css"; -import App from "./App"; + +import * as Sentry from "@sentry/react"; import * as serviceWorker from "./serviceWorker"; -import { Provider } from "react-redux"; + +import App from "./App"; import { ConnectedRouter } from "connected-react-router"; +import { Integrations } from "@sentry/tracing"; +import { Provider } from "react-redux"; +import React from "react"; +import ReactDOM from "react-dom"; import ThemeProvider from "@material-ui/styles/ThemeProvider"; -import { store } from "./redux/config"; import { history } from "./redux/Router/router"; +import { store } from "./redux/config"; import { theme } from "./style/theme"; +Sentry.init({ + dsn: "https://ab482aa399a24337b08ecd7b095a5c7e@o1040153.ingest.sentry.io/6009070", + integrations: [new Integrations.BrowserTracing()], + + // Set tracesSampleRate to 1.0 to capture 100% + // of transactions for performance monitoring. + // We recommend adjusting this value in production + tracesSampleRate: 1.0, +}); + ReactDOM.render( diff --git a/yarn.lock b/yarn.lock index 65fe0512..3f697bf9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1547,6 +1547,81 @@ resolved "https://registry.yarnpkg.com/@redux-saga/types/-/types-1.1.0.tgz#0e81ce56b4883b4b2a3001ebe1ab298b84237204" integrity sha512-afmTuJrylUU/0OtqzaRkbyYFFNgCF73Bvel/sw90pvGrWIZ+vyoIJqA6eMSoA6+nb443kTmulmBtC9NerXboNg== +"@sentry/browser@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.13.3.tgz#d4511791b1e484ad48785eba3bce291fdf115c1e" + integrity sha512-jwlpsk2/u1cofvfYsjmqcnx50JJtf/T6HTgdW+ih8+rqWC5ABEZf4IiB/H+KAyjJ3wVzCOugMq5irL83XDCfqQ== + dependencies: + "@sentry/core" "6.13.3" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" + tslib "^1.9.3" + +"@sentry/core@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.13.3.tgz#5cbbb995128e793ebebcbf1d3b7514e0e5e8b221" + integrity sha512-obm3SjgCk8A7nB37b2AU1eq1q7gMoJRrGMv9VRIyfcG0Wlz/5lJ9O3ohUk+YZaaVfZMxXn6hFtsBiOWmlv7IIA== + dependencies: + "@sentry/hub" "6.13.3" + "@sentry/minimal" "6.13.3" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" + tslib "^1.9.3" + +"@sentry/hub@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.13.3.tgz#cc09623a69b5343315fdb61c7fdd0be74b72299f" + integrity sha512-eYppBVqvhs5cvm33snW2sxfcw6G20/74RbBn+E4WDo15hozis89kU7ZCJDOPkXuag3v1h9igns/kM6PNBb41dw== + dependencies: + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" + tslib "^1.9.3" + +"@sentry/minimal@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.13.3.tgz#a675a79bcc830142e4f95e6198a2efde2cd3901e" + integrity sha512-63MlYYRni3fs5Bh8XBAfVZ+ctDdWg0fapSTP1ydIC37fKvbE+5zhyUqwrEKBIiclEApg1VKX7bkKxVdu/vsFdw== + dependencies: + "@sentry/hub" "6.13.3" + "@sentry/types" "6.13.3" + tslib "^1.9.3" + +"@sentry/react@^6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.13.3.tgz#f9607e0a60d52efd0baa96a14e694b6059f9379a" + integrity sha512-fdfmD9XNpGDwdkeLyd+iq+kqtNeghpH3wiez2rD81ZBvrn70uKaO2/yYDE71AXC6fUOwQuJmdfAuqBcNJkYIEw== + dependencies: + "@sentry/browser" "6.13.3" + "@sentry/minimal" "6.13.3" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" + hoist-non-react-statics "^3.3.2" + tslib "^1.9.3" + +"@sentry/tracing@^6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.13.3.tgz#ca657d4afa99c50f15e638fe38405bac33e780ee" + integrity sha512-yyOFIhqlprPM0g4f35Icear3eZk2mwyYcGEzljJfY2iU6pJwj1lzia5PfSwiCW7jFGMmlBJNhOAIpfhlliZi8Q== + dependencies: + "@sentry/hub" "6.13.3" + "@sentry/minimal" "6.13.3" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" + tslib "^1.9.3" + +"@sentry/types@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.13.3.tgz#63ad5b6735b0dfd90b3a256a9f8e77b93f0f66b2" + integrity sha512-Vrz5CdhaTRSvCQjSyIFIaV9PodjAVFkzJkTRxyY7P77RcegMsRSsG1yzlvCtA99zG9+e6MfoJOgbOCwuZids5A== + +"@sentry/utils@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.13.3.tgz#188754d40afe693c3fcae410f9322531588a9926" + integrity sha512-zYFuFH3MaYtBZTeJ4Yajg7pDf0pM3MWs3+9k5my9Fd+eqNcl7dYQYJbT9gyC0HXK1QI4CAMNNlHNl4YXhF91ag== + dependencies: + "@sentry/types" "6.13.3" + tslib "^1.9.3" + "@sheerun/mutationobserver-shim@^0.3.2": version "0.3.2" resolved "https://registry.yarnpkg.com/@sheerun/mutationobserver-shim/-/mutationobserver-shim-0.3.2.tgz#8013f2af54a2b7d735f71560ff360d3a8176a87b" @@ -10935,7 +11010,7 @@ ts-pnp@^1.1.6: resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92" integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw== -tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity "sha1-zy04vcNKE0vK8QkcQfZhni9nLQA= sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" From 563df965714887a0ef95ea5e5a00e7085a2a85c5 Mon Sep 17 00:00:00 2001 From: Nouamane Tazi Date: Fri, 15 Oct 2021 16:17:24 +0200 Subject: [PATCH 09/11] test error --- .../CalculatorModal/CalculatorModal.tsx | 51 +++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/components/CalculatorModal/CalculatorModal.tsx b/src/components/CalculatorModal/CalculatorModal.tsx index 70185791..d67f8f8b 100644 --- a/src/components/CalculatorModal/CalculatorModal.tsx +++ b/src/components/CalculatorModal/CalculatorModal.tsx @@ -1,17 +1,15 @@ +import { FOOD_ITEMS, FoodItem } from "../../data/food"; import React, { useState } from "react"; -import { withStyles } from "@material-ui/core/styles"; + +import { Button } from "@material-ui/core"; import { CSSProperties } from "@material-ui/styles"; -import Dialog from "@material-ui/core/Dialog"; -import DialogContent from "@material-ui/core/DialogContent"; -import IconButton from "@material-ui/core/IconButton"; import CloseIcon from "@material-ui/icons/Close"; - import { CustomTheme } from "../../style/theme"; -import { Button } from "@material-ui/core"; - +import Dialog from "@material-ui/core/Dialog"; +import DialogContent from "@material-ui/core/DialogContent"; import { default as FoodTile } from "../FoodTile/FoodTile"; - -import { FOOD_ITEMS, FoodItem } from "../../data/food"; +import IconButton from "@material-ui/core/IconButton"; +import { withStyles } from "@material-ui/core/styles"; type ClassNames = | "container" @@ -30,18 +28,17 @@ type Props = OwnProps; export const CalculatorModal: React.FC = (props: Props) => { const { classes, onClose, open } = props; - const [values, setValues] = useState< - { [k in string]: { value: number; kcal: number } } - >({}); + const [values, setValues] = useState<{ + [k in string]: { value: number; kcal: number }; + }>({}); - const handleChange = (itemName: string, itemKcal: number) => ( - value: number - ) => { - setValues({ - ...values, - [itemName]: { value, kcal: value * itemKcal } - }); - }; + const handleChange = + (itemName: string, itemKcal: number) => (value: number) => { + setValues({ + ...values, + [itemName]: { value, kcal: value * itemKcal }, + }); + }; const result = Object.keys(values).reduce((acc: number, itemName: string) => { return acc + values[itemName].kcal; @@ -68,7 +65,9 @@ export const CalculatorModal: React.FC = (props: Props) => { ))}
- +
@@ -80,22 +79,22 @@ const styles = (theme: CustomTheme): Record => ({ mainFoodItems: { display: "flex", flexWrap: "wrap", - justifyContent: "space-evenly" + justifyContent: "space-evenly", }, closeContainer: { display: "flex", - justifyContent: "flex-end" + justifyContent: "flex-end", }, itemContainer: { display: "flex", alignItems: "flex-end", - margin: theme.spacing(5) + margin: theme.spacing(5), }, buttonContainer: { display: "flex", justifyContent: "center", - marginBottom: theme.spacing(3) - } + marginBottom: theme.spacing(3), + }, }); export default withStyles(styles)(CalculatorModal); From 326d4c80930b8efa1f9e49d778250e26c8ba15f8 Mon Sep 17 00:00:00 2001 From: Nouamane Tazi Date: Fri, 15 Oct 2021 16:25:33 +0200 Subject: [PATCH 10/11] add sentry test --- src/components/CalculatorModal/CalculatorModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/CalculatorModal/CalculatorModal.tsx b/src/components/CalculatorModal/CalculatorModal.tsx index d67f8f8b..7de57af3 100644 --- a/src/components/CalculatorModal/CalculatorModal.tsx +++ b/src/components/CalculatorModal/CalculatorModal.tsx @@ -65,7 +65,7 @@ export const CalculatorModal: React.FC = (props: Props) => { ))}
-
From 93e8c4ff5e1d45d2788073e76a01e3bb3567139a Mon Sep 17 00:00:00 2001 From: Nouamane Tazi Date: Fri, 15 Oct 2021 18:04:25 +0200 Subject: [PATCH 11/11] fix: add sentry test --- src/components/CalculatorModal/CalculatorModal.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/CalculatorModal/CalculatorModal.tsx b/src/components/CalculatorModal/CalculatorModal.tsx index 7de57af3..34492c57 100644 --- a/src/components/CalculatorModal/CalculatorModal.tsx +++ b/src/components/CalculatorModal/CalculatorModal.tsx @@ -65,7 +65,10 @@ export const CalculatorModal: React.FC = (props: Props) => { ))}
-