Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vinh/adjust on header #107

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions frontend/my-app/src/routes/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@
onMount(() => {
if (IsLogin()) {
status = true;
UserInfo();
}
UserInfo();
setTimeout(() => {}, 100);
});
let jwtData = {
email: "",
Expand Down Expand Up @@ -83,27 +84,26 @@
});
}
}

</script>

<!-- ======= Header ======= -->
<Navbar
class="px-2 sm:px-4 py-2.5 fixed z-20 top-0 left-0 border-b md:flex md:justify-start"
>
{#if jwtData.role == "Customer"|| jwtData.role == ""}
<NavBrand href="/">
<img src={headerImage} class="mr-3 h-6 lg:h-20" alt="Ademy Logo" />
</NavBrand>
{:else if jwtData.role == "STAFF"}
<NavBrand href="/staff">
<img src={headerImage} class="mr-3 h-6 lg:h-20" alt="Ademy Logo" />
</NavBrand>
{:else}
<NavBrand href="/instructor">
<img src={headerImage} class="mr-3 h-6 lg:h-20" alt="Ademy Logo" />
</NavBrand>
>
{#if loginStatus == false || jwtData.role === "CUSTOMER"}
<NavBrand href="/">
<img src={headerImage} class="mr-3 h-6 lg:h-20" alt="Ademy Logo" />
</NavBrand>
{:else if jwtData.role === "STAFF"}
<NavBrand href="/staff">
<img src={headerImage} class="mr-3 h-6 lg:h-20" alt="Ademy Logo" />
</NavBrand>
{:else if jwtData.role === "INSTRUCTOR"}
<NavBrand href="/instructor">
<img src={headerImage} class="mr-3 h-6 lg:h-20" alt="Ademy Logo" />
</NavBrand>
{/if}

<div class="flex">
<div class="hidden relative md:block">
<div
Expand All @@ -124,14 +124,12 @@
<NavHamburger />
</div>
<NavUl>
{#if jwtData.role=="CUSTOMER"}
{#if jwtData.role == "CUSTOMER"}
<NavLi href="/mylearning">My Learning</NavLi>
<NavLi href="/cart">Your Cart</NavLi>
{:else }
{:else}
<NavLi href="/teaching">Assign Instructor</NavLi>
{/if}


</NavUl>
<div class="ml-20 w-20">
{#if status === true}
Expand Down