Merge branch 'market-list-toggle' of WrenchBoard/Users-Wrench into master

This commit is contained in:
2023-06-20 22:34:26 +00:00
committed by Gogs
5 changed files with 121 additions and 6 deletions
@@ -3,11 +3,13 @@ import { Link, useNavigate } from "react-router-dom";
import MarketPopUp from "../MarketPlace/PopUp/MarketPopUp"; import MarketPopUp from "../MarketPlace/PopUp/MarketPopUp";
import usersService from "../../services/UsersService"; import usersService from "../../services/UsersService";
import { PriceFormatter } from "../Helpers/PriceFormatter"; import { PriceFormatter } from "../Helpers/PriceFormatter";
import dataImage2 from "../../assets/images/data-table-user-2.png";
export default function AvailableJobsCard({ export default function AvailableJobsCard({
className, className,
datas, datas,
hidden = false, hidden = false,
contentDisplay
}) { }) {
//debugger; //debugger;
const [marketPopUp, setMarketPopUp] = useState({ show: false, data: {} }); const [marketPopUp, setMarketPopUp] = useState({ show: false, data: {} });
@@ -49,6 +51,7 @@ export default function AvailableJobsCard({
}, []); }, []);
return ( return (
<> <>
{contentDisplay == 'grid' ?
<div <div
className={`card-style-two w-full h-[426px] p-[20px] bg-white dark:bg-dark-white rounded-2xl section-shadow ${ className={`card-style-two w-full h-[426px] p-[20px] bg-white dark:bg-dark-white rounded-2xl section-shadow ${
className || "" className || ""
@@ -145,6 +148,78 @@ export default function AvailableJobsCard({
</div> </div>
</div> </div>
</div> </div>
:
<div className="card-style-two w-full p-8 my-2 flex items-center gap-4 bg-white dark:bg-dark-white rounded-2xl section-shadow">
<div className="flex gap-5 items-center w-full">
<div className="w-full h-[60px] rounded-full overflow-hidden flex justify-center items-center flex-[0.1] min-w-[60px] max-w-[60px]">
<img src={dataImage2} alt="data" className="w-full h-full" />
</div>
<div className="flex flex-col flex-[0.9]">
<Link to="/shop-details" className="">
<h1 className="font-bold text-xl tracking-wide line-clamp-1 text-dark-gray dark:text-white capitalize">
{datas?.title}
</h1>
</Link>
<div className="my-2">
<p className="text-dark-gray dark:text-white">{datas?.description}</p>
</div>
{/* <div className="card-two-info flex gap-2 items-center">
<div className="owned-by flex space-x-2 items-center">
<div>
<p className="text-thin-light-gray text-sm leading-3">Added</p>
<p className="text-base text-dark-gray dark:text-white">
{datas.offer_added}
</p>
</div>
</div>
<div className="w-[1px] bg-light-purple dark:bg-dark-light-purple h-7"></div>
<div className="created-by flex space-x-2 items-center flex-row-reverse">
<div>
<p className="text-thin-light-gray text-sm leading-3 text-right">
Expires
</p>
<p className="text-base text-dark-gray dark:text-white text-right">
{datas.expire}
</p>
</div>
</div>
</div> */}
<div className="block sm:flex flex-wrap gap-4">
<p className="text-sm text-thin-light-gray">
Price: <span className="text-purple">{thePrice}</span>
</p>
<p className="text-sm text-thin-light-gray">
Duration:{" "}
<span className="text-purple italic">
{" "}
{datas?.timeline_days} day(s)
</span>
</p>
<p className="text-sm text-thin-light-gray">
Code:{" "}
<span className="text-purple">
{" "}
{datas?.offer_code}
</span>
</p>
</div>
</div>
</div>
<div className="">
<button
type="button"
className="px-4 py-2.5 text-white text-sm bg-pink rounded-full tracking-wide"
onClick={() => {
setMarketPopUp({ show: true, data: datas });
}}
>
View
</button>
</div>
</div>
}
{marketPopUp.show && ( {marketPopUp.show && (
<MarketPopUp <MarketPopUp
details={datas} details={datas}
+10
View File
@@ -1,5 +1,9 @@
import React from "react"; import React from "react";
import ATMCard from '../../assets/images/card.svg'
import VisaCard from '../../assets/images/visa.svg'
import MasterCard from '../../assets/images/master.svg'
export default function Icons({ name }) { export default function Icons({ name }) {
return ( return (
<> <>
@@ -483,6 +487,12 @@ export default function Icons({ name }) {
c0.3,0,0.5-0.1,0.7-0.3l5.7-5.7c0,0,0,0,0,0C15.9,12.3,15.9,11.7,15.5,11.3z" c0.3,0,0.5-0.1,0.7-0.3l5.7-5.7c0,0,0,0,0,0C15.9,12.3,15.9,11.7,15.5,11.3z"
></path> ></path>
</svg> </svg>
) : name === "atm-card" ? (
<img className="w-[20px]" src={ATMCard} alt="card" />
) : name === "visa-card" ? (
<img className="w-[20px]" src={VisaCard} alt="card" />
) : name === "master-card" ? (
<img className="w-[20px]" src={MasterCard} alt="card" />
) : ( ) : (
"" ""
)} )}
@@ -95,8 +95,12 @@ export default function InputCom({
dir={direction} dir={direction}
/> />
{iconName && ( {iconName && (
<div className="absolute right-6 bottom-[10px] z-10"> <div className="absolute right-6 bottom-[10px] z-10 flex gap-2">
<Icons name={iconName} /> {
iconName.split(' ').map((item, index)=>(
<Icons key={index} name={item} />
))
}
</div> </div>
)} )}
{passIcon && ( {passIcon && (
+28 -2
View File
@@ -1,6 +1,8 @@
import React, { useEffect, useMemo, useState } from "react"; import React, { useEffect, useMemo, useState } from "react";
import DataIteration from "../Helpers/DataIteration"; import DataIteration from "../Helpers/DataIteration";
import AvailableJobsCard from "../Cards/AvailableJobsCard"; import AvailableJobsCard from "../Cards/AvailableJobsCard";
import ListView from '../../assets/images/list-view.png'
import GridView from '../../assets/images/grid-view.svg'
export default function MainSection({ export default function MainSection({
className, className,
@@ -14,6 +16,8 @@ export default function MainSection({
); );
const [tab, setTab] = useState(Object.keys(marketCategories)[0]); const [tab, setTab] = useState(Object.keys(marketCategories)[0]);
let [contentDisplay, setContentDisplay] = useState('grid') // STATE TO HOLD LIST VIEW STYLE
// Convert to array in order to map // Convert to array in order to map
const mappedArray = Object.entries(marketCategories).map(([key, value]) => { const mappedArray = Object.entries(marketCategories).map(([key, value]) => {
return { key, value }; return { key, value };
@@ -37,6 +41,18 @@ export default function MainSection({
return ( return (
<div className={`market-place-section w-full ${className || ""}`}> <div className={`market-place-section w-full ${className || ""}`}>
<div className="market-place-wrapper w-full"> <div className="market-place-wrapper w-full">
{/* contentDisplay toggler */}
<div className="w-full flex items-center justify-end">
<div className="p-2 w-[35px] h-[35px] bg-white dark:bg-slate-200 rounded-lg">
<img
title={contentDisplay=='grid'? 'list view' : 'grid view'}
onClick={()=>setContentDisplay((prev)=>prev=='grid'? 'list' : 'grid')}
src={contentDisplay=='grid'? ListView : GridView}
className="w-full h-full cursor-pointer" alt="view"
/>
</div>
</div>
{/* end of contentDisplay toggler */}
<div className="filter-navigate-area lg:flex justify-between mb-8 items-center"> <div className="filter-navigate-area lg:flex justify-between mb-8 items-center">
<div className="tab-item lg:mb-0 mb-5"> <div className="tab-item lg:mb-0 mb-5">
<div className="md:flex md:space-x-8 space-x-2"> <div className="md:flex md:space-x-8 space-x-2">
@@ -55,16 +71,26 @@ export default function MainSection({
))} ))}
</div> </div>
</div> </div>
{/* contentDisplay toggler */}
{/* <div className="p-2 w-[35px] h-[35px] bg-white dark:bg-slate-200 rounded-lg">
<img
title={contentDisplay=='grid'? 'list view' : 'grid view'}
onClick={()=>setContentDisplay((prev)=>prev=='grid'? 'list' : 'grid')}
src={contentDisplay=='grid'? ListView : GridView}
className="w-full h-full cursor-pointer" alt="view"
/>
</div> */}
{/* end of contentDisplay toggler */}
</div> </div>
<div className="filter-navigate-content w-full min-h-screen"> <div className="filter-navigate-content w-full min-h-screen">
<div className="grid lg:grid-cols-3 sm:grid-cols-2 gap-[30px]"> <div className={contentDisplay == 'grid' ? 'grid lg:grid-cols-3 sm:grid-cols-2 gap-[30px]' : 'w-full'}>
<DataIteration <DataIteration
datas={products} datas={products}
startLength={process.env.REACT_APP_ZERO_STATE} startLength={process.env.REACT_APP_ZERO_STATE}
endLength={products?.length} endLength={products?.length}
> >
{({ datas }) => ( {({ datas }) => (
<AvailableJobsCard key={datas.id} datas={datas} /> <AvailableJobsCard contentDisplay={contentDisplay} key={datas.id} datas={datas} />
)} )}
</DataIteration> </DataIteration>
</div> </div>
+2 -2
View File
@@ -230,7 +230,7 @@ function AddFundDollars(props) {
<InputCom <InputCom
fieldClass="px-6" fieldClass="px-6"
spanTag='*' spanTag='*'
iconName='wallet-two' iconName='master-card visa-card atm-card'
label="Card Number" label="Card Number"
type="text" type="text"
name="cardNum" name="cardNum"
@@ -318,7 +318,7 @@ function AddFundDollars(props) {
<InputCom <InputCom
fieldClass="px-6" fieldClass="px-6"
spanTag='*' spanTag='*'
iconName='wallet-two' iconName='atm-card'
label="CVV" label="CVV"
type="text" type="text"
name="cvv" name="cvv"