mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-30 06:12:37 +03:00
Working on wallet transactions
This commit is contained in:
parent
91a84e69d2
commit
5c4ff494ec
@ -25,6 +25,7 @@ class TransactionView extends Component {
|
||||
_handleOnDropdownSelect = () => {};
|
||||
|
||||
render() {
|
||||
const { transactions } = this.props;
|
||||
return (
|
||||
<View>
|
||||
<FilterBar
|
||||
@ -36,60 +37,39 @@ class TransactionView extends Component {
|
||||
iconSize={16}
|
||||
/>
|
||||
<Card>
|
||||
<WalletLineItem
|
||||
text="Steem"
|
||||
isCircleIcon
|
||||
isThin
|
||||
textColor="#3c4449"
|
||||
iconName="md-star"
|
||||
rightText="27.178 STEEM"
|
||||
/>
|
||||
<GrayWrapper>
|
||||
<WalletLineItem
|
||||
text="Comment Benefactor Reward"
|
||||
description="32 minutes ago"
|
||||
isCircleIcon
|
||||
isThin
|
||||
circleIconColor="white"
|
||||
textColor="#3c4449"
|
||||
iconName="ios-chatboxes"
|
||||
rightText="18,891.867 STEEM"
|
||||
tightTextColor="red"
|
||||
/>
|
||||
</GrayWrapper>
|
||||
<WalletLineItem
|
||||
text="Steem"
|
||||
isCircleIcon
|
||||
isThin
|
||||
textColor="#3c4449"
|
||||
iconName="md-star"
|
||||
rightText="27.178 STEEM"
|
||||
/>
|
||||
<CollapsibleCard
|
||||
titleColor="#788187"
|
||||
title="Wallet Details"
|
||||
expanded={false}
|
||||
noBorder
|
||||
fitContent
|
||||
titleComponent={(
|
||||
<WalletLineItem
|
||||
text="Steem"
|
||||
isCircleIcon
|
||||
isThin
|
||||
textColor="#3c4449"
|
||||
iconName="md-star"
|
||||
rightText="27.178 STEEM"
|
||||
description="1 hour ago"
|
||||
/>
|
||||
)}
|
||||
>
|
||||
<WalletLineItem
|
||||
fitContent
|
||||
text="@barbara-orenya / recycled-items-embellishments-recyclage-pour-decoration-poetique-eng-fr-901b24da0394fest"
|
||||
isThin
|
||||
textColor="#3c4449"
|
||||
/>
|
||||
</CollapsibleCard>
|
||||
{transactions
|
||||
&& transactions.map((item, index) => {
|
||||
if (index % 2 === 0) {
|
||||
return (
|
||||
<WalletLineItem
|
||||
text={item[1].op[0]}
|
||||
description="32 minutes ago"
|
||||
isCircleIcon
|
||||
isThin
|
||||
circleIconColor="white"
|
||||
textColor="#3c4449"
|
||||
iconName="ios-chatboxes"
|
||||
rightText="18,891.867 STEEM"
|
||||
tightTextColor="red"
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<GrayWrapper>
|
||||
<WalletLineItem
|
||||
text="Comment Benefactor Reward"
|
||||
description="32 minutes ago"
|
||||
isCircleIcon
|
||||
isThin
|
||||
circleIconColor="white"
|
||||
textColor="#3c4449"
|
||||
iconName="ios-chatboxes"
|
||||
rightText="18,891.867 STEEM"
|
||||
tightTextColor="red"
|
||||
/>
|
||||
</GrayWrapper>
|
||||
);
|
||||
})}
|
||||
</Card>
|
||||
</View>
|
||||
);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
// Services and Actions
|
||||
import { globalProps, getFeedHistory } from '../../../providers/steem/dsteem';
|
||||
import { globalProps, getFeedHistory, getState } from '../../../providers/steem/dsteem';
|
||||
|
||||
// Middleware
|
||||
|
||||
@ -69,6 +69,11 @@ class WalletContainer extends Component {
|
||||
const timeDiff = Math.abs(parseDate(user.next_vesting_withdrawal) - new Date());
|
||||
walletData.nextVestingWithdrawal = Math.ceil(timeDiff / (1000 * 3600 * 24));
|
||||
|
||||
const state = await getState(`/@${user.name}/transfers`);
|
||||
const { accounts } = state;
|
||||
const { transfer_history: transferHistory } = accounts[user.name];
|
||||
walletData.transactions = transferHistory.slice(Math.max(transferHistory.length - 20, 0));
|
||||
|
||||
this.setState({ walletData });
|
||||
}
|
||||
|
||||
|
@ -80,8 +80,11 @@ class WalletView extends Component {
|
||||
<WalletDetails walletData={walletData} />
|
||||
</CollapsibleCard>
|
||||
)}
|
||||
|
||||
<Transaction />
|
||||
{walletData === null ? (
|
||||
<WalletDetailsPlaceHolder />
|
||||
) : (
|
||||
<Transaction transactions={walletData.transactions} />
|
||||
)}
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
|
@ -37,6 +37,19 @@ export const getAccount = user => new Promise((resolve, reject) => {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @method getAccount get account data
|
||||
* @param user username
|
||||
*/
|
||||
export const getState = async (path) => {
|
||||
try {
|
||||
const state = await client.database.getState(path);
|
||||
return state;
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @method getUser get account data
|
||||
* @param user username
|
||||
|
Loading…
Reference in New Issue
Block a user