diff --git a/.gitignore b/.gitignore index c40f87b..aa04cf5 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,6 @@ yarn-error.log* /sync /.cache /now.json + +.browserslistrc + diff --git a/.travis.yml b/.travis.yml index 60e0515..b9300c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ cache: - node_modules - desktop/node_modules - "~/.cache/Cypress" - - build + - dist before_install: - openssl aes-256-cbc -K $encrypted_63d69a2d54d1_key -iv $encrypted_63d69a2d54d1_iv -in cypress/fixtures/accounts.json.enc -out cypress/fixtures/accounts.json -d @@ -55,9 +55,9 @@ deploy: condition: $TRAVIS_JOB_NAME = Release - provider: pages verbose: true - local-dir: build + local-dir: dist/build skip-cleanup: true github-token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable on: branch: master - condition: $TRAVIS_JOB_NAME = Release \ No newline at end of file + condition: $TRAVIS_JOB_NAME = Release diff --git a/package.json b/package.json index 74d8d8a..1bd6476 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "delay": "^4.1.0", "downshift": "^3.1.7", "dpos-ledger-api": "^3.0.1", - "dpos-offline": "^3.0.2", + "dpos-offline": "^3.0.4", "inobounce": "^0.1.6", "is-mobile": "^2.0.0", "jdenticon": "^2.1.0", @@ -37,7 +37,7 @@ "react-dom": "^16.6.3", "react-helmet": "^5.2.0", "react-intl": "^2.7.2", - "react-scripts-ts": "3.1.0", + "react-scripts": "^3.0.1", "regenerator-runtime": "^0.13.2", "risejs": "^1.4.1", "sinon": "^7.2.2", @@ -49,17 +49,16 @@ "unique-random": "^2.0.0", "utils": "^0.3.1" }, - "browserslist": [ - "last 1 Chrome version" - ], "scripts": { - "clean-es6-module": "rm -R dist/build-es6", - "start": "yarn clean-es6-module; parcel --out-dir dist/build-es6 src/dev.html --https", - "start-http": "yarn clean-es6-module; parcel --out-dir dist/build-es6 src/dev.html", - "build": "react-scripts-ts build", - "build-es6-module": "yarn clean-es6-module; parcel build --out-dir dist/build-es6 src/dev.html", + "set-build:dev": "rm .browserslistrc; cp scripts/browserslistrc-dev .browserslistrc", + "set-build:compat": "rm .browserslistrc; cp scripts/browserslistrc-compat .browserslistrc", + "clean-dev-build": "rm -R dist/build-dev", + "start": "yarn set-build:dev; yarn clean-dev-build; parcel --out-dir dist/build-dev src/dev.html --https", + "start-http": "yarn set-build:dev; yarn clean-dev-build; parcel --out-dir dist/build-dev src/dev.html", + "build": "yarn set-build:compat; rm -R dist/build; parcel build --out-dir dist/build src/dev.html", + "build-dev": "yarn set-build:dev; yarn clean-dev-build; mkdirp build/dev; parcel build --out-dir dist/build-dev src/dev.html", "bundle": "cd desktop; yarn bundle", - "deploy-now": "yarn build; cd build && now && now alias rise-wallet", + "deploy-now": "yarn build; cd dist/build && now && now alias rise-wallet", "cypress": "cypress open", "test": "run-p --race serve test-cypress", "test-ci": "run-p --race serve test-cypress", @@ -68,7 +67,6 @@ "test-unit": "jest", "test-unit:prepare": "rm -rf tmp/unit-test/; tsc --project tsconfig.test.json", "test-unit:prepare-watch": "rm -rf tmp/unit-test/; tsc --watch --project tsconfig.test.json", - "eject": "react-scripts-ts eject", "release": "./scripts/release.sh", "intl:prepare": "babel -o tmp/transpiled-bundle.js --config-file './babelrc.intl.js' $(./scripts/intl-files.sh)", "intl:export": "bash scripts/intl-export.sh", @@ -85,15 +83,15 @@ "precommit" ], "devDependencies": { - "@babel/plugin-proposal-decorators": "^7.4.4", - "@babel/preset-typescript": "^7.3.3", "@babel/cli": "^7.4.4", "@babel/core": "^7.4.5", + "@babel/plugin-proposal-decorators": "^7.4.4", "@babel/plugin-syntax-dynamic-import": "^7.2.0", "@babel/polyfill": "^7.0.0", "@babel/preset-env": "^7.4.5", "@babel/preset-es2015": "^7.0.0-beta.53", "@babel/preset-react": "^7.0.0", + "@babel/preset-typescript": "^7.3.3", "@bahmutov/add-typescript-to-cypress": "^2.0.0", "@types/bip39": "^2.4.1", "@types/bytebuffer": "^5.0.37", diff --git a/scripts/browserslistrc-compat b/scripts/browserslistrc-compat new file mode 100644 index 0000000..d942b2f --- /dev/null +++ b/scripts/browserslistrc-compat @@ -0,0 +1,3 @@ +# file changes depending on the build command +since 2015 +> 1% diff --git a/scripts/browserslistrc-dev b/scripts/browserslistrc-dev new file mode 100644 index 0000000..066547a --- /dev/null +++ b/scripts/browserslistrc-dev @@ -0,0 +1,2 @@ +# file changes depending on the build command +last 1 Chrome version diff --git a/scripts/release.sh b/scripts/release.sh index 38632ae..5713a81 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -7,8 +7,8 @@ rm -f release.zip rm -rf releases mkdir releases # place the web release archive in /releases with a proper version number -pushd build +pushd dist/build zip -r ../releases/rise-wallet-web-$VERSION.zip * popd # create a CNAME file for a custom domain in gh-pages -printf "gh-wallet.rise.vision\n" > build/CNAME +printf "gh-wallet.rise.vision\n" > dist/build/CNAME diff --git a/src/components/content/RegisterDelegateDialogContent.tsx b/src/components/content/RegisterDelegateDialogContent.tsx index 6b9e067..1791c59 100644 --- a/src/components/content/RegisterDelegateDialogContent.tsx +++ b/src/components/content/RegisterDelegateDialogContent.tsx @@ -51,7 +51,7 @@ type BaseProps = WithStyles & DialogContentProps; interface Props extends BaseProps, ICloseInterruptFormProps { delegateFee: RawAmount; registeredUsername?: string; - forgingPK: string; + forgingPK: string | null; error?: null | 'insufficient-funds'; onSubmit: (data: StateForm) => void; onClose: ReactEventHandler<{}>; @@ -120,8 +120,8 @@ class RegisterDelegateDialogContent extends React.Component< state: State = { username: '', usernameInvalid: false, - mnemonic: null, - mnemonicInvalid: null, + mnemonic: '', + mnemonicInvalid: false, forgingPK: '' }; @@ -338,7 +338,7 @@ class RegisterDelegateDialogContent extends React.Component< const { mnemonic, mnemonicInvalid } = this.state; const { registeredUsername, classes } = this.props; - const forgingPK = this.state.forgingPK || this.props.forgingPK; + const forgingPK = this.state.forgingPK || this.props.forgingPK || ''; const alreadyRegistered = Boolean(registeredUsername); return ( diff --git a/src/containers/onboarding/AddAccountPage.tsx b/src/containers/onboarding/AddAccountPage.tsx index 4c2b289..355dbca 100644 --- a/src/containers/onboarding/AddAccountPage.tsx +++ b/src/containers/onboarding/AddAccountPage.tsx @@ -95,6 +95,15 @@ class AddAccountPage extends React.Component { /> ); break; + case 'devnet': + network = ( + + ); + break; case 'custom': network = ( { handleChange = (event: React.ChangeEvent) => { this.setState({ network: event.target.value as NetworkType }); - } + }; handleSetNetwork = (network: NetworkType) => () => { this.setState({ network }); - } + }; handleCustomURL = (event: React.ChangeEvent) => { this.setState({ url: event.target.value, urlError: false }); - } + }; handleSubmit = async (e: FormEvent) => { e.preventDefault(); @@ -116,11 +118,12 @@ class ChooseNetworkPage extends React.Component { walletStore.setNetwork(network, url); routerStore.goTo(onboardingAddAccountRoute); } - } + }; render() { const { classes } = this.injected; - const { network, url, urlError } = this.state; + const { network } = this.state; + // const { network, url, urlError } = this.state; return ( @@ -165,7 +168,23 @@ class ChooseNetworkPage extends React.Component { /> - + + + + + + + {/* { value={url} /> - + */}