diff --git a/src/app/(app)/layout.tsx b/src/app/(app)/layout.tsx index 48b34ff..57b3653 100644 --- a/src/app/(app)/layout.tsx +++ b/src/app/(app)/layout.tsx @@ -1,36 +1,61 @@ "use client"; +import { useState } from "react"; import MobileNav from "@/lib/components/MobileNav"; import NavBar from "@/lib/components/NavBar"; import { useDevice } from "@/lib/context/DeviceContext"; export default function RootLayout({ - children, + children, }: Readonly<{ - children: React.ReactNode; + children: React.ReactNode; }>) { - const { isMobile, isSafari } = useDevice(); + const { isMobile, isSafari } = useDevice(); + const [isPlaying, setIsPlaying] = useState(false); - return ( -
- {!isMobile && !isSafari ? : null} -
- {children} -
- {isMobile && isSafari ? ( - <> - {/* Background Music */} - + const handlePlayMusic = () => { + const audioElement = document.getElementById("background-music") as HTMLAudioElement; + if (audioElement) { + audioElement.play(); + setIsPlaying(true); + } + }; - {/* Mobile Navigation */} -
- -
- - ) : null} -
- ); + return ( +
+ {!isMobile && !isSafari ? : null} +
+ {children} +
+ {isMobile && isSafari ? ( + <> + {/* Background Music */} + + + {/* Play Button */} + {!isPlaying && ( +
+ +
+ )} + + {/* Mobile Navigation */} +
+ +
+ + ) : null} +
+ ); }