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/accounts/AccountSyncCheck.jsx b/packages/desktop-client/src/components/accounts/AccountSyncCheck.tsx similarity index 84% rename from packages/desktop-client/src/components/accounts/AccountSyncCheck.jsx rename to packages/desktop-client/src/components/accounts/AccountSyncCheck.tsx index 29da40e1357..04c59a44ace 100644 --- a/packages/desktop-client/src/components/accounts/AccountSyncCheck.jsx +++ b/packages/desktop-client/src/components/accounts/AccountSyncCheck.tsx @@ -1,4 +1,4 @@ -import React, { useRef, useState } from 'react'; +import React, { useCallback, useRef, useState } from 'react'; import { Trans } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; import { useParams } from 'react-router-dom'; @@ -6,6 +6,7 @@ import { useParams } from 'react-router-dom'; import { t } from 'i18next'; import { unlinkAccount } from 'loot-core/client/actions'; +import { type AccountEntity } from 'loot-core/types/models'; import { authorizeBank } from '../../gocardless'; import { useAccounts } from '../../hooks/useAccounts'; @@ -16,7 +17,7 @@ import { Link } from '../common/Link'; import { Popover } from '../common/Popover'; import { View } from '../common/View'; -function getErrorMessage(type, code) { +function getErrorMessage(type: string, code: string) { switch (type.toUpperCase()) { case 'ITEM_ERROR': switch (code.toUpperCase()) { @@ -81,7 +82,29 @@ export function AccountSyncCheck() { const [open, setOpen] = useState(false); const triggerRef = useRef(null); - if (!failedAccounts) { + const reauth = useCallback( + (acc: AccountEntity) => { + setOpen(false); + + if (acc.account_id) { + authorizeBank(dispatch, { upgradingAccountId: acc.account_id }); + } + }, + [dispatch], + ); + + const unlink = useCallback( + (acc: AccountEntity) => { + if (acc.id) { + dispatch(unlinkAccount(acc.id)); + } + + setOpen(false); + }, + [dispatch], + ); + + if (!failedAccounts || !id) { return null; } @@ -91,22 +114,15 @@ export function AccountSyncCheck() { } const account = accounts.find(account => account.id === id); + if (!account) { + return null; + } + const { type, code } = error; const showAuth = (type === 'ITEM_ERROR' && code === 'ITEM_LOGIN_REQUIRED') || (type === 'INVALID_INPUT' && code === 'INVALID_ACCESS_TOKEN'); - function reauth() { - setOpen(false); - - authorizeBank(dispatch, { upgradingAccountId: account.account_id }); - } - - async function unlink() { - dispatch(unlinkAccount(account.id)); - setOpen(false); - } - return ( ) : ( - )} 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}
- +