From 974ba4f691c4064e3721dbcc50290515549d78a6 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Mon, 9 Nov 2020 09:23:08 -0600 Subject: [PATCH] Simplify the QR code component (#9828) --- ui/app/components/ui/qr-code/qr-code.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ui/app/components/ui/qr-code/qr-code.js b/ui/app/components/ui/qr-code/qr-code.js index e81822130..b8990186e 100644 --- a/ui/app/components/ui/qr-code/qr-code.js +++ b/ui/app/components/ui/qr-code/qr-code.js @@ -9,15 +9,17 @@ import { checksumAddress } from '../../../helpers/utils/util' export default connect(mapStateToProps)(QrCodeView) function mapStateToProps(state) { + const { buyView, warning } = state.appState return { // Qr code is not fetched from state. 'message' and 'data' props are passed instead. - buyView: state.appState.buyView, - warning: state.appState.warning, + buyView, + warning, } } function QrCodeView(props) { - const { message, data } = props.Qr + const { Qr, warning } = props + const { message, data } = Qr const address = `${isHexPrefixed(data) ? 'ethereum:' : ''}${checksumAddress( data, )}` @@ -29,7 +31,7 @@ function QrCodeView(props) {
{Array.isArray(message) ? (
- {props.Qr.message.map((msg, index) => ( + {message.map((msg, index) => (
{msg}
@@ -38,11 +40,7 @@ function QrCodeView(props) { ) : ( message &&
{message}
)} - {props.warning - ? props.warning && ( - {props.warning} - ) - : null} + {warning && {warning}}