mirror of
https://github.com/averel10/crypto_clash.git
synced 2026-03-12 10:58:11 +01:00
Display ETH winnings based on game outcome in Reveal component
This commit is contained in:
@@ -319,6 +319,30 @@ export default function Reveal({
|
|||||||
{outcomeData.name}
|
{outcomeData.name}
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
|
{/* Display ETH winnings */}
|
||||||
|
{gameDetails && (
|
||||||
|
<div className="mt-4 pt-4 border-t border-current border-opacity-20">
|
||||||
|
<p className="text-sm text-slate-600 dark:text-slate-300 mb-2">
|
||||||
|
{outcome === 1 ? "You Won" : outcome === 3 ? "Draw" : "You Lost"}
|
||||||
|
</p>
|
||||||
|
<p className="text-3xl font-bold">
|
||||||
|
{outcome === 1 ? (
|
||||||
|
<>
|
||||||
|
+{web3?.utils.fromWei(String(BigInt(gameDetails.initialBet) * BigInt(2)), "ether")} ETH
|
||||||
|
</>
|
||||||
|
) : outcome === 3 ? (
|
||||||
|
<>
|
||||||
|
+{web3?.utils.fromWei(gameDetails.initialBet, "ether")} ETH
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
-{web3?.utils.fromWei(gameDetails.initialBet, "ether")} ETH
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Show Claim Coins button only on win or draw and if game is active */}
|
{/* Show Claim Coins button only on win or draw and if game is active */}
|
||||||
{(outcome === 1 || outcome === 3) && gameDetails?.isActive && (
|
{(outcome === 1 || outcome === 3) && gameDetails?.isActive && (
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user