Skip to content

Commit

Permalink
Made login and signup button on home page unavailable when user is lo…
Browse files Browse the repository at this point in the history
…gged in
  • Loading branch information
emmanueposu committed May 30, 2024
1 parent be77af7 commit 9d0f4d9
Showing 1 changed file with 16 additions and 61 deletions.
77 changes: 16 additions & 61 deletions trivia-forge/frontend/src/Pages/HomePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import { Button, Container, Row, Col} from 'react-bootstrap';
import '../App.css';
import { FaRegFolderOpen, FaPlusCircle, FaUserCircle, FaUserPlus } from "react-icons/fa";
import { useNavigate } from 'react-router-dom';
import useStore from "../Components/useStore";

function Home() {
const navigate = useNavigate();
const currentUser = useStore(state => state.currentUser);

return (
<Container className="homepage-container">
Expand All @@ -29,68 +31,21 @@ function Home() {
<Button variant="primary" onClick={() => navigate('/triviagen')}> <FaPlusCircle /> Create New Game </Button>
</Col>
</Row>
<Row>
<Col>
<Button variant="primary" onClick={() => navigate('/login')}> <FaUserCircle /> Login </Button>
</Col>
</Row>
<Row>
<Col>
<Button variant="primary" onClick={() => navigate('/signUp')}> <FaUserPlus /> Sign Up </Button>
</Col>
</Row>
{!currentUser && (
<>
<Row>
<Col>
<Button variant="primary" onClick={() => navigate('/login')}> <FaUserCircle /> Login </Button>
</Col>
</Row>
<Row>
<Col>
<Button variant="primary" onClick={() => navigate('/signUp')}> <FaUserPlus /> Sign Up </Button>
</Col>
</Row>
</>
)}
</Container>
);
};
export default Home;

{/* // <div id="test">
// <h2 class="mt-5 mb-3">Customize Your Game!</h2>
// <div class="container">
// <div class="justify-content-center d-flex text-start">
// <form class="border rounded-4 p-5 col-5" id="customForm">
// <label class="form-label">Game Name</label>
// <input type="text" class="form-control" required></input>
// <label class="form-label mt-3">Catgeories</label>
// <div class="form-check">
// <input type="checkbox" class="form-check-input" name="category"></input>
// <label class="form-check-label" for="category">History</label>
// </div>
// <div class="form-check">
// <input type="checkbox" class="form-check-input" name="category"></input>
// <label class="form-check-label" for="category">Science</label>
// </div>
// <div class="form-check">
// <input type="checkbox" class="form-check-input" name="category"></input>
// <label class="form-check-label" for="category">Geography</label>
// </div>
// <div class="form-check">
// <input type="checkbox" class="form-check-input" name="category"></input>
// <label class="form-check-label" for="category">Sports</label>
// </div>
// <div class="form-check">
// <input type="checkbox" class="form-check-input" name="category"></input>
// <label class="form-check-label" for="category">Art and Literature</label>
// </div>
// <label class="form-label mt-3">Number of Questions</label>
// <input type="number" class="form-control" min="1"></input>
// <label class="form-label mt-3">Difficulty</label>
// <div class="form-check">
// <input type="radio" class="form-check-input" name="category"></input>
// <label class="form-check-label" for="category">Easy</label>
// </div>
// <div class="form-check">
// <input type="radio" class="form-check-input" name="category"></input>
// <label class="form-check-label" for="category">Medium</label>
// </div>
// <div class="form-check mb-3">
// <input type="radio" class="form-check-input" name="category"></input>
// <label class="form-check-label" for="category">Hard</label>
// </div>
// <div class="text-center">
// <button type="submit" class="btn btn-warning">Submit</button>
// </div>
// </form>
// </div>
// </div>
// </div> */}

0 comments on commit 9d0f4d9

Please sign in to comment.