Rename categories

Rename "식비" to "음식" and "생활비" to "쇼핑".
This commit is contained in:
gpt-engineer-app[bot]
2025-03-21 10:02:05 +00:00
parent 00d8d7f923
commit d6e6c00ea9
6 changed files with 37 additions and 19 deletions

View File

@@ -14,14 +14,17 @@ export const loadTransactionsFromStorage = (): Transaction[] => {
try {
const localData = JSON.parse(localDataStr);
// 지원되는 카테고리로 필터링
// 지원되는 카테고리로 필터링 및 카테고리명 변환
const filteredData = localData.map((transaction: Transaction) => {
// 트랜잭션의 카테고리가 현재 지원되는 카테고리가 아니면 '생활비'로 변경
if (transaction.type === 'expense' && !EXPENSE_CATEGORIES.includes(transaction.category)) {
return {
...transaction,
category: '생활비' // 기본값으로 '생활비' 사용
};
if (transaction.type === 'expense') {
// 기존 카테고리명 변환
if (transaction.category === '식비') {
return { ...transaction, category: '음식' };
} else if (transaction.category === '생활비') {
return { ...transaction, category: '쇼핑' };
} else if (!EXPENSE_CATEGORIES.includes(transaction.category)) {
return { ...transaction, category: '쇼핑' }; // 지원되지 않는 카테고리는 '쇼핑'으로
}
}
return transaction;
});