From ce35f56251cfc95e4586f79b8357d0037c76bb08 Mon Sep 17 00:00:00 2001 From: kevin3656 Date: Sat, 18 May 2024 19:56:10 -0700 Subject: [PATCH] refactor: navbar added keyprops for renderlink and other small changes --- public/images/ijp-logo.webp | Bin 0 -> 2706 bytes src/components/Buttons.tsx | 1 - src/components/NavBar/index.tsx | 28 +++++++++++++++++++++------- src/components/NavBar/style.ts | 3 +-- src/lib/icons.tsx | 28 ---------------------------- 5 files changed, 22 insertions(+), 38 deletions(-) create mode 100644 public/images/ijp-logo.webp diff --git a/public/images/ijp-logo.webp b/public/images/ijp-logo.webp new file mode 100644 index 0000000000000000000000000000000000000000..79873dd52f5d80746d64c700b894e8dac0e8a225 GIT binary patch literal 2706 zcmV;D3T^dLNk&GB3IG6CMM6+kP&il$0000G00018003S906|PpNGl2e00F@M{{JJl zjd%JM79e;B5FCJ4c!kiwy%F4WUXeMVuDEm4E5kkaPK8cS2vwG@j1kGdlU&m19Vl&|(EE8Xzu#|Wsf&mS;Q#+zSIR`L%biPfIded+%bDo% zOys&!<}CdS@~;5BO*vzrFP8nIz>MtEKwj==6SMMvWxa*|1;01|ZgOb|__5wy3uJm#f40FJtD1Mc+NZCee11FkB-bABcSh`s|59`jlafva5K14grG z071*q><1?0Z9;&HB25E?v5#hfpyBuf&==b-@|gz4Ri9b_ zP?Ak0fY5m8X5h3x*y=%HtFd`6ZM`CreGkB*JWT*ll1n9k@Yf#A9PqGBu{s=|4%{eD z69SavqY^+qcIhEt;DpWIGRu!wle5pANKpp*jmNJ-fRg+)0TBJ#r9R+pm#N-N%OKS;>D=GsnjPFb`+2{0Dh>@y*rVf6lT^781PTyWOo^4`&%m{%rhe;A+; zdo&`P!{sMi@@>`c9JRr}|JY-Omq=HqkSXx4PW_#vNY8V7Puw0&5(Rrnd#RT z0er-=>vWRAmlu?Mqco6U@CS(%fN)8E;R!F95O_jTyG%0pOjDg*xiJA{Nt%by$p2}2 zzS8!Q2`Nd6uOa!ahB|NlHNmHTEoom+m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a7|fzd zmNOZ&Hvm_t6Gs4Qr_48j+;f?otVy~a=skXlEcXDPlk~MxD}&hqUY436Fx);R-pT`E zOFG^|IG3g|42(+J18~zRF$wU5q;Y^z;}aLL&Plo!pql1~mu9(;W)9$TNh@K3T;&h8 zb_r|lGqI$27+_b5wO9u@JC>woIRS%pnJC^8kPIe`tR?`ut6m}5hF)6$)-TC^bUXp0 z`}&5kjxWhwCs|%oWq@Eop3j_~U>(-Mee$j+D6gG%86c?1|0@B`^^dG7Wj(>AW{t!j zAvq%{_K~^55=@&-v3WKrWj4O8sZ;#B=qpOpUC=dH%e75BCDSd$Wlz0=V!m@}JGyG9P?g$v->v zbT1GzvM_moo7-}JxoDJZlrG3@==K9jn#tffhn@+5pq|cz0HwB^N1*@SwvwxdOZgyG z@b=P?wyb*sxWuJe08me3LV!tmjsU0q!IF#*SFb9b6(-Ml|5eo=|5~0$0QS4ID+f^b zGa*1B_Lv9wq1Na}fWcLlN(mNxObAej<&Fn|g6y>;txQff%CFdd1yJ!&DG@BYObGD) zSe_37y~Z&}e<4mc-3MixZUMsBLnVOF*cyKiP?GP_9I#FHWuRZyUq(^%5!)Ov;%ElI z9X_f8gvS!g0l??wJqny7X9c*&z#(x3;09H^q zAUFU30I&oAodGId0ABz;kw~FTrKBSwAm{+F5(#Ml00(wee7(k=@^7b3ojP>s(|iB` M{`gG*0000008LU9i2wiq literal 0 HcmV?d00001 diff --git a/src/components/Buttons.tsx b/src/components/Buttons.tsx index 850fbe45..2e075560 100644 --- a/src/components/Buttons.tsx +++ b/src/components/Buttons.tsx @@ -274,7 +274,6 @@ export const BigAsyncButton = forwardRef( ); }, ); - BigAsyncButton.displayName = 'BigAsyncButton'; export const BigBlueAsyncButton = forwardRef< diff --git a/src/components/NavBar/index.tsx b/src/components/NavBar/index.tsx index 72e0e7de..987960c0 100644 --- a/src/components/NavBar/index.tsx +++ b/src/components/NavBar/index.tsx @@ -1,20 +1,26 @@ 'use client'; import { useMemo } from 'react'; +import Image from 'next/image'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; -import Icon from '@/components/Icon'; import COLORS from '@/styles/colors'; import { Flex } from '@/styles/containers'; +import { useAuth } from '@/utils/AuthProvider'; import { useProfile } from '@/utils/ProfileProvider'; +import IJPlogo from '~/public/images/ijp-logo.webp'; import { ProfileButton, SmallLinkButton } from '../Buttons'; import * as Styles from './style'; export default function NavBar() { const profile = useProfile(); + if (!profile) throw new Error('Profile must be defined.'); + + const auth = useAuth(); + if (!auth) throw new Error('Auth Must be defined.'); + const AuthButtonView = useMemo(() => { - if (!profile) throw new Error('Profile must be defined.'); - if (profile.profileReady && profile?.profileData) + if (profile.profileReady && auth.userId) return ( {profile.profileData?.first_name || 'Profile'} @@ -67,7 +73,7 @@ export default function NavBar() { ]; const renderLink = (link: NavLink) => ( - + - + background - {navlinks.map(NavLink => renderLink(NavLink))} + {navlinks.map(renderLink)} {AuthButtonView} diff --git a/src/components/NavBar/style.ts b/src/components/NavBar/style.ts index 4246e515..8500c036 100644 --- a/src/components/NavBar/style.ts +++ b/src/components/NavBar/style.ts @@ -44,8 +44,7 @@ export const DisplayText = styled.span<{ $isActive: boolean }>` top: 50%; left: 50%; transform: translate(-50%, -50%); - font-weight: ${({ $isActive }) => - $isActive ? '600' : '400'}; + font-weight: ${({ $isActive }) => ($isActive ? '600' : '400')}; color: white; `; diff --git a/src/lib/icons.tsx b/src/lib/icons.tsx index 5b8affd2..e0018e51 100644 --- a/src/lib/icons.tsx +++ b/src/lib/icons.tsx @@ -216,34 +216,6 @@ export const IconSvgs = { /> ), - IJPLogo: ( - - - - - - - - - - ), }; export type IconType = keyof typeof IconSvgs;