diff --git a/src/components/MyWallet/WalletBox.jsx b/src/components/MyWallet/WalletBox.jsx
index c6d3dfd..e3ff49d 100644
--- a/src/components/MyWallet/WalletBox.jsx
+++ b/src/components/MyWallet/WalletBox.jsx
@@ -1,5 +1,7 @@
+import { useSelector } from "react-redux";
import LoadingSpinner from "../Spinners/LoadingSpinner";
import WalletItemCard from "./WalletItemCard";
+import WalletItemCardFamily from "./WalletItemCardFamily";
/**
* Renders a list of wallet items or a loading spinner depending on the state of the `wallet` object.
@@ -7,9 +9,27 @@ import WalletItemCard from "./WalletItemCard";
export default function WalletBox({ wallet, payment, countries }) {
const { loading, data } = wallet;
+ const { userDetails } = useSelector((state) => state.userDetails);
+ const accountType = userDetails?.account_type === "FAMILY";
+
return (
+ {accountType ?
+
+ {loading ? (
+
+
+
+ ) : (
+ data.length > 0 && data.map((item) => (
+
+
+
+ ))
+ )}
+
+ :
{loading ? (
@@ -23,6 +43,7 @@ export default function WalletBox({ wallet, payment, countries }) {
))
)}
+ }
);
diff --git a/src/components/MyWallet/WalletItemCard.jsx b/src/components/MyWallet/WalletItemCard.jsx
index d4d7942..2b61cc0 100644
--- a/src/components/MyWallet/WalletItemCard.jsx
+++ b/src/components/MyWallet/WalletItemCard.jsx
@@ -11,8 +11,7 @@ import WalletAction from "./WalletAction";
* Renders a card displaying information about a wallet item.
*/
export default function WalletItemCard({ walletItem, payment, countries }) {
- const { userDetails } = useSelector((state) => state.userDetails);
- const accountType = userDetails?.account_type === "FAMILY";
+
const dispatch = useDispatch();
const [creditPopup, setCreditPopup] = useState({ show: false, data: {} });
@@ -91,13 +90,11 @@ export default function WalletItemCard({ walletItem, payment, countries }) {
- {!accountType && (
-
- )}
+
{creditPopup.show && (
diff --git a/src/components/MyWallet/WalletItemCardFamily.jsx b/src/components/MyWallet/WalletItemCardFamily.jsx
new file mode 100644
index 0000000..49a4fe9
--- /dev/null
+++ b/src/components/MyWallet/WalletItemCardFamily.jsx
@@ -0,0 +1,109 @@
+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 WalletItemCardFamily({ 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]"
+ )}
+
+
+
+
+
+ {/*
*/}
+
+
+ {creditPopup.show && (
+
+ )}
+ >
+ );
+}