Skip to content

Commit ad6caa3

Browse files
committed
Merge branch 'develop'
2 parents bc29469 + bacebeb commit ad6caa3

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

apps/extension/src/hooks/use-topup.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,26 @@ export function useTopUp({
5050

5151
const remainingText = (() => {
5252
if (remainingTimeMs === undefined) return undefined;
53-
const minutes = Math.floor(remainingTimeMs / 60000);
54-
const seconds = Math.floor((remainingTimeMs % 60000) / 1000);
55-
return intl.formatMessage(
56-
{ id: "components.top-up.wait-time" },
57-
{
58-
minutes: minutes.toString(),
59-
seconds: seconds.toString().padStart(2, "0"),
60-
}
61-
);
53+
54+
const HOUR_MS = 60 * 60 * 1000;
55+
const MINUTE_MS = 60 * 1000;
56+
let time: string;
57+
58+
if (remainingTimeMs >= HOUR_MS) {
59+
const hours = Math.floor(remainingTimeMs / HOUR_MS);
60+
const minutes = Math.floor((remainingTimeMs % HOUR_MS) / MINUTE_MS);
61+
time = `${hours.toString().padStart(2, "0")}h ${minutes
62+
.toString()
63+
.padStart(2, "0")}m`;
64+
} else {
65+
const minutes = Math.floor(remainingTimeMs / MINUTE_MS);
66+
const seconds = Math.floor((remainingTimeMs % MINUTE_MS) / 1000);
67+
time = `${minutes.toString().padStart(2, "0")}m ${seconds
68+
.toString()
69+
.padStart(2, "0")}s`;
70+
}
71+
72+
return intl.formatMessage({ id: "components.top-up.wait-time" }, { time });
6273
})();
6374

6475
useEffect(() => {

apps/extension/src/languages/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@
889889
"components.top-up.tx-fee": "Tx Fee",
890890
"components.top-up.covered-by-keplr": "Covered by Keplr",
891891
"components.top-up.keep-window-open": "Keep this window open during the transaction",
892-
"components.top-up.wait-time": "Next free tx in {minutes}:{seconds}",
892+
"components.top-up.wait-time": "Next free tx in {time}",
893893

894894
"button.confirm": "Confirm",
895895
"button.ok": "OK",

apps/extension/src/languages/ko.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@
795795
"components.top-up.tx-fee": "트랜잭션 수수료",
796796
"components.top-up.covered-by-keplr": "Keplr가 대신 지불",
797797
"components.top-up.keep-window-open": "거래 진행 중에는 이 창을 열어두세요",
798-
"components.top-up.wait-time": "다음 수수료 지원까지 {minutes}:{seconds}",
798+
"components.top-up.wait-time": "다음 수수료 지원까지 {time}",
799799

800800
"button.confirm": "확인",
801801
"button.ok": "확인",

apps/extension/src/languages/zh-cn.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@
738738
"components.top-up.tx-fee": "交易手续费",
739739
"components.top-up.covered-by-keplr": "由 Keplr 支付",
740740
"components.top-up.keep-window-open": "交易期间请保持此窗口打开",
741-
"components.top-up.wait-time": "下次免费交易在 {minutes}:{seconds}",
741+
"components.top-up.wait-time": "下次免费交易在 {time}",
742742

743743
"button.confirm": "确定",
744744
"button.ok": "好的",

0 commit comments

Comments
 (0)