diff --git a/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.jsx b/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx similarity index 88% rename from packages/desktop-client/src/components/mobile/budget/CategoryTransactions.jsx rename to packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx index c03f1676451..543f72c138b 100644 --- a/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.jsx +++ b/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx @@ -11,6 +11,10 @@ import { listen } from 'loot-core/platform/client/fetch'; import * as monthUtils from 'loot-core/shared/months'; import { q } from 'loot-core/shared/query'; import { isPreviewId } from 'loot-core/shared/transactions'; +import { + type TransactionEntity, + type CategoryEntity, +} from 'loot-core/src/types/models'; import { useDateFormat } from '../../../hooks/useDateFormat'; import { useNavigate } from '../../../hooks/useNavigate'; @@ -21,7 +25,15 @@ import { MobileBackButton } from '../MobileBackButton'; import { AddTransactionButton } from '../transactions/AddTransactionButton'; import { TransactionListWithBalances } from '../transactions/TransactionListWithBalances'; -export function CategoryTransactions({ category, month }) { +type CategoryTransactionsProps = { + category: CategoryEntity; + month: string; +}; + +export function CategoryTransactions({ + category, + month, +}: CategoryTransactionsProps) { const dispatch = useDispatch(); const navigate = useNavigate(); @@ -29,7 +41,7 @@ export function CategoryTransactions({ category, month }) { () => q('transactions') .options({ splits: 'inline' }) - .filter(getCategoryMonthFilter(category, month)) + .filter(getCategoryMonthFilter({ category, month })) .select('*'), [category, month], ); @@ -73,7 +85,7 @@ export function CategoryTransactions({ category, month }) { }); const onOpenTransaction = useCallback( - transaction => { + (transaction: TransactionEntity) => { // details of how the native app used to handle preview transactions here can be found at commit 05e58279 if (!isPreviewId(transaction.id)) { navigate(`/transactions/${transaction.id}`); @@ -119,7 +131,13 @@ export function CategoryTransactions({ category, month }) { ); } -function getCategoryMonthFilter(category, month) { +function getCategoryMonthFilter({ + category, + month, +}: { + category: CategoryEntity; + month: string; +}) { return { category: category.id, date: { $transform: '$month', $eq: month }, diff --git a/packages/desktop-client/src/components/mobile/transactions/TransactionListWithBalances.jsx b/packages/desktop-client/src/components/mobile/transactions/TransactionListWithBalances.jsx index f884f927ac1..37a98f1a6d3 100644 --- a/packages/desktop-client/src/components/mobile/transactions/TransactionListWithBalances.jsx +++ b/packages/desktop-client/src/components/mobile/transactions/TransactionListWithBalances.jsx @@ -67,7 +67,7 @@ export function TransactionListWithBalances({ onSearch, onLoadMore, onOpenTransaction, - onRefresh, + onRefresh = () => {}, }) { const selectedInst = useSelected('transactions', transactions); diff --git a/upcoming-release-notes/3875.md b/upcoming-release-notes/3875.md new file mode 100644 index 00000000000..7f139bf825b --- /dev/null +++ b/upcoming-release-notes/3875.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [cindywu] +--- + +Convert CategoryTransactions.jsx to tsx \ No newline at end of file