Merge pull request 'fix: Raw number rendering for taxPaidGes and profit after load (#375)' (#426) from fix/issue-375 into master
This commit is contained in:
commit
83ebc2885d
2 changed files with 10 additions and 4 deletions
|
|
@ -24,3 +24,9 @@ export function compactNumber(value: number): string {
|
|||
export function commaNumber(value: number): string {
|
||||
return value ? value.toLocaleString('en-US') : '0';
|
||||
}
|
||||
|
||||
/** Format a token amount with comma grouping and 2 decimal places (e.g. "1,234.56") */
|
||||
export function formatTokenAmount(value: number): string {
|
||||
if (!isFinite(value)) return '0.00';
|
||||
return value.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,15 +42,15 @@
|
|||
<div v-if="!error || taxPaidGes !== undefined" class="profit-stats-wrapper">
|
||||
<div class="profit-stats-item">
|
||||
<div><b>Tax Paid</b></div>
|
||||
<div>{{ taxPaidGes ?? '...' }} $KRK</div>
|
||||
<div>{{ taxPaidGes !== undefined ? formatTokenAmount(taxPaidGes) : '...' }} $KRK</div>
|
||||
</div>
|
||||
<div class="profit-stats-item">
|
||||
<div><b>Issuance Earned</b></div>
|
||||
<div>{{ profit ?? '...' }} $KRK</div>
|
||||
<div>{{ profit !== undefined ? formatTokenAmount(profit) : '...' }} $KRK</div>
|
||||
</div>
|
||||
<div class="profit-stats-item profit-stats-total">
|
||||
<div><b>Total</b></div>
|
||||
<div>{{ taxPaidGes !== undefined && profit !== undefined ? total.toFixed(5) : '...' }} $KRK</div>
|
||||
<div>{{ taxPaidGes !== undefined && profit !== undefined ? formatTokenAmount(total) : '...' }} $KRK</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -88,7 +88,7 @@ import FButton from '@/components/fcomponents/FButton.vue';
|
|||
import FTag from '@/components/fcomponents/FTag.vue';
|
||||
import FSelect from '@/components/fcomponents/FSelect.vue';
|
||||
import FCollapse from '@/components/fcomponents/FCollapse.vue';
|
||||
import { compactNumber, weiToNumber } from 'kraiken-lib/format';
|
||||
import { compactNumber, weiToNumber, formatTokenAmount } from 'kraiken-lib/format';
|
||||
import { useUnstake } from '@/composables/useUnstake';
|
||||
import { useAdjustTaxRate } from '@/composables/useAdjustTaxRates';
|
||||
import { computed, ref, onMounted } from 'vue';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue