diff --git a/src/app/page.tsx b/src/app/page.tsx index fb14b16..1015f85 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,15 +1,41 @@ +"use client"; + import Footer from "@/components/Footer"; import Header from "@/components/Header"; import HeroSection from "@/components/Home"; +import { PrivyProvider } from "@privy-io/react-auth"; +import { toSolanaWalletConnectors } from "@privy-io/react-auth/solana"; export default function Home() { return (
+
+ ); } diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 5501974..3811348 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -4,9 +4,7 @@ import Link from "next/link"; import Image from "next/image"; import { FaTelegram, FaXTwitter } from "react-icons/fa6"; import { useState } from "react"; -import { PrivyProvider } from "@privy-io/react-auth"; import PrivyButton from "./PrivyButton"; -import { toSolanaWalletConnectors } from "@privy-io/react-auth/solana"; export default function Header() { const [isDrawerOpen, setIsDrawerOpen] = useState(false); @@ -16,26 +14,7 @@ export default function Header() { }; return ( - <> + <>
{/* Logo */} @@ -193,6 +172,6 @@ export default function Header() {
)}
-
+ ); } diff --git a/src/components/Home.tsx b/src/components/Home.tsx index 8b330ea..a537c5a 100644 --- a/src/components/Home.tsx +++ b/src/components/Home.tsx @@ -4,14 +4,15 @@ import { useState } from "react"; import Image from "next/image"; import OpenGames from "./OpenGames"; import { Game, games } from "../data/games"; +import { usePrivy } from "@privy-io/react-auth"; +import { toast } from "react-toastify"; export default function HeroSection() { + const { ready, authenticated } = usePrivy(); const [isModalOpen, setIsModalOpen] = useState(false); const [isGameModalOpen, setIsGameModalOpen] = useState(false); const [selectedGame, setSelectedGame] = useState(null); const [selectedPrice, setSelectedPrice] = useState(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]; @@ -19,22 +20,19 @@ export default function HeroSection() { const handlePriceSelect = (price: number) => setSelectedPrice(price); const handleCreateGame = () => { - if (!isSignedIn) { - setAuthMessage("Please sign in first."); - return; - } + if (!authenticated) return; // Don't proceed if not signed in + 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."); + toast.warn("Please select a game and a price."); } }; const closeModals = () => { setIsModalOpen(false); setIsGameModalOpen(false); - setAuthMessage(""); // Clear message when modal is closed }; return ( @@ -55,13 +53,7 @@ export default function HeroSection() { - - - )} - {/* Game Modal */} {isGameModalOpen && (
@@ -159,12 +133,21 @@ export default function HeroSection() { ))}
+ {/* Create Game Button */} + + {/* Warning if Not Signed In */} + {!authenticated && ( +

Please sign in first

+ )} )}