feat: dynamic singular and plural strings on triggers descriptions
This commit is contained in:
parent
473aada9e1
commit
50d763a800
2 changed files with 19 additions and 6 deletions
|
|
@ -9,6 +9,7 @@ import Stepper from 'src/components/Stepper'
|
||||||
import { Button } from 'src/components/buttons'
|
import { Button } from 'src/components/buttons'
|
||||||
import { H5, Info3 } from 'src/components/typography'
|
import { H5, Info3 } from 'src/components/typography'
|
||||||
import { comet } from 'src/styling/variables'
|
import { comet } from 'src/styling/variables'
|
||||||
|
import { singularOrPlural } from 'src/utils/string'
|
||||||
|
|
||||||
import { type, requirements } from './helper'
|
import { type, requirements } from './helper'
|
||||||
|
|
||||||
|
|
@ -105,21 +106,29 @@ const getTypeText = (config, currency, classes) => {
|
||||||
<>
|
<>
|
||||||
makes {orUnderline(config.threshold.threshold, classes)} {currency}{' '}
|
makes {orUnderline(config.threshold.threshold, classes)} {currency}{' '}
|
||||||
worth of transactions within{' '}
|
worth of transactions within{' '}
|
||||||
{orUnderline(config.threshold.thresholdDays, classes)} days
|
{orUnderline(config.threshold.thresholdDays, classes)}{' '}
|
||||||
|
{singularOrPlural(config.threshold.thresholdDays, 'day', 'days')}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
case 'txVelocity':
|
case 'txVelocity':
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
makes {orUnderline(config.threshold.threshold, classes)} transactions
|
makes {orUnderline(config.threshold.threshold, classes)}{' '}
|
||||||
in {orUnderline(config.threshold.thresholdDays, classes)} days
|
{singularOrPlural(
|
||||||
|
config.threshold.threshold,
|
||||||
|
'transaction',
|
||||||
|
'transactions'
|
||||||
|
)}{' '}
|
||||||
|
in {orUnderline(config.threshold.thresholdDays, classes)}{' '}
|
||||||
|
{singularOrPlural(config.threshold.thresholdDays, 'day', 'days')}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
case 'consecutiveDays':
|
case 'consecutiveDays':
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
at least one transaction every day for{' '}
|
at least one transaction every day for{' '}
|
||||||
{orUnderline(config.threshold.thresholdDays, classes)} days
|
{orUnderline(config.threshold.thresholdDays, classes)}{' '}
|
||||||
|
{singularOrPlural(config.threshold.thresholdDays, 'day', 'days')}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
default:
|
default:
|
||||||
|
|
@ -147,7 +156,8 @@ const getRequirementText = (config, classes) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
suspended for{' '}
|
suspended for{' '}
|
||||||
{orUnderline(config.requirement.suspensionDays, classes)} days
|
{orUnderline(config.requirement.suspensionDays, classes)}{' '}
|
||||||
|
{singularOrPlural(config.requirement.suspensionDays, 'day', 'days')}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
case 'block':
|
case 'block':
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,7 @@ const startCase = R.compose(
|
||||||
splitOnUpper
|
splitOnUpper
|
||||||
)
|
)
|
||||||
|
|
||||||
export { startCase, onlyFirstToUpper, formatLong }
|
const singularOrPlural = (amount, singularStr, pluralStr) =>
|
||||||
|
parseInt(amount) === 1 ? singularStr : pluralStr
|
||||||
|
|
||||||
|
export { startCase, onlyFirstToUpper, formatLong, singularOrPlural }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue