(null);
+ const [isSignedIn, setIsSignedIn] = useState(false); // Replace with actual authentication logic
+ const [authMessage, setAuthMessage] = useState(""); // Message for sign-in prompt
+
+ const prices = [0.2, 0.5, 0.8];
+
+ const handleGameSelect = (game: Game) => setSelectedGame(game);
+ const handlePriceSelect = (price: number) => setSelectedPrice(price);
+
+ const handleCreateGame = () => {
+ if (!isSignedIn) {
+ setAuthMessage("Please sign in first.");
+ return;
+ }
+ if (selectedGame && selectedPrice !== null) {
+ console.log(`Creating game: ${selectedGame.name} with price ${selectedPrice} SOL`);
+ setIsGameModalOpen(false);
+ } else {
+ console.log("Please select a game and a price.");
+ }
+ };
+
+ const closeModals = () => {
+ setIsModalOpen(false);
+ setIsGameModalOpen(false);
+ setAuthMessage(""); // Clear message when modal is closed
+ };
return (
<>
- {/* Centered Image */}
- {/* Big Text */}
Instant Duels, Instant{" "}
Wins
- {/* Create a Game Button */}
-
- {/* Modal */}
- {isModalOpen && (
-
+ {/* Authentication Prompt */}
+ {authMessage && (
+
+
e.stopPropagation()}
+ >
+
{authMessage}
+
+ Okay
+
+
+
+ )}
+
+ {/* Game Modal */}
+ {isGameModalOpen && (
+
e.stopPropagation()}
+ >
+
Create Game
+
+ {/* Game Selection */}
+
+ {games.map((game) => (
+
handleGameSelect(game)}
+ >
+
+
{game.name}
+
+ ))}
+
+
+ {/* Price Selection */}
+
+ {prices.map((price) => (
+
handlePriceSelect(price)}
+ >
+
+ {price} SOL
+
+ ))}
+
+
+
+ Create Game
+
+
+
+ )}
+
+ {/* How it Works Modal */}
+ {isModalOpen && (
+
+
e.stopPropagation()}
>
How It Works
- {/* Steps */}
-
-
1. Connect Your Wallet
-
- Start by linking your wallet securely.
-
-
-
-
2. Create or Join Game
-
- Pick a game and set a wager, or join an existing match.
-
-
-
-
3. Place Your Bet
-
- Confirm your wager and get ready to play.
-
-
-
-
4. Claim Your Winnings
-
- Win the game and collect your rewards instantly!
-
-
+ {[
+ { step: "Connect Your Wallet", desc: "Start by linking your wallet securely." },
+ { step: "Create or Join Game", desc: "Pick a game and set a wager, or join an existing match." },
+ { step: "Place Your Bet", desc: "Confirm your wager and get ready to play." },
+ { step: "Claim Your Winnings", desc: "Win the game and collect your rewards instantly!" },
+ ].map(({ step, desc }, index) => (
+
+
{index + 1}. {step}
+
{desc}
+
+ ))}
- {/* Okay Button */}
setIsModalOpen(false)}
@@ -100,23 +201,6 @@ export default function HeroSection() {
)}
-
- {/* Animation */}
-
>
);
}
diff --git a/src/components/OpenGames.tsx b/src/components/OpenGames.tsx
index 6565183..b40d127 100644
--- a/src/components/OpenGames.tsx
+++ b/src/components/OpenGames.tsx
@@ -1,28 +1,6 @@
"use client";
-
import Image from "next/image";
-
-const games = [
- {
- id: 1,
- name: "Block Drop",
- entryFee: "0.1 SOL",
- thumbnail: "/duelfiassets/Block Drop Illustration.jpeg",
- },
- {
- id: 2,
- name: "Venom Trails",
- entryFee: "0.02 ETH",
- thumbnail: "/duelfiassets/Venom Trail Game Cover Illustration.png",
- },
- {
- id: 3,
- name: "Wall Smash",
- entryFee: "0.05 ETH",
- thumbnail: "/duelfiassets/Wall Smash Game Cover Illustration.png",
- },
-];
-
+import {games} from "../data/games";
export default function OpenGames() {
return (
diff --git a/src/components/PrivyButton.tsx b/src/components/PrivyButton.tsx
index c4de47c..2d690bc 100644
--- a/src/components/PrivyButton.tsx
+++ b/src/components/PrivyButton.tsx
@@ -11,8 +11,7 @@ export default function PrivyButton() {
const { wallets } = useSolanaWallets();
const [isModalOpen, setIsModalOpen] = useState(false);
const [solWallet, setSolWallet] = useState("");
- const [solBalance, setSolBalance] = useState("--"); // Placeholder
- const [tokenBalance] = useState("--"); // Placeholder
+ const [solBalance, setSolBalance] = useState("--");
const modalRef = useRef(null);
useEffect(() => {
@@ -89,7 +88,7 @@ export default function PrivyButton() {
) : (
Sign In
@@ -124,12 +123,6 @@ export default function PrivyButton() {
{solBalance} SOL
- {/* Token Balance */}
-
-
Token Balance
-
{tokenBalance}
-
-
{/* Socials */}
{(user?.discord?.username || user?.email?.address) && (
diff --git a/src/data/games.ts b/src/data/games.ts
new file mode 100644
index 0000000..2fb874e
--- /dev/null
+++ b/src/data/games.ts
@@ -0,0 +1,27 @@
+export const games = [
+ {
+ id: 1,
+ name: "Block Drop",
+ entryFee: "0.1 SOL",
+ thumbnail: "/duelfiassets/Block Drop Illustration.jpeg",
+ },
+ {
+ id: 2,
+ name: "Venom Trails",
+ entryFee: "0.02 ETH",
+ thumbnail: "/duelfiassets/Venom Trail Game Cover Illustration.png",
+ },
+ {
+ id: 3,
+ name: "Wall Smash",
+ entryFee: "0.05 ETH",
+ thumbnail: "/duelfiassets/Wall Smash Game Cover Illustration.png",
+ },
+];
+
+export interface Game {
+ id: number;
+ name: string;
+ entryFee: string;
+ thumbnail: string;
+ }
\ No newline at end of file