diff --git a/floethereum/index.html b/floethereum/index.html index 8b8d61d..9bee413 100644 --- a/floethereum/index.html +++ b/floethereum/index.html @@ -823,6 +823,7 @@ } let allTransactionsCache = []; + let currentFilter = 'all'; let currentBalances = { eth: '0', usdc: '0', usdt: '0' }; async function loadTransactionsPage(ethAddress, floAddress, page) { @@ -866,11 +867,19 @@ ({ eth: etherBalance, usdc: usdcBalance, usdt: usdtBalance } = currentBalances); } + // Filter interactions + let filteredTransactions = transactions; + if (currentFilter === 'sent') { + filteredTransactions = transactions.filter(tx => tx.isSent); + } else if (currentFilter === 'received') { + filteredTransactions = transactions.filter(tx => tx.isReceived); + } + // Local Pagination / Slicing const startIndex = (page - 1) * TRANSACTIONS_PER_PAGE; const endIndex = startIndex + TRANSACTIONS_PER_PAGE; - const paginatedTransactions = transactions.slice(startIndex, endIndex); - const hasNextPage = transactions.length > endIndex; + const paginatedTransactions = filteredTransactions.slice(startIndex, endIndex); + const hasNextPage = filteredTransactions.length > endIndex; // Sync Contacts (only on fresh load really, but safe here) if (page === 1) { @@ -941,15 +950,17 @@

Transactions

{ const selectedValue = e.detail?.value || e.target.value || 'all'; - filterTransactions(selectedValue, transactions, ethAddress); + currentFilter = selectedValue; + currentPage = 1; + loadTransactionsPage(ethAddress, floAddress, currentPage); }}> - All - Sent - Received + All + Sent + Received