Fix type errors in filtering

Fixes type errors related to transaction filtering and property assignments.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-17 23:22:13 +00:00
parent d3e8119f24
commit dea8b9f8ba
3 changed files with 11 additions and 6 deletions

View File

@@ -19,10 +19,12 @@ export type Transaction = {
interface TransactionCardProps { interface TransactionCardProps {
transaction: Transaction; transaction: Transaction;
onUpdate?: (updatedTransaction: Transaction) => void; onUpdate?: (updatedTransaction: Transaction) => void;
onDelete?: (id: string) => void; // onDelete 속성 추가
} }
const TransactionCard: React.FC<TransactionCardProps> = ({ const TransactionCard: React.FC<TransactionCardProps> = ({
transaction, transaction,
onDelete, // onDelete prop 추가
}) => { }) => {
const [isEditDialogOpen, setIsEditDialogOpen] = useState(false); const [isEditDialogOpen, setIsEditDialogOpen] = useState(false);
const { title, amount, date, category } = transaction; const { title, amount, date, category } = transaction;
@@ -47,6 +49,7 @@ const TransactionCard: React.FC<TransactionCardProps> = ({
transaction={transaction} transaction={transaction}
open={isEditDialogOpen} open={isEditDialogOpen}
onOpenChange={setIsEditDialogOpen} onOpenChange={setIsEditDialogOpen}
onDelete={onDelete} // onDelete prop 전달
/> />
</> </>
); );

View File

@@ -13,4 +13,5 @@ export interface FilteringReturn {
handlePrevMonth: () => void; handlePrevMonth: () => void;
handleNextMonth: () => void; handleNextMonth: () => void;
getTotalExpenses: (filteredTransactions: Transaction[]) => number; getTotalExpenses: (filteredTransactions: Transaction[]) => number;
forceRefresh: () => void;
} }

View File

@@ -1,14 +1,15 @@
import { getPrevMonth, getNextMonth } from '../dateUtils';
/** /**
* 월 선택 관련 훅 * 월 선택 관련 훅
* 이전/다음 월 선택 기능을 제공합니다. * 이전/다음 월 선택 기능을 제공합니다.
*/ */
export const useMonthSelection = ( export const useMonthSelection = ({
selectedMonth: string, selectedMonth,
setSelectedMonth: (month: string) => void setSelectedMonth
) => { }: {
selectedMonth: string;
setSelectedMonth: (month: string) => void;
}) => {
// 이전 월로 변경 // 이전 월로 변경
const handlePrevMonth = () => { const handlePrevMonth = () => {
setSelectedMonth(getPrevMonth(selectedMonth)); setSelectedMonth(getPrevMonth(selectedMonth));