From 1617c549f1c93aab3edcc88a0e10a08b08f7f44a Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Tue, 27 Jun 2023 23:40:32 +0100 Subject: [PATCH] current job list overflow fixed and count down added --- src/Services/JobsData.js | 4 +- src/assets/css/main.css | 3 +- src/components/Helper/CountDownTimer.js | 72 +++++++++++++++++++++++++ src/components/HomeOne/RecentJobsOne.js | 51 +++++++++--------- 4 files changed, 100 insertions(+), 30 deletions(-) create mode 100644 src/components/Helper/CountDownTimer.js diff --git a/src/Services/JobsData.js b/src/Services/JobsData.js index 1949192..84f46bb 100644 --- a/src/Services/JobsData.js +++ b/src/Services/JobsData.js @@ -16,8 +16,8 @@ async function JobsData() { }); } */ - let response = await Axios.post(process.env.REACT_APP_AUX_ENDPOINT + "/startjoblist", callData); - return response.data.result_list; + let response = await Axios.post(process.env.REACT_APP_AUX_ENDPOINT+'/startjoblist', callData); + return await response; } export default JobsData; diff --git a/src/assets/css/main.css b/src/assets/css/main.css index 232997b..e5323cf 100755 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -2319,7 +2319,7 @@ p { 4.APPIE SERVOCE css ===========================*/ .appie-service-area { - background: #eef1f6; + background: #fbf4fe; position: relative; background-position: 92% 100%; background-repeat: no-repeat; @@ -3008,6 +3008,7 @@ p { position: relative; overflow: hidden; z-index: 15; + background-color: #fbf4fe; } .appie-traffic-area .traffic-thumb { position: absolute; diff --git a/src/components/Helper/CountDownTimer.js b/src/components/Helper/CountDownTimer.js new file mode 100644 index 0000000..24b79c5 --- /dev/null +++ b/src/components/Helper/CountDownTimer.js @@ -0,0 +1,72 @@ +import React, { useEffect, useState } from 'react'; + +const CountDownTimer = ({ targetDate, aboutToExpire=false }) => { + const calculateTimeLeft = () => { + const difference = +new Date(targetDate) - +new Date(); + let timeLeft = {}; + + if (difference > 0) { + timeLeft = { + days: Math.floor(difference / (1000 * 60 * 60 * 24)), + hours: Math.floor((difference / (1000 * 60 * 60)) % 24), + minutes: Math.floor((difference / 1000 / 60) % 60), + seconds: Math.floor((difference / 1000) % 60) + }; + } + return timeLeft; + }; + + const [timeLeft, setTimeLeft] = useState(calculateTimeLeft()); + + useEffect(() => { + const timer = setInterval(() => { + setTimeLeft(calculateTimeLeft()); + }, 1000); + + return () => clearTimeout(timer); + },[]); + + const formatTime = (value) => { + return value.toString().padStart(2, '0'); + }; + + const { days, hours, minutes, seconds } = timeLeft; + + const newHours = hours+days*24 + + if (!days && !hours && !minutes && !seconds) { + return {targetDate}; + } + + return ( +
+
{formatTime(newHours)} : {formatTime(minutes)} : {formatTime(seconds)}
+
Hrs Min Sec
+ {/* + {formatTime(days)} + day(s) + */} + {/* + {formatTime(newHours)} + hr(s) + + : + + {formatTime(minutes)} + min(s) + + : + + {formatTime(seconds)} + sec(s) + */} +
+ ); +}; + +export default CountDownTimer; + +{/* {days && {formatTime(days)} days } */} +{/* {hours && {formatTime(hours)} hours } */} +{/* {minutes && {formatTime(minutes)} minutes } */} +{/* {seconds && {formatTime(seconds)} seconds } */} \ No newline at end of file diff --git a/src/components/HomeOne/RecentJobsOne.js b/src/components/HomeOne/RecentJobsOne.js index 94bc5a0..ddfa9e3 100644 --- a/src/components/HomeOne/RecentJobsOne.js +++ b/src/components/HomeOne/RecentJobsOne.js @@ -4,6 +4,7 @@ import blogTwo from '../../assets/images/blog-2.jpg'; import blogThree from '../../assets/images/blog-3.jpg'; import JobsData from '../../Services/JobsData'; import getConfig from './../../Config/config' +import CountDownTimer from '../Helper/CountDownTimer'; class RecentJobsOne extends Component { @@ -15,12 +16,15 @@ class RecentJobsOne extends Component { async componentDidMount(){ // debugger; - const response = await JobsData(); - this.setState({jobsDataResults:response}); + JobsData().then(res => { + this.setState({jobsDataResults:res.data.result_list}); + }).catch(err => { + console.log('startjoblist error', err) + }) } titleLen(title){ - let maxl = 58; + let maxl = 45; title.replace('/', ' '); title.replace('www.', ''); title.replace('.com', ''); @@ -62,12 +66,11 @@ titleLen(title){ return (
- -
+
- - -

-
- - - - - -
)