++
Added already existing code for further development
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import React from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
function Home({ isLoggedIn, setIsLoggedIn }) {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleLogout = () => {
|
||||
setIsLoggedIn(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="container">
|
||||
<h2>Welcome to the Game</h2>
|
||||
{!isLoggedIn ? (
|
||||
<div className="button-group">
|
||||
<button className="btn" onClick={() => navigate('/login')}>Login</button>
|
||||
<button className="btn" onClick={() => navigate('/register')}>Register</button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="button-group">
|
||||
<button className="btn" onClick={() => navigate('/start-game')}>Start Game</button>
|
||||
<button className="btn" onClick={() => navigate('/join-game')}>Join Game</button>
|
||||
<button className="btn" onClick={() => navigate('/continue-game')}>Continue Game</button>
|
||||
<button className="btn" onClick={handleLogout}>Logout</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Home;
|
||||
Reference in New Issue
Block a user