From 5aa857484e5839286a418c66419f0e8baf3efadc Mon Sep 17 00:00:00 2001 From: Eduardo Garcia Julia Date: Fri, 21 Nov 2025 17:59:28 -0500 Subject: [PATCH] fix: bug-666 --- BUG-666.md | 11 ++++++++ frontend/src/components/TransactionList.tsx | 29 +++++++++++++++++---- 2 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 BUG-666.md diff --git a/BUG-666.md b/BUG-666.md new file mode 100644 index 0000000..0832be2 --- /dev/null +++ b/BUG-666.md @@ -0,0 +1,11 @@ +# BUG-666: Missing Transaction Filter + +## Description + +The "Recent Transactions" table on the main dashboard is missing a feature. Users are unable to filter the list of transactions by their type (i.e., 'credit' or 'debit'). + +## Acceptance Criteria + +- A dropdown or similar UI control should be added to the transaction list. +- The user should be able to select 'All', 'Credit', or 'Debit' from the filter. +- The transaction list should update to show only the transactions of the selected type. diff --git a/frontend/src/components/TransactionList.tsx b/frontend/src/components/TransactionList.tsx index 3f147f9..3fbf65d 100644 --- a/frontend/src/components/TransactionList.tsx +++ b/frontend/src/components/TransactionList.tsx @@ -17,12 +17,13 @@ const TransactionList: React.FC = () => { const [transactions, setTransactions] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); + const [filterType, setFilterType] = useState('all'); useEffect(() => { const fetchTransactions = async () => { try { setLoading(true); - const response = await fetch('http://localhost:8000/api/v1/transactions/'); + const response = await fetch('http://localhost:8000/api/v1/transactions/?limit=100'); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } @@ -46,10 +47,28 @@ const TransactionList: React.FC = () => { return
Error: {error}
; } + const filteredTransactions = transactions.filter(t => { + if (filterType === 'all') return true; + return t.type === filterType; + }); + return (
-
+

Recent Transactions

+
+ + +
@@ -63,7 +82,7 @@ const TransactionList: React.FC = () => { - {transactions.map((transaction, index) => ( + {filteredTransactions.map((transaction, index) => ( ))} - {transactions.length === 0 && ( + {filteredTransactions.length === 0 && ( - + )}
{new Date(transaction.date).toLocaleDateString()} @@ -86,9 +105,9 @@ const TransactionList: React.FC = () => {
No transactions found.No transactions found for this filter.