Compare commits

...

11 Commits

14 changed files with 127 additions and 56 deletions
+21 -3
View File
@@ -18,6 +18,9 @@ export default function Login() {
const dispatch = useDispatch();
let [loginType, setLoginType] = useState({ full: true, family: false });
const [selectedLoginType, setSelectedLoginType] = useState(
document.cookie.includes("loginType=family") ? "loginfamily" : "loginfull"
);
const [checked, setValue] = useState(false);
const [loginLoading, setLoginLoading] = useState(false);
@@ -77,6 +80,10 @@ export default function Login() {
login_mode: 1100,
action: 11025,
};
// Clear the loginType cookie if the user switches to loginfull
document.cookie =
"loginType=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
} else if (name == "loginfamily") {
// Post Data Info for family Login
postData = {
@@ -86,6 +93,8 @@ export default function Login() {
login_mode: 1105,
action: 11025,
};
// Set the loginType cookie to remember the user's selection
document.cookie = "loginType=family; path=/;";
} else {
setLoginLoading(false);
setMsgError("Invalid Login Type. Consider refreshing the page");
@@ -127,15 +136,24 @@ export default function Login() {
};
const googleLogin = useGoogleLogin({
flow: 'auth-code',
ux_mode:'redirect',
flow: "auth-code",
ux_mode: "redirect",
redirect_uri: process.env.REACT_APP_GOOGLE_REDIRECT_URL,
onSuccess: async (codeResponse) => {
console.log("GOOGLE LOGIN GOOD --- ",codeResponse);
console.log("GOOGLE LOGIN GOOD --- ", codeResponse);
},
onError: (errorResponse) => console.log(errorResponse),
});
// In order to update the selected login type whenever the component renders
useEffect(() => {
setSelectedLoginType(
document.cookie.includes("loginType=family") ? "loginfamily" : "loginfull"
);
}, []);
console.log("Looking for the cookies >>", selectedLoginType)
useEffect(() => {
setMail("");
setPassword("");
+1 -1
View File
@@ -187,7 +187,7 @@ export default function AvailableJobsCard({
</div>
</div> */}
<div className="block sm:flex flex-wrap gap-4">
<p className="text-sm text-thin-light-gray">
<p className="text-sm text-thin-light-gray flex flext-start gap-1">
Price: <span className="text-purple">{thePrice}</span>
</p>
<p className="text-sm text-thin-light-gray">
@@ -72,7 +72,7 @@ export default function FamilyTasks({ familyData, className, loader }) {
{value.title}
</h1>
<div className="flex gap-4 items-center">
<span className="text-sm text-thin-light-gray">
<span className="text-sm text-thin-light-gray flex flex-start gap-1">
Price:{" "}
<span className="text-purple">
{thePrice}
+45 -13
View File
@@ -1,16 +1,48 @@
export const PriceFormatter = (price, currency, currencyName) => {
const supportedCurrencies = ["USD", "EUR", "GBP"];
const symbolFormatter = supportedCurrencies.includes(currency)
? currency
: undefined;
import React from 'react'
const formatter = new Intl.NumberFormat("en", {
style: symbolFormatter,
currencyDisplay: "symbol",
minimumFractionDigits: 2,
});
// export const PriceFormatter = (price, currency, currencyName) => {
// const supportedCurrencies = ["USD", "EUR", "GBP"];
// const symbolFormatter = supportedCurrencies.includes(currency)
// ? currency
// : undefined;
const displayCurrencyName = symbolFormatter ? "" : currencyName;
// const formatter = new Intl.NumberFormat("en", {
// style: symbolFormatter,
// currencyDisplay: "symbol",
// minimumFractionDigits: 2,
// });
return `${formatter.format(price)} ${displayCurrencyName}`;
};
// const displayCurrencyName = symbolFormatter ? "" : currencyName;
// return `${formatter.format(price)} ${displayCurrencyName}`;
// };
export const PriceFormatter = (price='00', currency='', currencyName='') => {
// Convert the number to a string
let numStr = String(price);
// Split the string into integer and decimal parts
let parts = numStr.split('.');
let integerPart = parts[0];
let decimalPart = parts[1] || '';
// Add thousands separators to the integer part
// let formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
let formattedInteger = integerPart;
// Truncate or pad the decimal part to two decimal points
let formattedDecimal = decimalPart.slice(0, 2).padEnd(2, '0');
// Combine the formatted integer and decimal parts
// let formattedNumber = formattedInteger + '.' + formattedDecimal;
// return formattedNumber;
return (
<span className='text-sm flex items-center'>
<sup>{currency || currencyName || ''}</sup>
<span className='px-1 font-bold text-lg'>{formattedInteger}</span>
<sup>{formattedDecimal}</sup>
</span>
)
}
@@ -4,6 +4,7 @@ import { toast } from "react-toastify";
import { Form, Formik } from "formik";
import usersService from "../../../services/UsersService";
import LoadingSpinner from "../../Spinners/LoadingSpinner";
import { PriceFormatter } from "../../Helpers/PriceFormatter";
const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
const [marketMsg, setMarketMsg] = useState({
@@ -96,14 +97,18 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
[apiCall, details, onClose, textValue]
);
console.log('Checking my mangeInt',manageInt)
let thePrice = PriceFormatter(
details?.price * 0.01,
details?.currency_code,
details?.currency
);
// let addedIntDate = marketInt?.added?.split(" ")[0];
let expireIntDate = marketInt?.expire?.split(" ")[0];
return (
<ModalCom action={onClose} situation={situation} className="edit-popup">
<div className="logout-modal-wrapper md:w-[750px] md:h-[700px] h-full bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
<div className="logout-modal-wrapper md:w-[750px] md:h-[660px] h-full bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
<div className="logout-modal-header w-full flex items-center justify-between lg:p-6 px-[30px] py-[23px]">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
{details.offer_code}
@@ -112,8 +117,8 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
</div>
<div className="md:flex bg-white rounded-lg">
<div className="p-4 w-full md:w-3/4 md:border-r-1">
<div className="min-h-[290px]">
<div className="p-4 w-full md:w-[75%] md:border-r-1">
<div className="min-h-[263px]">
<h2 className="font-semibold text-slate-900 dark:text-black tracking-wide">
{details?.title}
</h2>
@@ -128,7 +133,7 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
name: "",
content: {
text: `Timeline: ${details.timeline_days} day(s) -- `,
bold: `Budget: ${details.price} naira`,
bold: `Budget: ${thePrice}`,
},
},
{
@@ -138,7 +143,7 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
},
].map(({ name, content, danger }, idx) => (
<div className={`my-3 md:flex items-center`} key={idx}>
<label className="w-full md:w-1/4 text-slate-900 tracking-wide font-semibold">
<label className="w-full md:w-[19%] text-slate-900 tracking-wide font-semibold whitespace-pre-wrap">
{name}
</label>
<div
@@ -156,15 +161,19 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
}}
/>
) : (
<p className={`w-full md:w-3/4 text-slate-900`}>
<p className={`w-full text-slate-900`}>
{name !== "Delivery Detail" ? (
<>
{typeof content !== "object" ? content : null}
{typeof content === "object" && (
<span className="flex items-center gap-2">
{content?.text}
<strong>{content?.bold}</strong>
</span>
<>
<hr className="mb-1" />
<span className="flex items-center gap-2">
{content?.text}
<strong>{content?.bold}</strong>
</span>
<hr className="mt-1" />
</>
)}
</>
) : (
@@ -207,15 +216,15 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
</div>
</div>
<div className="w-full md:w-1/4 h-full ">
<div className="w-[90%] mx-auto bg-[#f1f8ff] p-4 rounded-md md:min-h-[550px] flex flex-col justify-between">
<div className="w-full md:w-[23%] h-full ">
<div className="mx-auto bg-[#f1f8ff] p-4 rounded-md md:min-h-[498px] flex flex-col justify-between">
<div className="w-full flex flex-col justify-center py-4 gap-2">
<p className="w-full text-slate-900 tracking-wide my-1">
Interested in the task?
</p>
<hr />
<button
className="bg-[#57cd89] text-center text-lg font-semibold text-white py-2 px-4 rounded-md inline-flex flex-col items-center justify-center"
className="bg-[#57cd89] text-center text-lg font-semibold text-white py-2 px-4 rounded-md inline-flex sm:flex-col flex-row sm:gap-0 gap-1 items-center justify-center"
name="market-interest"
onClick={marketCalls}
>
@@ -251,6 +260,13 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
<p className="my-1">Expire: {expireIntDate}</p>
</div>
</div>
<button
className="self-end w-[150px] mt-2 h-[52px] rounded-md text-base bg-transparent border border-red-500 text-red-500 mx-auto"
name="cancel"
onClick={onClose}
>
Cancel
</button>
</div>
{/* END OF ACTION SECTION */}
</div>
@@ -68,7 +68,7 @@ export default function MyActiveJobTable({ MyJobList, className }) {
{value.title}
</h1>
<div>{value.description}</div>
<span className="text-sm text-thin-light-gray">
<span className="text-sm text-thin-light-gray flex flext-start gap-1">
Price:{" "}
<span className="text-purple">
{thePrice}
+1 -1
View File
@@ -119,7 +119,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
{value.title}
</h1>
<div>{value.description}</div>
<span className="text-sm text-thin-light-gray">
<span className="text-sm text-thin-light-gray flex items-start gap-1">
Price: <span className="text-purple">{thePrice}</span>
</span>
<span className="text-sm text-thin-light-gray">
@@ -67,7 +67,7 @@ export default function MyPendingJobTable({ MyJobList, className }) {
{value.title}
</h1>
<div>{value.description}</div>
<span className="text-sm text-thin-light-gray">
<span className="text-sm text-thin-light-gray flex items-start gap-1">
Price:{" "}
<span className="text-purple">
{thePrice}
+1 -1
View File
@@ -86,7 +86,7 @@ export default function MyJobTable({ className, ActiveJobList }) {
<span className="text-base text-gray-600">
{task?.description}
</span>
<span className="text-sm text-thin-light-gray">
<span className="text-sm text-thin-light-gray flex flext-start gap-1">
Price:
<span className="text-purple ml-1">{thePrice}</span>
</span>
+3 -2
View File
@@ -4,6 +4,7 @@ import RecentActivityTable from './WalletComponent/RecentActivityTable'
import PurchasesTable from './WalletComponent/PurchasesTable'
import CouponTable from './WalletComponent/CouponTable'
import LoadingSpinner from '../Spinners/LoadingSpinner'
import { PriceFormatter } from '../Helpers/PriceFormatter'
function Balance({wallet, coupon}) {
return (
@@ -42,11 +43,11 @@ function Balance({wallet, coupon}) {
</div>
<div className='balance-info'>
<p className='py-2'>Balance</p>
<span className='py-1 px-2 bg-green-100 text-green-500 rounded-lg'>{item.symbol}{(item.amount*0.01).toFixed(2)}</span>
<span className='py-1 px-2 bg-green-100 text-green-500 rounded-lg flex flex-start gap-1'>{PriceFormatter(item.amount * 0.01, item.code)}</span>
</div>
<div className='balance-info'>
<p className='py-2'>Escrow</p>
<span className='py-1 px-2 bg-red-100 text-red-500 rounded-lg'>{item.symbol}{(item.escrow*0.01).toFixed(2)}</span>
<span className='py-1 px-2 bg-red-100 text-red-500 rounded-lg flex flex-start gap-1'>{PriceFormatter(item.escrow * 0.01, item.code)}</span>
</div>
</div>
+2 -4
View File
@@ -5,6 +5,7 @@ import bank2 from "../../assets/images/bank-2.png";
import bank3 from "../../assets/images/bank-3.png";
import bank4 from "../../assets/images/bank-4.png";
import Accordion from "../Helpers/Accordion";
import { PriceFormatter } from "../Helpers/PriceFormatter";
export default function WalletHeader(props) {
// debugger;
@@ -58,10 +59,7 @@ export default function WalletHeader(props) {
</div>
<div>
<p className="eth text-xl font-bold text-purple">
{(value.amount * 0.01).toFixed(2)} {value.code}
</p>
<p className="usd text-base text-thin-light-gray text-right">
{/*(773.69 USD)*/}
{PriceFormatter(value.amount * 0.01, value.code)}
</p>
</div>
</div>
@@ -143,13 +143,15 @@ export default function ManageInterestOffer(props) {
{/* info tab */}
{tab == 'info' ?
<div className="info-details w-full border-t">
<div className="my-3 flex items-center gap-1">
<span className="w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Name</span>
<span className="min-w-[100px] text-sm font-bold text-dark-gray dark:text-white tracking-wide">{props.offerDetails?.client_name}</span>
</div>
<div className="my-3 flex items-center gap-1">
<span className="w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Member Since</span>
<span className="min-w-[100px] text-sm font-bold text-dark-gray dark:text-white tracking-wide">{props.offerDetails?.client_added}</span>
<div className="my-0 md:my-3 block md:flex items-center gap-10">
<div className="my-3 md:my-0 flex items-center gap-1">
<span className="w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Name</span>
<span className="min-w-[100px] text-sm font-bold text-dark-gray dark:text-white tracking-wide">{props.offerDetails?.client_name}</span>
</div>
<div className="my-3 md:my-0 flex items-center gap-1">
<span className="w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Member Since</span>
<span className="min-w-[100px] text-sm font-bold text-dark-gray dark:text-white tracking-wide">{props.offerDetails?.client_added}</span>
</div>
</div>
<div className="my-3 flex items-center gap-1">
<span className="w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Jobs completed</span>
@@ -226,7 +228,7 @@ export default function ManageInterestOffer(props) {
{/* BUTTON section */}
<div className="p-4 w-full min-h-full bg-sky-100 dark:bg-dark-gray col-span-1">
<div className="w-full h-full">
<div className="mt-0 sm:mt-10 flex sm:flex-col justify-center items-center gap-10">
<div className="h-full flex sm:flex-col justify-center items-center gap-10">
{requestStatus.loading && requestStatus.processType == 'accept' ?
<LoadingSpinner color='sky-blue' size='10' />
:
@@ -235,9 +237,10 @@ export default function ManageInterestOffer(props) {
name='accept'
disabled={requestStatus.loading}
onClick={interestOfferProcess}
className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
// className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
className='max-w-[150px] h-[100px] bg-[#57cd89] text-center text-lg font-semibold text-white py-2 px-4 rounded-md shadow-md'
>
Accept
Accept this Interest
</button>
}
@@ -249,9 +252,10 @@ export default function ManageInterestOffer(props) {
name='reject'
disabled={requestStatus.loading}
onClick={interestOfferProcess}
className="px-2 py-1 h-11 flex justify-center items-center border-gradient text-base rounded-full text-black"
// className="px-2 py-1 h-11 flex justify-center items-center border-gradient text-base rounded-full text-black"
className='max-w-[150px] h-[100px] bg-red-300 text-center text-lg font-semibold text-white py-2 px-4 rounded-md shadow-md'
>
Reject
Reject this Interest
</button>
}
</div>
+1 -1
View File
@@ -118,7 +118,7 @@ function DeleteJobPopout({ details, onClose, situation }) {
<p className="text-xl tracking-wide text-dark-gray dark:text-white">
{details.title}
</p>
<p className="text-lg tracking-wide text-dark-gray dark:text-white">
<p className="text-lg tracking-wide text-dark-gray dark:text-white flex items-start gap-1">
Price: {details.thePrice}
</p>
<p className="text-lg tracking-wide text-dark-gray dark:text-white">
@@ -4,6 +4,7 @@ import ModalCom from "../Helpers/ModalCom";
import usersService from "../../services/UsersService";
import { toast } from "react-toastify";
import LoadingSpinner from "../Spinners/LoadingSpinner";
import { PriceFormatter } from "../Helpers/PriceFormatter";
const showSuccessToast = (message) => {
toast.success(message, {
@@ -133,7 +134,8 @@ function PendingJobsPopout({ details, onClose, situation }) {
<div className="my-2 md:flex">
<Detail
label="Price"
value={`${details.price * 0.01} ${details.currency}`}
// value={`${details.price * 0.01} ${details.currency}`}
value={PriceFormatter(details.price * 0.01, details?.currency_code, details.currency)}
/>
</div>