Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/actions/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {

Expand Down
104 changes: 57 additions & 47 deletions src/actions/generators/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<tr key={uuidv4()}>
<td className="blue-link-text align-left">
<a onClick={() => setBodyModalParamsAction('INFO_ACCOUNT', account)}>{accountRS}</a>
</td>
<td className="align-right">
<a>{effectiveBalanceAPL.toLocaleString('en')}</a>
</td>
<td className="align-right">
<a>{this.props.formatTimestamp(hitTime)}</a>
</td>
<td className="align-right"><a>{deadline}</a>
</td>
{/* <td className="align-right">
<a>{this.state.remaining}</a>
</td> */}
</tr>
);
}
render() {
const {
setBodyModalParamsAction,
account,
accountRS,
effectiveBalanceAPL,
hitTime,
deadline,
} = this.props;
return (
<tr key={uuidv4()}>
<td className="align-left">
<Button
color="blue-link"
onClick={() => setBodyModalParamsAction("INFO_ACCOUNT", account)}
name={accountRS}
/>
</td>
<td className="align-right">
{effectiveBalanceAPL.toLocaleString("en")}
</td>
<td className="align-right">{this.props.formatTimestamp(hitTime)}</td>
<td className="align-right">{deadline}</td>
</tr>
);
}
}

export default connect(null, mapDispatchToProps)(Generator);
2 changes: 1 addition & 1 deletion src/actions/login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import crypto from "../../helpers/crypto/crypto";
import {NotificationManager} from 'react-notifications';

import {INIT_TRANSACTION_TYPES} from '../../helpers/transaction-types/transaction-types';
import {login, logout, loadConstants, startLoad, endLoad, LOAD_BLOCKCHAIN_STATUS, SET_PASSPHRASE} from '../../modules/account';
import {login, logout, loadConstants, startLoad, endLoad} from '../../modules/account';
import {writeToLocalStorage, readFromLocalStorage} from "../localStorage";
import {getTransactionsAction} from "../transactions";
import {updateStoreNotifications} from "../../modules/account";
Expand Down
1 change: 0 additions & 1 deletion src/actions/open-orders/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import axios from "axios";
import config from "../../config";
import Marketplace from "../../containers/account/marketplace";
import store from '../../store'
import {getAssetAction} from "../assets";

Expand Down
2 changes: 0 additions & 2 deletions src/actions/scheduled-transactions/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import config from '../../config'
import store from '../../store'
import axios from 'axios';
import submitForm from '../../helpers/forms/forms'

export const getScheduledTransactions = async (reqParams) => {
Expand Down
106 changes: 55 additions & 51 deletions src/containers/account/account-properties/acocunt-property/index.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,64 @@
import React from 'react';
import {setBodyModalParamsAction} from "../../../../modules/modals";
import {connect} from 'react-redux';
import React from "react";
import { setBodyModalParamsAction } from "../../../../modules/modals";
import { connect } from "react-redux";
import Button from "../../../components/button";

class AccountProperty extends React.Component {
setProperty = (el) => this.props.setBodyModalParamsAction("SET_ACCOUNT_PROPERTY", el);
setProperty = (el) =>
this.props.setBodyModalParamsAction("SET_ACCOUNT_PROPERTY", el);

deleteProperty = (el) => {
const data = el;
const {recipientRS, incoming} = this.props;
if (incoming && recipientRS) data.recipientRS = recipientRS;
this.props.setBodyModalParamsAction("DELETE_ACCOUNT_PROPERTY", data);
};

render () {
const {transaction, setterRS, incoming, value, property, setter,recipientRS,setBodyModalParamsAction} = this.props;
deleteProperty = (el) => {
const data = el;
const { recipientRS, incoming } = this.props;
if (incoming && recipientRS) data.recipientRS = recipientRS;
this.props.setBodyModalParamsAction("DELETE_ACCOUNT_PROPERTY", data);
};

render() {
const {
transaction,
setterRS,
incoming,
value,
property,
setter,
recipientRS,
setBodyModalParamsAction,
} = this.props;

return (
<tr key={transaction}>
<td className="blue-link-text">
<a
onClick={() => setBodyModalParamsAction('INFO_ACCOUNT', setter)}
>
{incoming ? setterRS : recipientRS}
</a>
</td>
<td>{property}</td>
<td>{value}</td>
<td className="align-right">
<div className="btn-box inline">
{(recipientRS === setterRS || !incoming) &&
<button
type={'button'}
onClick={() => this.setProperty(this.props)}
className="btn btn-default"
>
Update
</button>
}
<button
type={'button'}
onClick={() => this.deleteProperty(this.props)}
className="btn btn-default"
>
Delete
</button>
</div>
</td>
</tr>
)
}
<tr key={transaction}>
<td>
<Button
color="blue-link"
onClick={() => setBodyModalParamsAction("INFO_ACCOUNT", setter)}
name={incoming ? setterRS : recipientRS}
/>
</td>
<td>{property}</td>
<td>{value}</td>
<td className="align-right">
<div className="btn-box inline">
{(recipientRS === setterRS || !incoming) && (
<Button
onClick={() => this.setProperty(this.props)}
name={"Update"}
/>
)}
<Button
onClick={() => this.deleteProperty(this.props)}
name={"Delete"}
/>
</div>
</td>
</tr>
);
}
}


