Skip to content

Commit

Permalink
style(costcenter): fix ratio (labring#5175)
Browse files Browse the repository at this point in the history
  • Loading branch information
xudaotutou authored Oct 25, 2024
1 parent b57e851 commit d6af196
Showing 1 changed file with 30 additions and 17 deletions.
47 changes: 30 additions & 17 deletions frontend/providers/costcenter/src/components/RechargeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -662,27 +662,40 @@ const RechargeModal = forwardRef(
{steps &&
ratios &&
steps.length === ratios.length &&
steps.map((step, idx) => (
<>
<Text key={idx} px={'24px'} color={'grayModern.900'}>
{step + '<='}
{t('Recharge Amount')}
{idx < steps.length - 1 ? `< ${steps[idx + 1]}` : ''}
</Text>
<Text px={'24px'} color={'grayModern.900'}>
{t('Bonus')}
{ratios[idx].toFixed(2)}%
</Text>
</>
))}
steps
.map(
(step, idx, steps) =>
[
step,
idx < steps.length - 1 ? steps[idx + 1] : undefined,
ratios[idx]
] as const
)
.filter(([_, _2, ratio], idx) => {
return ratio > 0;
})
.map(([pre, next, ratio], idx) => (
<>
<Text key={idx} pl={'24px'} color={'grayModern.900'}>
{pre}
{' <= '}
{t('Recharge Amount')}
{next ? `< ${next}` : ''}
</Text>
<Text px={'24px'} color={'grayModern.900'}>
{t('Bonus')}
{ratio.toFixed(2)}%
</Text>
</>
))}
{specialBonus &&
specialBonus.map(([k, v], i) => (
<>
<Text key={i} px={'24px'} color={'grayModern.900'}>
{k + '='} {t('Recharge Amount')}{' '}
<Text key={i} pl={'24px'} color={'grayModern.900'}>
{k} = {t('Recharge Amount')}{' '}
</Text>
<Text px={'24px'} color={'grayModern.900'}>
{t('Bonus')} {v}
<Text pl={'24px'} color={'grayModern.900'}>
{t('Bonus')} {v} %
</Text>
</>
))}
Expand Down

0 comments on commit d6af196

Please sign in to comment.