From 131c6b56712655ce474a062df95c4ca28a08f7be Mon Sep 17 00:00:00 2001 From: Nouman Tahir <nouman.hawkdev@gmail.com> Date: Wed, 23 Mar 2022 20:19:24 +0500 Subject: [PATCH] handling pending requests extra data --- src/components/transaction/transactionView.js | 5 ++++- src/config/locales/en-US.json | 3 ++- src/redux/reducers/walletReducer.ts | 1 + src/utils/wallet.ts | 12 ++++++++---- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/transaction/transactionView.js b/src/components/transaction/transactionView.js index be6b66a3a..41b6d4bb2 100644 --- a/src/components/transaction/transactionView.js +++ b/src/components/transaction/transactionView.js @@ -21,7 +21,10 @@ const TransactionView = ({ item, index }) => { text={intl.formatMessage({ id: `wallet.${get(item, 'textKey')}`, })} - description={getTimeFromNow(get(item, 'created'))} + description={ + (item.expires ? intl.formatMessage({ id: 'wallet.expires' }) + ' ' : '') + + getTimeFromNow(item.expires || item.created) + } isCircleIcon isThin circleIconColor="white" diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index c1888733f..f2ff68730 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -127,7 +127,8 @@ "activities":"Activities", "savings_withdrawal":"Pending Withdrawals", "open_orders":"Open Orders", - "conversions_requested":"Converstions Requested" + "conversions_requested":"Converstions Requested", + "expires":"expires" }, "notification": { "vote": "voted", diff --git a/src/redux/reducers/walletReducer.ts b/src/redux/reducers/walletReducer.ts index 68cb1cb6c..7125a52e0 100644 --- a/src/redux/reducers/walletReducer.ts +++ b/src/redux/reducers/walletReducer.ts @@ -33,6 +33,7 @@ export interface CoinActivity { iconType: string; textKey: string; created: string; + expires: string; icon: string; value:string; details: string; diff --git a/src/utils/wallet.ts b/src/utils/wallet.ts index f4315da8a..050039093 100644 --- a/src/utils/wallet.ts +++ b/src/utils/wallet.ts @@ -291,9 +291,11 @@ const fetchPendingRequests = async (username: string, coinSymbol: string): Promi return ({ iconType: "MaterialIcons", textKey: 'fill_order', - created: request.expiration, + expires: request.expiration, + created: request.created, icon: 'reorder', - value: request.sell_price.base + value: request.sell_price.base, + details: '', } as CoinActivity) }) @@ -305,7 +307,9 @@ const fetchPendingRequests = async (username: string, coinSymbol: string): Promi textKey: "transfer_from_savings", created: request.complete, icon: "compare-arrows", - value: request.amount + value: request.amount, + details: request.from && request.to ? `@${request.from} to @${request.to}` : null, + memo: request.memo || null } as CoinActivity) }) @@ -328,7 +332,7 @@ const fetchPendingRequests = async (username: string, coinSymbol: string): Promi ]; pendingRequests.sort((a, b) => ( - new Date(a.created).getTime() > new Date(b.created).getTime() ? 1 : -1 + new Date(a.expires || a.created).getTime() > new Date(b.expires || b.created).getTime() ? 1 : -1 )) return pendingRequests;