Skip to content

Commit cd44e43

Browse files
committed
feat(neuron-ui): update the info and message of nervos dao
1 parent e8398b6 commit cd44e43

4 files changed

Lines changed: 28 additions & 9 deletions

File tree

packages/neuron-ui/src/components/CustomRows/DAORecordRow.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ const DAORecord = ({
8484
return (
8585
<div className={`${styles.daoRecord} ${depositOutPoint ? styles.isClaim : ''}`}>
8686
<div className={styles.primaryInfo}>
87-
<div>{interest >= BigInt(0) ? `${shannonToCKBFormatter(interest.toString()).toString()} CKB` : ''}</div>
87+
<div>
88+
{interest >= BigInt(0)
89+
? `${depositOutPoint ? '' : '~'}${shannonToCKBFormatter(interest.toString()).toString()} CKB`
90+
: ''}
91+
</div>
8892
<div>{`${shannonToCKBFormatter(capacity)} CKB`}</div>
8993
<div>
9094
<DefaultButton

packages/neuron-ui/src/components/NervosDAO/WithdrawDialog.tsx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useEffect } from 'react'
2-
import { Dialog, DialogFooter, DefaultButton, PrimaryButton, DialogType } from 'office-ui-fabric-react'
2+
import { Dialog, DialogFooter, DefaultButton, PrimaryButton, DialogType, Text } from 'office-ui-fabric-react'
33
import { useTranslation } from 'react-i18next'
44
import { shannonToCKBFormatter, localNumberFormatter } from 'utils/formatters'
55
import { ckbCore } from 'services/chain'
@@ -65,6 +65,14 @@ const WithdrawDialog = ({
6565
blocks: localNumberFormatter(currentEpochInfo.length - currentEpochInfo.index),
6666
days: localNumberFormatter(epochs / BigInt(6)),
6767
})
68+
const alert =
69+
epochs <= BigInt(5)
70+
? t('nervos-dao.withdraw-alert', {
71+
epochs,
72+
nextLeftEpochs: epochs + BigInt(180),
73+
days: (epochs + BigInt(180)) / BigInt(6),
74+
})
75+
: ''
6876
return (
6977
<Dialog
7078
hidden={!record}
@@ -77,20 +85,25 @@ const WithdrawDialog = ({
7785
>
7886
{record ? (
7987
<>
80-
<div>
88+
<Text as="p" variant="large" block>
8189
<span>{`${t('nervos-dao.deposit')}: `}</span>
8290
<span>{`${shannonToCKBFormatter(record.capacity)} CKB`}</span>
83-
</div>
84-
<div>
91+
</Text>
92+
<Text as="p" variant="large" block>
8593
<span>{`${t('nervos-dao.interest')}: `}</span>
8694
<span>
8795
{withdrawValue
8896
? `${shannonToCKBFormatter((BigInt(withdrawValue) - BigInt(record.capacity)).toString())} CKB`
8997
: ''}
9098
</span>
91-
</div>
99+
</Text>
92100
<div>
93-
<span>{message}</span>
101+
<Text as="p" variant="medium" block>
102+
{message}
103+
</Text>
104+
<Text as="p" variant="xSmall" block styles={{ root: { color: 'red' } }}>
105+
{alert}
106+
</Text>
94107
</div>
95108
</>
96109
) : null}

packages/neuron-ui/src/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,8 @@
332332
"withdrawing-action-label": "Claim",
333333
"minimal-fee-required": "The minimum deposit capacity is {{minimal}} CKB",
334334
"interest-accumulated": "{{blockNumber}} blocks interest accumulated",
335-
"blocks-left": "{{epochs}} epochs {{blocks}} blocks left(~{{days}} days)"
335+
"blocks-left": "{{epochs}} epochs {{blocks}} blocks left(~{{days}} days)",
336+
"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."
336337
}
337338
}
338339
}

packages/neuron-ui/src/locales/zh.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,8 @@
332332
"withdrawing-action-label": "Claim",
333333
"minimal-fee-required": "存入金额应不少于 {{minimal}} CKB",
334334
"interest-accumulated": "已累计 {{blockNumber}} 个块的利息",
335-
"blocks-left": " 还需等待 {{epochs}} epochs {{blocks}} 个块(~{{days}} 天)"
335+
"blocks-left": " 还需等待 {{epochs}} epochs {{blocks}} 个块(~{{days}} 天)",
336+
"withdraw-alert": "风险提示:距离 NervosDAO 规定的最近一个允许提现 epoch 仅剩下 {{epochs}} 个 epoch,存在提现交易拥堵无法上链从而导致只能在下一个提现周期(约 {{days}} 天)的风险"
336337
}
337338
}
338339
}

0 commit comments

Comments
 (0)