Skip to content

Commit

Permalink
Open a modal when clicking on offer profile item (#2589)
Browse files Browse the repository at this point in the history
* open a modal when clicking on offer

* fixed hash
  • Loading branch information
dudchakk authored Oct 10, 2024
1 parent ed5ec28 commit f1a7df9
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/components/profile-item/ProfileItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { styles } from '~/components/profile-item/ProfileItem.styles'
import useBreakpoints from '~/hooks/use-breakpoints'
import { ProfileItemType } from '~/components/profile-item/complete-profile.constants'
import { UserRoleEnum } from '~/types'
import CreateOffer from '~/containers/offer-page/create-offer/CreateOffer'
import { useDrawer } from '~/hooks/use-drawer'
import AppDrawer from '~/components/app-drawer/AppDrawer'

interface ProfileItemProps {
item: ProfileItemType
Expand All @@ -25,10 +28,16 @@ const ProfileItem = ({
const { id, icon } = item
const navigate = useNavigate()

const isClickable = !isFilled && item.id !== 'schedule' && item.id !== 'offer'
const { openDrawer, closeDrawer, isOpen } = useDrawer()
const handleOpenDrawer = () => openDrawer()

const isClickable = !isFilled && item.id !== 'schedule'
const isOffer = item.id === 'offer'

const handleItemClick = () => {
if (isClickable) {
if (isOffer) {
handleOpenDrawer()
} else if (isClickable) {
navigate(`${item.path}#${item.id}`)
}
}
Expand All @@ -54,6 +63,11 @@ const ProfileItem = ({
</Typography>
</Box>
</Box>
{isOffer && (
<AppDrawer onClose={closeDrawer} open={isOpen}>
<CreateOffer closeDrawer={closeDrawer} />
</AppDrawer>
)}
</Box>
{isFilled && (
<CheckIcon
Expand Down

0 comments on commit f1a7df9

Please sign in to comment.