Skip to content

Commit

Permalink
added checks for onboarding status
Browse files Browse the repository at this point in the history
  • Loading branch information
kylezryr committed Nov 24, 2024
1 parent 0fb2d06 commit 570c01f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import CONFIG from '@/lib/configs';
import { useProfile } from '@/utils/ProfileProvider';
import Icon from '../Icon';
import { Container, HamburgerButton } from './styles';

Expand All @@ -11,6 +13,7 @@ interface HeaderProps {

export default function Header({ toggleNavColumn, isLoggedIn }: HeaderProps) {
const currentPath = usePathname();
const { profileReady } = useProfile();

const onNavColumnClick = () => {
toggleNavColumn();
Expand All @@ -28,11 +31,17 @@ export default function Header({ toggleNavColumn, isLoggedIn }: HeaderProps) {
<Link href="/">
<Icon type="logo" />
</Link>
{/* still need to check if onboarding completed or not, after ProfileContext merged*/}
{isLoggedIn ? (
<Icon type="profile" />
profileReady ? (
// display profile icon if user is logged in and onboarded
<Icon type="profile" />
) : (
// display onboarding link if user is logged in but not onboarded
<Link href={CONFIG.onboarding}>Complete Onboarding</Link>
)
) : (
<Link href="/login">Login/Sign Up</Link>
// display login link if user is not logged in
<Link href={CONFIG.login}>Login/Sign Up</Link>
)}
</Container>
);
Expand Down

0 comments on commit 570c01f

Please sign in to comment.