Skip to content

Commit f5cad48

Browse files
committed
feat: Change the way pending confirmations display on overview
1 parent 1dabb3c commit f5cad48

4 files changed

Lines changed: 18 additions & 16 deletions

File tree

packages/neuron-ui/src/components/Overview/index.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,21 @@ const Overview = ({
129129

130130
if (status === 'success' && confirmationCount < CONFIRMATION_THRESHOLD) {
131131
status = 'pending'
132+
133+
if (confirmationCount === 1) {
134+
confirmations = t('overview.confirmation', {
135+
confirmationCount: localNumberFormatter(confirmationCount),
136+
threshold: CONFIRMATION_THRESHOLD,
137+
})
138+
} else if (confirmationCount > 1) {
139+
confirmations = `${t('overview.confirmations', {
140+
confirmationCount: localNumberFormatter(confirmationCount),
141+
threshold: CONFIRMATION_THRESHOLD,
142+
})}`
143+
}
132144
}
133145

134146
typeLabel = genTypeLabel(item.type, confirmationCount, status)
135-
136-
if (confirmationCount === 1) {
137-
confirmations = t('overview.confirmation', {
138-
confirmationCount: localNumberFormatter(confirmationCount),
139-
})
140-
} else if (confirmationCount > 1) {
141-
confirmations = `${t('overview.confirmations', {
142-
confirmationCount: localNumberFormatter(confirmationCount),
143-
})}`
144-
}
145147
}
146148

147149
return {

packages/neuron-ui/src/components/TransactionList/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const TransactionList = ({
116116
const confirmationCount = 1 + +tipBlockNumber - +item.blockNumber
117117
if (confirmationCount < CONFIRMATION_THRESHOLD) {
118118
return t(`history.confirming-with-count`, {
119-
confirmations: `${Math.max(0, confirmationCount)} / ${CONFIRMATION_THRESHOLD}`,
119+
confirmations: `${Math.max(0, confirmationCount)}/${CONFIRMATION_THRESHOLD}`,
120120
})
121121
}
122122
const confirmations = localNumberFormatter(confirmationCount)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"epoch": "Epoch",
2727
"difficulty": "Difficulty",
2828
"address": "Address",
29-
"confirmation": "{{confirmationCount}} Confirmation",
30-
"confirmations": "{{confirmationCount}} Confirmations",
29+
"confirmation": "{{confirmationCount}}/{{threshold}} Confirmation",
30+
"confirmations": "{{confirmationCount}}/{{threshold}} Confirmations",
3131
"sent": "Sent",
3232
"sending": "Sending",
3333
"received": "Received",
@@ -137,7 +137,7 @@
137137
"placeholder": "Search tx hash, address or date (yyyy-mm-dd)"
138138
},
139139
"confirmations": "Confirmations",
140-
"confirming-with-count": "{{confirmations}} confirmations"
140+
"confirming-with-count": "{{confirmations}} Confirmations"
141141
},
142142
"transaction": {
143143
"date": "Date",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"epoch": "Epoch",
2727
"difficulty": "难度",
2828
"address": "地址",
29-
"confirmation": "{{confirmationCount}} 个确认",
30-
"confirmations": "{{confirmationCount}} 个确认",
29+
"confirmation": "{{confirmationCount}}/{{threshold}} 个确认",
30+
"confirmations": "{{confirmationCount}}{{threshold}} 个确认",
3131
"sent": "已发送",
3232
"sending": "正在发送",
3333
"received": "已收款",

0 commit comments

Comments
 (0)