|
1 | 1 | import Link from 'next/link'; |
| 2 | +import { useRouter } from 'next/router'; |
2 | 3 | import { useAuth } from '@lib/context/auth-context'; |
3 | 4 | import { useWindow } from '@lib/context/window-context'; |
4 | 5 | import { useModal } from '@lib/hooks/useModal'; |
@@ -61,10 +62,12 @@ const navLinks: Readonly<NavLink[]> = [ |
61 | 62 | export function Sidebar(): JSX.Element { |
62 | 63 | const { user } = useAuth(); |
63 | 64 | const { isMobile } = useWindow(); |
| 65 | + const { pathname } = useRouter(); |
64 | 66 |
|
65 | 67 | const { open, openModal, closeModal } = useModal(); |
66 | 68 |
|
67 | 69 | const username = user?.username as string; |
| 70 | + const isOnChatPage = pathname.startsWith('/chat'); |
68 | 71 |
|
69 | 72 | return ( |
70 | 73 | <header |
@@ -113,18 +116,20 @@ export function Sidebar(): JSX.Element { |
113 | 116 | )} |
114 | 117 | {!isMobile && <MoreSettings />} |
115 | 118 | </nav> |
116 | | - <Button |
117 | | - className='accent-tab absolute right-4 -translate-y-[72px] bg-main-accent text-lg font-bold text-white |
118 | | - outline-none transition hover:brightness-90 active:brightness-75 xs:static xs:translate-y-0 |
119 | | - xs:hover:bg-main-accent/90 xs:active:bg-main-accent/75 xl:w-11/12' |
120 | | - onClick={openModal} |
121 | | - > |
122 | | - <CustomIcon |
123 | | - className='block h-6 w-6 xl:hidden' |
124 | | - iconName='FeatherIcon' |
125 | | - /> |
126 | | - <p className='hidden xl:block'>Blab</p> |
127 | | - </Button> |
| 119 | + {!(isMobile && isOnChatPage) && ( |
| 120 | + <Button |
| 121 | + className='accent-tab absolute right-4 -translate-y-[72px] bg-main-accent text-lg font-bold text-white |
| 122 | + outline-none transition hover:brightness-90 active:brightness-75 xs:static xs:translate-y-0 |
| 123 | + xs:hover:bg-main-accent/90 xs:active:bg-main-accent/75 xl:w-11/12' |
| 124 | + onClick={openModal} |
| 125 | + > |
| 126 | + <CustomIcon |
| 127 | + className='block h-6 w-6 xl:hidden' |
| 128 | + iconName='FeatherIcon' |
| 129 | + /> |
| 130 | + <p className='hidden xl:block'>Blab</p> |
| 131 | + </Button> |
| 132 | + )} |
128 | 133 | </section> |
129 | 134 | {!isMobile && <SidebarProfile />} |
130 | 135 | </div> |
|
0 commit comments