- Added full-height flex layout with fixed header and centered main content.
- Locked page scroll via body overflow hidden to prevent outer page scrolling. - Moved game content into scrollable middle pane. - Removed global top padding from styles.css to match new fixed-header layout. - Simplified layout structure and removed unused commented code.
This commit is contained in:
@@ -33,29 +33,17 @@ export default function TicTacToe() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
document.body.style.overflow = "hidden";
|
||||||
|
return () => {
|
||||||
|
document.body.style.overflow = "auto";
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
onMatchData(onMatchDataCallback);
|
onMatchData(onMatchDataCallback);
|
||||||
}, [onMatchData]);
|
}, [onMatchData]);
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// let active = true;
|
|
||||||
//
|
|
||||||
// async function refreshLoop() {
|
|
||||||
// while (active) {
|
|
||||||
// const matches = await listOpenMatches();
|
|
||||||
// setOpenMatches(matches);
|
|
||||||
//
|
|
||||||
// await new Promise(res => setTimeout(res, 500)); // 0.5s refresh
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// refreshLoop();
|
|
||||||
//
|
|
||||||
// return () => {
|
|
||||||
// active = false;
|
|
||||||
// };
|
|
||||||
// }, [listOpenMatches]);
|
|
||||||
|
|
||||||
// ------------------------------------------
|
// ------------------------------------------
|
||||||
// SEND A MOVE
|
// SEND A MOVE
|
||||||
// ------------------------------------------
|
// ------------------------------------------
|
||||||
@@ -66,73 +54,66 @@ export default function TicTacToe() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<div
|
||||||
initial={{ opacity: 0 }}
|
|
||||||
animate={{ opacity: 1 }}
|
|
||||||
style={{
|
style={{
|
||||||
minHeight: "100vh",
|
height: "100vh",
|
||||||
background: "#060606",
|
|
||||||
padding: "30px 0",
|
|
||||||
color: "white",
|
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
alignItems: "center"
|
background: "#060606",
|
||||||
|
color: "white",
|
||||||
|
overflow: "hidden",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* Game header bar */}
|
{/* ---------------- HEADER (always fixed at top) ---------------- */}
|
||||||
<motion.h1
|
<header
|
||||||
initial={{ opacity: 0, y: -10 }}
|
|
||||||
animate={{ opacity: 1, y: 0 }}
|
|
||||||
transition={{ duration: 0.4 }}
|
|
||||||
style={{
|
style={{
|
||||||
marginBottom: "20px",
|
padding: "16px 20px",
|
||||||
padding: "10px 20px",
|
background: "rgba(255,255,255,0.04)",
|
||||||
background: "rgba(255,255,255,0.03)",
|
borderBottom: "1px solid rgba(255,255,255,0.08)",
|
||||||
borderRadius: "16px",
|
backdropFilter: "blur(6px)",
|
||||||
boxShadow: "0 0 20px rgba(255,255,255,0.05)",
|
textAlign: "center",
|
||||||
backdropFilter: "blur(5px)",
|
|
||||||
fontSize: "26px",
|
fontSize: "26px",
|
||||||
fontWeight: 700,
|
fontWeight: 700,
|
||||||
letterSpacing: "1px",
|
letterSpacing: "1px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Tic Tac Toe Multiplayer
|
Tic Tac Toe Multiplayer
|
||||||
</motion.h1>
|
</header>
|
||||||
|
|
||||||
{/* Player component panel */}
|
{/* ---------------- MAIN CONTENT (scrolls) ---------------- */}
|
||||||
<div
|
<motion.div
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{ opacity: 1 }}
|
||||||
style={{
|
style={{
|
||||||
marginBottom: "25px",
|
flex: 1,
|
||||||
width: "100%",
|
overflowY: "auto",
|
||||||
|
padding: "20px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
justifyContent: "center"
|
flexDirection: "column",
|
||||||
|
alignItems: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Player onMatchDataCallback={onMatchDataCallback} />
|
<Player onMatchDataCallback={onMatchDataCallback} />
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Board display container */}
|
<div
|
||||||
<motion.div
|
style={{
|
||||||
initial={{ opacity: 0, y: 20 }}
|
padding: "20px",
|
||||||
animate={{ opacity: session ? 1 : 0.2, y: session ? 0 : 20 }}
|
background: "rgba(255,255,255,0.03)",
|
||||||
transition={{ duration: 0.4 }}
|
borderRadius: "20px",
|
||||||
style={{
|
boxShadow: "0 6px 20px rgba(0,0,0,0.4)",
|
||||||
padding: "20px",
|
minWidth: "300px",
|
||||||
background: "rgba(255,255,255,0.03)",
|
}}
|
||||||
borderRadius: "20px",
|
>
|
||||||
boxShadow: "0 6px 20px rgba(0,0,0,0.4)",
|
<Board
|
||||||
minWidth: "300px",
|
board={board}
|
||||||
}}
|
turn={turn}
|
||||||
>
|
winner={winner}
|
||||||
<Board
|
players={players}
|
||||||
board={board}
|
myUserId={session?.user_id ?? null}
|
||||||
turn={turn}
|
onCellClick={handleCellClick}
|
||||||
winner={winner}
|
/>
|
||||||
players={players}
|
</div>
|
||||||
myUserId={session?.user_id ?? null}
|
|
||||||
onCellClick={handleCellClick}
|
|
||||||
/>
|
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</motion.div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ body {
|
|||||||
background: #eaeef3;
|
background: #eaeef3;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding-top: 50px;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: #222;
|
color: #222;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user