diff --git a/packages/desktop-client/src/components/mobile/accounts/AccountTransactions.jsx b/packages/desktop-client/src/components/mobile/accounts/AccountTransactions.jsx index 8aa3ae6d6c7..69a036571cc 100644 --- a/packages/desktop-client/src/components/mobile/accounts/AccountTransactions.jsx +++ b/packages/desktop-client/src/components/mobile/accounts/AccountTransactions.jsx @@ -13,19 +13,24 @@ import { useDebounceCallback } from 'usehooks-ts'; import { getPayees, markAccountRead, + openAccountCloseModal, + pushModal, + reopenAccount, syncAndDownload, + updateAccount, } from 'loot-core/client/actions'; import { SchedulesProvider } from 'loot-core/client/data-hooks/schedules'; import * as queries from 'loot-core/client/queries'; import { pagedQuery } from 'loot-core/client/query-helpers'; -import { listen } from 'loot-core/platform/client/fetch'; +import { listen, send } from 'loot-core/platform/client/fetch'; import { isPreviewId } from 'loot-core/shared/transactions'; import { useDateFormat } from '../../../hooks/useDateFormat'; import { useLocalPref } from '../../../hooks/useLocalPref'; import { useNavigate } from '../../../hooks/useNavigate'; import { usePreviewTransactions } from '../../../hooks/usePreviewTransactions'; -import { theme } from '../../../style'; +import { styles, theme } from '../../../style'; +import { Text } from '../../common/Text'; import { View } from '../../common/View'; import { Page } from '../../Page'; import { MobileBackButton } from '../MobileBackButton'; @@ -36,32 +41,7 @@ export function AccountTransactions({ account, pending, failed }) { return ( -
- {account.name} - - ) + } headerLeftContent={} headerRightContent={} @@ -78,6 +58,79 @@ export function AccountTransactions({ account, pending, failed }) { ); } +function AccountName({ account, pending, failed }) { + const dispatch = useDispatch(); + + const onSave = account => { + dispatch(updateAccount(account)); + }; + + const onSaveNotes = async (id, notes) => { + await send('notes-save', { id, note: notes }); + }; + + const onEditNotes = () => { + dispatch( + pushModal('notes', { + id: account.id, + name: account.name, + onSave: onSaveNotes, + }), + ); + }; + + const onCloseAccount = () => { + dispatch(openAccountCloseModal(account.id)); + }; + + const onReopenAccount = () => { + dispatch(reopenAccount(account.id)); + }; + + const onClick = () => { + dispatch( + pushModal('account-menu', { + accountId: account.id, + onSave, + onEditNotes, + onCloseAccount, + onReopenAccount, + }), + ); + }; + return ( + + {account.bankId && ( +
+ )} + + {`${account.closed ? 'Closed: ' : ''}${account.name}`} + + + ); +} + const getSchedulesTransform = memoizeOne(id => { const filter = queries.getAccountFilter(id, '_account');