Skip to content

Commit

Permalink
feat(neuron-ui): update the info and message of nervos dao
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Nov 12, 2019
1 parent e8398b6 commit cd44e43
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
Expand Up @@ -84,7 +84,11 @@ const DAORecord = ({
return (
<div className={`${styles.daoRecord} ${depositOutPoint ? styles.isClaim : ''}`}>
<div className={styles.primaryInfo}>
<div>{interest >= BigInt(0) ? `${shannonToCKBFormatter(interest.toString()).toString()} CKB` : ''}</div>
<div>
{interest >= BigInt(0)
? `${depositOutPoint ? '' : '~'}${shannonToCKBFormatter(interest.toString()).toString()} CKB`
: ''}
</div>
<div>{`${shannonToCKBFormatter(capacity)} CKB`}</div>
<div>
<DefaultButton
Expand Down
25 changes: 19 additions & 6 deletions packages/neuron-ui/src/components/NervosDAO/WithdrawDialog.tsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react'
import { Dialog, DialogFooter, DefaultButton, PrimaryButton, DialogType } from 'office-ui-fabric-react'
import { Dialog, DialogFooter, DefaultButton, PrimaryButton, DialogType, Text } from 'office-ui-fabric-react'
import { useTranslation } from 'react-i18next'
import { shannonToCKBFormatter, localNumberFormatter } from 'utils/formatters'
import { ckbCore } from 'services/chain'
Expand Down Expand Up @@ -65,6 +65,14 @@ const WithdrawDialog = ({
blocks: localNumberFormatter(currentEpochInfo.length - currentEpochInfo.index),
days: localNumberFormatter(epochs / BigInt(6)),
})
const alert =
epochs <= BigInt(5)
? t('nervos-dao.withdraw-alert', {
epochs,
nextLeftEpochs: epochs + BigInt(180),
days: (epochs + BigInt(180)) / BigInt(6),
})
: ''
return (
<Dialog
hidden={!record}
Expand All @@ -77,20 +85,25 @@ const WithdrawDialog = ({
>
{record ? (
<>
<div>
<Text as="p" variant="large" block>
<span>{`${t('nervos-dao.deposit')}: `}</span>
<span>{`${shannonToCKBFormatter(record.capacity)} CKB`}</span>
</div>
<div>
</Text>
<Text as="p" variant="large" block>
<span>{`${t('nervos-dao.interest')}: `}</span>
<span>
{withdrawValue
? `${shannonToCKBFormatter((BigInt(withdrawValue) - BigInt(record.capacity)).toString())} CKB`
: ''}
</span>
</div>
</Text>
<div>
<span>{message}</span>
<Text as="p" variant="medium" block>
{message}
</Text>
<Text as="p" variant="xSmall" block styles={{ root: { color: 'red' } }}>
{alert}
</Text>
</div>
</>
) : null}
Expand Down
3 changes: 2 additions & 1 deletion packages/neuron-ui/src/locales/en.json
Expand Up @@ -332,7 +332,8 @@
"withdrawing-action-label": "Claim",
"minimal-fee-required": "The minimum deposit capacity is {{minimal}} CKB",
"interest-accumulated": "{{blockNumber}} blocks interest accumulated",
"blocks-left": "{{epochs}} epochs {{blocks}} blocks left(~{{days}} days)"
"blocks-left": "{{epochs}} epochs {{blocks}} blocks left(~{{days}} days)",
"withdraw-alert": "Alert: these are only {{epochs}} epochs left before the next start withdrawing epoch number conforming to Nervos DAO, and it is possible that you have to do the withdraw after the next period(~{{days}}) due to the jam on CKB."
}
}
}
3 changes: 2 additions & 1 deletion packages/neuron-ui/src/locales/zh.json
Expand Up @@ -332,7 +332,8 @@
"withdrawing-action-label": "Claim",
"minimal-fee-required": "存入金额应不少于 {{minimal}} CKB",
"interest-accumulated": "已累计 {{blockNumber}} 个块的利息",
"blocks-left": " 还需等待 {{epochs}} epochs {{blocks}} 个块(~{{days}} 天)"
"blocks-left": " 还需等待 {{epochs}} epochs {{blocks}} 个块(~{{days}} 天)",
"withdraw-alert": "风险提示:距离 NervosDAO 规定的最近一个允许提现 epoch 仅剩下 {{epochs}} 个 epoch,存在提现交易拥堵无法上链从而导致只能在下一个提现周期(约 {{days}} 天)的风险"
}
}
}

0 comments on commit cd44e43

Please sign in to comment.