From 984bdfde7add83e921ec9c223504a922e99c577a Mon Sep 17 00:00:00 2001 From: Dany Khalife Date: Tue, 10 Dec 2024 19:34:31 -0800 Subject: [PATCH 1/5] rename --- .../{CategoryTransactions.jsx => CategoryTransactions.tsx} | 1 + 1 file changed, 1 insertion(+) rename packages/desktop-client/src/components/mobile/budget/{CategoryTransactions.jsx => CategoryTransactions.tsx} (99%) diff --git a/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.jsx b/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx similarity index 99% rename from packages/desktop-client/src/components/mobile/budget/CategoryTransactions.jsx rename to packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx index aa0df7912c0..3f82c79e038 100644 --- a/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.jsx +++ b/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx @@ -116,6 +116,7 @@ export function CategoryTransactions({ category, month }) { isLoadingMore={isLoadingMore} onLoadMore={loadMoreTransactions} onOpenTransaction={onOpenTransaction} + onRefresh={undefined} /> ); From 983ec01c388559ca0aa7af0633a6d9cb03919fd5 Mon Sep 17 00:00:00 2001 From: Dany Khalife Date: Tue, 10 Dec 2024 19:39:56 -0800 Subject: [PATCH 2/5] a bit of hardening --- .../components/mobile/budget/CategoryTransactions.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx b/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx index 3f82c79e038..a2ba3c0615f 100644 --- a/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx +++ b/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx @@ -20,8 +20,14 @@ import { MobilePageHeader, Page } from '../../Page'; import { MobileBackButton } from '../MobileBackButton'; import { AddTransactionButton } from '../transactions/AddTransactionButton'; import { TransactionListWithBalances } from '../transactions/TransactionListWithBalances'; +import { CategoryEntity } from 'loot-core/types/models'; -export function CategoryTransactions({ category, month }) { +type CategoryTransactionsProps = { + category: CategoryEntity; + month: string; +}; + +export function CategoryTransactions({ category, month }: CategoryTransactionsProps) { const dispatch = useDispatch(); const navigate = useNavigate(); @@ -122,7 +128,7 @@ export function CategoryTransactions({ category, month }) { ); } -function getCategoryMonthFilter(category, month) { +function getCategoryMonthFilter(category: CategoryEntity, month: string) { return { category: category.id, date: { $transform: '$month', $eq: month }, From efdc398c9fdd3ee5d7512035941f2252c231b6f5 Mon Sep 17 00:00:00 2001 From: Dany Khalife Date: Tue, 10 Dec 2024 19:43:50 -0800 Subject: [PATCH 3/5] release notes --- upcoming-release-notes/3959.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 upcoming-release-notes/3959.md diff --git a/upcoming-release-notes/3959.md b/upcoming-release-notes/3959.md new file mode 100644 index 00000000000..3d33f1f6154 --- /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 From f0e74267073a339ac59730480b84973078b5f7b7 Mon Sep 17 00:00:00 2001 From: Dany Khalife Date: Tue, 10 Dec 2024 19:49:04 -0800 Subject: [PATCH 4/5] typecheck & lint --- .../src/components/mobile/budget/CategoryTransactions.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx b/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx index a2ba3c0615f..5a36ea55c87 100644 --- a/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx +++ b/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx @@ -20,7 +20,7 @@ import { MobilePageHeader, Page } from '../../Page'; import { MobileBackButton } from '../MobileBackButton'; import { AddTransactionButton } from '../transactions/AddTransactionButton'; import { TransactionListWithBalances } from '../transactions/TransactionListWithBalances'; -import { CategoryEntity } from 'loot-core/types/models'; +import { CategoryEntity, TransactionEntity } from 'loot-core/types/models'; type CategoryTransactionsProps = { category: CategoryEntity; @@ -80,7 +80,7 @@ export function CategoryTransactions({ category, month }: CategoryTransactionsPr }); 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}`); From 63fd7ddb5ac31b0add424f8704762fc0235d3c90 Mon Sep 17 00:00:00 2001 From: Dany Khalife Date: Tue, 10 Dec 2024 19:57:22 -0800 Subject: [PATCH 5/5] lint --- .../components/mobile/budget/CategoryTransactions.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx b/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx index 5a36ea55c87..4eee5f6e2cb 100644 --- a/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx +++ 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'; @@ -20,14 +24,16 @@ import { MobilePageHeader, Page } from '../../Page'; import { MobileBackButton } from '../MobileBackButton'; import { AddTransactionButton } from '../transactions/AddTransactionButton'; import { TransactionListWithBalances } from '../transactions/TransactionListWithBalances'; -import { CategoryEntity, TransactionEntity } from 'loot-core/types/models'; type CategoryTransactionsProps = { category: CategoryEntity; month: string; }; -export function CategoryTransactions({ category, month }: CategoryTransactionsProps) { +export function CategoryTransactions({ + category, + month, +}: CategoryTransactionsProps) { const dispatch = useDispatch(); const navigate = useNavigate();