Skip to content

Commit

Permalink
hide navigation item if not logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
akoskm committed Dec 26, 2023
1 parent ded346b commit ec72806
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/components/Navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ export default function Navigation({
loginId?: string | null;
defaultTenant: boolean;
}) {
function getNavigationItems() {
if (!loginId) return [];

return navigation;
}

function renderTeamLink() {
if (!isAdmin) return null;

Expand Down Expand Up @@ -135,7 +141,7 @@ export default function Navigation({
</div>
<div className="hidden sm:ml-6 sm:block">
<div className="flex space-x-4">
{navigation.map((item) => {
{getNavigationItems().map((item) => {
if (item.name === "Team" && defaultTenant) return null;

return (
Expand Down Expand Up @@ -201,7 +207,7 @@ export default function Navigation({

<Disclosure.Panel className="sm:hidden">
<div className="space-y-1 px-2 pb-3 pt-2">
{navigation.map((item) => (
{getNavigationItems().map((item) => (
<NavLink
key={item.name}
to={item.href}
Expand Down

0 comments on commit ec72806

Please sign in to comment.