Skip to content

Commit

Permalink
Rewards: fix fiat values (#442)
Browse files Browse the repository at this point in the history
* fix fiat values

* fix ts error

* remove import
  • Loading branch information
Nikita-Polyakov authored Aug 19, 2021
1 parent 5bd2b6a commit 3ad8096
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
7 changes: 2 additions & 5 deletions src/components/Rewards/AmountTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
:value="isCodecString ? getFPNumberFromCodec(item.amount, item.asset.decimals).toLocaleString() : item.amount"
:font-size-rate="FontSizeRate.MEDIUM"
:asset-symbol="item.asset.symbol"
:fiat-value="getFiatAmountByCodecString(item.amount, item.asset)"
:fiat-value="isCodecString ? getFiatAmountByCodecString(item.amount, item.asset) : getFiatAmountByString(item.amount, item.asset)"
:fiat-font-size-rate="FontSizeRate.MEDIUM"
with-left-shift
>
Expand Down Expand Up @@ -104,10 +104,7 @@ export default class AmountTable extends Mixins(FormattedAmountMixin, Translatio
}
formatItem (item: RewardInfoGroup | RewardInfo): RewardsAmountTableItem {
const toLimit = (amount, asset) => ({
amount: amount,
asset: asset
})
const toLimit = (amount, asset) => ({ amount, asset })
const key = `rewards.events.${item.type}`
const title = this.te(key) ? this.t(key) : item.type
Expand Down
16 changes: 11 additions & 5 deletions src/components/SwapInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,17 @@ export default class SwapInfo extends Mixins(FormattedAmountMixin, TranslationMi
}
get rewardsValues (): Array<any> {
return this.rewards.map((reward, index) => ({
value: this.formatCodecNumber(reward.amount),
assetSymbol: KnownAssets.get(reward.currency)?.symbol ?? '',
label: index === 0 ? this.t('swap.rewardsForSwap') : ''
}))
return this.rewards.map((reward, index) => {
const asset = KnownAssets.get(reward.currency)
const value = this.formatCodecNumber(reward.amount)
return {
value,
fiatValue: this.getFiatAmountByString(value, asset as AccountAsset),
assetSymbol: asset?.symbol ?? '',
label: index === 0 ? this.t('swap.rewardsForSwap') : ''
}
})
}
get formattedNetworkFee (): string {
Expand Down

0 comments on commit 3ad8096

Please sign in to comment.