diff --git a/src/actions/dashboard/index.js b/src/actions/dashboard/index.js index 450b7c078..32fbc6e45 100644 --- a/src/actions/dashboard/index.js +++ b/src/actions/dashboard/index.js @@ -2,21 +2,17 @@ import {getBlockAction} from "../../actions/blocks"; import {getTransactionsAction} from "../../actions/transactions"; import {getAccountCurrenciesAction} from "../../actions/currencies"; import { - getDGSGoodsCountAction, - getDGSPurchaseCountAction, getDGSPurchasesAction, getDGSGoodsAction, getDGSPendingPurchases } from "../../actions/marketplace"; -import {getAccountAssetsAction, getAssetAction, getSpecificAccountAssetsAction} from '../../actions/assets' +import {getAccountAssetsAction, getAssetAction} from '../../actions/assets' import {getAliasesCountAction} from '../../actions/aliases' import {getMessages} from "../../actions/messager"; -// import {BlockUpdater} from "../../block-subscriber/index"; import {getAllTaggedDataAction} from "../../actions/datastorage"; import {getActiveShfflings, getShufflingAction} from "../../actions/shuffling"; import {getpollsAction} from "../../actions/polls"; import {getAccountInfoAction} from "../../actions/account"; -import {LOAD_ACCOUNT} from "../../modules/account"; export const getDashboardData = () => (dispatch, getState, subscribe) => { diff --git a/src/actions/generators/generator/index.js b/src/actions/generators/generator/index.js index 2ad4878e0..1d6d185b7 100644 --- a/src/actions/generators/generator/index.js +++ b/src/actions/generators/generator/index.js @@ -3,62 +3,72 @@ * * ******************************************************************************/ +import React from "react"; +import { connect } from "react-redux"; +import { v4 as uuidv4 } from "uuid"; +import { setBodyModalParamsAction } from "../../../modules/modals"; +import { formatTimestamp } from "../../../helpers/util/time"; +import { toEpochTime } from "../../../helpers/util/time"; +import Button from "../../../containers/components/button"; -import React from 'react'; -import {connect} from 'react-redux'; -import { v4 as uuidv4 } from 'uuid'; -import {setBodyModalParamsAction} from "../../../modules/modals"; -import {formatTimestamp} from "../../../helpers/util/time"; -import {toEpochTime} from "../../../helpers/util/time" - -const mapDispatchToProps = dispatch => ({ - formatTimestamp: (timestamp, date_only, isAbsoluteTime) => dispatch(formatTimestamp(timestamp, date_only, isAbsoluteTime)), - setBodyModalParamsAction: (type, data, valueForModal) => dispatch(setBodyModalParamsAction(type, data, valueForModal)), +const mapDispatchToProps = (dispatch) => ({ + formatTimestamp: (timestamp, date_only, isAbsoluteTime) => + dispatch(formatTimestamp(timestamp, date_only, isAbsoluteTime)), + setBodyModalParamsAction: (type, data, valueForModal) => + dispatch(setBodyModalParamsAction(type, data, valueForModal)), }); class Generator extends React.Component { - state = { - remaining: 0 - }; + state = { + remaining: 0, + }; - initTimer = () => { - const remaining = this.props.deadline - (toEpochTime(undefined, this.props.epochB) - this.props.resTimestamps) + 20; - this.setState({ - remaining - }); - }; + initTimer = () => { + const remaining = + this.props.deadline - + (toEpochTime(undefined, this.props.epochB) - this.props.resTimestamps) + + 20; + this.setState({ + remaining, + }); + }; - timer = {}; + timer = {}; - componentDidMount() { - this.timer = setInterval(this.initTimer, 1000); - } + componentDidMount() { + this.timer = setInterval(this.initTimer, 1000); + } - componentWillUnmount() { - clearInterval(this.timer); - } + componentWillUnmount() { + clearInterval(this.timer); + } - render() { - const {setBodyModalParamsAction, account, accountRS, effectiveBalanceAPL, hitTime, deadline} = this.props; - return ( - - - setBodyModalParamsAction('INFO_ACCOUNT', account)}>{accountRS} - - - {effectiveBalanceAPL.toLocaleString('en')} - - - {this.props.formatTimestamp(hitTime)} - - {deadline} - - {/* - {this.state.remaining} - */} - - ); - } + render() { + const { + setBodyModalParamsAction, + account, + accountRS, + effectiveBalanceAPL, + hitTime, + deadline, + } = this.props; + return ( + + + - } - - - - - ) - } + + + - - View + View + diff --git a/src/containers/account/active-shufflings/shuffling-item/index.js b/src/containers/account/active-shufflings/shuffling-item/index.js index 743c9329a..a2fa2b30a 100644 --- a/src/containers/account/active-shufflings/shuffling-item/index.js +++ b/src/containers/account/active-shufflings/shuffling-item/index.js @@ -3,101 +3,86 @@ * * ******************************************************************************/ - -import React from 'react'; -import { Link } from 'react-router-dom'; +import React from "react"; +import { Link } from "react-router-dom"; import { setBodyModalParamsAction } from "../../../../modules/modals"; import { connect } from "react-redux"; +import Button from "../../../components/button"; -const mapStateToProps = state => ({ +const mapStateToProps = (state) => ({ decimals: state.account.decimals, ticker: state.account.ticker, }); -const mapDispatchToProps = dispatch => ({ - setBodyModalParamsAction: (type, data, valueForModal) => dispatch(setBodyModalParamsAction(type, data, valueForModal)), +const mapDispatchToProps = (dispatch) => ({ + setBodyModalParamsAction: (type, data, valueForModal) => + dispatch(setBodyModalParamsAction(type, data, valueForModal)), }); const ShufflingItem = (props) => { - return ( - - - props.getTransaction(props.shuffling)}> - {props.shuffling} - - - - { - props.stage === 0 && - 'Registration' - } - { - props.stage === 1 && - 'Processing' - } - { - props.stage === 4 && - 'Expired' - } - { - props.stage === 5 && - 'Done' - } - - - { - props.holdingType === 0 && - props.ticker - } - { - props.holdingType === 1 && - - {props.holding} (Asset) - - } - { - props.holdingType === 2 && - - {props.holding} (Currency) - - } - - - {props.amount / props.decimals} - { - props.blocksRemaining ? - {props.blocksRemaining} : null - } + return ( + + + - - - - ); - } + return ( + + + + name={"Approve"} + /> diff --git a/src/containers/account/asset-exchange/asset/index.js b/src/containers/account/asset-exchange/asset/index.js index 85c9631c3..d76062fe9 100644 --- a/src/containers/account/asset-exchange/asset/index.js +++ b/src/containers/account/asset-exchange/asset/index.js @@ -3,83 +3,86 @@ * * ******************************************************************************/ - -import React from 'react'; -import { v4 as uuidv4 } from 'uuid'; +import React from "react"; +import { v4 as uuidv4 } from "uuid"; import crypto from "../../../../helpers/crypto/crypto"; import converters from "../../../../helpers/converters"; -import {setBodyModalParamsAction} from "../../../../modules/modals"; -import {connect} from 'react-redux'; +import { setBodyModalParamsAction } from "../../../../modules/modals"; +import { connect } from "react-redux"; +import Button from '../../../components/button'; class Asset extends React.Component { - constructor(props) { - super(props); + constructor(props) { + super(props); - this.state = { - entry: this.props.entry - } - } + this.state = { + entry: this.props.entry, + }; + } - componentWillMount() { - if (this.props.entry.encryptedLedgerEntry) { - var options = { - publicKey : converters.hexStringToByteArray(this.props.publicKey), - privateKey : converters.hexStringToByteArray(this.props.privateKey), - }; + componentWillMount() { + if (this.props.entry.encryptedLedgerEntry) { + var options = { + publicKey: converters.hexStringToByteArray(this.props.publicKey), + privateKey: converters.hexStringToByteArray(this.props.privateKey), + }; - options.sharedKey = this.props.sharedKey; + options.sharedKey = this.props.sharedKey; - var decrypted = crypto.decryptDataStreamAPL(this.props.entry.encryptedLedgerEntry, options); - decrypted = decrypted.message; + var decrypted = crypto.decryptDataStreamAPL( + this.props.entry.encryptedLedgerEntry, + options + ); + decrypted = decrypted.message; - decrypted = converters.hexStringToStringAPL(decrypted); - decrypted = decrypted.slice(0, decrypted.lastIndexOf('}') + 1); - decrypted = JSON.parse(decrypted); + decrypted = converters.hexStringToStringAPL(decrypted); + decrypted = decrypted.slice(0, decrypted.lastIndexOf("}") + 1); + decrypted = JSON.parse(decrypted); - this.setState({ - entry: decrypted - }) - } + this.setState({ + entry: decrypted, + }); } + } - render () { - if (!this.state.entry.encryptedLedgerEntry) { - return ( - - - {this.state.entry.timestamp} - - - {this.state.entry.eventType} - - - -{this.state.entry.change / this.props.decimals} - {(this.state.entry.balance / this.props.decimals).toFixed(2)} - - - - - - - - - - - ); - } else { - return ( - encrypted - ) - } + render() { + if (!this.state.entry.encryptedLedgerEntry) { + return ( + + + - View - - - +const FinishedpollsItem = (props) => ( + + +
diff --git a/src/containers/account/funding-monitors/index.js b/src/containers/account/funding-monitors/index.js index 6c40361da..00a36d542 100644 --- a/src/containers/account/funding-monitors/index.js +++ b/src/containers/account/funding-monitors/index.js @@ -9,7 +9,6 @@ import SiteHeader from '../../components/site-header' import { v4 as uuidv4 } from 'uuid'; import {setBodyModalParamsAction} from "../../../modules/modals"; import {connect} from "react-redux"; -import ContentLoader from '../../components/content-loader' import ContentHendler from '../../components/content-hendler' import {getFundingMonitorsAction} from '../../../actions/monitors' import InfoBox from '../../components/info-box' @@ -77,18 +76,13 @@ class FundingMonitors extends React.Component { - this.props.setBodyModalParamsAction("ADD_MONITOR", this.reloadFundingMonitors)}> Add monitor - +
- {/*
*/} - {/*

Incorrect "adminPassword" (locked for 1 hour, too many incorrect password*/} - {/*attempts)

*/} - {/*
*/} - { this.state.monitors && this.state.monitors.errorCode && diff --git a/src/containers/account/funding-monitors/monitor-item/index.js b/src/containers/account/funding-monitors/monitor-item/index.js index 77b66dbcc..c18e968ef 100644 --- a/src/containers/account/funding-monitors/monitor-item/index.js +++ b/src/containers/account/funding-monitors/monitor-item/index.js @@ -4,6 +4,7 @@ import {Link} from 'react-router-dom'; import {setBodyModalParamsAction} from "../../../../modules/modals"; import {stopMonitor} from "../../../../actions/monitors"; import {NotificationManager} from 'react-notifications' +import Button from "../../../components/button"; const mapStateToProps = state => ({ adminPassword: state.account.adminPassword, @@ -33,12 +34,11 @@ const stopMonitorAction = (props) => { const MonitorItem = (props) => ( - props.setBodyModalParamsAction('INFO_ACCOUNT', props.accountRS)} - > - {props.accountRS} - + name={props.accountRS} + /> ( > Status - + name={"Stop"} + /> ) diff --git a/src/containers/account/ledger/entry/index.jsx b/src/containers/account/ledger/entry/index.jsx index 3818cec35..5a3f4f2be 100644 --- a/src/containers/account/ledger/entry/index.jsx +++ b/src/containers/account/ledger/entry/index.jsx @@ -31,7 +31,7 @@ export default function Entry(props) { <> {ledgerId && ( - + - - +
); -export default connect(mapStateToProps, mapDispatchToProps)(MarketplaceTableItem); +export default connect( + mapStateToProps, + mapDispatchToProps +)(MarketplaceTableItem); diff --git a/src/containers/account/marketplace/marketplace-tags/index.js b/src/containers/account/marketplace/marketplace-tags/index.js index 4c757825f..db3ab2734 100644 --- a/src/containers/account/marketplace/marketplace-tags/index.js +++ b/src/containers/account/marketplace/marketplace-tags/index.js @@ -1,14 +1,12 @@ import React, {Component} from 'react'; import classNames from 'classnames'; import {Form, Text} from 'react-form'; -import InputMask from 'react-input-mask' import {connect} from 'react-redux'; import {getDGSTagsAction,} from '../../../../actions/marketplace' import { v4 as uuidv4 } from 'uuid'; import {Link, withRouter} from 'react-router-dom'; import AccountRS from "../../../components/account-rs"; import {NotificationManager} from "react-notifications"; -import { thisExpression } from '@babel/types'; class MarketplaceTags extends Component { state = { diff --git a/src/containers/account/messenger/chat/chat-form.js b/src/containers/account/messenger/chat/chat-form.js index 6a74ec04d..7406c36c4 100644 --- a/src/containers/account/messenger/chat/chat-form.js +++ b/src/containers/account/messenger/chat/chat-form.js @@ -1,5 +1,5 @@ import React from 'react'; -import {Checkbox, Form, Text, TextArea} from 'react-form'; +import {Form, Text, TextArea} from 'react-form'; import {withRouter} from 'react-router-dom'; import {connect} from 'react-redux'; import {handleSendMessageFormSubmit} from './handleFormSubmit'; diff --git a/src/containers/account/messenger/chat/handleFormSubmit.js b/src/containers/account/messenger/chat/handleFormSubmit.js index ea43d67fd..a10a38b5d 100644 --- a/src/containers/account/messenger/chat/handleFormSubmit.js +++ b/src/containers/account/messenger/chat/handleFormSubmit.js @@ -1,53 +1,64 @@ -import {NotificationManager} from 'react-notifications'; -import submitForm from '../../../../helpers/forms/forms'; +import { NotificationManager } from "react-notifications"; +import submitForm from "../../../../helpers/forms/forms"; export const handleSendMessageFormSubmit = (values) => { - return async (dispatch, getState) => { - const {account: {account, puplicKey}} = getState(); - const {recipient, resetForm} = values; - - delete values.resetForm; - - if (!values.message || values.message.length === 0 || !(/\S/.test(values.message))) { - NotificationManager.error('Please write your message.', 'Error', 5000); - return; - } - - if (values.message.length > 100) { - NotificationManager.error('Message must not exceed 100 characters.', 'Error', 5000); - return; - } - - if (values.messageToEncrypt) { - values = { - ...values, - messageToEncrypt: values.message, - // message: null - }; - delete values.message; - } - - if (!values.secretPhrase) { - NotificationManager.error('Enter secret phrase.', 'Error', 5000); - return; - } - - const secretPhrase = JSON.parse(JSON.stringify(values.secretPhrase)); - // delete values.secretPhrase; - - const res = await dispatch(submitForm.submitForm({ - ...values, - recipient, - secretPhrase, - feeATM: 4 - }, 'sendMessage')); - - if (res && res.errorCode) { - NotificationManager.error(res.errorDescription, 'Error', 5000); - } else if (res && !res.errorCode) { - resetForm(); - NotificationManager.success('Message has been submitted!', null, 5000); - } - return; + return async (dispatch, getState) => { + const { recipient, resetForm } = values; + + delete values.resetForm; + + if ( + !values.message || + values.message.length === 0 || + !/\S/.test(values.message) + ) { + NotificationManager.error("Please write your message.", "Error", 5000); + return; + } + + if (values.message.length > 100) { + NotificationManager.error( + "Message must not exceed 100 characters.", + "Error", + 5000 + ); + return; + } + + if (values.messageToEncrypt) { + values = { + ...values, + messageToEncrypt: values.message, + }; + delete values.message; + } + + if (!values.secretPhrase) { + NotificationManager.error("Enter secret phrase.", "Error", 5000); + return; + } + + const secretPhrase = JSON.parse(JSON.stringify(values.secretPhrase)); + // delete values.secretPhrase; + + const res = await dispatch( + submitForm.submitForm( + { + ...values, + recipient, + secretPhrase, + feeATM: 4, + }, + "sendMessage" + ) + ); + + if (res && res.errorCode) { + NotificationManager.error(res.errorDescription, "Error", 5000); + } else if (res && !res.errorCode) { + resetForm(); + NotificationManager.success("Message has been submitted!", null, 5000); } -}; \ No newline at end of file + return; + }; +}; diff --git a/src/containers/account/modalTransactions/transaction/index.js b/src/containers/account/modalTransactions/transaction/index.js index 57ccfeca8..e6e35f33a 100644 --- a/src/containers/account/modalTransactions/transaction/index.js +++ b/src/containers/account/modalTransactions/transaction/index.js @@ -3,97 +3,117 @@ * * ******************************************************************************/ +import React from "react"; +import { v4 as uuidv4 } from "uuid"; +import { setBodyModalParamsAction } from "../../../../modules/modals"; +import { connect } from "react-redux"; +import { formatTimestamp } from "../../../../helpers/util/time"; +import { formatTransactionType } from "../../../../actions/transactions"; +import { getBlockAction } from "../../../../actions/blocks"; +import Button from '../../../components/button'; -import React from 'react'; -import { v4 as uuidv4 } from 'uuid'; -import {setBodyModalParamsAction} from "../../../../modules/modals"; -import {connect} from 'react-redux' -import {formatTimestamp} from "../../../../helpers/util/time"; -import {formatTransactionType} from "../../../../actions/transactions"; -import {getBlockAction} from "../../../../actions/blocks"; - -const mapStateToProps = state => ({ - constants: state.account.constants, - decimals: state.account.decimals, +const mapStateToProps = (state) => ({ + constants: state.account.constants, + decimals: state.account.decimals, }); -const mapDispatchToProps = dispatch => ({ - setBodyModalParamsAction: (type, data, valueForModal) => dispatch(setBodyModalParamsAction(type, data, valueForModal)), - getBlockAction: (data) => dispatch(getBlockAction(data)), - formatTimestamp: (timestamp, date_only, isAbsoluteTime) => dispatch(formatTimestamp(timestamp, date_only, isAbsoluteTime)) +const mapDispatchToProps = (dispatch) => ({ + setBodyModalParamsAction: (type, data, valueForModal) => + dispatch(setBodyModalParamsAction(type, data, valueForModal)), + getBlockAction: (data) => dispatch(getBlockAction(data)), + formatTimestamp: (timestamp, date_only, isAbsoluteTime) => + dispatch(formatTimestamp(timestamp, date_only, isAbsoluteTime)), }); class Transaction extends React.Component { - getBlock = async (blockHeight) => { - this.props.setBodyModalParamsAction('INFO_BLOCK', blockHeight) - } + getBlock = async (blockHeight) => { + this.props.setBodyModalParamsAction("INFO_BLOCK", blockHeight); + }; - render () { - const { - feeATM, - amountATM, - subtype, - type, - transaction, - constants, - setTransactionInfo, - formatTimestamp, - timestamp, - sender, - senderRS, - recipient, - recipientRS, - height, - isUnconfirmed, - setBodyModalParamsAction, - attachment, - decimals, - } = this.props; - const transactionType = constants.transactionTypes && constants.transactionTypes[type]; - return ( - - { - transaction && constants && - - - setBodyModalParamsAction('INFO_TRANSACTION', transaction)}> - {formatTimestamp(timestamp)} - - - - {!!transactionType && ( - (transactionType.subtypes[subtype].name === "AliasSell" && amountATM === "0" && attachment.priceATM === "0") ? - formatTransactionType("AliasTransfer") - : - formatTransactionType(transactionType.subtypes[subtype].name) - )} - - - {amountATM / decimals} - - - {feeATM / decimals} - - - {senderRS} - - - {recipientRS} - - - { - !isUnconfirmed && - setBodyModalParamsAction('INFO_BLOCK', height)}>{height} - } - { - isUnconfirmed && '-' - } - - + render() { + const { + feeATM, + amountATM, + subtype, + type, + transaction, + constants, + formatTimestamp, + timestamp, + sender, + senderRS, + recipient, + recipientRS, + height, + isUnconfirmed, + setBodyModalParamsAction, + attachment, + decimals, + } = this.props; + const transactionType = + constants.transactionTypes && constants.transactionTypes[type]; + return ( + + {transaction && constants && ( + + + - -
- )} - - - ); + close = () => { + if (this.props.closeModal) { + this.props.closeModal(); } + }; + + gotToAsset = () => { + const { asset, history, setBodyModalParamsAction } = this.props; + + setBodyModalParamsAction(); + history.push("/asset-exchange/" + asset); + }; + + render() { + const { decimals, asset, name, unconfirmedQuantityATU, quantityATU } = + this.props; + + return ( + + + + {name} + + + + {(unconfirmedQuantityATU / Math.pow(10, decimals)).toLocaleString( + "en", + { + minimumFractionDigits: decimals, + maximumFractionDigits: decimals, + } + )} + + + {(quantityATU / Math.pow(10, decimals)).toLocaleString("en", { + minimumFractionDigits: decimals, + maximumFractionDigits: decimals, + })} + + + {( + (parseInt(unconfirmedQuantityATU) / parseInt(quantityATU)) * + 100 + ).toFixed(2)} +  % + + + {!!( + (this.state.lowestAskOrder / Math.pow(10, 8)) * + Math.pow(10, decimals) + ) && + ( + (this.state.lowestAskOrder / Math.pow(10, 8)) * + Math.pow(10, decimals) + ).toLocaleString("en", { + minimumFractionDigits: decimals, + maximumFractionDigits: decimals, + })} + + + {!!( + (this.state.highestBidOrder / Math.pow(10, 8)) * + Math.pow(10, decimals) + ) && + ( + (this.state.highestBidOrder / Math.pow(10, 8)) * + Math.pow(10, decimals) + ).toLocaleString("en", { + minimumFractionDigits: decimals, + maximumFractionDigits: decimals, + })} + + + {!!( + (this.state.highestBidOrder / Math.pow(10, 8)) * + Math.pow(10, decimals) + ) && + ( + (this.state.highestBidOrder / Math.pow(10, 8)) * + Math.pow(10, decimals) * + (quantityATU / Math.pow(10, decimals)) + ).toLocaleString("en", { + minimumFractionDigits: decimals, + maximumFractionDigits: decimals, + })} + + + {!this.props.info && ( +
+ + +
+ )} + + + ); + } } -const mapDispatchToProps = dispatch => ({ - setBodyModalParamsAction: (type, data, valueForModal) => dispatch(setBodyModalParamsAction(type, data, valueForModal)), - setModalType: (type) => dispatch(setModalType(type)), - getAskOrders: asset => getAskOrders(asset), - getBidOrders: asset => getBidOrders(asset), +const mapDispatchToProps = (dispatch) => ({ + setBodyModalParamsAction: (type, data, valueForModal) => + dispatch(setBodyModalParamsAction(type, data, valueForModal)), + setModalType: (type) => dispatch(setModalType(type)), + getAskOrders: (asset) => getAskOrders(asset), + getBidOrders: (asset) => getBidOrders(asset), }); export default connect(null, mapDispatchToProps)(withRouter(MyAssetItem)); diff --git a/src/containers/account/my-completed-orders/index.js b/src/containers/account/my-completed-orders/index.js index 128a672cf..a6d333688 100644 --- a/src/containers/account/my-completed-orders/index.js +++ b/src/containers/account/my-completed-orders/index.js @@ -3,131 +3,121 @@ * * ******************************************************************************/ - -import React from 'react'; -import {connect} from 'react-redux'; -import classNames from 'classnames'; -import SiteHeader from '../../components/site-header' -import {setBodyModalParamsAction} from "../../../modules/modals"; - -import {getDGSGoodsAction} from "../../../actions/marketplace"; -import MarketplaceItem from "../marketplace/marketplace-card"; -import {BlockUpdater} from "../../block-subscriber/index"; -import InfoBox from "../../components/info-box" -import ContentLoader from '../../components/content-loader' -import ContentHendler from "../../components/content-hendler"; +import React from "react"; +import { connect } from "react-redux"; +import SiteHeader from "../../components/site-header"; +import { setBodyModalParamsAction } from "../../../modules/modals"; + +import { getDGSGoodsAction } from "../../../actions/marketplace"; +import { BlockUpdater } from "../../block-subscriber/index"; +import InfoBox from "../../components/info-box"; import MarketplaceColumnTable from "../../components/marketplace-column-table"; const itemsPerPage = 15; class MyProductsForSale extends React.Component { - constructor(props) { - super(props); - - this.state = { - page: 1, - firstIndex: 0, - lastIndex: itemsPerPage - 1, - getDGSGoods: null - }; - } - - componentDidMount() { - this.getDGSGoods({ - seller: this.props.account, - requestType: 'getDGSPurchases', - firstIndex: this.state.firstIndex, - lastIndex: this.state.lastIndex, - completed: true - }); - BlockUpdater.on("data", data => { - this.updateMyCompletedOrders(); - }); - } - - componentWillUnmount() { - BlockUpdater.removeAllListeners('data'); - } - - updateMyCompletedOrders = () => { - this.getDGSGoods({ - requestType: 'getDGSPurchases', - seller: this.props.account, - firstIndex: this.state.firstIndex, - lastIndex: this.state.lastIndex, - completed: true - }); + constructor(props) { + super(props); + + this.state = { + page: 1, + firstIndex: 0, + lastIndex: itemsPerPage - 1, + getDGSGoods: null, + }; + } + + componentDidMount() { + this.getDGSGoods({ + seller: this.props.account, + requestType: "getDGSPurchases", + firstIndex: this.state.firstIndex, + lastIndex: this.state.lastIndex, + completed: true, + }); + BlockUpdater.on("data", (data) => { + this.updateMyCompletedOrders(); + }); + } + + componentWillUnmount() { + BlockUpdater.removeAllListeners("data"); + } + + updateMyCompletedOrders = () => { + this.getDGSGoods({ + requestType: "getDGSPurchases", + seller: this.props.account, + firstIndex: this.state.firstIndex, + lastIndex: this.state.lastIndex, + completed: true, + }); + }; + + onPaginate(page) { + let reqParams = { + page: page, + seller: this.props.account, + requestType: "getDGSPurchases", + completed: true, + firstIndex: page * itemsPerPage - itemsPerPage, + lastIndex: page * itemsPerPage - 1, }; - onPaginate(page) { - let reqParams = { - page: page, - seller: this.props.account, - requestType: 'getDGSPurchases', - completed: true, - firstIndex: page * itemsPerPage - itemsPerPage, - lastIndex: page * itemsPerPage - 1 - }; - - this.setState(reqParams, () => { - this.getDGSGoods(reqParams) - }); - } - - getDGSGoods = async (reqParams) => { - const getDGSGoods = await this.props.getDGSGoodsAction(reqParams); + this.setState(reqParams, () => { + this.getDGSGoods(reqParams); + }); + } - if (getDGSGoods) { - this.setState({ - getDGSGoods: getDGSGoods.purchases - }) - } - }; + getDGSGoods = async (reqParams) => { + const getDGSGoods = await this.props.getDGSGoodsAction(reqParams); - render() { - const { getDGSGoods } = this.state; - return ( -
- + +
+
+
+ {getDGSGoods && getDGSGoods.length ? ( + -
-
-
- {getDGSGoods && getDGSGoods.length ? ( - - ) : ( - - No orders found. - - )} -
-
-
+ ) : ( + No orders found. + )}
- ); - } +
+
+
+ ); + } } -const mapStateToProps = state => ({ - account: state.account.account, - - // modals - modalData: state.modals.modalData +const mapStateToProps = (state) => ({ + account: state.account.account, + modalData: state.modals.modalData, }); -const initMapDispatchToProps = dispatch => ({ - getDGSGoodsAction: (reqParams) => dispatch(getDGSGoodsAction(reqParams)), - setBodyModalParamsAction: (type, data, valueForModal) => dispatch(setBodyModalParamsAction(type, data, valueForModal)), +const initMapDispatchToProps = (dispatch) => ({ + getDGSGoodsAction: (reqParams) => dispatch(getDGSGoodsAction(reqParams)), + setBodyModalParamsAction: (type, data, valueForModal) => + dispatch(setBodyModalParamsAction(type, data, valueForModal)), }); export default connect( - mapStateToProps, - initMapDispatchToProps + mapStateToProps, + initMapDispatchToProps )(MyProductsForSale); diff --git a/src/containers/account/my-messages/index.js b/src/containers/account/my-messages/index.js index c7fa4ef0e..39fd4b71f 100644 --- a/src/containers/account/my-messages/index.js +++ b/src/containers/account/my-messages/index.js @@ -3,153 +3,150 @@ * * ******************************************************************************/ +import React from "react"; +import SiteHeader from "../../components/site-header"; +import MessageItem from "./message-item"; +import { connect } from "react-redux"; +import { setBodyModalParamsAction } from "../../../modules/modals"; +import { BlockUpdater } from "../../block-subscriber/index"; -import React from 'react'; -import { v4 as uuidv4 } from 'uuid'; -import classNames from "classnames"; -import SiteHeader from "../../components/site-header" -import MessageItem from './message-item' -import {connect} from 'react-redux'; -import {setBodyModalParamsAction} from "../../../modules/modals"; -import {BlockUpdater} from "../../block-subscriber/index"; -import InfoBox from "../../components/info-box"; -import ContentLoader from '../../components/content-loader' -import ContentHendler from '../../components/content-hendler' - -import CustomTable from '../../components/tables/table'; -import {getMessagesPerpage} from '../../../actions/messager' +import CustomTable from "../../components/tables/table"; +import { getMessagesPerpage } from "../../../actions/messager"; const itemsPerPage = 15; class MyMessages extends React.Component { - constructor(props) { - super(props); - this.state = { - page: 1, - firstIndex: 0, - lastIndex: itemsPerPage, - messages: null, - isLoading: false, - account: null - }; - } + constructor(props) { + super(props); + this.state = { + page: 1, + firstIndex: 0, + lastIndex: itemsPerPage, + messages: null, + isLoading: false, + account: null, + }; + } - listener = () => this.getMessagesPerpage(); + listener = () => this.getMessagesPerpage(); - componentDidMount() { - this.getMessagesPerpage(); + componentDidMount() { + this.getMessagesPerpage(); - if (!BlockUpdater.listeners('data').length) { - BlockUpdater.on("data", data => { - if (!this.state.isLoading) { - this.listener(); - } - }); + if (!BlockUpdater.listeners("data").length) { + BlockUpdater.on("data", (data) => { + if (!this.state.isLoading) { + this.listener(); } + }); } + } - componentDidUpdate(prevProps) { - if (prevProps.passPhrase !== this.props.passPhrase) { - this.listener(); - } + componentDidUpdate(prevProps) { + if (prevProps.passPhrase !== this.props.passPhrase) { + this.listener(); } - - componentWillUnmount() { - BlockUpdater.removeAllListeners('data'); + } + + componentWillUnmount() { + BlockUpdater.removeAllListeners("data"); + } + + getMessagesPerpage = async (pagination) => { + this.setState({ isLoading: true }); + if (!pagination) { + pagination = { + page: this.state.page, + firstIndex: this.state.firstIndex, + lastIndex: this.state.lastIndex, + }; } - getMessagesPerpage = async (pagination) => { - this.setState({isLoading: true}); - if (!pagination) { - pagination = { - page: this.state.page, - firstIndex: this.state.firstIndex, - lastIndex: this.state.lastIndex - }; - } - - await this.props.getMessagesPerpage({ - firstIndex: pagination.firstIndex, - lastIndex: pagination.lastIndex - }); - - this.setState({ - ...pagination, - isLoading: false - }); + await this.props.getMessagesPerpage({ + firstIndex: pagination.firstIndex, + lastIndex: pagination.lastIndex, + }); + + this.setState({ + ...pagination, + isLoading: false, + }); + }; + + onPaginate = (page) => { + const pagination = { + page: page, + firstIndex: page * itemsPerPage - itemsPerPage, + lastIndex: page * itemsPerPage, }; - onPaginate = (page) => { - const pagination = { - page: page, - firstIndex: page * itemsPerPage - itemsPerPage, - lastIndex: page * itemsPerPage - }; - - this.getMessagesPerpage(pagination); - }; - - render() { - const {messages, setBodyModalParamsAction} = this.props; - - return ( -
- - - -
- -
-
- ); - } + this.getMessagesPerpage(pagination); + }; + + render() { + const { messages, setBodyModalParamsAction } = this.props; + + return ( +
+ + + +
+ +
+
+ ); + } } -const mapStateToProps = state => ({ - account: state.account.account, - messages: state.messages.messages, - passPhrase: state.account.passPhrase, +const mapStateToProps = (state) => ({ + account: state.account.account, + messages: state.messages.messages, + passPhrase: state.account.passPhrase, }); -const mapDispatchToProps = dispatch => ({ - getMessagesPerpage: (reqParams) => dispatch(getMessagesPerpage(reqParams)), - setBodyModalParamsAction: (type, data, valueForModal) => dispatch(setBodyModalParamsAction(type, data, valueForModal)), +const mapDispatchToProps = (dispatch) => ({ + getMessagesPerpage: (reqParams) => dispatch(getMessagesPerpage(reqParams)), + setBodyModalParamsAction: (type, data, valueForModal) => + dispatch(setBodyModalParamsAction(type, data, valueForModal)), }); export default connect(mapStateToProps, mapDispatchToProps)(MyMessages); diff --git a/src/containers/account/my-messages/message-item/index.js b/src/containers/account/my-messages/message-item/index.js index 7b2ea1821..f0c289a3e 100644 --- a/src/containers/account/my-messages/message-item/index.js +++ b/src/containers/account/my-messages/message-item/index.js @@ -3,153 +3,148 @@ * * ******************************************************************************/ - -import React from 'react'; -import {setBodyModalParamsAction} from "../../../../modules/modals"; -import {connect} from 'react-redux'; -import crypto from '../../../../helpers/crypto/crypto' -import {formatTimestamp} from "../../../../helpers/util/time"; +import React from "react"; +import { setBodyModalParamsAction } from "../../../../modules/modals"; +import { connect } from "react-redux"; +import crypto from "../../../../helpers/crypto/crypto"; +import { formatTimestamp } from "../../../../helpers/util/time"; import submitForm from "../../../../helpers/forms/forms"; -const mapStateToProps = state => ({ - account: state.account +const mapStateToProps = (state) => ({ + account: state.account, }); -const mapDispatchToProps = dispatch => ({ - setBodyModalParamsAction: (type, data, valueForModal) => dispatch(setBodyModalParamsAction(type, data, valueForModal)), - tryToDecryptMessageAPL: (data, options) => dispatch(crypto.tryToDecryptMessageAPL(data, options)), - formatTimestamp: (time) => dispatch(formatTimestamp(time)), - submitForm: (data, requestType) => dispatch(submitForm.submitForm(data, requestType)), +const mapDispatchToProps = (dispatch) => ({ + setBodyModalParamsAction: (type, data, valueForModal) => + dispatch(setBodyModalParamsAction(type, data, valueForModal)), + tryToDecryptMessageAPL: (data, options) => + dispatch(crypto.tryToDecryptMessageAPL(data, options)), + formatTimestamp: (time) => dispatch(formatTimestamp(time)), + submitForm: (data, requestType) => + dispatch(submitForm.submitForm(data, requestType)), }); class MessageItem extends React.Component { - state = { - message: null - }; + state = { + message: null, + }; - componentWillReceiveProps(newProps) { - if (newProps.account.passPhrase !== this.props.account.passPhrase) { - this.tryToDecrypt(newProps); - } + componentWillReceiveProps(newProps) { + if (newProps.account.passPhrase !== this.props.account.passPhrase) { + this.tryToDecrypt(newProps); } + } - tryToDecrypt = (newState) => { - if (newState.account.passPhrase) { - this.decryptMessage(this.props, newState.account.passPhrase); - } - }; + tryToDecrypt = (newState) => { + if (newState.account.passPhrase) { + this.decryptMessage(this.props, newState.account.passPhrase); + } + }; - decryptMessage = async (data, passPhrase) => { - if (passPhrase) { - const message = await this.props.submitForm({ - requestType: 'readMessage', - secretPhrase: passPhrase, - transaction: this.props.transaction, - createNoneTransactionMethod: true - }, 'readMessage'); + decryptMessage = async (data, passPhrase) => { + if (passPhrase) { + const message = await this.props.submitForm( + { + requestType: "readMessage", + secretPhrase: passPhrase, + transaction: this.props.transaction, + createNoneTransactionMethod: true, + }, + "readMessage" + ); - if (message) { - this.setState({ - message: message.decryptedMessage - }); - } - } - }; + if (message) { + this.setState({ + message: message.decryptedMessage, + }); + } + } + }; - render() { - const { - publicMessage, - decryptedMessage, - messageIsPrunable, - transaction, - recipient, - sender, - recipientRS, - senderRS, - timestamp, - isDescrypted, - attachment, + render() { + const { + publicMessage, + decryptedMessage, + recipient, + sender, + recipientRS, + senderRS, + timestamp, + isDescrypted, - formatTimestamp, - setBodyModalParamsAction - } = this.props; - - return ( - - <> - {formatTimestamp(timestamp)} - - setBodyModalParamsAction('INFO_ACCOUNT', sender)}>{senderRS} - - - setBodyModalParamsAction('INFO_ACCOUNT', recipient)}>{recipientRS} - - - { - publicMessage && - publicMessage - } - { - isDescrypted && - decryptedMessage && - decryptedMessage !== 'false' && -
-    {decryptedMessage} -
- } - { - isDescrypted && - !publicMessage && - !decryptedMessage && -
-     - Empty Message. -
- } - { - isDescrypted && - !publicMessage && - !decryptedMessage && -
- -     - Message is pruned. -
- } - { - !isDescrypted && - !publicMessage && - !decryptedMessage && - <> - setBodyModalParamsAction('DECRYPT_MESSAGES')} - > - < i className="zmdi zmdi-lock" /> - -   Message is encrypted - - } - - - -
- { - !isDescrypted && - !publicMessage && - !decryptedMessage && - - } -
- - - ); - } + formatTimestamp, + setBodyModalParamsAction, + } = this.props; + + return ( + + <> + {formatTimestamp(timestamp)} + + + + + + + + {publicMessage && publicMessage} + {isDescrypted && decryptedMessage && decryptedMessage !== "false" && ( +
+ +    {decryptedMessage} +
+ )} + {isDescrypted && !publicMessage && !decryptedMessage && ( +
+ +     + Empty Message. +
+ )} + {isDescrypted && !publicMessage && !decryptedMessage && ( +
+ +     + Message is pruned. +
+ )} + {!isDescrypted && !publicMessage && !decryptedMessage && ( + <> + setBodyModalParamsAction("DECRYPT_MESSAGES")}> + + + +   Message is encrypted + + + )} + + +
+ {!isDescrypted && !publicMessage && !decryptedMessage && ( + + )} +
+ + + ); + } } -export default connect(mapStateToProps, mapDispatchToProps)(MessageItem); \ No newline at end of file +export default connect(mapStateToProps, mapDispatchToProps)(MessageItem); diff --git a/src/containers/account/my-polls/index.js b/src/containers/account/my-polls/index.js index 6d5f7d309..6e710ea6f 100644 --- a/src/containers/account/my-polls/index.js +++ b/src/containers/account/my-polls/index.js @@ -9,7 +9,6 @@ import {connect} from 'react-redux'; import SiteHeader from '../../components/site-header' import {getMyPollsAction, getVoteAction} from '../../../actions/polls'; import PoolItem from '../active-polls/pool-item'; -import { v4 as uuidv4 } from 'uuid'; import {getTransactionAction} from "../../../actions/transactions"; import {setBodyModalParamsAction} from "../../../modules/modals"; import {BlockUpdater} from "../../block-subscriber/index"; diff --git a/src/containers/account/my-votes/index.js b/src/containers/account/my-votes/index.js index 02303d56c..236ee1fff 100644 --- a/src/containers/account/my-votes/index.js +++ b/src/containers/account/my-votes/index.js @@ -9,7 +9,6 @@ import {connect} from 'react-redux'; import SiteHeader from '../../components/site-header' import {getMyVotesAction, getVoteAction} from '../../../actions/polls'; import PoolItem from '../active-polls/pool-item'; -import { v4 as uuidv4 } from 'uuid'; import {getTransactionAction} from "../../../actions/transactions"; import {setBodyModalParamsAction} from "../../../modules/modals"; import {BlockUpdater} from "../../block-subscriber/index"; diff --git a/src/containers/account/scheduled-transactions/index.js b/src/containers/account/scheduled-transactions/index.js index 3bbf855bc..3f3a5379b 100644 --- a/src/containers/account/scheduled-transactions/index.js +++ b/src/containers/account/scheduled-transactions/index.js @@ -3,177 +3,194 @@ * * ******************************************************************************/ - -import React from 'react'; -import SiteHeader from '../../components/site-header' -import ContentLoader from '../../components/content-loader' +import React from "react"; +import SiteHeader from "../../components/site-header"; import InfoBox from "../../components/info-box"; -import {Link} from "react-router-dom"; -import {connect} from 'react-redux' -import {setBodyModalParamsAction} from "../../../modules/modals"; -import {getScheduledTransactions} from "../../../actions/scheduled-transactions"; +import { Link } from "react-router-dom"; +import { connect } from "react-redux"; +import { setBodyModalParamsAction } from "../../../modules/modals"; +import { getScheduledTransactions } from "../../../actions/scheduled-transactions"; import ContentHendler from "../../components/content-hendler"; import classNames from "classnames"; -import TransactionItem from '../transactions/transaction'; +import TransactionItem from "../transactions/transaction"; import submitForm from "../../../helpers/forms/forms"; -import {NotificationManager} from "react-notifications"; +import { NotificationManager } from "react-notifications"; +import Button from '../../components/button'; -const mapStateToProps = state => ({ - adminPassword: state.account.adminPassword, - account: state.account.account, +const mapStateToProps = (state) => ({ + adminPassword: state.account.adminPassword, + account: state.account.account, }); -const mapDispatchToProps = dispatch => ({ - setBodyModalParamsAction: (type, data, valueForModal) => dispatch(setBodyModalParamsAction(type, data, valueForModal)), - submitForm: (data, requestType) => dispatch(submitForm.submitForm(data, requestType)), +const mapDispatchToProps = (dispatch) => ({ + setBodyModalParamsAction: (type, data, valueForModal) => + dispatch(setBodyModalParamsAction(type, data, valueForModal)), + submitForm: (data, requestType) => + dispatch(submitForm.submitForm(data, requestType)), }); class ScheduledTransactions extends React.Component { - state = { - scheduledTransactions: null, - adminPassword: localStorage.getItem('adminPassword') ? JSON.parse(localStorage.getItem('adminPassword')) : '' + state = { + scheduledTransactions: null, + adminPassword: localStorage.getItem("adminPassword") + ? JSON.parse(localStorage.getItem("adminPassword")) + : "", + }; + + componentDidUpdate = () => { + if ( + !this.state.isLoaded && + this.props.account && + (this.state.adminPassword || this.state.adminPassword === "") + ) { + this.getScheduledTransactions({ + adminPassword: this.state.adminPassword, + account: this.props.account, + }); } + }; + + componentDidMount = () => { + if (this.state.adminPassword) { + this.getScheduledTransactions({ + adminPassword: this.state.adminPassword, + account: this.props.account, + }); + } else { + this.setState({ + monitors: { + errorCode: 3, + }, + }); + } + }; - componentDidUpdate = () => { - if (!this.state.isLoaded && this.props.account && (this.state.adminPassword || this.state.adminPassword === '')) { - this.getScheduledTransactions({ - adminPassword: this.state.adminPassword, - account: this.props.account - }) - } - }; - - componentDidMount = () => { - if (this.state.adminPassword) { - this.getScheduledTransactions({ - adminPassword: this.state.adminPassword, - account: this.props.account - }) - } else { - this.setState({ - monitors: { - errorCode: 3 - } - }) - } - }; - - getScheduledTransactions = async (reqParams) => { - const scheduledTransactions = await getScheduledTransactions(reqParams); - - if (scheduledTransactions && !scheduledTransactions.errorCode) { - this.setState({ - scheduledTransactions: scheduledTransactions.scheduledTransactions, - isLoaded: true - }) - } - - if (scheduledTransactions && scheduledTransactions.errorCode) { - this.setState({ - scheduledTransactions, - isLoaded: true - }) - } - }; - - reloadSceduledTransactions = () => { - - this.getScheduledTransactions({ - adminPassword: this.state.adminPassword - }) - }; - - deleteScheduledTransaction = async (transaction) => { - const deleteTransacrtio = await this.props.submitForm({adminPassword : this.state.adminPassword , transaction}, 'deleteScheduledTransaction'); + getScheduledTransactions = async (reqParams) => { + const scheduledTransactions = await getScheduledTransactions(reqParams); - if (deleteTransacrtio) { - if (deleteTransacrtio.errorCode) { - NotificationManager.error(deleteTransacrtio.errorDescription, 'Error', 5000); + if (scheduledTransactions && !scheduledTransactions.errorCode) { + this.setState({ + scheduledTransactions: scheduledTransactions.scheduledTransactions, + isLoaded: true, + }); + } - } else { - NotificationManager.success('Scheduled transaction has been deleted!', null, 5000); - this.reloadSceduledTransactions(); + if (scheduledTransactions && scheduledTransactions.errorCode) { + this.setState({ + scheduledTransactions, + isLoaded: true, + }); + } + }; + + reloadSceduledTransactions = () => { + this.getScheduledTransactions({ + adminPassword: this.state.adminPassword, + }); + }; + + deleteScheduledTransaction = async (transaction) => { + const deleteTransacrtio = await this.props.submitForm( + { adminPassword: this.state.adminPassword, transaction }, + "deleteScheduledTransaction" + ); + + if (deleteTransacrtio) { + if (deleteTransacrtio.errorCode) { + NotificationManager.error( + deleteTransacrtio.errorDescription, + "Error", + 5000 + ); + } else { + NotificationManager.success( + "Scheduled transaction has been deleted!", + null, + 5000 + ); + this.reloadSceduledTransactions(); + } + } + }; + + render() { + return ( +
+ +
+ +
+ + + ); + } } -export default connect(mapStateToProps, mapDispatchToProps)(ScheduledTransactions); \ No newline at end of file +export default connect( + mapStateToProps, + mapDispatchToProps +)(ScheduledTransactions); diff --git a/src/containers/account/trade-history/trade-history-item/index.js b/src/containers/account/trade-history/trade-history-item/index.js index 4c5896f42..e984670eb 100644 --- a/src/containers/account/trade-history/trade-history-item/index.js +++ b/src/containers/account/trade-history/trade-history-item/index.js @@ -3,61 +3,92 @@ * * ******************************************************************************/ - -import React from 'react'; -import { v4 as uuidv4 } from 'uuid'; -import { Link } from 'react-router-dom'; -import {connect} from 'react-redux'; -import {setBodyModalParamsAction} from "../../../../modules/modals"; -import {formatTimestamp} from "../../../../helpers/util/time"; +import React from "react"; +import { v4 as uuidv4 } from "uuid"; +import { Link } from "react-router-dom"; +import { connect } from "react-redux"; +import { setBodyModalParamsAction } from "../../../../modules/modals"; +import { formatTimestamp } from "../../../../helpers/util/time"; class TradeHistoryItem extends React.Component { - constructor(props) { - super(props); + constructor(props) { + super(props); - this.state = { - transfer: this.props.transfer - } - } + this.state = { + transfer: this.props.transfer, + }; + } - render () { - if (this.state.transfer) { - return ( - - - {this.state.transfer.name} - - - {this.props.formatTimestamp(this.state.transfer.timestamp)} - - - {this.state.transfer.tradeType} - {this.state.transfer.quantityATU/ Math.pow(10, this.state.transfer.decimals)} - {(this.state.transfer.priceATM / this.props.decimals) * Math.pow(10, this.state.transfer.decimals)} - {((this.state.transfer.quantityATU )/ this.state.transfer.decimals) * ((this.state.transfer.priceATM / this.props.decimals) * this.state.transfer.decimals)} - - {this.state.transfer.buyerRS} - - - {this.state.transfer.sellerRS} - - - ); - } else { - return ( - - ); - } + render() { + if (this.state.transfer) { + return ( + + + + {this.state.transfer.name} + + + + {this.props.formatTimestamp(this.state.transfer.timestamp)} + + + + + {this.state.transfer.tradeType} + + {this.state.transfer.quantityATU / + Math.pow(10, this.state.transfer.decimals)} + + + {(this.state.transfer.priceATM / this.props.decimals) * + Math.pow(10, this.state.transfer.decimals)} + + + {(this.state.transfer.quantityATU / this.state.transfer.decimals) * + ((this.state.transfer.priceATM / this.props.decimals) * + this.state.transfer.decimals)} + + + + + + + + + ); + } else { + return ; } + } } -const mapStateToProps = state => ({ +const mapStateToProps = (state) => ({ decimals: state.account.decimals, }); -const mapDispatchToProps = dispatch => ({ - setBodyModalParamsAction: (type, data, valueForModal) => dispatch(setBodyModalParamsAction(type, data, valueForModal)), - formatTimestamp: (timestamp, date_only, isAbsoluteTime) => dispatch(formatTimestamp(timestamp, date_only, isAbsoluteTime)), +const mapDispatchToProps = (dispatch) => ({ + setBodyModalParamsAction: (type, data, valueForModal) => + dispatch(setBodyModalParamsAction(type, data, valueForModal)), + formatTimestamp: (timestamp, date_only, isAbsoluteTime) => + dispatch(formatTimestamp(timestamp, date_only, isAbsoluteTime)), }); export default connect(mapStateToProps, mapDispatchToProps)(TradeHistoryItem); diff --git a/src/containers/account/trade-history/trade-history-item/index1.jsx b/src/containers/account/trade-history/trade-history-item/index1.jsx index 38eb3d0a1..1ed0a9be8 100644 --- a/src/containers/account/trade-history/trade-history-item/index1.jsx +++ b/src/containers/account/trade-history/trade-history-item/index1.jsx @@ -3,60 +3,85 @@ * * ******************************************************************************/ - -import React from 'react'; -import { v4 as uuidv4 } from 'uuid'; -import crypto from "../../../../helpers/crypto/crypto"; -import converters from "../../../../helpers/converters"; -import {setBodyModalParamsAction} from "../../../../modules/modals"; -import {connect} from 'react-redux'; -import { Link } from 'react-router-dom'; -import {formatTimestamp} from "../../../../helpers/util/time"; -import {ONE_APL} from '../../../../constants'; +import React from "react"; +import { v4 as uuidv4 } from "uuid"; +import { setBodyModalParamsAction } from "../../../../modules/modals"; +import { connect } from "react-redux"; +import { Link } from "react-router-dom"; +import { formatTimestamp } from "../../../../helpers/util/time"; +import { ONE_APL } from "../../../../constants"; +import Button from "../../../components/button"; class TradeHistoryItem extends React.Component { - constructor(props) { - super(props); + constructor(props) { + super(props); - this.state = { - transfer: this.props.transfer - } - } + this.state = { + transfer: this.props.transfer, + }; + } - render () { - if (this.state.transfer) { - return ( - - - {this.state.transfer.name} - - - {this.props.formatTimestamp(this.state.transfer.timestamp)} - - - {this.state.transfer.tradeType} - {this.state.transfer.quantityATU/ Math.pow(10, this.state.transfer.decimals)} - {(this.state.transfer.priceATM / ONE_APL) * Math.pow(10, this.state.transfer.decimals)} - {((this.state.transfer.quantityATU )/ this.state.transfer.decimals) * ((this.state.transfer.priceATM / ONE_APL) * this.state.transfer.decimals)} - - {this.state.transfer.buyerRS} - - - {this.state.transfer.sellerRS} - - - ); - } else { - return ( - - ); - } + render() { + if (this.state.transfer) { + return ( + + + + {this.state.transfer.name} + + + + {this.props.formatTimestamp(this.state.transfer.timestamp)} + + {this.state.transfer.tradeType} + + {this.state.transfer.quantityATU / + Math.pow(10, this.state.transfer.decimals)} + + + {(this.state.transfer.priceATM / ONE_APL) * + Math.pow(10, this.state.transfer.decimals)} + + + {(this.state.transfer.quantityATU / this.state.transfer.decimals) * + ((this.state.transfer.priceATM / ONE_APL) * + this.state.transfer.decimals)} + + + {!!transactionType && ( @@ -112,18 +112,18 @@ class Transaction extends React.Component { {feeATM / decimals} - - setBodyModalParamsAction('INFO_ACCOUNT', sender)}> + +         - setBodyModalParamsAction('INFO_ACCOUNT', recipient)}> + @@ -151,9 +151,9 @@ class Transaction extends React.Component { {!isUnconfirmed ? ( - + ) : ( --- )} diff --git a/src/containers/account/transfer-history/index.js b/src/containers/account/transfer-history/index.js index 732414b84..afe1a5de9 100644 --- a/src/containers/account/transfer-history/index.js +++ b/src/containers/account/transfer-history/index.js @@ -7,18 +7,13 @@ import React from 'react'; import SiteHeader from '../../components/site-header' import TransferHistoryItem from './transfer-history-item' -import classNames from "classnames"; -import { v4 as uuidv4 } from 'uuid'; import {connect} from 'react-redux' -import InfoBox from '../../components/info-box'; import {getTransferHistory} from "../../../actions/assets"; import {setBodyModalParamsAction} from "../../../modules/modals"; import {getTransactionAction} from "../../../actions/transactions"; import {BlockUpdater} from "../../block-subscriber"; import {formatTimestamp} from "../../../helpers/util/time"; -import ContentLoader from '../../components/content-loader' -import ContentHendler from '../../components/content-hendler' import CustomTable from '../../components/tables/table'; diff --git a/src/containers/account/transfer-history/transfer-history-item/index.js b/src/containers/account/transfer-history/transfer-history-item/index.js index 28bb299f1..f8175dad2 100644 --- a/src/containers/account/transfer-history/transfer-history-item/index.js +++ b/src/containers/account/transfer-history/transfer-history-item/index.js @@ -3,55 +3,88 @@ * * ******************************************************************************/ - -import React from 'react'; -import { v4 as uuidv4 } from 'uuid'; -import crypto from "../../../../helpers/crypto/crypto"; -import converters from "../../../../helpers/converters"; -import {setBodyModalParamsAction} from "../../../../modules/modals"; -import {connect} from 'react-redux'; -import {formatTimestamp} from "../../../../helpers/util/time"; +import React from "react"; +import { setBodyModalParamsAction } from "../../../../modules/modals"; +import { connect } from "react-redux"; +import { formatTimestamp } from "../../../../helpers/util/time"; +import Button from "../../../components/button"; class TransferHistoryItem extends React.Component { - constructor(props) { - super(props); + constructor(props) { + super(props); - this.state = { - transfer: this.props.transfer - } - } + this.state = { + transfer: this.props.transfer, + }; + } - render () { - const {setBodyModalParamsAction, assetTransfer, timestamp, name, decimals, quantityATU, recipient, sender, senderRS, recipientRS} = this.props; + render() { + const { + setBodyModalParamsAction, + assetTransfer, + timestamp, + name, + decimals, + quantityATU, + recipient, + sender, + senderRS, + recipientRS, + } = this.props; - return ( - - - {assetTransfer} - - - {name} - - - {this.props.formatTimestamp(timestamp)} - {(quantityATU / Math.pow(10, decimals)).toLocaleString('en', { - minimumFractionDigits: decimals, - maximumFractionDigits: decimals - })} - - {recipientRS} - - - {senderRS} - - - ) - } + return ( + + + ))} diff --git a/src/containers/components/account-rs/index1.jsx b/src/containers/components/account-rs/index1.jsx index cc9b9d91d..bdc51be31 100644 --- a/src/containers/components/account-rs/index1.jsx +++ b/src/containers/components/account-rs/index1.jsx @@ -124,9 +124,9 @@ export default function AccountRS(props) { diff --git a/src/containers/components/form-components/block-height-input.js b/src/containers/components/form-components/block-height-input.js index 920bc5926..39f4c2362 100644 --- a/src/containers/components/form-components/block-height-input.js +++ b/src/containers/components/form-components/block-height-input.js @@ -1,6 +1,5 @@ import React, {Component} from 'react'; import {connect} from 'react-redux'; -import classNames from "classnames"; import InputForm from '../../components/input-form'; class BlockHeightInput extends Component { @@ -12,7 +11,7 @@ class BlockHeightInput extends Component { } render () { - const {setValue, label, actualBlock, field, placeholder, deafultPlus, className, idGroup, isSubtitle} = this.props; + const {setValue, label, actualBlock, field, placeholder, className, idGroup, isSubtitle} = this.props; return (
diff --git a/src/containers/components/form-components/block-height-input1.jsx b/src/containers/components/form-components/block-height-input1.jsx index 90948a730..a70238c71 100644 --- a/src/containers/components/form-components/block-height-input1.jsx +++ b/src/containers/components/form-components/block-height-input1.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import { useField } from 'formik'; import { useSelector } from 'react-redux'; import CustomInput from '../custom-input'; @@ -11,10 +10,6 @@ export default function BlockHeightInput(props) { placeholder, className, idGroup, } = props; - // useEffect(() => { - // setValue(field, actualBlock); - // }, [actualBlock, field, setValue]); - return (
diff --git a/src/containers/components/form-components/input-accounts.js b/src/containers/components/form-components/input-accounts.js index d2f0daf33..053be6d5c 100644 --- a/src/containers/components/form-components/input-accounts.js +++ b/src/containers/components/form-components/input-accounts.js @@ -1,84 +1,87 @@ -import React, {Component} from 'react'; -import AccountRSFormInput from '../../components/form-components/account-rs'; -import CustomInputForm from '../../components/form-components/textual-input'; +import React, { Component } from "react"; +import AccountRSFormInput from "../../components/form-components/account-rs"; +import CustomInputForm from "../../components/form-components/textual-input"; class InputAccounts extends Component { - state = { - accounts: [''] - }; - - addAccount = () => { - this.setState({ - accounts : [...this.state.accounts, ''] - }) - }; + state = { + accounts: [""], + }; - setListValue = (i, setValue) => { - return (value) => { + addAccount = () => { + this.setState({ + accounts: [...this.state.accounts, ""], + }); + }; - let list = this.state.accounts; - list[i] = value; + setListValue = (i, setValue) => { + return (value) => { + let list = this.state.accounts; + list[i] = value; - this.setState({ - accounts: list - }, () => { - if (this.props.setValue) { - this.props.setValue('controlWhitelisted', list) - } - }) + this.setState( + { + accounts: list, + }, + () => { + if (this.props.setValue) { + this.props.setValue("controlWhitelisted", list); + } } + ); }; + }; - removeListValue = (setValue) => { - return (index) => { - let accounts = this.state.accounts; - - if (accounts.length > 1) { - accounts.splice(index, 1); + removeListValue = (setValue) => { + return (index) => { + let accounts = this.state.accounts; - this.setState({ - accounts - }, () => { - if (setValue) { - setValue('controlWhitelisted', accounts) - } - }) + if (accounts.length > 1) { + accounts.splice(index, 1); + + this.setState( + { + accounts, + }, + () => { + if (setValue) { + setValue("controlWhitelisted", accounts); } - } - } + } + ); + } + }; + }; - render () { - const {setValue, label, values} = this.props; + render() { + const { setValue } = this.props; - return ( - <> - { - this.state.accounts && - this.state.accounts.map((el, index) => { - return ( - - ); - }) - } - - {/* Button */} - this.addAccount()} - /> - - ); - } + return ( + <> + {this.state.accounts && + this.state.accounts.map((el, index) => { + return ( + + ); + })} + + {/* Button */} + this.addAccount()} + /> + + ); + } } -export default InputAccounts; \ No newline at end of file +export default InputAccounts; diff --git a/src/containers/components/form-components/text-area1.jsx b/src/containers/components/form-components/text-area1.jsx index b56747ab9..d668220b8 100644 --- a/src/containers/components/form-components/text-area1.jsx +++ b/src/containers/components/form-components/text-area1.jsx @@ -1,24 +1,29 @@ -import React from 'react'; -import { useField } from 'formik'; -// import { TextArea } from 'react-form'; +import React from "react"; +import { useField } from "formik"; const CustomTextArea = ({ - label, name, placeholder, note, className, idGroup, rows, cols, labelStyle, + label, + name, + placeholder, + note, + className, + idGroup, + rows, + cols, + labelStyle, }) => { - const [field, , helpers] = useField(name); + const field = useField(name); return (
- +