Fix budget display and category issues

- Fix budget amount not displaying outside the homepage.
- Remove unexpected categories and revert to the original 3 categories.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-16 08:17:02 +00:00
parent 32a6832b84
commit 79d38f1fc1
5 changed files with 50 additions and 14 deletions

View File

@@ -21,7 +21,10 @@ export const calculateCategorySpending = (
// 모든 카테고리에 대해 초기값 0 설정
Object.keys(categoryBudgets).forEach(category => {
categorySpending[category] = 0;
// 3개 카테고리만 유지
if (EXPENSE_CATEGORIES.includes(category)) {
categorySpending[category] = 0;
}
});
expenseTransactions.forEach(t => {
@@ -30,10 +33,10 @@ export const calculateCategorySpending = (
}
});
return Object.keys(categoryBudgets).map(category => ({
return EXPENSE_CATEGORIES.map(category => ({
title: category,
current: categorySpending[category] || 0,
total: categoryBudgets[category]
total: categoryBudgets[category] || 0
}));
};