diff --git a/packages/desktop-client/src/components/accounts/Account.tsx b/packages/desktop-client/src/components/accounts/Account.tsx index 65783c08914..fc21cfe093a 100644 --- a/packages/desktop-client/src/components/accounts/Account.tsx +++ b/packages/desktop-client/src/components/accounts/Account.tsx @@ -266,8 +266,8 @@ type AccountInternalProps = { accounts: AccountEntity[]; getPayees: () => Promise; updateAccount: (newAccount: AccountEntity) => void; - newTransactions: string[]; - matchedTransactions: string[]; + newTransactions: Array; + matchedTransactions: Array; splitsExpandedDispatch: ReturnType['dispatch']; expandSplits?: boolean; savedFilters: TransactionFilterEntity[]; @@ -870,11 +870,11 @@ class AccountInternal extends PureComponent< return amount; }; - isNew = (id: string) => { + isNew = (id: TransactionEntity['id']) => { return this.props.newTransactions.includes(id); }; - isMatched = (id: string) => { + isMatched = (id: TransactionEntity['id']) => { return this.props.matchedTransactions.includes(id); }; diff --git a/packages/desktop-client/src/components/mobile/accounts/Accounts.jsx b/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx similarity index 73% rename from packages/desktop-client/src/components/mobile/accounts/Accounts.jsx rename to packages/desktop-client/src/components/mobile/accounts/Accounts.tsx index 396cead5b2e..f17806dc4a8 100644 --- a/packages/desktop-client/src/components/mobile/accounts/Accounts.jsx +++ b/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx @@ -1,10 +1,11 @@ -import React from 'react'; +import React, { type CSSProperties, useCallback } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { t } from 'i18next'; import { replaceModal, syncAndDownload } from 'loot-core/src/client/actions'; import * as queries from 'loot-core/src/client/queries'; +import { type AccountEntity } from 'loot-core/types/models'; import { useAccounts } from '../../../hooks/useAccounts'; import { useFailedAccounts } from '../../../hooks/useFailedAccounts'; @@ -18,11 +19,22 @@ import { Text } from '../../common/Text'; import { TextOneLine } from '../../common/TextOneLine'; import { View } from '../../common/View'; import { MobilePageHeader, Page } from '../../Page'; +import { type Binding, type SheetFields } from '../../spreadsheet'; import { CellValue, CellValueText } from '../../spreadsheet/CellValue'; import { MOBILE_NAV_HEIGHT } from '../MobileNavTabs'; import { PullToRefresh } from '../PullToRefresh'; -function AccountHeader({ name, amount, style = {} }) { +type AccountHeaderProps> = { + name: string; + amount: Binding<'account', SheetFieldName>; + style?: CSSProperties; +}; + +function AccountHeader>({ + name, + amount, + style = {}, +}: AccountHeaderProps) { return ( {props => ( - + + {...props} + style={{ ...styles.text, fontSize: 14 }} + /> )} ); } +type AccountCardProps = { + account: AccountEntity; + updated: boolean; + connected: boolean; + pending: boolean; + failed: boolean; + getBalanceQuery: (account: AccountEntity) => Binding<'account', 'balance'>; + onSelect: (id: string) => void; +}; + function AccountCard({ account, updated, @@ -63,7 +88,7 @@ function AccountCard({ failed, getBalanceQuery, onSelect, -}) { +}: AccountCardProps) { return (