1- import { useParams } from 'react-router' ;
2- import NavBar from '../../components/sidebar/navHeader' ;
3- import { BsFillPersonLinesFill } from 'react-icons/bs' ;
4- import React , { useEffect , useState } from 'react' ;
5- import { fetchSingleJobPost } from '../../redux/actions/fetchSingleJobPostAction' ;
6- import { useAppDispatch , useAppSelector } from '../../hooks/hooks' ;
7- import { connect } from 'react-redux' ;
1+ import { useParams } from "react-router" ;
2+ import NavBar from "../../components/sidebar/navHeader" ;
3+ import { BsFillPersonLinesFill } from "react-icons/bs" ;
4+ import React , { useEffect , useState } from "react" ;
5+ import { fetchSingleJobPost } from "../../redux/actions/fetchSingleJobPostAction" ;
6+ import { useAppDispatch , useAppSelector } from "../../hooks/hooks" ;
7+ import { connect } from "react-redux" ;
8+ import { FaLinkedin , FaTelegram , FaTwitter , FaWhatsapp , FaEnvelope } from "react-icons/fa" ;
9+ import { FcGoogle } from 'react-icons/fc' ;
810
911const SingleJobPostDetails = ( props : any ) => {
1012 const { fetchSingleJobPostStates } = props ;
11- console . log ( 'fetchSingleJobPostStates:' , fetchSingleJobPostStates ) ;
1213 const dispatch = useAppDispatch ( ) ;
1314 const params = useParams ( ) ;
1415 const [ jobPostId , setjobPostId ] = useState ( params . id ) ;
1516
1617 useEffect ( ( ) => {
1718 dispatch ( fetchSingleJobPost ( jobPostId ) ) ;
1819 } , [ jobPostId ] ) ;
20+
21+ const shareMessage = `Check out this job opportunity: ${ fetchSingleJobPostStates ?. data ?. title } \n${ window . location . href } ` ;
22+
23+ const shareOnTwitterDM = ( ) => {
24+ const url = `https://twitter.com/messages/compose?text=${ encodeURIComponent ( shareMessage ) } ` ;
25+ window . open ( url , "_blank" , "width=600,height=400" ) ;
26+ } ;
27+
28+ const shareOnWhatsApp = ( ) => {
29+ const url = `https://api.whatsapp.com/send?text=${ encodeURIComponent ( shareMessage ) } ` ;
30+ window . open ( url , "_blank" , "width=600,height=400" ) ;
31+ } ;
32+
33+ const shareOnTelegram = ( ) => {
34+ const url = `https://t.me/share/url?url=${ encodeURIComponent ( window . location . href ) } ` ;
35+ window . open ( url , "_blank" , "width=600,height=400" ) ;
36+ } ;
37+
38+ const shareOnLinkedIn = ( ) => {
39+ const url = `https://www.linkedin.com/sharing/share-offsite/?url=${ encodeURIComponent ( window . location . href ) } ` ;
40+ window . open ( url , "_blank" ) ;
41+ } ;
42+
43+ const shareOnGmail = ( ) => {
44+ const subject = encodeURIComponent ( "Interesting Job Opportunity" ) ;
45+ const body = encodeURIComponent ( shareMessage ) ;
46+ const url = `https://mail.google.com/mail/?view=cm&fs=1&to=&su=${ subject } &body=${ body } ` ;
47+ window . open ( url , "_blank" ) ;
48+ }
49+
1950 return (
2051 < >
21- < div className = "h-screen flex flex-col items-center dark:bg-dark-frame-bg" >
22- < div className = "flex flex-col justify-start mt-24 items-start p-5 w-[95%] lg:w-1/2 md_:mx-auto overflow-hidden dark:bg-dark-bg" >
52+ < div className = "min- h-screen flex flex-col items-center dark:bg-dark-frame-bg" >
53+ < div className = "flex flex-col justify-start mt-24 items-start p-5 w-[95%] md_:mx-auto overflow-hidden dark:bg-dark-bg" >
2354 < h2 className = "text-white font-bold my-5" >
2455 < BsFillPersonLinesFill className = "float-left m-1" />
2556 Job Post information
@@ -29,46 +60,47 @@ const SingleJobPostDetails = (props: any) => {
2960 < >
3061 < div className = "flex flex-col" >
3162 < h3 className = "text-white" > Job title</ h3 >
32- < p className = "text-gray-500 text-sm dark:text-gray-400" >
33- { fetchSingleJobPostStates . data . title }
34- </ p >
63+ < p className = "text-gray-500 text-sm dark:text-gray-400" > { fetchSingleJobPostStates . data . title } </ p >
3564 </ div >
3665 < div className = "flex flex-col" >
3766 < h3 className = "text-white" > Program</ h3 >
38- < p className = "text-gray-500 text-sm dark:text-gray-400" >
39- { fetchSingleJobPostStates . data . program . title }
40- </ p >
67+ < p className = "text-gray-500 text-sm dark:text-gray-400" > { fetchSingleJobPostStates . data . program . title } </ p >
4168 </ div >
4269 < div className = "flex flex-col" >
4370 < h3 className = "text-white" > Cycle</ h3 >
44- < p className = "text-gray-500 text-sm dark:text-gray-400" >
45- { fetchSingleJobPostStates . data . cycle . name }
46- </ p >
71+ < p className = "text-gray-500 text-sm dark:text-gray-400" > { fetchSingleJobPostStates . data . cycle . name } </ p >
4772 </ div >
4873 < div className = "flex flex-col" >
4974 < h3 className = "text-white" > Cohort</ h3 >
50- < p className = "text-gray-500 text-sm dark:text-gray-400" >
51- { fetchSingleJobPostStates . data . cohort . title }
52- </ p >
75+ < p className = "text-gray-500 text-sm dark:text-gray-400" > { fetchSingleJobPostStates . data . cohort . title } </ p >
5376 </ div >
5477 < div className = "flex flex-col" >
5578 < h3 className = "text-white" > Program description</ h3 >
56- < p className = "text-gray-500 text-sm dark:text-gray-400" >
57- { fetchSingleJobPostStates . data . description }
58- </ p >
79+ < p className = "text-gray-500 text-sm dark:text-gray-400" > { fetchSingleJobPostStates . data . description } </ p >
80+ </ div >
81+ < div className = "text-white" > Share Job Post</ div >
82+ < div className = "flex fle gap-4 mt-6" >
83+ < button onClick = { shareOnTwitterDM } className = "flex items-center gap-2 px-4 py-2 bg-blue-400 text-white rounded hover:bg-blue-500 transition-colors" >
84+ < FaTwitter />
85+ </ button >
86+ < button onClick = { shareOnWhatsApp } className = "flex items-center gap-2 px-4 py-2 bg-green text-white rounded hover:bg-green-600 transition-colors" >
87+ < FaWhatsapp />
88+ </ button >
89+ < button onClick = { shareOnTelegram } className = "flex items-center gap-2 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors" >
90+ < FaTelegram />
91+ </ button >
92+ < button onClick = { shareOnLinkedIn } className = "flex items-center gap-2 px-4 py-2 bg-blue-800 text-white rounded hover:bg-blue-900 transition-colors" >
93+ < FaLinkedin />
94+ </ button >
95+ < button onClick = { shareOnGmail } className = "flex items-center justify-center gap-2 px-4 py-2 bg-white text-gray-700 rounded hover:bg-gray-100 transition-colors" >
96+ < FcGoogle size = { 20 } />
97+ </ button >
5998 </ div >
60- < button
61- type = "submit"
62- className = "flex justify-self-start self-start rounded w-15 px-5 py-2 mt-10 bg-green ml-2 sm:ml-80 text-white transition-colors hover:bg-dark-frame-bg hover:text-green hover:border hover:border-green"
63- >
64- Share Post
65- </ button >
6699 </ >
67100 ) }
68101 </ div >
69102 </ div >
70- </ div >
71-
103+ </ div >
72104 </ >
73105 ) ;
74106} ;
0 commit comments