A local-first personal finance app
Dkhalife/ts/categorytransactions (#3959)
Dany Khalife (MSFT)9e6a486c90d3
diff --git a/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.jsx b/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsxsimilarity index 90%rename from packages/desktop-client/src/components/mobile/budget/CategoryTransactions.jsxrename to packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsxindex aa0df7912c..4eee5f6e2c 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 CategoryEntity,+ type TransactionEntity,+} from 'loot-core/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();@@ -74,7 +86,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 05e58279if (!isPreviewId(transaction.id)) {navigate(`/transactions/${transaction.id}`);@@ -116,12 +128,13 @@ export function CategoryTransactions({ category, month }) {isLoadingMore={isLoadingMore}onLoadMore={loadMoreTransactions}onOpenTransaction={onOpenTransaction}+ onRefresh={undefined}/></Page>);}-function getCategoryMonthFilter(category, month) {+function getCategoryMonthFilter(category: CategoryEntity, month: string) {return {category: category.id,date: { $transform: '$month', $eq: month },diff --git a/upcoming-release-notes/3959.md b/upcoming-release-notes/3959.mdnew file mode 100644index 0000000000..3d33f1f615--- /dev/null+++ b/upcoming-release-notes/3959.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [dkhalife]+---++Migrate CategoryTransactions to TypeScript\ No newline at end of file