-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50029c9
commit 1aad6e8
Showing
7 changed files
with
78 additions
and
11 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { convertToInitials } from "@/lib/utils"; | ||
import { FaUser } from "react-icons/fa6"; | ||
|
||
interface NavBarAuthButtonProps { | ||
isAuthenticated: boolean; | ||
name?: string | null; | ||
} | ||
|
||
const NavBarAuthButton = ({ isAuthenticated, name }: NavBarAuthButtonProps) => { | ||
if (isAuthenticated) { | ||
return ( | ||
<span className="flex items-center justify-between gap-2"> | ||
<FaUser /> | ||
<span className="md:inline hidden">{name ?? "User"}</span> | ||
<span className="md:hidden inline">{convertToInitials(name ?? "U s e r")}</span> | ||
|
||
</span> | ||
); | ||
} | ||
|
||
return <div></div>; | ||
}; | ||
|
||
export default NavBarAuthButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,46 @@ | ||
import React from 'react' | ||
import Link from "next/link"; | ||
import { FiBook } from "react-icons/fi"; | ||
import { FaChartColumn } from "react-icons/fa6"; | ||
import Image from "next/image"; | ||
import { getServerAuthSession } from "@/server/auth"; | ||
import NavBarAuthButton from "./nav-bar-auth-button"; | ||
|
||
const NavBar = () => { | ||
const NavBar = async () => { | ||
const session = await getServerAuthSession(); | ||
return ( | ||
<nav> </nav> | ||
) | ||
} | ||
<nav className="flex items-center justify-between p-4 px-6"> | ||
<span className="flex select-none items-center justify-between gap-4 text-xl font-semibold"> | ||
<Image | ||
src="/mlsa-logo.png" | ||
width={40} | ||
height={40} | ||
alt="MLSA Logo" | ||
priority={true} | ||
quality={100} | ||
/> | ||
<span className="md:inline hidden">Kryptic Hunt</span> | ||
|
||
</span> | ||
<ul className="flex items-center justify-between gap-6 text-gray-300"> | ||
<Link href="/rules"> | ||
<li className="flex items-center justify-center gap-2 hover:text-gray-100 hover:underline"> | ||
<FiBook /> | ||
Rules | ||
</li> | ||
</Link> | ||
<Link href="/leaderboard"> | ||
<li className="flex items-center justify-center gap-2 hover:text-gray-100 hover:underline"> | ||
<FaChartColumn /> | ||
Leaderboard | ||
</li> | ||
</Link> | ||
<li></li> | ||
</ul> | ||
<div> | ||
<NavBarAuthButton isAuthenticated={session ? true : false} name={session?.user?.name} /> | ||
</div> | ||
</nav> | ||
); | ||
}; | ||
|
||
export default NavBar | ||
export default NavBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const convertToInitials = (fullName: string) => { | ||
return fullName | ||
.split(" ") | ||
.map((word) => word.charAt(0).toUpperCase()) | ||
.join(" "); | ||
}; |