1
0

Hide transactions button if not logged in

This commit is contained in:
Ahmed Al-Taiar
2023-11-22 11:58:57 -05:00
parent c9946b3d33
commit fb78791be7

View File

@ -17,7 +17,7 @@ type NavBarLayoutProps = {
}
const NavBarLayout = ({ children }: NavBarLayoutProps) => {
const { hasRole } = useAuth()
const { hasRole, isAuthenticated } = useAuth()
const [basket] = useState(getBasket())
return (
@ -40,6 +40,7 @@ const NavBarLayout = ({ children }: NavBarLayoutProps) => {
</div>
<div className="ml-auto justify-end space-x-3">
<ul className="relative hidden items-center space-x-3 lg:flex">
{isAuthenticated ? (
<li>
<Link
to={routes.userTransactions()}
@ -48,6 +49,9 @@ const NavBarLayout = ({ children }: NavBarLayoutProps) => {
Transactions
</Link>
</li>
) : (
<></>
)}
</ul>
<ThemeToggle />
<Link
@ -114,6 +118,7 @@ const NavBarLayout = ({ children }: NavBarLayoutProps) => {
<p className="font-inter text-base">Basket</p>
</Link>
</li>
{isAuthenticated ? (
<li>
<Link
to={routes.userTransactions()}
@ -122,6 +127,9 @@ const NavBarLayout = ({ children }: NavBarLayoutProps) => {
<p className="font-inter text-base">Transactions</p>
</Link>
</li>
) : (
<></>
)}
</ul>
</div>
</div>