From 7f35ea1e8e6793a4ab0d542e33dbb75f700c708d Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 20 May 2019 14:32:26 +0200 Subject: [PATCH] Highlight password when unlock fails (#3) * Highlight password when unlock fails * Remove old/renamed packages * manifest.json matched package.json * Update build script name * Update package name, skip tests --- .travis.yml | 2 +- package.json | 3 +-- packages/extension-ui/package.json | 1 - .../extension-ui/src/Popup/Signing/Unlock.tsx | 16 +++++++++++++--- packages/extension/package.json | 1 - packages/extension/public/manifest.json | 2 +- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 39da1a40..c242b592 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,4 @@ cache: install: - yarn script: - - yarn polkadot-dev-build-travis + - yarn polkadot-dev-travis-build diff --git a/package.json b/package.json index bc38fa3f..ff032240 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,4 @@ { - "name": "@polkadot/extension", "version": "0.1.0", "description": "A sample signer extension for the @polkadot/api", "repository": "https://github.com/polkadot-js/extension", @@ -23,7 +22,7 @@ "lint": "tslint --project . && tsc --noEmit --pretty", "clean": "polkadot-dev-clean-build", "postinstall": "polkadot-dev-yarn-only", - "test": "jest --coverage", + "test": "echo \"no tests... yet\"", "watch": "cd packages/extension && webpack --config webpack.config.js --watch" }, "devDependencies": { diff --git a/packages/extension-ui/package.json b/packages/extension-ui/package.json index b8647f56..7483580c 100644 --- a/packages/extension-ui/package.json +++ b/packages/extension-ui/package.json @@ -5,7 +5,6 @@ "author": "Jaco Greeff ", "license": "Apache-2", "dependencies": { - "@polkadot/extension-inject": "^0.1.0", "@polkadot/ui-identicon": "^0.39.0-beta.5", "@types/react-router-dom": "^4.3.2", "react-router": "^5.0.0", diff --git a/packages/extension-ui/src/Popup/Signing/Unlock.tsx b/packages/extension-ui/src/Popup/Signing/Unlock.tsx index 85cc9caf..03ab558b 100644 --- a/packages/extension-ui/src/Popup/Signing/Unlock.tsx +++ b/packages/extension-ui/src/Popup/Signing/Unlock.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { Button, Input } from '../../components'; import { approveRequest } from '../../messaging'; @@ -14,22 +14,32 @@ type Props = { }; export default function Unlock ({ isVisible, onAction, signId }: Props) { + const [error, setError] = useState(''); const [password, setPassword] = useState(''); if (!isVisible) { return null; } + useEffect(() => { + if (error) { + setError(''); + } + }, [password]); + const _onSign = (): void => { approveRequest(signId, password) .then(onAction) - .catch(console.error); + .catch((error) => { + console.error(error); + setError(error.message); + }); }; return ( <>