forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[frenemies] Add claim workflow (MystenLabs#8256)
- Loading branch information
1 parent
09293e2
commit 2e6f86a
Showing
16 changed files
with
355 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { useEffect } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { GAME_END_DATE, gameIsOver } from "../config"; | ||
import { Card } from "./Card"; | ||
|
||
export function useGameOverRedirect() { | ||
const navigate = useNavigate(); | ||
|
||
useEffect(() => { | ||
if (gameIsOver()) { | ||
navigate("/claim", { replace: true }); | ||
return; | ||
} | ||
|
||
const timer = setTimeout(() => { | ||
navigate("/claim", { replace: true }); | ||
}, GAME_END_DATE.getTime() - Date.now()); | ||
return () => { | ||
clearTimeout(timer); | ||
}; | ||
}, []); | ||
} | ||
|
||
export function GameEnding() { | ||
return ( | ||
<Card> | ||
<h2 className="text-steel-darker font-semibold text-heading2"> | ||
Frenemies is ending soon | ||
</h2> | ||
<div className="text-left text-steel-darker mt-4"> | ||
Frenemies will end on{" "} | ||
<span className="font-bold"> | ||
{GAME_END_DATE.toLocaleString("en-US", { | ||
day: "numeric", | ||
month: "long", | ||
minute: "2-digit", | ||
hour: "numeric", | ||
timeZoneName: "short", | ||
})} | ||
</span> | ||
. We will take a snapshot of the leaderboard by 10am PST. Please submit | ||
your final moves before that time. | ||
</div> | ||
</Card> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ export function useBalance() { | |
{ | ||
enabled: !!currentAccount, | ||
refetchInterval: 60 * 1000, | ||
staleTime: 2000, | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ export function useValidators() { | |
}, | ||
{ | ||
refetchInterval: 60 * 1000, | ||
staleTime: 5000, | ||
} | ||
); | ||
} |
Oops, something went wrong.