v1 rc4 fixes
This commit is contained in:
parent
b01e31f146
commit
caf681a4e6
|
|
@ -26,7 +26,7 @@ export default function Header() {
|
|||
return (
|
||||
<>
|
||||
<header className="w-full bg-[rgb(22,22,22)] shadow-md h-26">
|
||||
<div className="container mx-auto flex items-center justify-between px-12 h-full max-w-screen-xl w-full">
|
||||
<div className="container mx-auto flex items-center justify-between px-3 h-full max-w-screen-xl w-full">
|
||||
{/* Logo */}
|
||||
<div className="flex items-center">
|
||||
<Image
|
||||
|
|
@ -166,7 +166,9 @@ export default function Header() {
|
|||
|
||||
{/* Mobile-only view (Logo & Login) */}
|
||||
<div className="flex md:hidden items-center ">
|
||||
<div className="scale-[0.8]">
|
||||
<PrivyButton></PrivyButton>
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={toggleDrawer}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ export default function HeroSection() {
|
|||
const [solWallet, setSolWallet] = useState<ConnectedSolanaWallet>();
|
||||
const [myActiveBet, setMyActiveBet] = useState<Bet>();
|
||||
const [rematch, setRematch] = useState(false);
|
||||
const [refund, setRefund] = useState(false);
|
||||
const [lastActiveBet, setLastActiveBet] = useState<Bet>();
|
||||
const [rematchInProgress, setRematchInProgress] = useState(false);
|
||||
const [rematchTxError, setRematchTxError] = useState(false);
|
||||
|
|
@ -48,7 +47,6 @@ export default function HeroSection() {
|
|||
|
||||
const game_close_signal = (status: number) => {
|
||||
setRematch(status == 1);
|
||||
setRefund(status == -1);
|
||||
setMyActiveBet(undefined);
|
||||
};
|
||||
|
||||
|
|
@ -63,12 +61,19 @@ export default function HeroSection() {
|
|||
const fetchedBets = await fetchOpenBets(wallet);
|
||||
const filteredBets = fetchedBets.filter((bet) => !(bet.owner_id && bet.joiner_id));
|
||||
const filledBets = fetchedBets.filter((bet) => bet.owner_id && bet.joiner_id);
|
||||
const activeBet = filledBets.find((bet) => bet.owner_id === user?.id || bet.joiner_id === user?.id);
|
||||
let activeBet = filledBets.find((bet) => bet.owner_id === user?.id || bet.joiner_id === user?.id);
|
||||
|
||||
if(!activeBet && refund){ // if user got rid of the bet and still on a refund, set refund to false
|
||||
setRefund(false);
|
||||
if(activeBet){
|
||||
const betHistoryResponse = await fetch(`https://vps.playpoolstudios.com/duelfi/api/get_game_completed.php?address=${activeBet.address}`);
|
||||
const betHistory = await betHistoryResponse.text();
|
||||
|
||||
console.log(`bet history for ${activeBet.address}: ${betHistory}`);
|
||||
|
||||
if(betHistory == "1"){
|
||||
activeBet = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(rematch){
|
||||
setMyActiveBet(undefined);
|
||||
return;
|
||||
|
|
@ -232,11 +237,7 @@ export default function HeroSection() {
|
|||
return (
|
||||
<>
|
||||
{myActiveBet ? (
|
||||
rematch ? (
|
||||
<div className="w-full h-screen flex justify-center items-center bg-black">
|
||||
<label>Loading...</label>
|
||||
</div>
|
||||
) : (
|
||||
(
|
||||
myActiveBet.owner_id && myActiveBet.joiner_id ? (
|
||||
<div className="w-full h-screen flex justify-center items-center bg-black">
|
||||
<iframe
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export const games = [
|
|||
id: "tetris",
|
||||
name: "Block Drop",
|
||||
entryFee: "0.1 SOL",
|
||||
thumbnail: "/duelfiassets/Block Drop Illustration.jpeg",
|
||||
thumbnail: "/duelfiassets/Block Drop Game Cover Illustration.png",
|
||||
isAvailable: true
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export const fetchOpenBets = async (wallets: ConnectedSolanaWallet): Promise<Bet
|
|||
signAllTransactions: wallets.signAllTransactions,
|
||||
};
|
||||
const provider = new AnchorProvider(connection, wallet, {
|
||||
preflightCommitment: CONFIRMATION_THRESHOLD,
|
||||
preflightCommitment: 'recent',
|
||||
});
|
||||
|
||||
const program = new Program<Bets>(idl, provider);
|
||||
|
|
@ -27,7 +27,7 @@ export const fetchOpenBets = async (wallets: ConnectedSolanaWallet): Promise<Bet
|
|||
program.programId
|
||||
);
|
||||
// Fetch all open bet accounts
|
||||
const bet_list = await program.account.betsList.fetch(bet_list_pda);
|
||||
const bet_list = await program.account.betsList.fetch(bet_list_pda, 'recent');
|
||||
|
||||
// Extract required bet data
|
||||
const formattedBets = await Promise.all(
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user