Skip to content

Commit

Permalink
Merge pull request #1045 from nervosnetwork/confirmation-threshold
Browse files Browse the repository at this point in the history
Confirmation update
  • Loading branch information
ashchan authored Nov 3, 2019
2 parents d513498 + f5cad48 commit 6a099dc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
22 changes: 12 additions & 10 deletions packages/neuron-ui/src/components/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,21 @@ const Overview = ({

if (status === 'success' && confirmationCount < CONFIRMATION_THRESHOLD) {
status = 'pending'

if (confirmationCount === 1) {
confirmations = t('overview.confirmation', {
confirmationCount: localNumberFormatter(confirmationCount),
threshold: CONFIRMATION_THRESHOLD,
})
} else if (confirmationCount > 1) {
confirmations = `${t('overview.confirmations', {
confirmationCount: localNumberFormatter(confirmationCount),
threshold: CONFIRMATION_THRESHOLD,
})}`
}
}

typeLabel = genTypeLabel(item.type, confirmationCount, status)

if (confirmationCount === 1) {
confirmations = t('overview.confirmation', {
confirmationCount: localNumberFormatter(confirmationCount),
})
} else if (confirmationCount > 1) {
confirmations = `${t('overview.confirmations', {
confirmationCount: localNumberFormatter(confirmationCount),
})}`
}
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const TransactionList = ({
const confirmationCount = 1 + +tipBlockNumber - +item.blockNumber
if (confirmationCount < CONFIRMATION_THRESHOLD) {
return t(`history.confirming-with-count`, {
confirmations: `${Math.max(0, confirmationCount)} / ${CONFIRMATION_THRESHOLD}`,
confirmations: `${Math.max(0, confirmationCount)}/${CONFIRMATION_THRESHOLD}`,
})
}
const confirmations = localNumberFormatter(confirmationCount)
Expand Down
6 changes: 3 additions & 3 deletions packages/neuron-ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"epoch": "Epoch",
"difficulty": "Difficulty",
"address": "Address",
"confirmation": "{{confirmationCount}} Confirmation",
"confirmations": "{{confirmationCount}} Confirmations",
"confirmation": "{{confirmationCount}}/{{threshold}} Confirmation",
"confirmations": "{{confirmationCount}}/{{threshold}} Confirmations",
"sent": "Sent",
"sending": "Sending",
"received": "Received",
Expand Down Expand Up @@ -137,7 +137,7 @@
"placeholder": "Search tx hash, address or date (yyyy-mm-dd)"
},
"confirmations": "Confirmations",
"confirming-with-count": "{{confirmations}} confirmations"
"confirming-with-count": "{{confirmations}} Confirmations"
},
"transaction": {
"date": "Date",
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-ui/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"epoch": "Epoch",
"difficulty": "难度",
"address": "地址",
"confirmation": "{{confirmationCount}} 个确认",
"confirmations": "{{confirmationCount}} 个确认",
"confirmation": "{{confirmationCount}}/{{threshold}} 个确认",
"confirmations": "{{confirmationCount}}{{threshold}} 个确认",
"sent": "已发送",
"sending": "正在发送",
"received": "已收款",
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/utils/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const MIN_AMOUNT = 61
export const PAGE_SIZE = 15
export const UNREMOVABLE_NETWORK = 'Testnet'
export const UNREMOVABLE_NETWORK_ID = '0'
export const CONFIRMATION_THRESHOLD = 10
export const CONFIRMATION_THRESHOLD = 30

export const MAX_DECIMAL_DIGITS = 8

Expand Down

0 comments on commit 6a099dc

Please sign in to comment.