A local-first personal finance app
Unlink account via bank sync page (#4714)
Josh Woodward04aa086c9eb8
diff --git a/packages/desktop-client/src/components/accounts/Account.tsx b/packages/desktop-client/src/components/accounts/Account.tsxindex 5bab47d0ac..e86a1f95bd 100644--- a/packages/desktop-client/src/components/accounts/Account.tsx+++ b/packages/desktop-client/src/components/accounts/Account.tsx@@ -847,6 +847,7 @@ class AccountInternal extends PureComponent<name: 'confirm-unlink-account',options: {accountName: account.name,+ isViewBankSyncSettings: false,onUnlink: () => {this.props.dispatch(unlinkAccount({ id: accountId }));},diff --git a/packages/desktop-client/src/components/banksync/AccountRow.tsx b/packages/desktop-client/src/components/banksync/AccountRow.tsxindex ec1697d5b0..ee513a7b6e 100644--- a/packages/desktop-client/src/components/banksync/AccountRow.tsx+++ b/packages/desktop-client/src/components/banksync/AccountRow.tsx@@ -25,6 +25,11 @@ export const AccountRow = memo(capitalize: true,});+ const potentiallyTruncatedAccountName =+ account.name.length > 30+ ? account.name.slice(0, 30) + '...'+ : account.name;+return (<Rowheight="auto"@@ -44,7 +49,7 @@ export const AccountRow = memo(plainstyle={{ color: theme.tableText, padding: '10px' }}>- {account.name}+ {potentiallyTruncatedAccountName}</Cell><Celldiff --git a/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx b/packages/desktop-client/src/components/banksync/EditSyncAccount.tsxindex f88b58e649..b45208740d 100644--- a/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx+++ b/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx@@ -5,10 +5,13 @@ import { Button } from '@actual-app/components/button';import { SvgQuestion } from '@actual-app/components/icons/v1';import { Stack } from '@actual-app/components/stack';import { Text } from '@actual-app/components/text';+import { theme } from '@actual-app/components/theme';import { Tooltip } from '@actual-app/components/tooltip';import { View } from '@actual-app/components/view';+import { unlinkAccount } from 'loot-core/client/accounts/accountsSlice';import { useTransactions } from 'loot-core/client/data-hooks/transactions';+import { pushModal } from 'loot-core/client/modals/modalsSlice';import {defaultMappings,type Mappings,@@ -22,6 +25,7 @@ import {} from 'loot-core/types/models';import { useSyncedPref } from '../../hooks/useSyncedPref';+import { useDispatch } from '../../redux';import { Modal, ModalCloseButton, ModalHeader } from '../common/Modal';import { CheckboxOption } from '../modals/ImportTransactionsModal/CheckboxOption';@@ -181,6 +185,26 @@ export function EditSyncAccount({ account }: EditSyncAccountProps) {close();};+ const dispatch = useDispatch();++ const onUnlink = async (close: () => void) => {+ dispatch(+ pushModal({+ modal: {+ name: 'confirm-unlink-account',+ options: {+ accountName: account.name,+ isViewBankSyncSettings: true,+ onUnlink: () => {+ dispatch(unlinkAccount({ id: account.id }));+ close();+ },+ },+ },+ }),+ );+ };+const setMapping = (field: string, value: string) => {setMappings(prev => {const updated = new Map(prev);@@ -189,6 +213,9 @@ export function EditSyncAccount({ account }: EditSyncAccountProps) {});};+ const potentiallyTruncatedAccountName =+ account.name.length > 30 ? account.name.slice(0, 30) + '...' : account.name;+const fields = exampleTransaction ? getFields(exampleTransaction) : [];const mapping = mappings.get(transactionDirection);@@ -200,7 +227,9 @@ export function EditSyncAccount({ account }: EditSyncAccountProps) {{({ state: { close } }) => (<><ModalHeader- title={t('Account settings')}+ title={t('{{accountName}} bank sync settings', {+ accountName: potentiallyTruncatedAccountName,+ })}rightContent={<ModalCloseButton onPress={close} />}/>@@ -261,24 +290,38 @@ export function EditSyncAccount({ account }: EditSyncAccountProps) {</Tooltip></CheckboxOption>- <Stack- direction="row"- justify="flex-end"- align="center"- style={{ marginTop: 20 }}+ <View+ style={{+ display: 'flex',+ flexDirection: 'row',+ alignItems: 'center',+ justifyContent: 'space-between',+ marginTop: 20,+ }}>- <Button style={{ marginRight: 10 }} onPress={close}>- <Trans>Cancel</Trans>- </Button><Button- variant="primary"+ style={{ color: theme.errorText }}onPress={() => {- onSave(close);+ onUnlink(close);}}>- <Trans>Save</Trans>+ <Trans>Unlink account</Trans></Button>- </Stack>++ <Stack direction="row">+ <Button style={{ marginRight: 10 }} onPress={close}>+ <Trans>Cancel</Trans>+ </Button>+ <Button+ variant="primary"+ onPress={() => {+ onSave(close);+ }}+ >+ <Trans>Save</Trans>+ </Button>+ </Stack>+ </View></>)}</Modal>diff --git a/packages/desktop-client/src/components/modals/ConfirmUnlinkAccountModal.tsx b/packages/desktop-client/src/components/modals/ConfirmUnlinkAccountModal.tsxindex ab5062c779..e650d8cdba 100644--- a/packages/desktop-client/src/components/modals/ConfirmUnlinkAccountModal.tsx+++ b/packages/desktop-client/src/components/modals/ConfirmUnlinkAccountModal.tsx@@ -1,5 +1,5 @@import React from 'react';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Button } from '@actual-app/components/button';import { InitialFocus } from '@actual-app/components/initial-focus';@@ -17,6 +17,7 @@ type ConfirmUnlinkAccountModalProps = Extract<export function ConfirmUnlinkAccountModal({accountName,+ isViewBankSyncSettings,onUnlink,}: ConfirmUnlinkAccountModalProps) {const { t } = useTranslation();@@ -34,13 +35,19 @@ export function ConfirmUnlinkAccountModal({/><View style={{ lineHeight: 1.5 }}><Paragraph>- Are you sure you want to unlink <strong>{accountName}</strong>?+ <Trans>+ Are you sure you want to unlink <strong>{accountName}</strong>?+ </Trans></Paragraph><Paragraph>- {t(- 'Transactions will no longer be synchronized with this account and must be manually entered.',- )}+ {isViewBankSyncSettings+ ? t(+ 'Transactions will no longer be synchronized with this account and must be manually entered. You will not be able to edit the bank sync settings for this account and the settings will close.',+ )+ : t(+ 'Transactions will no longer be synchronized with this account and must be manually entered.',+ )}</Paragraph><Viewdiff --git a/packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsx b/packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsxindex 948bd1325c..3acc485942 100644--- a/packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsx+++ b/packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsx@@ -218,7 +218,7 @@ export function GoCardlessExternalMsgModal({<Warning><Trans>- By enabling bank-sync, you will be granting GoCardless (a third+ By enabling bank sync, you will be granting GoCardless (a thirdparty service) read-only access to your entire account’s transactionhistory. This service is not affiliated with Actual in any way. Makesure you’ve read and understand GoCardless’s{' '}diff --git a/packages/desktop-client/src/components/modals/GoCardlessInitialiseModal.tsx b/packages/desktop-client/src/components/modals/GoCardlessInitialiseModal.tsxindex 0fc2ae19bd..35e6586193 100644--- a/packages/desktop-client/src/components/modals/GoCardlessInitialiseModal.tsx+++ b/packages/desktop-client/src/components/modals/GoCardlessInitialiseModal.tsx@@ -92,7 +92,7 @@ export const GoCardlessInitialiseModal = ({<View style={{ display: 'flex', gap: 10 }}><Text><Trans>- In order to enable bank-sync via GoCardless (only for EU banks)+ In order to enable bank sync via GoCardless (only for EU banks)you will need to create access credentials. This can be done bycreating an account with{' '}<Linkdiff --git a/packages/desktop-client/src/components/modals/PluggyAiInitialiseModal.tsx b/packages/desktop-client/src/components/modals/PluggyAiInitialiseModal.tsxindex dc66b97bfb..ac8e1a3725 100644--- a/packages/desktop-client/src/components/modals/PluggyAiInitialiseModal.tsx+++ b/packages/desktop-client/src/components/modals/PluggyAiInitialiseModal.tsx@@ -110,7 +110,7 @@ export const PluggyAiInitialiseModal = ({<View style={{ display: 'flex', gap: 10 }}><Text><Trans>- In order to enable bank-sync via Pluggy.ai (only for Brazilian+ In order to enable bank sync via Pluggy.ai (only for Brazilianbanks) you will need to create access credentials. This can bedone by creating an account with{' '}<Linkdiff --git a/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsx b/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsxindex e29a4104e3..a15e23b3b7 100644--- a/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsx+++ b/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsx@@ -322,7 +322,7 @@ function TableRow({}}style={{ float: 'right' }}>- <Trans>Remove bank-sync</Trans>+ <Trans>Remove bank sync</Trans></Button>) : (<Button@@ -332,7 +332,7 @@ function TableRow({}}style={{ float: 'right' }}>- <Trans>Set up bank-sync</Trans>+ <Trans>Set up bank sync</Trans></Button>)}</Field>diff --git a/packages/desktop-client/src/components/modals/SimpleFinInitialiseModal.tsx b/packages/desktop-client/src/components/modals/SimpleFinInitialiseModal.tsxindex fba6fede3a..0ebfb91485 100644--- a/packages/desktop-client/src/components/modals/SimpleFinInitialiseModal.tsx+++ b/packages/desktop-client/src/components/modals/SimpleFinInitialiseModal.tsx@@ -70,7 +70,7 @@ export const SimpleFinInitialiseModal = ({<View style={{ display: 'flex', gap: 10 }}><Text><Trans>- In order to enable bank-sync via SimpleFIN (only for North+ In order to enable bank sync via SimpleFIN (only for NorthAmerican banks), you will need to create a token. This can bedone by creating an account with{' '}<Linkdiff --git a/packages/loot-core/src/client/modals/modalsSlice.ts b/packages/loot-core/src/client/modals/modalsSlice.tsindex fcf59b9609..8a7f85a86b 100644--- a/packages/loot-core/src/client/modals/modalsSlice.ts+++ b/packages/loot-core/src/client/modals/modalsSlice.ts@@ -511,6 +511,7 @@ export type Modal =name: 'confirm-unlink-account';options: {accountName: string;+ isViewBankSyncSettings: boolean;onUnlink: () => void;};}diff --git a/upcoming-release-notes/4714.md b/upcoming-release-notes/4714.mdnew file mode 100644index 0000000000..17873e812d--- /dev/null+++ b/upcoming-release-notes/4714.md@@ -0,0 +1,6 @@+---+category: Enhancements+authors: [Triscal]+---++You can now unlink accounts from bank sync settings