mirror of
https://github.com/status-im/liquid-funding.git
synced 2025-02-19 22:58:16 +00:00
use token specific amt formatter in project pledges
This commit is contained in:
parent
765ded684f
commit
0a80d12402
@ -14,8 +14,7 @@ import { makeStyles } from '@material-ui/styles'
|
|||||||
import Paper from '@material-ui/core/Paper'
|
import Paper from '@material-ui/core/Paper'
|
||||||
import Tabs from '@material-ui/core/Tabs'
|
import Tabs from '@material-ui/core/Tabs'
|
||||||
import Tab from '@material-ui/core/Tab'
|
import Tab from '@material-ui/core/Tab'
|
||||||
import { toEther } from '../../utils/conversions'
|
import { getTokenLabel, getHumanAmountFormatter } from '../../utils/currencies'
|
||||||
import { getTokenLabel } from '../../utils/currencies'
|
|
||||||
|
|
||||||
const { mWithdraw, withdraw } = LiquidPledging.methods
|
const { mWithdraw, withdraw } = LiquidPledging.methods
|
||||||
const { confirmPayment } = LPVault.methods
|
const { confirmPayment } = LPVault.methods
|
||||||
@ -109,11 +108,12 @@ function SimplePledge({ classes, pledge, values, handleChange, pledgeType }) {
|
|||||||
|
|
||||||
const notPaid = pledgeTypes[pledgeType] !== PAID
|
const notPaid = pledgeTypes[pledgeType] !== PAID
|
||||||
const notPaying = pledgeTypes[pledgeType] !== PAYING
|
const notPaying = pledgeTypes[pledgeType] !== PAYING
|
||||||
|
const amtFormatter = getHumanAmountFormatter(pledge.token)
|
||||||
return (
|
return (
|
||||||
<Card className={classes.card}>
|
<Card className={classes.card}>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Typography className={classes.title} color="primary" gutterBottom>
|
<Typography className={classes.title} color="primary" gutterBottom>
|
||||||
{toEther(pledge.amount)} {getTokenLabel(pledge.token)}
|
{amtFormatter(pledge.amount)} {getTokenLabel(pledge.token)}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="h5" component="h2" className={classes.subText}>
|
<Typography variant="h5" component="h2" className={classes.subText}>
|
||||||
Pledge ID: {pledge.idPledge}
|
Pledge ID: {pledge.idPledge}
|
||||||
|
@ -56,6 +56,7 @@ export const currencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
export const getTokenByAddress = memoizeWith(identity, value => currencies.find(currency => currency.value.toLowerCase() === value.toLowerCase()))
|
export const getTokenByAddress = memoizeWith(identity, value => currencies.find(currency => currency.value.toLowerCase() === value.toLowerCase()))
|
||||||
|
export const getHumanAmountFormatter = tokenAddress => getTokenByAddress(tokenAddress).humanReadibleFn
|
||||||
export const getTokenLabel = value => {
|
export const getTokenLabel = value => {
|
||||||
const token = getTokenByAddress(value)
|
const token = getTokenByAddress(value)
|
||||||
return token ? token.label : null
|
return token ? token.label : null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user