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

update number format #144

Merged
merged 1 commit into from
Feb 7, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { CreditRecordType, PoolInfoType, timeUtil } from '@huma-finance/shared'
import {
CreditRecordType,
PoolInfoType,
formatNumber,
timeUtil,
} from '@huma-finance/shared'
import React from 'react'

import { useAppSelector } from '../../../hooks/useRedux'
Expand All @@ -24,7 +29,7 @@ export function Success({
const dueDate = timeUtil.timestampToLL(creditRecord?.dueDate.toNumber())

const content = [
`${borrowAmountNet} ${symbol} is now in your wallet.`,
`${formatNumber(borrowAmountNet)} ${symbol} is now in your wallet.`,
`Note: your payment will be automatically deducted on ${dueDate}.`,
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
CreditStatsV2,
formatNumber,
timeUtil,
UnderlyingTokenInfo,
} from '@huma-finance/shared'
Expand Down Expand Up @@ -27,7 +28,7 @@ export function Success({
const dueDate = timeUtil.timestampToLL(creditRecord?.nextDueDate.toNumber())

const content = [
`${borrowAmountNet} ${symbol} is now in your wallet.`,
`${formatNumber(borrowAmountNet)} ${symbol} is now in your wallet.`,
`Note: your payment will be automatically deducted on ${dueDate}.`,
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
decodeLogs,
downScale,
formatMoney,
formatNumber,
PoolInfoType,
sendTxAtom,
TRANSFER_ABI,
Expand Down Expand Up @@ -32,7 +32,7 @@ export function Success({ poolInfo, handleAction }: Props): React.ReactElement {
}, [decimals, txReceipt])

const content = [
`You successfully paid ${formatMoney(payedAmount)} ${symbol}.`,
`You successfully paid ${formatNumber(payedAmount)} ${symbol}.`,
]

return <TxDoneModal handleAction={handleAction} content={content} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
decodeLogs,
downScale,
formatMoney,
formatNumber,
sendTxAtom,
TRANSFER_ABI,
UnderlyingTokenInfo,
Expand Down Expand Up @@ -35,7 +35,7 @@ export function Success({
}, [decimals, txReceipt])

const content = [
`You successfully paid ${formatMoney(paidAmount)} ${symbol}.`,
`You successfully paid ${formatNumber(paidAmount)} ${symbol}.`,
]

return <TxDoneModal handleAction={handleAction} content={content} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { formatNumber } from '@huma-finance/shared'
import React from 'react'

import { useAppSelector } from '../../../hooks/useRedux'
import { selectWidgetState } from '../../../store/widgets.selectors'
import { TxDoneModal } from '../../TxDoneModal'
Expand All @@ -12,7 +14,9 @@ export function Success({ handleAction }: Props): React.ReactElement {
useAppSelector(selectWidgetState)

const content = [
`${borrowAmountNet} ${approval?.token.symbol} is now in your wallet.`,
`${formatNumber(borrowAmountNet)} ${
approval?.token.symbol
} is now in your wallet.`,
`The remaining ${remainder} ${approval?.token.symbol} will be sent to your wallet when the invoice is paid.`,
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
CreditStatsV2,
formatNumber,
timeUtil,
UnderlyingTokenInfo,
} from '@huma-finance/shared'
Expand Down Expand Up @@ -27,7 +28,7 @@ export function Success({
const dueDate = timeUtil.timestampToLL(creditRecord?.nextDueDate.toNumber())

const content = [
`${borrowAmountNet} ${symbol} is now in your wallet.`,
`${formatNumber(borrowAmountNet)} ${symbol} is now in your wallet.`,
`Note: your payment will be automatically deducted on ${dueDate}.`,
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
decodeLogs,
downScale,
formatMoney,
formatNumber,
TRANSFER_ABI,
UnderlyingTokenInfo,
} from '@huma-finance/shared'
Expand Down Expand Up @@ -37,12 +37,12 @@ export function Success({
}
}, [decimals, successTxReceipt])

const amoutFormatted = formatMoney(paidAmount)
const amountFormatted = formatNumber(paidAmount)
const content =
paymentType === PaymentType.PaymentWithReceivable
? [`You successfully paid ${amoutFormatted} ${symbol}.`]
? [`You successfully paid ${amountFormatted} ${symbol}.`]
: [
`You successfully paid ${amoutFormatted} ${symbol} and borrowed ${amoutFormatted} ${symbol}.`,
`You successfully paid ${amountFormatted} ${symbol} and borrowed ${amountFormatted} ${symbol}.`,
]

return <TxDoneModal handleAction={handleAction} content={content} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { formatNumber } from '@huma-finance/shared'
import React from 'react'

import { useAppSelector } from '../../../hooks/useRedux'
import { selectWidgetState } from '../../../store/widgets.selectors'
import { TxDoneModal } from '../../TxDoneModal'
Expand All @@ -11,7 +13,7 @@ export function Success({ handleAction }: Props): React.ReactElement {
const { borrowAmount, approval } = useAppSelector(selectWidgetState)

const content = [
`${borrowAmount?.toFixed(2)} ${
`${formatNumber(borrowAmount)} ${
approval?.token.symbol
} is now in your wallet.`,
]
Expand Down
Loading