Compare commits

...

4 Commits

Author SHA1 Message Date
victorAnumudu da389c937e preference component added 2024-10-09 15:21:03 +01:00
ameye 804f76100a Merge branch 'settings-page-update' of WrenchBoard/Users-Wrench into master 2024-10-08 21:27:10 +00:00
victorAnumudu 64f6e55fb6 currency code added 2024-10-08 20:09:56 +01:00
ameye 16119dc332 Merge branch 'recipient-account' of WrenchBoard/Users-Wrench into master 2024-10-08 16:10:52 +00:00
12 changed files with 91 additions and 25 deletions
+19
View File
@@ -75,4 +75,23 @@ export const AmountTo2DP = (
// return formattedNumber; // return formattedNumber;
return formattedNumber; return formattedNumber;
};
// FUNCTION TO RETURN CURRENCY SYMBOL
export const currencySymbol = (
currencyName = "naira",
amount = "00",
) => {
// Cureency Array
let currencyArray = [
{currencyName:'naira', symbol:'₦'},
{currencyName:'usd', symbol:'$'},
]
const matchedCurrency = currencyArray.filter(item => item.currencyName.toLocaleLowerCase() == currencyName.toLocaleLowerCase())
const amountTo2DP = AmountTo2DP(amount)
// return formattedNumber;
return matchedCurrency.length ? <><span>{matchedCurrency[0].symbol}</span><span>{amountTo2DP}</span></> : <><span>$</span><span>{amountTo2DP}</span></>;
}; };
+2 -5
View File
@@ -7,7 +7,7 @@ import PaginatedList from '../../components/Pagination/PaginatedList';
import LoadingSpinner from '../Spinners/LoadingSpinner'; import LoadingSpinner from '../Spinners/LoadingSpinner';
import { AmountTo2DP, PriceFormatter } from '../Helpers/PriceFormatter'; import { currencySymbol } from '../Helpers/PriceFormatter';
import {NewDateTimeFormatter} from '../../lib/NewDateTimeFormatter' import {NewDateTimeFormatter} from '../../lib/NewDateTimeFormatter'
function JobsCompleted() { function JobsCompleted() {
@@ -76,10 +76,7 @@ function JobsCompleted() {
</div> </div>
</div> </div>
</td> </td>
<td className="p-4 flex text-right justify-end items-center">{AmountTo2DP(item?.price*0.01)} {item?.currency_code}</td> <td className="p-4 flex text-right justify-end items-center">{currencySymbol(item?.currency_code, item?.price*0.01)}</td>
{/* <td className="p-4 text-right">{PriceFormatter(item?.price*0.01, item?.currency_code)}</td> */}
{/* <td className="p-4">{date}</td>
<td className="p-4">{item?.contract}</td> */}
</tr> </tr>
) )
} }
+9 -9
View File
@@ -7,7 +7,7 @@ import PaginatedList from '../../components/Pagination/PaginatedList';
import LoadingSpinner from '../Spinners/LoadingSpinner'; import LoadingSpinner from '../Spinners/LoadingSpinner';
import { AmountTo2DP } from '../Helpers/PriceFormatter'; import { currencySymbol } from '../Helpers/PriceFormatter';
export const RewardsTable = memo(() => { export const RewardsTable = memo(() => {
@@ -47,7 +47,7 @@ export const RewardsTable = memo(() => {
}, []) }, [])
return ( return (
<div className='py-4 flex flex-col justify-between min-h-[500px]'> <div className='py-4 flex flex-col justify-between min-h-[500px] w-full overflow-x-auto'>
{familyRewardHistory.loading ? {familyRewardHistory.loading ?
<LoadingSpinner size='16' color='sky-blue' height='h-[500px]' /> <LoadingSpinner size='16' color='sky-blue' height='h-[500px]' />
: familyRewardHistory.data.length ? : familyRewardHistory.data.length ?
@@ -55,9 +55,9 @@ export const RewardsTable = memo(() => {
<thead className='w-full'> <thead className='w-full'>
<tr className='text-slate-600 dark:text-white'> <tr className='text-slate-600 dark:text-white'>
<th className="p-4"></th> <th className="p-4"></th>
<th className="p-4 text-right">Amount</th> <th className="p-4 text-center">Amount</th>
<th className="p-4">Date</th> <th className="p-4 text-center">Date</th>
<th className="p-4">Confirmation</th> <th className="p-4 text-center">Confirmation</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -65,7 +65,7 @@ export const RewardsTable = memo(() => {
let date = new Date(item.added).toLocaleDateString() let date = new Date(item.added).toLocaleDateString()
return ( return (
<tr key={index} className='dark:text-white dark:bg-dark-white border-y dark:border-[#5356fb29] hover:bg-gray-50 dark:hover:bg-gray-50 dark:hover:text-black transition-all duration-300'> <tr key={index} className='dark:text-white dark:bg-dark-white border-y dark:border-[#5356fb29] hover:bg-gray-50 dark:hover:bg-gray-50 dark:hover:text-black transition-all duration-300'>
<td className="p-4 min-w-[350px] max-w-[400px]"> <td className="p-4 min-w-[300px]">
<div className='flex w-full items-center gap-2'> <div className='flex w-full items-center gap-2'>
<img src={item.icon} className='min-w-[60px] max-w-[60px] min-h-[60px] max-h-[60px] rounded-full bg-slate-500' alt='Reward Logo' /> <img src={item.icon} className='min-w-[60px] max-w-[60px] min-h-[60px] max-h-[60px] rounded-full bg-slate-500' alt='Reward Logo' />
<div className='flex flex-col w-full'> <div className='flex flex-col w-full'>
@@ -74,9 +74,9 @@ export const RewardsTable = memo(() => {
</div> </div>
</div> </div>
</td> </td>
<td className="p-4 text-right">{AmountTo2DP(item.amount*0.01)} {item.currency}</td> <td className="p-4 text-right flex-nowrap">{currencySymbol(item.currency, item.amount*0.01)}</td>
<td className="p-4">{date}</td> <td className="p-4 text-center">{date}</td>
<td className="p-4">{item.confirmation}</td> <td className="p-4 text-center">{item.confirmation}</td>
</tr> </tr>
) )
} }
+1 -1
View File
@@ -127,7 +127,7 @@ export default function History() {
</div> </div>
</div> </div>
<div className="w-[1px] bg-[#E3E4FE] dark:bg-[#a7a9b533] mr-10"></div> <div className="w-[1px] bg-[#E3E4FE] dark:bg-[#a7a9b533] mr-10"></div>
<div className="flex-1 overflow-y-auto min-h-[520px]"> <div className="w-full overflow-y-auto min-h-[520px]">
<> <>
{/* PURCHASE SECTION */} {/* PURCHASE SECTION */}
{selectedTab == 'purchases' && {selectedTab == 'purchases' &&
@@ -3,6 +3,8 @@ import React, {useState} from 'react'
import PaginatedList from '../../Pagination/PaginatedList'; import PaginatedList from '../../Pagination/PaginatedList';
import { handlePagingFunc } from '../../Pagination/HandlePagination'; import { handlePagingFunc } from '../../Pagination/HandlePagination';
import { currencySymbol } from '../../Helpers/PriceFormatter';
function PurchasesTable({purchase}) { function PurchasesTable({purchase}) {
const [currentPage, setCurrentPage] = useState(0); const [currentPage, setCurrentPage] = useState(0);
@@ -31,8 +33,8 @@ function PurchasesTable({purchase}) {
<td className="p-4">{item.added_date}<br /> <td className="p-4">{item.added_date}<br />
<b>{item.confirmation} </b> <b>{item.confirmation} </b>
</td> </td>
<td className="p-4 text-right">{item.amount}</td> <td className="p-4 text-right">{currencySymbol('', item.amount)}</td>
<td className="p-4 text-right">{item.fee}</td> <td className="p-4 text-right">{currencySymbol('', item.fee)}</td>
</tr> </tr>
))} ))}
</tbody> </tbody>
@@ -3,6 +3,8 @@ import React, { useState } from "react";
import PaginatedList from "../../Pagination/PaginatedList"; import PaginatedList from "../../Pagination/PaginatedList";
import { handlePagingFunc } from "../../Pagination/HandlePagination"; import { handlePagingFunc } from "../../Pagination/HandlePagination";
import { currencySymbol } from '../../Helpers/PriceFormatter';
function RecentActivityTable({ payment }) { function RecentActivityTable({ payment }) {
const [currentPage, setCurrentPage] = useState(0); const [currentPage, setCurrentPage] = useState(0);
const indexOfFirstItem = Number(currentPage); const indexOfFirstItem = Number(currentPage);
@@ -38,9 +40,9 @@ function RecentActivityTable({ payment }) {
dangerouslySetInnerHTML={{ __html: item.recipient }} dangerouslySetInnerHTML={{ __html: item.recipient }}
></td> ></td>
<td className="p-4 text-right"> <td className="p-4 text-right">
{item.amount} {currencySymbol('', item.amount)}
<br /> <br />
{item.fee} {currencySymbol('', item.fee)}
</td> </td>
<td className="p-4">{item.status}</td> <td className="p-4">{item.status}</td>
</tr> </tr>
+1 -1
View File
@@ -413,7 +413,7 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
</div> </div>
</Link> </Link>
</li> </li>
{userDetails && userDetails?.account_type !== "FAMILY" && ( {(userDetails && userDetails?.account_type !== "FAMILY" && Number(process.env.REACT_APP_SHOW_USER_PAGE) == 1) && (
<li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg"> <li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
<Link to="/yourpage" className="notifications"> <Link to="/yourpage" className="notifications">
<div className="name"> <div className="name">
+1 -1
View File
@@ -457,7 +457,7 @@ export default function MediaHeader({ logoutModalHandler, sidebarHandler, backpa
</div> </div>
</Link> </Link>
</li> </li>
{userDetails && userDetails?.account_type !== "FAMILY" && ( {(userDetails && userDetails?.account_type !== "FAMILY" && Number(process.env.REACT_APP_SHOW_USER_PAGE) == 1) && (
<li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg"> <li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
<Link to="/yourpage" className="notifications"> <Link to="/yourpage" className="notifications">
<div className="name"> <div className="name">
@@ -120,7 +120,7 @@ export default function ChangePasswordTab() {
className="input-label text-dark-gray dark:text-white text-xl font-bold block mb-2.5" className="input-label text-dark-gray dark:text-white text-xl font-bold block mb-2.5"
htmlFor="old_password" htmlFor="old_password"
> >
Old Password <span className="text-[10px] text-red-500 italic px-2">{(inputEmpty && !inputs.old_pwd) && 'required'}</span> Current Password <span className="text-[10px] text-red-500 italic px-2">{(inputEmpty && !inputs.old_pwd) && 'required'}</span>
</label> </label>
<div className="input-wrapper border border-light-purple dark:border-[#5356fb29] w-full rounded-[50px] h-[58px] overflow-hidden relative "> <div className="input-wrapper border border-light-purple dark:border-[#5356fb29] w-full rounded-[50px] h-[58px] overflow-hidden relative ">
<div className="absolute left-6 bottom-[17px] z-10"> <div className="absolute left-6 bottom-[17px] z-10">
@@ -0,0 +1,43 @@
import React from "react";
import Icons from "../../Helpers/Icons";
export default function Preferences() {
return (
<div className="login-activity-tab w-full">
<div className="relative w-full overflow-x-auto sm:rounded-lg">
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
{/* <thead>
<tr className="text-base text-thin-light-gray border-b dark:border-[#5356fb29] default-border-b ">
<td className="py-4 text-center">Channel</td>
<td className="py-4 text-center">Date</td>
<td className="py-4 text-center">Location</td>
</tr>
</thead>
<tbody>
<tr className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50">
<td className="text-center py-4">
<div className="flex items-center justify-center">
<span className="text-base text-dark-gray dark:text-white font-medium whitespace-nowrap px-2">
Desktop
</span>
</div>
</td>
<td className="text-center py-4">
<div className="flex space-x-1 items-center justify-center">
<span className="text-base text-dark-gray dark:text-white font-medium whitespace-nowrap px-2">
10-10-2035
</span>
</div>
</td>
<td className="text-center py-4">
<span className="text-base text-dark-gray dark:text-white whitespace-nowrap px-2">
10.0.0.1000
</span>
</td>
</tr>
</tbody> */}
</table>
</div>
</div>
);
}
+2
View File
@@ -7,6 +7,7 @@ import PersonalInfoTab from "./PersonalInfoTab";
import PrivacyPolicyTab from "./PrivacyPolicyTab"; import PrivacyPolicyTab from "./PrivacyPolicyTab";
import RecentActivitiesTab from "./RecentActivitiesTab"; import RecentActivitiesTab from "./RecentActivitiesTab";
import TermsConditionTab from "./TermsConditionTab"; import TermsConditionTab from "./TermsConditionTab";
import Preferences from './Preferences'
export { export {
ChangePasswordTab, ChangePasswordTab,
@@ -18,4 +19,5 @@ export {
PrivacyPolicyTab, PrivacyPolicyTab,
RecentActivitiesTab, RecentActivitiesTab,
TermsConditionTab, TermsConditionTab,
Preferences
}; };
+4 -3
View File
@@ -13,6 +13,7 @@ import {
PrivacyPolicyTab, PrivacyPolicyTab,
RecentActivitiesTab, RecentActivitiesTab,
TermsConditionTab, TermsConditionTab,
Preferences,
} from "./Tabs"; } from "./Tabs";
import RecipientAccountTab from "./Tabs/RecipientAccountTab"; import RecipientAccountTab from "./Tabs/RecipientAccountTab";
@@ -91,8 +92,8 @@ export default function Settings({ faq }) {
}, },
{ {
id: 5, id: 5,
name: "login_activity", name: "preferences",
title: "Login Activity", title: "Preferences",
iconName: "login-activity", iconName: "login-activity",
}, },
{ {
@@ -166,7 +167,7 @@ export default function Settings({ faq }) {
<NotificationSettingTab /> <NotificationSettingTab />
</div> </div>
), ),
login_activity: <LoginActivityTab />, preferences: <Preferences />,
recent_activities: <RecentActivitiesTab />, recent_activities: <RecentActivitiesTab />,
password: <ChangePasswordTab />, password: <ChangePasswordTab />,
faq: <FaqTab datas={faq} />, faq: <FaqTab datas={faq} />,