Skip to content

Commit 93cf060

Browse files
author
Cohen, Yohay
committed
add TransactionTable component with sorting, filtering, column customization, and transaction details modal.
1 parent f86aef1 commit 93cf060

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

client/src/components/TransactionTable.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ interface ColumnConfig {
6969
}
7070

7171
const AVAILABLE_COLUMNS: ColumnConfig[] = [
72-
{ key: 'account', label: 'table.account', sortable: true, defaultVisible: true },
72+
{ key: 'account', label: 'table.account', sortable: true, defaultVisible: false },
7373
{ key: 'description', label: 'table.description', sortable: true, defaultVisible: true },
7474
{ key: 'date', label: 'table.date', sortable: true, defaultVisible: false },
7575
{ key: 'category', label: 'table.category', sortable: false, defaultVisible: true },
@@ -96,18 +96,13 @@ export function TransactionTable({
9696
const stored = localStorage.getItem('transactionTableColumns');
9797
if (stored) {
9898
try {
99-
const parsed = new Set<ColumnKey>(JSON.parse(stored));
100-
// Show Account when upgrading from older saved prefs
101-
if (!parsed.has('account')) {
102-
parsed.add('account');
103-
}
104-
return parsed;
99+
return new Set<ColumnKey>(JSON.parse(stored));
105100
} catch {
106101
// Fall back to defaults if localStorage is corrupted
107102
}
108103
}
109-
// Default columns
110-
return new Set<ColumnKey>(['account', 'description', 'category', 'chargedAmount', 'status']);
104+
// Default columns (date under description; account optional via column picker)
105+
return new Set<ColumnKey>(['description', 'category', 'chargedAmount', 'status']);
111106
});
112107
const [showColumnPicker, setShowColumnPicker] = useState(false);
113108
const [selectedCategory, setSelectedCategory] = useState<string>('all');
@@ -147,7 +142,7 @@ export function TransactionTable({
147142
};
148143

149144
const resetToDefaults = () => {
150-
setVisibleColumns(new Set(['account', 'description', 'category', 'chargedAmount', 'status']));
145+
setVisibleColumns(new Set(['description', 'category', 'chargedAmount', 'status']));
151146
};
152147

153148
const filteredAndSortedTransactions = useMemo(() => {

0 commit comments

Comments
 (0)