import React, { useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import background from "../../assets/images/bg-sky-blue.jpg"; //shape/balance-bg.svg"; import localImgLoad from "../../lib/localImgLoad"; import { tableReload } from "../../store/TableReloads"; import { PriceFormatter } from "../Helpers/PriceFormatter"; import CreditPopup from "./Popup/CreditPopup"; import WalletAction from "./WalletAction"; /** * Renders a card displaying information about a wallet item. */ export default function WalletItemCard({ walletItem, payment, countries }) { const dispatch = useDispatch(); const [creditPopup, setCreditPopup] = useState({ show: false, data: {} }); /** * Opens the credit popup. * @param {Object} value - The value object. */ const openPopUp = (value) => { setCreditPopup({ show: true, data: { ...value }, }); }; /** * Closes the credit popup and dispatches a table reload action. */ const closePopUp = () => { setCreditPopup({ show: false, data: {} }); dispatch(tableReload({ type: "WALLETTABLE" })); }; const currentWalletCurrency = countries .map((country) => country) .filter((country) => country[0] === walletItem.country); const image = walletItem.code ? `${walletItem.code.toLowerCase()}.svg` : "default.png"; return ( <>
Current Balance
{PriceFormatter( walletItem.amount * 0.01, walletItem.code, undefined, "text-[2rem]" )}
HOLDINGS :{" "} {PriceFormatter( walletItem.escrow * 0.01, walletItem.code, undefined, "text-[2rem]" )}