Skip to content

Commit beaa5fc

Browse files
committed
temp(suite): REMOVE LATER
1 parent 4231e26 commit beaa5fc

File tree

2 files changed

+50
-3
lines changed

2 files changed

+50
-3
lines changed

packages/suite/src/views/wallet/transactions/TransactionList/TransactionList.tsx

+42-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,38 @@ const ActionsWrapper = styled.div`
3434
align-items: center;
3535
`;
3636

37+
const TEMPINFOPANEL = ({
38+
info,
39+
searched,
40+
filtered,
41+
}: {
42+
info: ReturnType<typeof useFetchTransactions>['TEMPINFO'];
43+
searched: WalletAccountTransaction[];
44+
filtered: WalletAccountTransaction[];
45+
}) => (
46+
<div style={{ alignSelf: 'center', marginTop: '16px' }}>
47+
FETCHED {info.pagesFetched}/{info.pagesTotal} PAGES ({info.txFetched}/{info.txTotal} TXS)
48+
<br />
49+
{info.txFetched} -&gt; FILTER -&gt; {filtered.length} -&gt; SEARCH -&gt; {searched.length}
50+
</div>
51+
);
52+
53+
const TEMPBUTTON = ({
54+
fetchedAll,
55+
fetchNext,
56+
}: {
57+
fetchedAll: boolean;
58+
fetchNext: () => unknown;
59+
}) => (
60+
<button
61+
disabled={fetchedAll}
62+
onClick={fetchNext}
63+
style={{ alignSelf: 'center', marginTop: '16px', padding: '12px' }}
64+
>
65+
LOAD MORE
66+
</button>
67+
);
68+
3769
interface TransactionListProps {
3870
account: Account;
3971
transactions: WalletAccountTransaction[];
@@ -77,7 +109,10 @@ export const TransactionList = ({
77109
[filteredTransactions, account.metadata, searchQuery, accountMetadata],
78110
);
79111

80-
const { fetchNext, fetchAll, fetchedAll } = useFetchTransactions(account, transactions);
112+
const { fetchNext, fetchAll, fetchedAll, TEMPINFO } = useFetchTransactions(
113+
account,
114+
transactions,
115+
);
81116

82117
useEffect(() => {
83118
if (anchor) fetchAll();
@@ -171,7 +206,12 @@ export const TransactionList = ({
171206
<>{areTransactionsAvailable ? <NoSearchResults /> : listItems}</>
172207
)}
173208

174-
{/* TODO add fetching logic */}
209+
<TEMPINFOPANEL
210+
info={TEMPINFO}
211+
searched={searchedTransactions}
212+
filtered={filteredTransactions}
213+
/>
214+
<TEMPBUTTON fetchNext={fetchNext} fetchedAll={fetchedAll} />
175215
</StyledSection>
176216
);
177217
};

packages/suite/src/views/wallet/transactions/TransactionList/useFetchTransactions.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,12 @@ export const useFetchTransactions = (
9393
[synchronize, fetchCommon, pagesFetched, fetchedAll],
9494
);
9595

96-
return { fetchNext, fetchAll, isFetching, fetchedAll };
96+
const TEMPINFO = {
97+
txTotal: account.networkType === 'ripple' ? NaN : account.history.total,
98+
txFetched: transactions.length,
99+
pagesTotal: account.networkType === 'ripple' ? NaN : pagesTotal,
100+
pagesFetched,
101+
};
102+
103+
return { fetchNext, fetchAll, isFetching, fetchedAll, TEMPINFO };
97104
};

0 commit comments

Comments
 (0)