Browse Source

Code formatting, small UI fix & Mirror video

all-modes
Miikat 8 years ago
parent
commit
92bdfd96f1
  1. 33
      react/src/components/dashboard/qrModal/qrModal.js
  2. 9
      react/src/components/dashboard/qrModal/qrModal.render.js
  3. 4
      react/src/components/dashboard/sendCoin/sendCoin.render.js

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

@ -1,6 +1,5 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import Store from '../../../store'; import Store from '../../../store';
import { translate } from '../../../translate/translate'; import { translate } from '../../../translate/translate';
import QrReader from 'react-qr-reader' import QrReader from 'react-qr-reader'
@ -12,59 +11,55 @@ import {
class QRModal extends React.Component { class QRModal extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
modalIsOpen: false, modalIsOpen: false,
error: "" error: ''
}; };
this.openModal = this.openModal.bind(this); this.openModal = this.openModal.bind(this);
this.closeModal = this.closeModal.bind(this); this.closeModal = this.closeModal.bind(this);
this.handleScan = this.handleScan.bind(this); this.handleScan = this.handleScan.bind(this);
this.handleError = this.handleError.bind(this); this.handleError = this.handleError.bind(this);
document.body.addEventListener('click', this.closeModal); document.body.addEventListener('click', this.closeModal);
} }
handleScan(data) { handleScan(data) {
if(data !== null) { if(data !== null) {
if(this.props.mode==="scan") { if(this.props.mode === 'scan') {
this.props.setRecieverFromScan(data) this.props.setRecieverFromScan(data)
} }
this.closeModal(); this.closeModal();
} }
return data;
} }
handleError(err) { handleError(err) {
this.setState({error: err}); this.setState({error: err});
} }
openModal() { openModal() {
this.setState({modalIsOpen: true}); this.setState({modalIsOpen: true});
if(this.props.mode==="scan") { if(this.props.mode === 'scan') {
ReactDOM.render(<QrReader ReactDOM.render(
delay={500} <QrReader
style={{ height: 281, width: 500, }} delay={50}
style={{ height: 281, width: 500, transform: 'scaleX(-1)' }}
onError={this.handleError} onError={this.handleError}
onScan={this.handleScan} onScan={this.handleScan} />, document.getElementById('webcam'));
/>, document.getElementById('webcam'));
} }
} }
closeModal() { closeModal() {
this.setState({modalIsOpen: false}); this.setState({modalIsOpen: false});
if(this.props.mode==="scan") { if(this.props.mode === 'scan') {
ReactDOM.unmountComponentAtNode(document.getElementById('webcam')); ReactDOM.unmountComponentAtNode(document.getElementById('webcam'));
} }
} }
render() { render() {
if(this.props.mode==="scan") { if(this.props.mode === 'scan') {
return QRModalReaderRender.call(this); return QRModalReaderRender.call(this);
} else { } else {
return QRModalRender.call(this); return QRModalRender.call(this);
} }
} }
} }

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

@ -5,8 +5,7 @@ import QRCode from 'qrcode.react';
export const QRModalRender = function () { export const QRModalRender = function () {
return ( return (
<span> <span>
<span <span className="label label-default margin-left-10 action"
className="label label-default margin-left-10 action"
title={ translate('INDEX.QRCODE') } title={ translate('INDEX.QRCODE') }
onClick={this.openModal}> onClick={this.openModal}>
<i className="icon fa-qrcode" aria-hidden="true"></i> <i className="icon fa-qrcode" aria-hidden="true"></i>
@ -48,7 +47,6 @@ export const QRModalRender = function () {
); );
}; };
export const QRModalReaderRender = function () { export const QRModalReaderRender = function () {
return ( return (
<span> <span>
@ -58,8 +56,7 @@ export const QRModalReaderRender = function () {
<i className="icon fa-qrcode" aria-hidden="true"></i> <i className="icon fa-qrcode" aria-hidden="true"></i>
{ translate('INDEX.SCAN_QRCODE_WEBCAM') } { translate('INDEX.SCAN_QRCODE_WEBCAM') }
</button> </button>
<div <div className={ 'modal modal-3d-sign ' + (this.state.modalIsOpen ? 'show in' : 'fade hide') }
className={ 'modal modal-3d-sign ' + (this.state.modalIsOpen ? 'show in' : 'fade hide') }
id="QRReadModal" id="QRReadModal"
aria-hidden="true" aria-hidden="true"
aria-labelledby="QRReadModal" aria-labelledby="QRReadModal"
@ -93,5 +90,3 @@ export const QRModalReaderRender = function () {
</span> </span>
); );
}; };

4
react/src/components/dashboard/sendCoin/sendCoin.render.js

@ -139,7 +139,7 @@ export const OASendUIRender = function () {
export const SendApiTypeSelectorRender = function () { export const SendApiTypeSelectorRender = function () {
return ( return (
<div className="row"> <div className="row">
<div className="col-lg-9 margin-bottom-10"> <div className="col-lg-8 margin-bottom-10">
<span className="pointer"> <span className="pointer">
<label className="switch"> <label className="switch">
<input <input
@ -156,7 +156,7 @@ export const SendApiTypeSelectorRender = function () {
</div> </div>
</span> </span>
</div> </div>
<div className="col-lg-3 text-right"> <div className="col-lg-4 text-right">
<QRModal <QRModal
mode="scan" mode="scan"
setRecieverFromScan={this.setRecieverFromScan} setRecieverFromScan={this.setRecieverFromScan}

Loading…
Cancel
Save