Skip to content

Commit

Permalink
Dkhalife/ts/categorytransactions (#3959)
Browse files Browse the repository at this point in the history
* rename

* a bit of hardening

* release notes

* typecheck & lint

* lint
  • Loading branch information
dkhalife authored Dec 11, 2024
1 parent 9af3539 commit 9e6a486
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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();

Expand Down Expand Up @@ -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 05e58279
if (!isPreviewId(transaction.id)) {
navigate(`/transactions/${transaction.id}`);
Expand Down Expand Up @@ -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 },
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3959.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [dkhalife]
---

Migrate CategoryTransactions to TypeScript

0 comments on commit 9e6a486

Please sign in to comment.