Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 455248f9db | |||
| fee3376a88 | |||
| 64f3625990 | |||
| 9ec8855ed6 | |||
| 06450808ed | |||
| 7eecd34a5e | |||
| ab3693fc0b | |||
| e1879222b3 | |||
| 22250da988 | |||
| 7e8704d633 |
@@ -85,6 +85,7 @@ export default function SocketIOContextProvider({children}) {
|
||||
}
|
||||
console.log('data', data)
|
||||
});
|
||||
// dispatch(tableReload({ type: "HOMEBANNERS" })); // RELOADS HOME BANNERS
|
||||
|
||||
}, [socket]);
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ const AccountDashboard = ({ className, bannerList, offersList, imageServer }) =>
|
||||
}`}
|
||||
>
|
||||
|
||||
{/* for normal banner section */}
|
||||
<div className="w-full grid xxs:grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 items-center justify-center gap-2 md:gap-4">
|
||||
|
||||
{/* OFFER LIST DISPLAY */}
|
||||
<>
|
||||
{(offersList && offersList?.length > 0) &&
|
||||
@@ -44,11 +44,13 @@ const AccountDashboard = ({ className, bannerList, offersList, imageServer }) =>
|
||||
);
|
||||
|
||||
let image = `${imageServer}${localStorage.getItem("session_token")}/job/${item.job_uid}`
|
||||
return (
|
||||
<div key={item.id}>
|
||||
<NewOfferCard datas={item} image={image} price={thePrice} setOfferPopout={setOfferPopout} />
|
||||
</div>
|
||||
)
|
||||
if(index < 3){
|
||||
return (
|
||||
<div key={item.offer_uid}>
|
||||
<NewOfferCard datas={item} image={image} price={thePrice} setOfferPopout={setOfferPopout} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
})}
|
||||
</>
|
||||
|
||||
@@ -71,7 +73,30 @@ const AccountDashboard = ({ className, bannerList, offersList, imageServer }) =>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div className="w-full grid-cols-1 md:grid-cols-2 2xl::grid-cols-3 grid items-center justify-center gap-2 md:gap-4">
|
||||
|
||||
|
||||
{/* for flat banner section */}
|
||||
<div className="w-full grid-cols-1 md:grid-cols-2 2xl:grid-cols-3 grid items-center justify-center gap-2 md:gap-4">
|
||||
{/* OFFER LIST DISPLAY */}
|
||||
<>
|
||||
{(offersList && offersList?.length > 0) &&
|
||||
offersList.map((item, index) => {
|
||||
let thePrice = PriceFormatter(
|
||||
item?.price * 0.01,
|
||||
item?.currency_code,
|
||||
item?.currency
|
||||
);
|
||||
|
||||
let image = `${imageServer}${localStorage.getItem("session_token")}/job/${item.job_uid}`
|
||||
if(index >= 3) {
|
||||
return(
|
||||
<div key={item.offer_uid}>
|
||||
<NewOfferCardFlat datas={item} image={image} price={thePrice} setOfferPopout={setOfferPopout} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
})}
|
||||
</>
|
||||
{getLowerBanner?.map((props, idx) => {
|
||||
let image = getImage(props);
|
||||
|
||||
@@ -160,9 +185,16 @@ const NewOfferCard = ({ datas, hidden = false, price, setOfferPopout, image }) =
|
||||
<div
|
||||
className="thumbnail w-full h-full rounded-xl overflow-hidden px-4 pt-4"
|
||||
style={{
|
||||
background: `url(${image}) center / contain no-repeat`,
|
||||
// background: `url(${image}) center / contain no-repeat`,
|
||||
}}
|
||||
>
|
||||
{/* <img src={image} className='' /> */}
|
||||
<div
|
||||
className="thumbnail w-full h-full rounded-xl overflow-hidden"
|
||||
style={{
|
||||
background: `url(${image}) center / contain no-repeat`,
|
||||
}}
|
||||
></div>
|
||||
{hidden && <div className="flex justify-center"></div>}
|
||||
</div>
|
||||
}
|
||||
@@ -172,9 +204,6 @@ const NewOfferCard = ({ datas, hidden = false, price, setOfferPopout, image }) =
|
||||
<h1 className="font-bold text-lg line-clamp-1 text-center">
|
||||
{datas?.title}
|
||||
</h1>
|
||||
{/* <Link to={link_path} className="text-sm">
|
||||
{desc}
|
||||
</Link> */}
|
||||
<div className="card-buttons flex justify-center items-center space-x-2">
|
||||
<button
|
||||
type="button"
|
||||
@@ -205,6 +234,62 @@ const NewOfferCard = ({ datas, hidden = false, price, setOfferPopout, image }) =
|
||||
);
|
||||
};
|
||||
|
||||
const NewOfferCardFlat = ({ datas, hidden = false, price, setOfferPopout, image }) => {
|
||||
return (
|
||||
<div className="flex flex-col shadow-md bg-red-50 dark:bg-dark-white rounded-xl dark:border-[#5356fb29] overflow-hidden">
|
||||
<div className="w-full xxs:flex justify-between items-center border-b border-slate-300 p-2">
|
||||
<div className="min-h-[130px] sm:min-h-[100px] flex justify-between items-center">
|
||||
<div className="px-2 flex flex-col gap-2 dark:text-white">
|
||||
<h1 className="font-bold text-lg line-clamp-1 text-center">
|
||||
{datas?.title}
|
||||
</h1>
|
||||
<div className="card-buttons flex items-center space-x-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
setOfferPopout({ show: true, data: { ...datas, image } })
|
||||
}
|
||||
className="btn-shine w-28 h-[40px] text-white rounded-full text-sm bg-pink flex justify-center items-center"
|
||||
>
|
||||
Start Now
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className='w-[150px] h-[100px]'>
|
||||
{datas.job_type == "MEDIA" ?
|
||||
<Suspense fallback={<p>Loading...</p>}>
|
||||
<VideoElement videoId={datas?.media_uid} />
|
||||
</Suspense>
|
||||
:
|
||||
<div
|
||||
className="thumbnail w-full h-full rounded-xl overflow-hidden px-4 pt-4"
|
||||
style={{
|
||||
background: `url(${image}) center / contain no-repeat`,
|
||||
}}
|
||||
>
|
||||
{hidden && <div className="flex justify-center"></div>}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-between w-full p-1 items-center">
|
||||
<div className="flex gap-1 items-center">
|
||||
<p className="text-[12px] text-red-500 tracking-wide">Expires</p>
|
||||
<p className="text-[12px] font-semibold tracking-wide text-dark-gray dark:text-white">
|
||||
<CountDown lastDate={datas.expire} />
|
||||
</p>
|
||||
</div>
|
||||
<button className="flex items-center justify-center gap-2">
|
||||
<div className="w-[4px] h-[4px] bg-slate-400 rounded-full"></div>
|
||||
<div className="w-[4px] h-[4px] bg-slate-400 rounded-full"></div>
|
||||
<div className="w-[4px] h-[4px] bg-slate-400 rounded-full"></div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const LowerBanner = ({ image, title = "", desc = "", btn, link_path, card_type, blog_id, key }) => {
|
||||
const newLinkPath = card_type == 'BLOG' ? `${link_path}?blog_id=${blog_id}` : link_path
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@ export default function FamilyTableNew() {
|
||||
|
||||
let { pathname } = useLocation();
|
||||
|
||||
const queryParams = new URLSearchParams(location?.search);
|
||||
const preSelectedTab = queryParams.get("tab");
|
||||
|
||||
// Initial state for family details
|
||||
const initialDetailState = {
|
||||
loading: false,
|
||||
@@ -55,9 +58,9 @@ export default function FamilyTableNew() {
|
||||
|
||||
// Array of tab names
|
||||
const tabs = [
|
||||
{ id: 1, name: "Tasks" },
|
||||
{ id: 2, name: "Waiting" },
|
||||
{ id: 3, name: "Pending" },
|
||||
{ id: 1, name: "tasks" },
|
||||
{ id: 2, name: "waiting" },
|
||||
{ id: 3, name: "pending" },
|
||||
];
|
||||
|
||||
// State for the currently selected tab
|
||||
@@ -94,6 +97,14 @@ export default function FamilyTableNew() {
|
||||
// Selected tab component based on the current 'tab'
|
||||
const selectedTabComponent = tabComponents[tab] || defaultTabComponent;
|
||||
|
||||
useEffect(()=>{ // EFFECT TO CHECK FOR PRE SELECTED TAB AND DEFAULT TO IT OR TO DEFAULT IF NOT AVALIABLE
|
||||
if(preSelectedTab && tabs.map(item => item.name.toLowerCase()).includes(preSelectedTab.toLowerCase())){
|
||||
setTab(preSelectedTab)
|
||||
}else{
|
||||
setTab(tabs[0].name)
|
||||
}
|
||||
},[])
|
||||
|
||||
|
||||
// Effect to manage active family task details
|
||||
useEffect(() => {
|
||||
|
||||
@@ -78,6 +78,7 @@ function OfferJobPopout({ details, onClose, situation }) {
|
||||
setTimeout(() => {
|
||||
onClose();
|
||||
dispatch(tableReload({ type: "MYTASKTABLE" }));
|
||||
dispatch(tableReload({ type: "HOMEBANNERS" }));
|
||||
navigate("/mytask", { replace: true });
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
@@ -140,60 +141,85 @@ function OfferJobPopout({ details, onClose, situation }) {
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div className="md:flex bg-white dark:bg-dark-white rounded-lg">
|
||||
<div className="p-4 w-full md:w-3/4 md:border-r-2">
|
||||
<div className="grid md:grid-cols-4 bg-white dark:bg-dark-white rounded-lg">
|
||||
<div className="p-4 w-full md:col-span-3 md:border-r-2">
|
||||
|
||||
{/* INPUT SECTION */}
|
||||
<div className='grid md:grid-cols-2'>
|
||||
<div className="my-2 md:flex">
|
||||
<Detail
|
||||
label="Date"
|
||||
{/* <Detail
|
||||
label="Date :"
|
||||
value={
|
||||
(details.offer_added && details.offer_added?.split(" ")[0]) ||
|
||||
"default"
|
||||
}
|
||||
/>
|
||||
/> */}
|
||||
<label className='job-label w-full md:w-[150px] md:text-right'>Date :</label>
|
||||
<p className={`p-1 w-full md:w-3/4 text-sm text-slate-900 dark:text-white`}>
|
||||
{
|
||||
(details.offer_added && details.offer_added?.split(" ")[0]) ||
|
||||
"default"
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="my-2 md:flex">
|
||||
<Detail
|
||||
label="Offer Expire"
|
||||
{/* <Detail
|
||||
label="Offer Expire :"
|
||||
value={details.expire && details.expire.split(" ")[0]}
|
||||
/>
|
||||
/> */}
|
||||
<label className='job-label w-full md:w-[150px] md:text-right'>Expire :</label>
|
||||
<p className={`p-1 w-full md:w-3/4 text-sm text-slate-900 dark:text-white`}>{details.expire && details.expire.split(" ")[0]}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='grid md:grid-cols-2'>
|
||||
<div className="my-2 md:flex">
|
||||
<Detail label="Reward" value={thePrice} />
|
||||
{/* <Detail label="Reward :" value={thePrice} /> */}
|
||||
<label className='job-label w-full md:w-[150px] md:text-right'>Reward :</label>
|
||||
<p className={`p-1 w-full md:w-3/4 text-sm text-slate-900 dark:text-white`}>{thePrice}</p>
|
||||
</div>
|
||||
|
||||
<div className="my-2 md:flex">
|
||||
<Detail
|
||||
label="Duration"
|
||||
{/* <Detail
|
||||
label="Duration :"
|
||||
value={`${details.timeline_days} day(s)`}
|
||||
/>
|
||||
/> */}
|
||||
<label className='job-label w-full md:w-[150px] md:text-right'>Duration :</label>
|
||||
<p className={`p-1 w-full md:w-3/4 text-sm text-slate-900 dark:text-white`}>{`${details.timeline_days} day(s)`}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p className="text-lg my-5 font-semibold text-slate-900 dark:text-white tracking-wide line-clamp-1">
|
||||
<p className="text-lg my-2 font-semibold text-slate-900 dark:text-white tracking-wide max-h-[200px] overflow-y-auto">
|
||||
{details.title}
|
||||
</p>
|
||||
|
||||
<div className="my-2 md:flex">
|
||||
<Detail label="Description" value={details.description} />
|
||||
<label className='job-label w-full md:w-[150px]'>Description :</label>
|
||||
<p className={`p-1 w-full md:w-3/4 text-sm text-slate-900 dark:text-white max-h-[200px] overflow-y-auto`}>{details.description}</p>
|
||||
{/* <Detail label="Description" value={details.description} /> */}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div className="my-2 md:flex">
|
||||
<label className='job-label w-full md:w-[150px]'>Detail</label>
|
||||
<p className={`p-1 w-full md:w-3/4 text-sm text-slate-900 dark:text-white min-h-[100px] max-h-[200px] overflow-y-auto border boder-2 rounded-md`}>{details.job_description || details.job_detail}</p>
|
||||
<div className="my-2 md:flx">
|
||||
{/* <label className='job-label w-full md:w-[150px]'>Detail</label>
|
||||
<p className={`p-1 w-full md:w-3/4 text-sm text-slate-900 dark:text-white min-h-[100px] max-h-[200px] overflow-y-auto border-2 rounded-md`}>{details.job_description || details.job_detail}</p> */}
|
||||
<label className="w-full text-slate-900 dark:text-white tracking-wide font-semibold">
|
||||
Delivery Detail :
|
||||
</label>
|
||||
<textarea
|
||||
className={`p-2 w-full text-sm text-slate-900 dark:text-white bg-transparent outline-none border border-slate-300 rounded-md`}
|
||||
rows="5"
|
||||
style={{ resize: "none" }}
|
||||
value={details.job_description || details.job_detail}
|
||||
readOnly
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ACTION SECTION */}
|
||||
<div className="p-4 w-full md:w-1/4 h-full">
|
||||
<div className="p-4 w-full md:col-span-1 h-full flex flex-col justify-between">
|
||||
<div className="my-3 md:flex flex-col md:justify-center">
|
||||
<h1 className='mb-2 text-base font-semibold text-slate-900 dark:text-white tracking-wide'>I understand the task</h1>
|
||||
{requestStatus.loading && requestStatus.trigger == "offer" ? (
|
||||
|
||||
@@ -27,7 +27,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
const [loadProfileDetails, setLoadProfileDetails] = useState([]);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { jobListTable, marketTableList, walletTable, familyBannersListTable } = useSelector(
|
||||
const { jobListTable, marketTableList, walletTable, familyBannersListTable, homeBanners } = useSelector(
|
||||
(state) => state.tableReload
|
||||
);
|
||||
|
||||
@@ -247,7 +247,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
.catch((error) => {
|
||||
console.log("ERROR ", error);
|
||||
});
|
||||
}, [isLogin.status]);
|
||||
}, [isLogin.status, homeBanners]);
|
||||
|
||||
//FUNCTION TO GET COMMON HEAD DATA
|
||||
// useEffect(() => {
|
||||
|
||||
@@ -14,6 +14,7 @@ const initialState = {
|
||||
familyOfferList: false,
|
||||
parentFamilyTaskList: false,
|
||||
offerInterestListReload: false,
|
||||
homeBanners: false,
|
||||
};
|
||||
|
||||
export const tableReloadSlice = createSlice({
|
||||
@@ -61,6 +62,9 @@ export const tableReloadSlice = createSlice({
|
||||
case "OFFERINTERESTLISTRELOAD": // to reload offer interest list of owner when a worker sends interest in a job
|
||||
state.offerInterestListReload = !state.offerInterestListReload;
|
||||
return;
|
||||
case "HOMEBANNERS": // to reload offer interest list of owner when a worker sends interest in a job
|
||||
state.homeBanners = !state.homeBanners;
|
||||
return;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
+14
-6
@@ -1,15 +1,23 @@
|
||||
import {useState, useEffect} from 'react'
|
||||
import { useSelector } from "react-redux";
|
||||
import Home from "../components/Home";
|
||||
|
||||
export default function HomePages() {
|
||||
const { commonHeadBanner } = useSelector((state) => state.commonHeadBanner);
|
||||
|
||||
const bannerOptions = {
|
||||
bannerList: commonHeadBanner?.result_list,
|
||||
dashTypes: commonHeadBanner?.home_dash_type,
|
||||
offersList: commonHeadBanner?.offers_list,
|
||||
imageServer: commonHeadBanner?.session_image_server
|
||||
};
|
||||
const [bannerOptions, setBannerOptions] = useState({})
|
||||
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
const bannerOptions = {
|
||||
bannerList: commonHeadBanner?.result_list,
|
||||
dashTypes: commonHeadBanner?.home_dash_type,
|
||||
offersList: commonHeadBanner?.offers_list,
|
||||
imageServer: commonHeadBanner?.session_image_server
|
||||
};
|
||||
setBannerOptions(bannerOptions)
|
||||
},[commonHeadBanner])
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user