Skip to content

Commit

Permalink
mentor registrations
Browse files Browse the repository at this point in the history
  • Loading branch information
harshit-jain52 committed Nov 15, 2024
1 parent 090c48f commit d7d81fc
Showing 1 changed file with 47 additions and 49 deletions.
96 changes: 47 additions & 49 deletions src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,55 @@ import kwoc_logo from "../assets/kwoc_logo.png";
import "../styles/Navbar.css";
import {
ROUTER_PATHS,
// GH_OAUTH_URL,
// REGISTRATIONS_OPEN,
GH_OAUTH_URL,
REGISTRATIONS_OPEN,
} from "../util/constants";
// import { useAuthContext } from '../util/auth';
// import { UserType } from '../util/types';
import { useAuthContext } from '../util/auth';
import { UserType } from '../util/types';

// function LoginButton() {
// const authContext = useAuthContext();
function LoginButton() {
const authContext = useAuthContext();

// return (
// <>
// {authContext.isAuthenticated ? (
// <Link
// to={
// authContext.isRegistered
// ? authContext.dashboardLink
// : authContext.formLink
// }
// >
// <img
// className="profile-picture-navbar"
// src={`https://github.com/${authContext.userData.username}.png`}
// />
// </Link>
// ) : REGISTRATIONS_OPEN ? (
// ["mentor", "student"].map((userType, i) => (
// <button
// className='reg-button'
// key={i}
// onClick={(e) => {
// e.preventDefault();
return (
<>
{authContext.isAuthenticated ? (
<Link
to={
authContext.isRegistered
? authContext.dashboardLink
: authContext.formLink
}
>
<img
className="profile-picture-navbar"
src={`https://github.com/${authContext.userData.username}.png`}
/>
</Link>
) : REGISTRATIONS_OPEN ? (
["mentor", "student"].map((userType, i) => (
<button
className='reg-button'
key={i}
onClick={(e) => {
e.preventDefault();

// authContext.setUserType(userType as UserType);
// window.location.href=GH_OAUTH_URL
// }}
// >
// {userType.toUpperCase()} LOGIN
// </button>
// ))
// ) : (
// <Link
// to={GH_OAUTH_URL}
// >
// LOGIN
// </Link>
// )}
// </>
// );
// }
authContext.setUserType(userType as UserType);
window.location.href=GH_OAUTH_URL
}}
>
{userType.toUpperCase()} LOGIN
</button>
))
) : (
<Link
to={GH_OAUTH_URL}
>
LOGIN
</Link>
)}
</>
);
}

const Navbar = () => {
const location = useLocation();
Expand Down Expand Up @@ -98,10 +98,8 @@ const Navbar = () => {
</li>
))}

{/* <LoginButton /> */}
<p>Registrations Coming Soon!</p>

{/* <button className='reg-button'>Registration Opens Soon!</button> */}
<LoginButton />
<p>Register as Mentor</p>
</ul>
<div className='burger' onClick={() => setIsOpen(!isOpen)}>{isOpen ? '✖' : '☰'}</div>
</div>
Expand Down

0 comments on commit d7d81fc

Please sign in to comment.