Skip to content

Commit

Permalink
Merge pull request #3653 from Emurgo/fix/YOEXT-1320/total-amount
Browse files Browse the repository at this point in the history
always show total ADA amount in wallet list
  • Loading branch information
vsubhuman committed Sep 27, 2024
2 parents 8721aa6 + 9253da2 commit 6074dbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ export default class AmountDisplay extends Component<Props> {

if (shouldHideBalance) {
balanceDisplay = <span>{hiddenAmount}</span>;
fiatDisplay = (
<span>
{hiddenAmount} {currency}
</span>
);
fiatDisplay = <span>{hiddenAmount}</span>;
} else {
const shiftedAmount = defaultEntry.amount.shiftedBy(-tokenInfo.Metadata.numberOfDecimals);

Expand Down Expand Up @@ -90,7 +86,7 @@ export default class AmountDisplay extends Component<Props> {
)}
{showFiat === true && (
<Typography mb="5px" color="ds.text_gray_medium" fontSize="12px" id={id + '-availableFiatBalance-text'}>
{fiatDisplay || '-'} {currency || 'USD'}
{fiatDisplay || '-'}&nbsp;{currency || 'USD'}
</Typography>
)}
</>
Expand Down
17 changes: 3 additions & 14 deletions packages/yoroi-extension/app/components/topbar/WalletListDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import DialogCloseButton from '../widgets/DialogCloseButton';
import styles from './WalletListDialog.scss';
import WalletCard from './WalletCard';
import globalMessages from '../../i18n/global-messages';
import AmountDisplay, { FiatDisplay } from '../common/AmountDisplay';
import AmountDisplay from '../common/AmountDisplay';
import type { WalletType } from '../../../chrome/extension/background/types';
import type { WalletChecksum } from '@emurgo/cip4-js';
import { Typography, styled } from '@mui/material';
Expand Down Expand Up @@ -293,27 +293,16 @@ export default class WalletListDialog extends Component<Props, State> {

renderWalletsTotal(): ?Node {
const { unitOfAccountSetting, cardanoWallets, shouldHideBalance, getCurrentPrice } = this.props;
if (unitOfAccountSetting.enabled) {
const adaFiat = this.sumWallets(cardanoWallets).fiat;
if (adaFiat != null) {
const totalFiat = adaFiat;
const { currency } = unitOfAccountSetting;
return <FiatDisplay shouldHideBalance={shouldHideBalance} amount={totalFiat} currency={currency} />;
}
}
// either unit of account is not enabled, or fails to convert to fiat
const amount = this.sumWallets(cardanoWallets).sum;
const totalAmountId = `changeWalletDialog:total`;
return (
<AmountDisplay
shouldHideBalance={shouldHideBalance}
amount={amount}
amount={this.sumWallets(cardanoWallets).sum}
getTokenInfo={this.props.getTokenInfo}
showFiat={false}
showAmount
unitOfAccountSetting={unitOfAccountSetting}
getCurrentPrice={getCurrentPrice}
id={totalAmountId}
id="changeWalletDialog:total"
/>
);
}
Expand Down

0 comments on commit 6074dbc

Please sign in to comment.