From 41d59226358c00e968f4dd97e2c7fdff1fc8fc9f Mon Sep 17 00:00:00 2001 From: Koen van Staveren Date: Sun, 3 Nov 2024 20:26:53 +0100 Subject: [PATCH 1/2] Add context menu's (#3381) * feat: context menu on transactions * feat: context menu's on budget page * chore: release note * fix: losing focus on context menu * feat: schedules context menu * feat: payees context menu * feat: rules context menu * chore: update release note * chore: lint * fix: broken balance movement menu * fix: placement on context menu to be closer to cursor * feat: context menu on budget field * chore: lint * Update packages/desktop-client/src/components/transactions/TransactionsTable.jsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * chore: fix merge * fix: e2e test * fix: moving of the popover in the sidebar * chore: lint * chore: add feature flag * chore: fix tsc * chore: fix test * Update packages/desktop-client/src/components/settings/Experimental.tsx Co-authored-by: Julian Dominguez-Schatz * fix: to budget button next steps didn't work * chore: lint --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Julian Dominguez-Schatz --- .../src/components/ManageRules.tsx | 8 + .../src/components/accounts/Account.tsx | 9 + .../src/components/budget/SidebarCategory.tsx | 12 +- .../src/components/budget/SidebarGroup.tsx | 12 +- .../budget/envelope/BalanceMovementMenu.tsx | 18 +- .../envelope/EnvelopeBudgetComponents.tsx | 15 ++ .../envelope/budgetsummary/ToBudget.tsx | 112 +++++---- .../envelope/budgetsummary/ToBudgetAmount.tsx | 5 +- .../src/components/common/Popover.tsx | 23 +- .../src/components/payees/ManagePayees.tsx | 9 +- .../src/components/payees/PayeeTable.tsx | 96 ++++---- .../src/components/payees/PayeeTableRow.tsx | 70 +++++- .../src/components/rules/RuleRow.tsx | 66 ++++- .../src/components/rules/RulesList.tsx | 3 + .../components/schedules/SchedulesTable.tsx | 226 +++++++++++------- .../src/components/settings/Experimental.tsx | 6 + .../transactions/TransactionList.jsx | 14 ++ .../transactions/TransactionMenu.tsx | 139 +++++++++++ .../transactions/TransactionsTable.jsx | 84 +++++++ .../transactions/TransactionsTable.test.jsx | 3 + .../src/hooks/useFeatureFlag.ts | 1 + packages/loot-core/src/types/prefs.d.ts | 3 +- upcoming-release-notes/3381.md | 6 + 23 files changed, 742 insertions(+), 198 deletions(-) create mode 100644 packages/desktop-client/src/components/transactions/TransactionMenu.tsx create mode 100644 upcoming-release-notes/3381.md diff --git a/packages/desktop-client/src/components/ManageRules.tsx b/packages/desktop-client/src/components/ManageRules.tsx index f3eb583005a..bb9ce717ae5 100644 --- a/packages/desktop-client/src/components/ManageRules.tsx +++ b/packages/desktop-client/src/components/ManageRules.tsx @@ -204,6 +204,13 @@ export function ManageRules({ setLoading(false); } + async function onDeleteRule(id: string) { + setLoading(true); + await send('rule-delete', id); + await loadRules(); + setLoading(false); + } + const onEditRule = useCallback(rule => { dispatch( pushModal('edit-rule', { @@ -306,6 +313,7 @@ export function ManageRules({ hoveredRule={hoveredRule} onHover={onHover} onEditRule={onEditRule} + onDeleteRule={rule => onDeleteRule(rule.id)} /> )} diff --git a/packages/desktop-client/src/components/accounts/Account.tsx b/packages/desktop-client/src/components/accounts/Account.tsx index 1a8009db0b5..37936e10c7d 100644 --- a/packages/desktop-client/src/components/accounts/Account.tsx +++ b/packages/desktop-client/src/components/accounts/Account.tsx @@ -1803,6 +1803,15 @@ class AccountInternal extends PureComponent< sortField={this.state.sort?.field} ascDesc={this.state.sort?.ascDesc} onChange={this.onTransactionsChange} + onBatchDelete={this.onBatchDelete} + onBatchDuplicate={this.onBatchDuplicate} + onBatchLinkSchedule={this.onBatchLinkSchedule} + onBatchUnlinkSchedule={this.onBatchUnlinkSchedule} + onCreateRule={this.onCreateRule} + onScheduleAction={this.onScheduleAction} + onMakeAsNonSplitTransactions={ + this.onMakeAsNonSplitTransactions + } onRefetch={this.refetchTransactions} onCloseAddTransaction={() => this.setState({ isAdding: false }) diff --git a/packages/desktop-client/src/components/budget/SidebarCategory.tsx b/packages/desktop-client/src/components/budget/SidebarCategory.tsx index 7e20348176b..4d3b53e7a04 100644 --- a/packages/desktop-client/src/components/budget/SidebarCategory.tsx +++ b/packages/desktop-client/src/components/budget/SidebarCategory.tsx @@ -7,6 +7,7 @@ import { type CategoryEntity, } from 'loot-core/src/types/models'; +import { useFeatureFlag } from '../../hooks/useFeatureFlag'; import { SvgCheveronDown } from '../../icons/v1'; import { theme } from '../../style'; import { Button } from '../common/Button2'; @@ -51,6 +52,7 @@ export function SidebarCategory({ const temporary = category.id === 'new'; const [menuOpen, setMenuOpen] = useState(false); const triggerRef = useRef(null); + const contextMenusEnabled = useFeatureFlag('contextMenus'); const displayed = ( { + if (!contextMenusEnabled) return; + e.preventDefault(); + setMenuOpen(true); }} >
{category.name}
- +