import React, { useState, useEffect } from 'react'; import { useNavigate, useLocation } from 'react-router-dom'; import { Box, Container, Typography, Paper, Grid, Button, alpha, GlobalStyles, } from '@mui/material'; import { useTheme } from '@mui/material/styles'; import ConstructionIcon from '@mui/icons-material/Construction'; import RocketLaunchIcon from '@mui/icons-material/RocketLaunch'; import { Beta } from '../components/ui/Beta'; interface BetaPageProps { children?: React.ReactNode; title?: string; subtitle?: string; returnPath?: string; returnLabel?: string; onReturn?: () => void; } const BetaPage: React.FC = ({ children, title = 'Coming Soon', subtitle = 'This page is currently in development', returnPath = '/', returnLabel = 'Return to Backstory', onReturn, }) => { const theme = useTheme(); const [showSparkle, setShowSparkle] = useState(false); const navigate = useNavigate(); const location = useLocation(); if (!children) { children = ( The page you requested ({location.pathname.replace(/^\//, '')}) is not yet ready. ); } // Enhanced sparkle effect for background elements const [sparkles, setSparkles] = useState< Array<{ id: number; x: number; y: number; size: number; opacity: number; duration: number; delay: number; }> >([]); useEffect(() => { // Generate sparkle elements with random properties const newSparkles = Array.from({ length: 30 }).map((_, index) => ({ id: index, x: Math.random() * 100, y: Math.random() * 100, size: 2 + Math.random() * 5, opacity: 0.3 + Math.random() * 0.7, duration: 2 + Math.random() * 4, delay: Math.random() * 3, })); setSparkles(newSparkles); // Show main sparkle effect after a short delay const timer = setTimeout(() => { setShowSparkle(true); }, 500); return () => clearTimeout(timer); }, []); const handleReturn = (): void => { if (onReturn) { onReturn(); } else if (returnPath) { navigate(returnPath); } }; return ( {/* Animated background elements */} {sparkles.map(sparkle => ( ))} {title} {subtitle} {/* Construction icon */} {/* Content */} {children || ( We're working hard to bring you this exciting new feature! Check back soon for updates. )} div': { paddingRight: '30px', background: 'gold', color: '#808080', }, }} onClick={(): void => { navigate('/docs/beta'); }} /> {/* Return button */} {/* Global styles added with MUI's GlobalStyles component */} ); }; export { BetaPage };