From 1223ce8da4f9f50d8f6df5cf7dde9e3f61496799 Mon Sep 17 00:00:00 2001 From: Fabrizio Vigevani Date: Tue, 2 Jun 2020 21:55:26 -0300 Subject: [PATCH] Balance Module: Update latest movement message when not effective --- src/components/Dashboard/Balance.js | 28 ++++++++++++----------- src/components/Dashboard/BalanceModule.js | 8 +++---- src/utils/anj-movement-utils.js | 4 +++- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/components/Dashboard/Balance.js b/src/components/Dashboard/Balance.js index ebafcdf0..a7db3cfd 100644 --- a/src/components/Dashboard/Balance.js +++ b/src/components/Dashboard/Balance.js @@ -17,13 +17,13 @@ import ANJIcon from '../../assets/IconANJ.svg' import lockIcon from '../../assets/IconLock.svg' const Balance = React.memo(function Balance({ - label, amount, - loading, actions, - mainIcon, activity, distribution, + label, + loading, + mainIcon, mainIconBackground, }) { const theme = useTheme() @@ -76,11 +76,11 @@ const Balance = React.memo(function Balance({
{label} @@ -99,10 +99,10 @@ const Balance = React.memo(function Balance({
$ {convertedAmount} @@ -218,7 +218,9 @@ const LatestActivity = ({ activity, distribution }) => { color: ${theme.content}; `} > - {convertToString(activity.type, activity.direction)} + {activity.isImmediate && !activity.isEffective + ? 'Effective next term' + : convertToString(activity.type, activity.direction)} {distribution && } diff --git a/src/components/Dashboard/BalanceModule.js b/src/components/Dashboard/BalanceModule.js index 6a51a830..c16c3279 100644 --- a/src/components/Dashboard/BalanceModule.js +++ b/src/components/Dashboard/BalanceModule.js @@ -95,7 +95,7 @@ const BalanceModule = React.memo( onClick: onRequestActivate, }, ]} - activity={inactiveBalance && inactiveBalance.latestMovement} + activity={inactiveBalance?.latestMovement} loading={loading} /> @@ -114,7 +114,7 @@ const BalanceModule = React.memo( actions={[ { label: 'Deactivate', onClick: onRequestDeactivate }, ]} - activity={activeBalance && activeBalance.latestMovement} + activity={activeBalance?.latestMovement} distribution={lockedBalanceDistribution} loading={loading} /> @@ -139,7 +139,7 @@ const BalanceModule = React.memo( `} > diff --git a/src/utils/anj-movement-utils.js b/src/utils/anj-movement-utils.js index 02615da1..1cb97486 100644 --- a/src/utils/anj-movement-utils.js +++ b/src/utils/anj-movement-utils.js @@ -262,9 +262,11 @@ export function convertMovement(acceptedMovements, movement) { const direction = getMovementDirection(acceptedMovements, movementType) return { - type: movementType, amount: movement.amount, direction, + isEffective: movement.isEffective, + isImmediate: movement.isImmediate, + type: movementType, } }