const mapDispatchToProps = dispatch => ({
setBodyModalParamsAction: (type, data, valueForModal) => dispatch(setBodyModalParamsAction(type, data, valueForModal)),
const mapDispatchToProps = (dispatch) => ({
setBodyModalParamsAction: (type, data, valueForModal) =>
dispatch(setBodyModalParamsAction(type, data, valueForModal)),
});

export default connect(null, mapDispatchToProps)(AccountProperty)
export default connect(null, mapDispatchToProps)(AccountProperty);
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
import React, { useCallback } from 'react';
import { useDispatch } from 'react-redux';
import { setBodyModalParamsAction } from '../../../../modules/modals';
import Button from '../../../components/button';
import React, { useCallback } from "react";
import { useDispatch } from "react-redux";
import { setBodyModalParamsAction } from "../../../../modules/modals";
import Button from "../../../components/button";

export default function AccountProperty(props) {
const dispatch = useDispatch();

const {
transaction, setterRS, incoming, value,
property, setter, recipientRS,
transaction,
setterRS,
incoming,
value,
property,
setter,
recipientRS,
} = props;

const setProperty = useCallback(el => dispatch(setBodyModalParamsAction('SET_ACCOUNT_PROPERTY', el)), [dispatch]);
const setProperty = useCallback(
(el) => dispatch(setBodyModalParamsAction("SET_ACCOUNT_PROPERTY", el)),
[dispatch]
);

const deleteProperty = useCallback(el => {
const data = el;
if (incoming && recipientRS) data.recipientRS = recipientRS;
dispatch(setBodyModalParamsAction('DELETE_ACCOUNT_PROPERTY', data));
}, [dispatch, incoming, recipientRS]);
const deleteProperty = useCallback(
(el) => {
const data = el;
if (incoming && recipientRS) data.recipientRS = recipientRS;
dispatch(setBodyModalParamsAction("DELETE_ACCOUNT_PROPERTY", data));
},
[dispatch, incoming, recipientRS]
);

return (
<tr key={transaction}>
<td className="blue-link-text">
<td>
<Button
onClick={() => dispatch(setBodyModalParamsAction('INFO_ACCOUNT', setter))}
onClick={() =>
dispatch(setBodyModalParamsAction("INFO_ACCOUNT", setter))
}
color="blue-link"
name={incoming ? setterRS : recipientRS}
/>
Expand All @@ -33,15 +46,9 @@ export default function AccountProperty(props) {
<td className="align-right">
<div className="btn-box inline">
{(recipientRS === setterRS || !incoming) && (
<Button
onClick={() => setProperty(props)}
name="Update"
/>
<Button onClick={() => setProperty(props)} name="Update" />
)}
<Button
onClick={() => deleteProperty(props)}
name="Delete"
/>
<Button onClick={() => deleteProperty(props)} name="Delete" />
</div>
</td>
</tr>
Expand Down
12 changes: 4 additions & 8 deletions src/containers/account/account-properties/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
import React from 'react';
import SiteHeader from '../../components/site-header';
import {connect} from 'react-redux';
import { v4 as uuidv4 } from 'uuid';
import {getAccountPropertiesAction} from '../../../actions/account/index';
import InfoBox from '../../components/info-box';
import {setBodyModalParamsAction} from "../../../modules/modals";
import ContentLoader from '../../components/content-loader'
import ContentHendler from '../../components/content-hendler'

import AccountProperty from './acocunt-property';
import CustomTable from '../../components/tables/table';
Expand Down Expand Up @@ -115,14 +111,14 @@ class AccountProperties extends React.Component {
<SiteHeader
pageTitle={'Account properties'}
>
<a className={`btn ${this.state.incoming ? 'outline-primary' : 'outline-transparent'} mr-1`}
<button type="button" className={`btn ${this.state.incoming ? 'outline-primary' : 'outline-transparent'} mr-1`}
onClick={() => this.getAccountPropertiesIncoming(null, initialPagination)}>
Incoming
</a>
<a className={`btn ${this.state.incoming ? 'outline-transparent' : 'outline-primary'} mr-1`}
</button>
<button type="button" className={`btn ${this.state.incoming ? 'outline-transparent' : 'outline-primary'} mr-1`}
onClick={() => this.getAccountPropertiesOutgoing(null, initialPagination)}>
Outgoing
</a>
</button>
<button
type={'button'}
className={'btn btn-green btn-sm'}
Expand Down
Loading