From 8a21153f473eb345e1e70c0dbf407ba4f76f8983 Mon Sep 17 00:00:00 2001 From: KacperKoza343 Date: Wed, 23 Oct 2024 10:33:30 +0200 Subject: [PATCH] fix(human-app/frontend/logo-icon): handle logo icon click on mobile drawers --- .../layout/protected/drawer-navigation.tsx | 8 +++++++- .../src/components/layout/protected/navbar.tsx | 3 +++ .../mobile/available-jobs-drawer-mobile.tsx | 12 +++++++++++- .../my-jobs/mobile/my-jobs-drawer-mobile.tsx | 12 +++++++++++- 4 files changed, 32 insertions(+), 3 deletions(-) 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 e332d842e4..469daee271 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 @@ -77,7 +77,13 @@ export function DrawerNavigation({ { + handleMainNavIconClick(); + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (isMobile) { + setDrawerOpen(false); + } + }} > 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 da77a4d454..d26d378ce0 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 @@ -84,6 +84,9 @@ export function Navbar({ { + if (isMobile) { + setOpen(false); + } handleMainNavIconClick(); }} role="button" diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-drawer-mobile.tsx b/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-drawer-mobile.tsx index 929db94719..80cb59fdd6 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-drawer-mobile.tsx +++ b/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-drawer-mobile.tsx @@ -13,6 +13,7 @@ import { AvailableJobsNetworkFilterMobile } from '@/pages/worker/jobs/components import { AvailableJobsStatusFilterMobile } from '@/pages/worker/jobs/components/available-jobs/mobile/available-jobs-status-filter-mobile'; import { AvailableJobsJobTypeFilterMobile } from '@/pages/worker/jobs/components/available-jobs/mobile/available-jobs-job-type-filter-mobile'; import { useColorMode } from '@/hooks/use-color-mode'; +import { useHandleMainNavIconClick } from '@/hooks/use-handle-main-nav-icon-click'; interface DrawerMobileProps { setIsMobileFilterDrawerOpen: Dispatch>; @@ -20,6 +21,7 @@ interface DrawerMobileProps { export function AvailableJobsDrawerMobile({ setIsMobileFilterDrawerOpen, }: DrawerMobileProps) { + const handleMainNavIconClick = useHandleMainNavIconClick(); const { colorPalette } = useColorMode(); const { t } = useTranslation(); const { setFilterParams, filterParams } = useJobsFilterStore(); @@ -58,7 +60,15 @@ export function AvailableJobsDrawerMobile({ zIndex: '999999', }} > - + { + handleMainNavIconClick(); + // setIsMobileFilterDrawerOpen(false); + }} + > + + { diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-drawer-mobile.tsx b/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-drawer-mobile.tsx index a6de46a0d1..735b7fe4aa 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-drawer-mobile.tsx +++ b/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-drawer-mobile.tsx @@ -10,6 +10,7 @@ import { Button } from '@/components/ui/button'; import { HumanLogoIcon, SortArrow } from '@/components/ui/icons'; import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; import { useColorMode } from '@/hooks/use-color-mode'; +import { useHandleMainNavIconClick } from '@/hooks/use-handle-main-nav-icon-click'; import { MyJobsNetworkFilterMobile } from './my-jobs-network-filter-mobile'; import { MyJobsJobTypeFilterMobile } from './my-jobs-job-type-filter-mobile'; import { MyJobsStatusFilterMobile } from './my-jobs-status-filter-mobile'; @@ -20,6 +21,7 @@ interface DrawerMobileProps { export function MyJobsDrawerMobile({ setIsMobileFilterDrawerOpen, }: DrawerMobileProps) { + const handleMainNavIconClick = useHandleMainNavIconClick(); const { colorPalette } = useColorMode(); const { t } = useTranslation(); const { setFilterParams, filterParams } = useMyJobsFilterStore(); @@ -58,7 +60,15 @@ export function MyJobsDrawerMobile({ zIndex: '999999', }} > - + { + handleMainNavIconClick(); + // setIsMobileFilterDrawerOpen(false); + }} + > + + {