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 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | 2x 157x 157x 157x 157x 157x 157x 157x 4x 157x 157x 157x 157x 157x 157x 72x 157x 72x 157x | import BackgroundAnimation from "@shared/Banner/BackgroundAnimation";
import GiveMotionWrapper from "@shared/Motion/GiveMotionWrapper";
import NiceModal from "@ebay/nice-modal-react";
import { useHandleScroll } from "componentsV2/Table/hooks/useHandleScroll";
import useTableSearch from "componentsV2/Table/hooks/useTableSearch";
import Table from "componentsV2/Table/Table";
import { TableProps } from "componentsV2/Table/Table.types";
import { useEffect, useMemo, useState } from "react";
import { useLocation } from "react-router-dom";
import { QKEY_PROCESSING_LIST } from "@constants/queryKeys";
import ManageMoneyBanner from "@features/MerchantPortal/ManageMoney/ManageMoneyBanner";
import { useTable } from "componentsV2/Table/hooks/useTable";
import { TRANSACTION_INFO_MODAL } from "modals/modal_names";
import { useTransactionsFilters } from "./hooks/useTransactionsFilters";
import { useTransactionsColumns } from "./hooks/useTransactionsColumns";
import { useComponentHeight } from "@hooks/common/useComponentHeight";
type TransactionsTableProps = Omit<TableProps, "columns" | "openModal"> & {
totalExportRecords?: number;
allRows?: any;
totalRows?: number;
};
const TransactionsTable = ({
nextCursor,
paginationMethod,
...props
}: TransactionsTableProps) => {
const {
totalExportRecords,
allRows,
totalRows,
type,
queryKey,
isLoading,
page,
setPageDispatcher,
setPage,
isFetching,
} = props;
const { setSelectedRowIdx, loadMore, numberOfPages, selectedRowIdx } =
useTable({
allRows,
isLoading,
totalRows,
page,
setPageDispatcher,
setPage,
openModal: TRANSACTION_INFO_MODAL,
enabledInfiniteScroll: props.enabledInfiniteScroll,
nextCursor,
paginationMethod,
});
const { onScroll } = useHandleScroll();
const location = useLocation();
const [localIsLoading, setLocalIsLoading] = useState<boolean>(false);
// Deep-link support: transfer/manual-adjustment emails link to
// /acquirer/transactions?transactionId=<id>; useRedirectTransaction fetches
// the record and navigates here with it in nav state. Open the side panel so
// the "Review" button lands on the specific transaction, not just the list.
useEffect(() => {
if (location.state && location.state.transactionData) {
NiceModal.show(TRANSACTION_INFO_MODAL, {
data: location.state.transactionData,
isFirst: true,
isLast: true,
});
}
}, [location]);
const isLoadingTransactions = localIsLoading || isLoading || isFetching;
const { search, searchQuery, handleSearchChange } = useTableSearch({
queryKey: queryKey || "",
});
const { height } = useComponentHeight();
const { tableFilters, selectedFilter } = useTransactionsFilters({
isLoading: isLoadingTransactions,
});
const { columns } = useTransactionsColumns();
const Head = useMemo(
() => (
<ManageMoneyBanner
search={search}
handleSearchChange={handleSearchChange}
filters={tableFilters}
isProcessing={true}
sortReduxKey={queryKey}
selectedTabFilter={selectedFilter}
setLocalIsLoading={setLocalIsLoading}
localIsLoading={localIsLoading}
/>
),
[
totalRows,
type,
handleSearchChange,
search,
props.hasFilters,
selectedFilter,
isLoadingTransactions,
tableFilters,
],
);
const CompactHead = useMemo(
() => (
<ManageMoneyBanner
search={search}
handleSearchChange={handleSearchChange}
filters={tableFilters}
isProcessing={true}
sortReduxKey={queryKey}
selectedTabFilter={selectedFilter}
setLocalIsLoading={setLocalIsLoading}
localIsLoading={localIsLoading}
compact
/>
),
[
search,
handleSearchChange,
tableFilters,
queryKey,
selectedFilter,
setLocalIsLoading,
localIsLoading,
],
);
return (
<>
<BackgroundAnimation page="manageMoney" />
<GiveMotionWrapper
delay={30}
containerProps={{ sx: { height: "100%", zIndex: 2 } }}
customStyle={{
height: "100%",
display: "flex",
justifyContent: "center",
}}
>
<Table
{...props}
top={height}
totalExportRecords={totalExportRecords}
openModal={TRANSACTION_INFO_MODAL}
columns={columns}
totalRows={totalRows}
queryKey={QKEY_PROCESSING_LIST}
onScroll={onScroll}
searchQuery={searchQuery}
handleSearchChange={handleSearchChange}
selectedRowIdx={selectedRowIdx}
setSelectedRowIdx={setSelectedRowIdx}
numberOfPages={numberOfPages}
Head={Head}
CompactHead={CompactHead}
compactAnimationPage="manageMoney"
loadMore={loadMore}
sortReduxKey={queryKey}
defaultSortKey="createdAt"
isLoading={isLoading || localIsLoading}
/>
</GiveMotionWrapper>
</>
);
};
export default TransactionsTable;
|