diff --git a/src/libs/material-ui/components/transactions/transaction_signing_overlay.jsx b/src/libs/material-ui/components/transactions/transaction_signing_overlay.jsx index ade1877..2a2bf0e 100644 --- a/src/libs/material-ui/components/transactions/transaction_signing_overlay.jsx +++ b/src/libs/material-ui/components/transactions/transaction_signing_overlay.jsx @@ -2,7 +2,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import classnames from 'classnames'; import { connect } from 'react-redux'; import Dialog from '@material-ui/core/Dialog'; @@ -10,16 +9,8 @@ import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; import DialogTitle from '@material-ui/core/DialogTitle'; import Grid from '@material-ui/core/Grid'; -import Collapse from '@material-ui/core/Collapse'; -import Typography from '@material-ui/core/Typography'; -import Card from '@material-ui/core/Card'; -import TextField from '@material-ui/core/TextField'; -import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; -import Slider from '@digix/mui/lib/components/SimpleSlider'; -import '@digix/mui/lib/assets/css/simpleSlider.css'; - -import { withStyles } from '@material-ui/core/styles'; +import { GasPrice } from '@digix/governance-ui-components/src/components/common'; import Button from '@material-ui/core/Button'; import LinearProgress from '@material-ui/core/LinearProgress'; @@ -36,109 +27,18 @@ const defaultState = { autoBroadcast: true, signedTx: null, signingAction: undefined, - openAdvanced: false, gasPrice: 20, showAdvancedTab: true, }; -const styles = theme => ({ - expand: { - transform: 'rotate(0deg)', - transition: theme.transitions.create('transform', { - duration: theme.transitions.duration.shortest - }) - }, - slider: { - margin: '3em 0 0 0' - }, - advancedBtn: { - fontWeight: '300', - border: 0, - marginTop: '1.5em', - padding: 0, - fontSize: '0.8em', - textAlign: 'center' - }, - expandOpen: { - transform: 'rotate(180deg)' - }, - card: { - padding: '2rem', - borderRadius: '.5rem', - background: 'rgba(70, 78, 91, 0.2);', - boxShadow: 'none', - textAlign: 'center', - [theme.breakpoints.between('xs', 'sm')]: { - padding: '2em 1em' - } - }, - noPadding: { - display: 'flex', - alignItems: 'center', - padding: '0 !important' - }, - typography: { - margin: '1em 0 2em 0', - color: '#000' - }, - voteSelection: { - background: '#E2CE98', - borderRadius: '50px', - textAlign: 'center', - padding: '0 !important' - }, - selected: { - margin: '0', - // color: globalVars.tertiaryColor, - fontSize: '1.5em', - paddingRight: '1rem' - }, - textField: { - // color: globalVars.tertiaryColor, - width: 'auto', - textAlign: 'center', - fontSize: '1.1em', - fontWeight: '600', - '&': { - '-moz-appearance': 'textfield' - }, - '&::-webkit-inner-spin-button, &::-webkit-inner-spin-button': { - '-webkit-appearance': 'none', - margin: 0 - } - }, - noBorder: { - border: '0', - '&::before': { - borderBottom: '0' - }, - ':hover': { - border: 'none' - } - }, - minValue: { - textAlign: 'left', - fontSize: '1.3em', - color: '#000', - marginTop: '1em' - }, - maxValue: { - textAlign: 'right', - fontSize: '1.3em', - color: '#000', - marginTop: '1em' - } -}); - class TransactionSigningOverlay extends Component { static propTypes = { data: PropTypes.object, hideTxSigningModal: PropTypes.func.isRequired, - classes: PropTypes.object.isRequired }; static defaultProps = { - data: undefined + data: undefined, }; constructor(props) { @@ -150,7 +50,7 @@ class TransactionSigningOverlay extends Component { this.handleSign = this.handleSign.bind(this); } - componentWillReceiveProps = nextProps => { + componentWillReceiveProps = (nextProps) => { const { data } = nextProps; if (data) { const { txData } = data; @@ -159,10 +59,10 @@ class TransactionSigningOverlay extends Component { } }; - setGasPrice = gasPrice => { + setGasPrice = (gasPrice) => { // this.props.setTxFee(gasPrice); this.setState({ - gasPrice + gasPrice, }); }; @@ -206,10 +106,10 @@ class TransactionSigningOverlay extends Component { this.props.hideTxSigningModal({ error: t.cancelled }); } - handleChange = (name, { min, max }) => event => { + handleChange = (name, { min, max }) => (event) => { const value = parseFloat(event.target.value) || min; this.setState({ - [name]: value > max ? max : value + [name]: value > max ? max : value, }); }; @@ -217,99 +117,6 @@ class TransactionSigningOverlay extends Component { this.setState({ showAdvancedTab: false }); } - toggleAdvancedTab = (e) => { - e.preventDefault(); - const { logTxn } = this.props.data; - const { openAdvanced } = this.state; - - if (logTxn) { - logTxn.toggleAdvanced(!openAdvanced); - } - - this.setState({ openAdvanced: !openAdvanced }); - } - - renderAdvancedTab() { - const t = this.props.data.translations.common; - const { classes } = this.props; - const { gasPrice, openAdvanced, showAdvancedTab } = this.state; - - if (!showAdvancedTab) { - return null; - } - - const MIN_GWEI = 1; - const MAX_GWEI = 100; - const range = { - min: MIN_GWEI, - max: MAX_GWEI, - }; - - const inputProps = { - step: 1, - ...range, - className: classes.textField, - }; - - const classProps = { - classes: { - root: classes.textField, - input: classes.noBorder, - underline: classes.noBorder, - }, - }; - - return ( -