From 21c8cdaf7f330c2b35b696e6d504f588e426f26c Mon Sep 17 00:00:00 2001 From: Alex Ruzenhack Date: Thu, 1 Feb 2024 16:11:36 +0000 Subject: [PATCH] chore: cherry-pick solutions for QA issues * fix: forceful quit (#497) * chore: Upgrade to NodeJS 20 (#501) * fix: Accessing colors from `scss` (#510) --- .github/workflows/e2e.yml | 2 +- .github/workflows/main.yml | 2 +- .nvmrc | 2 +- ELECTRON.md | 2 +- README.md | 2 +- package.json | 12 ++++++++---- src/App.js | 2 +- src/ErrorWrapper.js | 13 ++++++++----- src/components/Loading.js | 2 +- src/components/ModalSendTx.js | 2 +- src/components/ModalUnhandledError.js | 5 ++++- src/components/TokenHistory.js | 2 +- src/components/tokens/TokenAction.js | 2 +- src/components/tokens/TokenMelt.js | 2 +- src/constants.js | 10 ++++++++++ src/{index.scss => index.module.scss} | 0 src/screens/LoadingAddresses.js | 2 +- src/screens/LockedWallet.js | 2 +- src/screens/NewWallet.js | 4 ++-- src/screens/SendTokens.js | 3 +-- src/screens/Server.js | 2 +- src/screens/TransactionDetail.js | 2 +- src/screens/Wallet.js | 2 +- 23 files changed, 49 insertions(+), 30 deletions(-) rename src/{index.scss => index.module.scss} (100%) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 8a775e61..8b640dc3 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - node-version: [14.x] + node-version: [20.x] steps: - name: Checkout # https://github.com/actions/checkout/releases/tag/v4.0.0 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 57a67de3..2d260048 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: timeout-minutes: 40 # default is 360 strategy: matrix: - node-version: [14.x] + node-version: [20.x] steps: # https://github.com/actions/checkout/releases/tag/v4.0.0 - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac diff --git a/.nvmrc b/.nvmrc index 958b5a36..9a2a0e21 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v14 +v20 diff --git a/ELECTRON.md b/ELECTRON.md index f4d4faac..b32716a8 100644 --- a/ELECTRON.md +++ b/ELECTRON.md @@ -1,6 +1,6 @@ ## Install -Must use node v14 +Must use node v20 or greater ## Running on Electron diff --git a/README.md b/README.md index 3b98b7ce..821f8196 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ A transaction is displayed. ### Prerequisites -* Install node v14 +* Install node v20 ### To Install diff --git a/package.json b/package.json index b0b892d6..fe48319a 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,10 @@ "description": "Light wallet for Hathor Network", "author": "Hathor Labs (https://hathor.network/)", "version": "0.27.1-rc4", + "engines": { + "node": ">=20.0.0", + "npm": ">=10.0.0" + }, "private": true, "dependencies": { "@hathor/wallet-lib": "1.0.4", @@ -57,11 +61,11 @@ "main": "public/electron.js", "homepage": "./", "scripts": { - "build-css": "sass --no-source-map src/index.scss src/index.css", - "watch-css": "npm run build-css && sass --no-source-map -w src/index.scss src/index.css", - "start-js": "react-scripts start", + "build-css": "sass --no-source-map src/index.module.scss src/index.css", + "watch-css": "npm run build-css && sass --no-source-map -w src/index.module.scss src/index.css", + "start-js": "react-scripts --openssl-legacy-provider start", "start": "npm-run-all -p watch-css start-js", - "build-js": "react-scripts build", + "build-js": "react-scripts --openssl-legacy-provider build", "build": "npm-run-all build-css build-js", "test": "react-scripts test --env=./tests/env.js", "e2e": "cypress run", diff --git a/src/App.js b/src/App.js index 850df8a6..18776389 100644 --- a/src/App.js +++ b/src/App.js @@ -72,7 +72,7 @@ class Root extends React.Component { // When Ledger device loses connection or the app is closed if (this.props.ledgerClosed && !prevProps.ledgerClosed) { LOCAL_STORE.lock(); - this.props.history.push('/wallet_type/'); + this.props.history.push('/locked/'); } } diff --git a/src/ErrorWrapper.js b/src/ErrorWrapper.js index 912afdf9..c4b058c9 100644 --- a/src/ErrorWrapper.js +++ b/src/ErrorWrapper.js @@ -6,17 +6,20 @@ */ import React, { useEffect, useState } from 'react'; -import { Route } from 'react-router-dom'; +import { useHistory } from 'react-router-dom'; import $ from 'jquery'; import App from './App'; -import ModalUnhandledError from './components/ModalUnhandledError'; +import ModalUnhandledError, { UNHANDLED_ERROR_MODAL_ID_SELECTOR } from './components/ModalUnhandledError'; import 'bootstrap'; import 'bootstrap/dist/css/bootstrap.min.css'; import 'font-awesome/css/font-awesome.min.css'; import './index.css'; -function ErrorBoundary({ onError }) { +function ErrorBoundary(props) { + const { onError } = props; + const history = useHistory(); + const handleErrorEvent = (event) => { onError(event.error); } @@ -30,7 +33,7 @@ function ErrorBoundary({ onError }) { }, []); return ( - }/> + ) } @@ -41,7 +44,7 @@ function ErrorWrapper(props) { // Don't propagate error messages listened more than once if (newError !== error) { setError(error); - $('#unhandledErrorModal').modal('show'); + $(UNHANDLED_ERROR_MODAL_ID_SELECTOR).modal('show'); } } diff --git a/src/components/Loading.js b/src/components/Loading.js index abeab1cd..7dfe513d 100644 --- a/src/components/Loading.js +++ b/src/components/Loading.js @@ -7,7 +7,7 @@ import React from 'react'; import ReactLoading from 'react-loading'; -import colors from '../index.scss'; +import { colors } from '../constants'; const defaults = { width: 18, diff --git a/src/components/ModalSendTx.js b/src/components/ModalSendTx.js index c2ab98bd..56e2e98d 100644 --- a/src/components/ModalSendTx.js +++ b/src/components/ModalSendTx.js @@ -12,7 +12,7 @@ import $ from 'jquery'; import PropTypes from "prop-types"; import SendTxHandler from '../components/SendTxHandler'; import ReactLoading from 'react-loading'; -import colors from '../index.scss'; +import { colors } from '../constants'; const mapStateToProps = (state) => { diff --git a/src/components/ModalUnhandledError.js b/src/components/ModalUnhandledError.js index 1b4e4e50..e290b585 100644 --- a/src/components/ModalUnhandledError.js +++ b/src/components/ModalUnhandledError.js @@ -12,6 +12,9 @@ import { CopyToClipboard } from 'react-copy-to-clipboard'; import { walletReset } from '../actions'; import { connect } from 'react-redux'; +const UNHANDLED_ERROR_MODAL_ID = 'unhandledErrorModal'; +export const UNHANDLED_ERROR_MODAL_ID_SELECTOR = `#${UNHANDLED_ERROR_MODAL_ID}`; + const mapDispatchToProps = dispatch => { return { walletReset: () => dispatch(walletReset()), @@ -68,7 +71,7 @@ class ModalUnhandledError extends React.Component { const { renderError } = this.props const readableError = t`Error Message: ${message}\nStack trace: ${stack}` return ( -