From 6703403455ae11963ffa322afdb482d6d10f8917 Mon Sep 17 00:00:00 2001 From: Jimmy Zhen Date: Fri, 20 Oct 2023 14:13:25 -0700 Subject: [PATCH 1/9] Remove vis-network-react dependency due to failing Jest test suite failing on unsupported JS syntax Also remove JS particle dependencies as they are no longer being used, as well as the Jest config to attempt a workaround on the failing test. --- package.json | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/package.json b/package.json index bb6d7fab..d46f104b 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "react-dom": "17.0.1", "react-google-recaptcha": "^3.1.0", "react-helmet": "^6.1.0", - "react-particles-js": "3.5.3", "react-redux": "8.0.5", "react-router-dom": "^5.1.2", "react-scripts": "5.0.1", @@ -33,9 +32,7 @@ "react-tooltip": "^5.11.2", "redux": "^4.0.1", "redux-thunk": "^2.3.0", - "tsparticles": "1.36.0", - "victory": "36.4.1", - "vis-network-react": "^1.3.6" + "victory": "36.4.1" }, "scripts": { "start": "react-scripts start", @@ -78,10 +75,5 @@ }, "resolutions": { "autoprefixer": "10.4.5" - }, - "jest": { - "transformIgnorePatterns": [ - "/node_modules/(?!(vis-network|vis-data))" - ] } } From c355910df15ec953b84f00b10736629bd08a5e9f Mon Sep 17 00:00:00 2001 From: Jimmy Zhen Date: Fri, 20 Oct 2023 14:16:56 -0700 Subject: [PATCH 2/9] Switch to try cytoscape as a replacement for vis.js --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index d46f104b..70607fcf 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "axios": "^0.27.2", "bootstrap": "4.6.1", "chart.js": "^2.9.3", + "cytoscape": "3.26.0", "d3": "6.7.0", "dayjs": "1.11.7", "from-exponential": "^1.1.1", @@ -22,6 +23,7 @@ "react": "17.0.1", "react-bootstrap-typeahead": "^6.0.0", "react-chartjs-2": "^2.8.0", + "react-cytoscapejs": "^2.0.0", "react-dom": "17.0.1", "react-google-recaptcha": "^3.1.0", "react-helmet": "^6.1.0", From 0c9c33b51693fa728397d01bdb37de8a2136c093 Mon Sep 17 00:00:00 2001 From: Jimmy Zhen Date: Sun, 22 Oct 2023 22:27:53 -0700 Subject: [PATCH 3/9] Add Jest test config to resolve crypto.getRandomValues error --- src/setupTests.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/setupTests.js b/src/setupTests.js index b8be4a7d..c165966f 100644 --- a/src/setupTests.js +++ b/src/setupTests.js @@ -1,6 +1,8 @@ import { configure } from 'enzyme'; import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; +const crypto = require('crypto'); + configure({ adapter: new Adapter() }); require('jest-canvas-mock'); @@ -8,5 +10,11 @@ require('jest-canvas-mock'); jest.mock('react-chartjs-2', () => ({ Bar: () => null, Pie: () => null, - Doughnut: () => null + Doughnut: () => null, })); + +Object.defineProperty(globalThis, 'crypto', { + value: { + getRandomValues: (arr) => crypto.randomBytes(arr.length), + }, +}); From 144e328de36339ef49a59465c8d72b5731314890 Mon Sep 17 00:00:00 2001 From: Jimmy Zhen Date: Sun, 22 Oct 2023 22:31:16 -0700 Subject: [PATCH 4/9] Revert to use vis-network dependencies to render gene network on homepage and add local Jest test config to ignore ESM modules --- package.json | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 70607fcf..5c94bca5 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "axios": "^0.27.2", "bootstrap": "4.6.1", "chart.js": "^2.9.3", - "cytoscape": "3.26.0", + "crypto": "^1.0.1", "d3": "6.7.0", "dayjs": "1.11.7", "from-exponential": "^1.1.1", @@ -21,9 +21,8 @@ "popper.js": "^1.16.1", "prop-types": "15.8.1", "react": "17.0.1", - "react-bootstrap-typeahead": "^6.0.0", + "react-bootstrap-typeahead": "6.0.0", "react-chartjs-2": "^2.8.0", - "react-cytoscapejs": "^2.0.0", "react-dom": "17.0.1", "react-google-recaptcha": "^3.1.0", "react-helmet": "^6.1.0", @@ -34,7 +33,10 @@ "react-tooltip": "^5.11.2", "redux": "^4.0.1", "redux-thunk": "^2.3.0", - "victory": "36.4.1" + "victory": "36.4.1", + "vis-data": "^7.1.7", + "vis-network": "^9.1.8", + "vis-network-react": "^1.3.6" }, "scripts": { "start": "react-scripts start", @@ -77,5 +79,11 @@ }, "resolutions": { "autoprefixer": "10.4.5" + }, + "jest": { + "transform": {}, + "transformIgnorePatterns": [ + "/node_modules/(?!(vis-network|vis-data))" + ] } } From 867fd831b0607f3112bab4a7b19867ca9c33e585 Mon Sep 17 00:00:00 2001 From: Jimmy Zhen Date: Sun, 22 Oct 2023 22:34:26 -0700 Subject: [PATCH 5/9] Remove extraneous export syntax --- src/Footer/footer.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Footer/footer.jsx b/src/Footer/footer.jsx index 396bad26..2b85f708 100644 --- a/src/Footer/footer.jsx +++ b/src/Footer/footer.jsx @@ -5,7 +5,7 @@ import React from 'react'; * * @returns {object} JSX representation of the global footer. */ -export function Footer() { +function Footer() { // Get current copyright year const getCopyrightYear = () => { const today = new Date(); From 214f0d574faf67e965111e7a9494bbe0a0ba6596 Mon Sep 17 00:00:00 2001 From: Jimmy Zhen Date: Sun, 22 Oct 2023 22:35:35 -0700 Subject: [PATCH 6/9] Fix homepage CSS config --- src/sass/_base.scss | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sass/_base.scss b/src/sass/_base.scss index c3f65a67..45af9e8e 100644 --- a/src/sass/_base.scss +++ b/src/sass/_base.scss @@ -45,7 +45,11 @@ body.homepage { padding-top: 4.30rem; &.authenticated { - padding-top: 4.50rem; + padding-top: 4.30rem; + } + + &.homepage { + padding-top: 0; } } } From e9b47c4445b8a242ff059bbf527decc413918073 Mon Sep 17 00:00:00 2001 From: Jimmy Zhen Date: Sun, 22 Oct 2023 22:36:08 -0700 Subject: [PATCH 7/9] Patch up homepage CSS configs --- src/sass/_landingPage.scss | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sass/_landingPage.scss b/src/sass/_landingPage.scss index 3124b9b3..4a324160 100644 --- a/src/sass/_landingPage.scss +++ b/src/sass/_landingPage.scss @@ -27,15 +27,15 @@ .animated-down-arrow { position: absolute; - bottom: 4rem; + bottom: 0.5rem; text-align: center; z-index: 5; img { - width: 3.0rem; - height: 3.0rem; + width: 2.75rem; + height: 2.75rem; margin: 0 auto !important; - opacity: 0.65; + opacity: 0.55; } } @@ -113,8 +113,8 @@ background-image: url(./assets/LandingPageGraphics/background_molecule_network_horizontal_wave.jpg); .section-content-container { - height: 65vh; - margin-top: -5.0rem; + height: 60vh; + margin-top: -3.0rem; padding-top: 15px; padding-bottom: 15px; From b0e31a403ce96b6e892282aed3656ccfce7107b2 Mon Sep 17 00:00:00 2001 From: Jimmy Zhen Date: Sun, 22 Oct 2023 23:08:36 -0700 Subject: [PATCH 8/9] Add global Jest test config to resolve error related to