Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 52x 76x 76x 76x 76x 72x 76x | // features/TransactionPanel/hooks/usePurchaseItems.ts
import { useMemo } from "react";
import { getPurchaseItems } from "../helpers/getPurchaseItems";
import { TransactionStatus } from "../utils";
import { TTransaction } from "../types";
export const usePurchaseItems = (data: TTransaction) => {
const isTransfer = data?.displayType === TransactionStatus.MONEY_TRANSFER;
const isFees = data?.isFees;
const showPurchaseItems =
!isTransfer && !isFees && Array.isArray(data?.items);
const purchaseItems = useMemo(() => {
return showPurchaseItems ? getPurchaseItems(data) : [];
}, [data, showPurchaseItems]);
return { purchaseItems };
};
|