67 lines
2.3 KiB
React
67 lines
2.3 KiB
React
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 WalletAction from "./WalletAction";
|
|
|
|
/**
|
|
* Renders a card displaying information about a wallet item.
|
|
*/
|
|
export default function WalletItemCardFamily({ walletItem, payment, countries }) {
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
/**
|
|
* Opens the credit popup.
|
|
* @param {Object} value - The value object.
|
|
*/
|
|
|
|
/**
|
|
* Closes the credit popup and dispatches a table reload action.
|
|
*/
|
|
|
|
const currentWalletCurrency = countries?.filter((country) => country.code === walletItem.country);
|
|
|
|
const image = walletItem.code
|
|
? `${walletItem.code.toLowerCase()}.svg`
|
|
: "default.png";
|
|
|
|
return (
|
|
<>
|
|
<div
|
|
className="current-balance-widget w-full h-full rounded-2xl overflow-hidden flex flex-col items-center gap-2 p-8 justify-between bg-family-header-bg"
|
|
// style={{
|
|
// background: `url(${background}) 0% 0% / cover no-repeat`,
|
|
// }}
|
|
>
|
|
<div className="wallet w-full flex justify-between items-center gap-3">
|
|
<div className="min-w-[100px] min-h-[100px] max-w-min md:max-w-[150px] max-h-min md:max-h-[150px] rounded-full bg-[#e3e3e3] flex justify-center items-center">
|
|
<img
|
|
src={localImgLoad(`images/currency/${image}`)}
|
|
className="w-full h-full"
|
|
alt="currency-icon"
|
|
/>
|
|
</div>
|
|
<div className="balance w-full mt-2 flex justify-center">
|
|
<div className="">
|
|
<p className="text-base sm:text-lg text-white opacity-[70%] tracking-wide mb-2 sm:mb-6">
|
|
Current Balance
|
|
</p>
|
|
<p className="text-[44px] lg:text-[62px] font-bold text-white tracking-wide leading-10 xxs:scale-100 lg:scale-100 xl:scale-125">
|
|
{PriceFormatter(
|
|
walletItem.amount * 0.01,
|
|
walletItem.code,
|
|
undefined,
|
|
"text-[2rem]"
|
|
)}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|