Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balance Module: Update latest movement message when not effective #355

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
28 changes: 15 additions & 13 deletions src/components/Dashboard/Balance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -76,11 +76,11 @@ const Balance = React.memo(function Balance({
</div>
<div>
<span
css={`
${textStyle('body2')}
color: ${theme.surfaceContentSecondary};
display:block;
`}
css={`
${textStyle('body2')};
color: ${theme.surfaceContentSecondary};
display: block;
`}
>
{label}
</span>
Expand All @@ -99,10 +99,10 @@ const Balance = React.memo(function Balance({
</div>
<span
css={`
${textStyle('body4')}
color: ${theme.surfaceContentSecondary};
display:block;
`}
${textStyle('body4')};
color: ${theme.surfaceContentSecondary};
display: block;
`}
>
$ {convertedAmount}
</span>
Expand Down Expand Up @@ -218,7 +218,9 @@ const LatestActivity = ({ activity, distribution }) => {
color: ${theme.content};
`}
>
{convertToString(activity.type, activity.direction)}
{activity.isImmediate && !activity.isEffective
? 'Effective next term'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we should have different text for the Inactive part of the balance module to clarify where the inactive portion has moved (to be withdrawal or activated).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm yeah perhaps doesn't make sense to show the effective next term message there since is not something that is relevant for that balance and we can just return the Activated.

: convertToString(activity.type, activity.direction)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should have a tooltip for the Active part of the balance module when it's Effective next term.

I can still see a user being confused about their "immediate" active balance vs. their "effective" active balance at the moment, as we only show one value in the module.

</span>
</div>
{distribution && <ANJLockedHelp distribution={distribution} />}
Expand Down
8 changes: 4 additions & 4 deletions src/components/Dashboard/BalanceModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const BalanceModule = React.memo(
onClick: onRequestActivate,
},
]}
activity={inactiveBalance && inactiveBalance.latestMovement}
activity={inactiveBalance?.latestMovement}
loading={loading}
/>
</Box>
Expand All @@ -114,7 +114,7 @@ const BalanceModule = React.memo(
actions={[
{ label: 'Deactivate', onClick: onRequestDeactivate },
]}
activity={activeBalance && activeBalance.latestMovement}
activity={activeBalance?.latestMovement}
distribution={lockedBalanceDistribution}
loading={loading}
/>
Expand All @@ -139,7 +139,7 @@ const BalanceModule = React.memo(
`}
>
<Balance
amount={walletBalance && walletBalance.amount}
amount={walletBalance?.amount}
label="My wallet"
mainIcon={walletIcon}
mainIconBackground={theme.accent.alpha(0.2)}
Expand All @@ -150,7 +150,7 @@ const BalanceModule = React.memo(
onClick: onRequestStakeActivate,
},
]}
activity={walletBalance && walletBalance.latestMovement}
activity={walletBalance?.latestMovement}
loading={loading}
/>
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/utils/anj-movement-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down