Skip to content

A local-first personal finance app

Hide the “Show unused payees” button when not needed (#1335)

Jed Fox9d31120f1afa
diff --git a/packages/desktop-client/src/components/payees/index.js b/packages/desktop-client/src/components/payees/index.js
index b18e53d9c3..4ea0e0e125 100644
--- a/packages/desktop-client/src/components/payees/index.js
+++ b/packages/desktop-client/src/components/payees/index.js
@@ -510,21 +510,27 @@ export const ManagePayees = forwardRef(
)}
</View>
<View>
- <Button
- bare
- style={{
- marginRight: '10px',
- }}
- disabled={!(orphanedPayees?.length > 0) && !orphanedOnly}
- onClick={() => {
- setOrphanedOnly(!orphanedOnly);
- const filterInput = document.getElementById('filter-input');
- applyFilter(filterInput.value);
- tableNavigator.onEdit(null);
- }}
- >
- {orphanedOnly ? 'Show all payees' : 'Show unused payees'}
- </Button>
+ {(orphanedOnly ||
+ (orphanedPayees && orphanedPayees.length > 0)) && (
+ <Button
+ bare
+ style={{ marginRight: 10 }}
+ onClick={() => {
+ setOrphanedOnly(!orphanedOnly);
+ const filterInput = document.getElementById('filter-input');
+ applyFilter(filterInput.value);
+ tableNavigator.onEdit(null);
+ }}
+ >
+ {orphanedOnly
+ ? 'Show all payees'
+ : `Show ${
+ orphanedPayees.length === 1
+ ? '1 unused payee'
+ : `${orphanedPayees.length} unused payees`
+ }`}
+ </Button>
+ )}
</View>
<View style={{ flex: 1 }} />
<Input
diff --git a/upcoming-release-notes/1335.md b/upcoming-release-notes/1335.md
new file mode 100644
index 0000000000..24f47c17b6
--- /dev/null
+++ b/upcoming-release-notes/1335.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [j-f1]
+---
+
+Hide the “Show unused payees” button unless it is relevant