diff --git a/packages/apps/human-app/frontend/src/components/layout/protected/drawer-navigation.tsx b/packages/apps/human-app/frontend/src/components/layout/protected/drawer-navigation.tsx index 7b05a49025..fa3e75d41d 100644 --- a/packages/apps/human-app/frontend/src/components/layout/protected/drawer-navigation.tsx +++ b/packages/apps/human-app/frontend/src/components/layout/protected/drawer-navigation.tsx @@ -16,6 +16,7 @@ import { NAVBAR_PADDING } from '@/components/layout/protected/navbar'; import { colorPalette } from '@/styles/color-palette'; import { useColorMode } from '@/hooks/use-color-mode'; import { onlyDarkModeColor } from '@/styles/dark-color-palette'; +import { useHandleMainNavIconClick } from '@/hooks/use-handle-main-nav-icon-click'; const drawerWidth = 240; @@ -49,6 +50,7 @@ export function DrawerNavigation({ const navigate = useNavigate(); const isMobile = useIsMobile(); const location = useLocation(); + const handleMainNavIconClick = useHandleMainNavIconClick(); return ( {!isMobile && ( - + )} diff --git a/packages/apps/human-app/frontend/src/components/layout/protected/navbar.tsx b/packages/apps/human-app/frontend/src/components/layout/protected/navbar.tsx index 56c488292f..213cd731dd 100644 --- a/packages/apps/human-app/frontend/src/components/layout/protected/navbar.tsx +++ b/packages/apps/human-app/frontend/src/components/layout/protected/navbar.tsx @@ -7,6 +7,7 @@ import { useIsMobile } from '@/hooks/use-is-mobile'; import { Button } from '@/components/ui/button'; import { useIsHCaptchaLabelingPage } from '@/hooks/use-is-hcaptcha-labeling-page'; import { useColorMode } from '@/hooks/use-color-mode'; +import { useHandleMainNavIconClick } from '@/hooks/use-handle-main-nav-icon-click'; export const NAVBAR_PADDING = '16px'; @@ -23,6 +24,7 @@ export function Navbar({ userStatsDrawerOpen, toggleUserStatsDrawer, }: NavbarProps) { + const handleMainNavIconClick = useHandleMainNavIconClick(); const { colorPalette } = useColorMode(); const isMobile = useIsMobile(); const isHCaptchaLabelingPage = useIsHCaptchaLabelingPage(); @@ -79,9 +81,17 @@ export function Navbar({ top: open ? '0' : 'unset', }} > - + { + handleMainNavIconClick(); + }} + role="button" + tabIndex={0} + aria-hidden="true" + > - + - {isMobile ? : } + { + handleMainNavIconClick(); + }} + role="button" + tabIndex={0} + aria-hidden="true" + > + {isMobile ? : } + {withNavigation ? ( { + const navigate = useNavigate(); + const { user: web3User } = useWeb3Auth(); + const { user: web2Auth } = useAuth(); + const { setPageView } = useHomePageState(); + + const handleIconClick = () => { + if (web3User) { + navigate(routerPaths.operator.profile); + return; + } + + if (web2Auth) { + navigate(routerPaths.worker.profile); + return; + } + setPageView('welcome'); + navigate(routerPaths.homePage); + }; + + return handleIconClick; +};