import { useEffect, useState } from "react";
import Layout from "@/components/Layout";
import CrapsGame from "@/components/CrapsGame";

const CrapsGamePage = () => {
  const [showBackLink, setShowBackLink] = useState(false);

  useEffect(() => {
    // Check if user came from games page
    const referrer = document.referrer;
    if (referrer.includes('/themes/games') && !referrer.includes('/themes/games/craps-game')) {
      setShowBackLink(true);
    }
  }, []);

  return (
    <Layout showBackToGames={showBackLink}>
      <CrapsGame showSocialShare={true} />
    </Layout>
  );
};

export default CrapsGamePage;