Skip to content

Commit

Permalink
[frenemies] Adds 'about a min' (MystenLabs#8000)
Browse files Browse the repository at this point in the history
  • Loading branch information
damirka authored Feb 1, 2023
1 parent bb40936 commit 17f18eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dapps/frenemies/src/components/your-score/Refresh.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function Refresh({ scorecard, round, leaderboardID }: Props) {
function: "update",
gasPayment: normalizeSuiAddress(gas.reference.objectId),
typeArguments: [],
gasBudget: 1000000,
gasBudget: Number(GAS_BUDGET),
arguments: [
normalizeSuiAddress(scorecard.reference.objectId),
SUI_SYSTEM_ID,
Expand Down
21 changes: 11 additions & 10 deletions dapps/frenemies/src/utils/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ export function formatBalance(

/** Print time in the format `hh:mm:ss` */
export function formatTimeRemaining(timer: number): string {
return `${new Date(timer)
.getUTCHours()
.toString()
.padStart(2, "0")}:${new Date(timer)
.getUTCMinutes()
.toString()
.padStart(2, "0")}:${new Date(timer)
.getUTCSeconds()
.toString()
.padStart(2, "0")}`;
const date = new Date(timer);
const hh = date.getUTCHours().toString().padStart(2, '0');
const mm = date.getUTCMinutes().toString().padStart(2, '0');
const ss = date.getUTCSeconds().toString().padStart(2, '0');

// When it's less than a minute, we show a text
if (hh == '00' && mm == '00') {
return 'About a min';
}

return `${hh}:${mm}:${ss}`;
}

0 comments on commit 17f18eb

Please sign in to comment.