Browse Source

hide qr code scan btn if device check failed

all-modes
pbca26 8 years ago
parent
commit
b17b4cf8d4
  1. 2
      react/src/components/dashboard/qrModal/qrModal.js
  2. 76
      react/src/components/dashboard/qrModal/qrModal.render.js
  3. 6
      react/src/components/dashboard/qrModal/qrModal.scss

2
react/src/components/dashboard/qrModal/qrModal.js

@ -14,6 +14,7 @@ class QRModal extends React.Component {
this.state = { this.state = {
modalIsOpen: false, modalIsOpen: false,
error: null, error: null,
errorShown: false,
}; };
this.openModal = this.openModal.bind(this); this.openModal = this.openModal.bind(this);
this.closeModal = this.closeModal.bind(this); this.closeModal = this.closeModal.bind(this);
@ -65,6 +66,7 @@ class QRModal extends React.Component {
closeModal() { closeModal() {
this.setState({ this.setState({
modalIsOpen: false, modalIsOpen: false,
errorShown: this.state.error ? true : false,
}); });
} }

76
react/src/components/dashboard/qrModal/qrModal.render.js

@ -2,7 +2,7 @@ import React from 'react';
import { translate } from '../../../translate/translate'; import { translate } from '../../../translate/translate';
import QRCode from 'qrcode.react'; import QRCode from 'qrcode.react';
export const QRModalRender = function () { export const QRModalRender = function() {
return ( return (
<span> <span>
<span className="label label-default margin-left-10 action" <span className="label label-default margin-left-10 action"
@ -41,48 +41,46 @@ export const QRModalRender = function () {
); );
}; };
export const QRModalReaderRender = function () { export const QRModalReaderRender = function() {
return ( if (!this.state.errorShown) {
<span> return (
<button type="button" <span>
className="btn btn-default" <button type="button"
onClick={ this.openModal }> className="btn btn-default"
<i className="icon fa-qrcode"></i> onClick={ this.openModal }>
{ translate('INDEX.SCAN_QRCODE_WEBCAM') } <i className="icon fa-qrcode"></i>
</button> { translate('INDEX.SCAN_QRCODE_WEBCAM') }
<div </button>
className={ 'modal modal-3d-sign ' + (this.state.modalIsOpen ? 'show in' : 'fade hide') } <div
id="QRReadModal"> className={ 'modal modal-3d-sign ' + (this.state.modalIsOpen ? 'show in' : 'fade hide') }
<div className="modal-dialog modal-center modal-md"> id="QRReadModal">
<div className="modal-content"> <div className="modal-dialog modal-center modal-md">
<div className="modal-header bg-orange-a400 wallet-send-header"> <div className="modal-content">
<button <div className="modal-header bg-orange-a400 wallet-send-header">
type="button" <button
className="close white" type="button"
onClick={ this.closeModal }> className="close white"
<span>×</span> onClick={ this.closeModal }>
</button> <span>×</span>
<h4 className="modal-title white text-left">{ translate('INDEX.SCAN_QRCODE_WEBCAM') }</h4> </button>
</div> <h4 className="modal-title white text-left">{ translate('INDEX.SCAN_QRCODE_WEBCAM') }</h4>
<div className="modal-body"> </div>
<div className="animsition vertical-align fade-in"> <div className="modal-body">
<div <div className="animsition vertical-align fade-in">
className="page-content vertical-align-middle" <div className="page-content vertical-align-middle webcam-frame">
style={{ <div id="webcam">
width: '100%', { this.state.error }
textAlign: 'center', </div>
fontSize: '16px'
}}>
<div id="webcam">
{ this.state.error }
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> <div className={ 'modal-backdrop ' + (this.state.modalIsOpen ? 'show in' : 'fade hide') }></div>
<div className={ 'modal-backdrop ' + (this.state.modalIsOpen ? 'show in' : 'fade hide') }></div> </span>
</span> );
); } else {
return null;
}
}; };

6
react/src/components/dashboard/qrModal/qrModal.scss

@ -2,4 +2,10 @@
position: absolute; position: absolute;
top: 15px; top: 15px;
right: 30px; right: 30px;
}
.webcam-frame {
width: 100%;
text-align: center;
font-size: 16px;
} }
Loading…
Cancel
Save