Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dkhalife/ts/categorytransactions #3959

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading