Skip to content

Commit

Permalink
fix: conditionally render login link in footer
Browse files Browse the repository at this point in the history
  • Loading branch information
atrincas committed Jan 14, 2025
1 parent b4cad7a commit 9cefaa5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/src/containers/footer/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import Image from 'next/image';
import Link from 'next/link';
import { useRouter } from 'next/router';

import { useSession } from 'next-auth/react';

import { NAV, POLICIES } from 'constants/nav';

import Wrapper from 'containers/wrapper';
Expand All @@ -18,9 +20,13 @@ import TWITTER_SVG from 'svgs/social/twitter.svg?sprite';

const Footer = () => {
const { pathname } = useRouter();
const { data: session } = useSession();
const hideNav = useMemo(() => {
return pathname.includes('/auth');
}, [pathname]);
const NAV_ITEMS = useMemo(() => {
return NAV.filter((n) => !(session && n.auth));
}, [session]);

return (
<footer>
Expand All @@ -41,7 +47,7 @@ const Footer = () => {

<nav className="flex">
<ul className="gap-10 space-y-3 text-center md:text-left md:columns-2">
{NAV.map((item) => {
{NAV_ITEMS.map((item) => {
const { href, label, target, rel } = item;

return (
Expand Down

0 comments on commit 9cefaa5

Please sign in to comment.