diff --git a/frontend/app/(urls)/search/components/SearchCard.tsx b/frontend/app/(urls)/search/components/SearchCard.tsx index dc3e547..56af4b9 100644 --- a/frontend/app/(urls)/search/components/SearchCard.tsx +++ b/frontend/app/(urls)/search/components/SearchCard.tsx @@ -1,8 +1,13 @@ -import React from 'react' +'use client' + +import React, { useState } from 'react' import Image from 'next/image' import Button from '@/components/ui/Button' import { SearchCardProps } from '@/app/types' import noPhoto from '../../../../public/images/noPhoto.png' +import LeadPopup from '@/components/popups/LeadPopup' +import useUserStore from '@/app/store/userStore' +import { useRouter } from 'next/navigation' const formatDateTime = (dateTimeString: string): string => { const date = new Date(dateTimeString) @@ -41,6 +46,18 @@ const SearchCard = ({ country_from_icon, country_to_icon, }: SearchCardProps) => { + const [isLeadPopupOpen, setIsLeadPopupOpen] = useState(false) + const { isAuthenticated } = useUserStore() + const router = useRouter() + + const handleLeadClick = () => { + if (!isAuthenticated) { + router.push('/login') + return + } + setIsLeadPopupOpen(true) + } + const getUserRequestStyles = () => { if (owner_type === 'customer') { return 'text-[#065bff]' @@ -88,6 +105,7 @@ const SearchCard = ({ + + + {children} + + + + ) +} + +export default Modal