Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update logic for showing and rendering the “Show unused payees” button #1335

Merged
merged 2 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions packages/desktop-client/src/components/payees/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/1335.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [j-f1]
---

Hide the “Show unused payees” button unless it is relevant
Loading