Files
zellyy-finance/src/components/transaction/categoryUtils.ts
gpt-engineer-app[bot] 508eea9cde Refactor expense form and categories
-   Rename "지출 추가" to "지출 입력" in the add expense dialog.
-   Rename "교통비" to "교통" in categories and ensure all 4 icons are displayed on a single line.
2025-03-22 06:45:50 +00:00

15 lines
599 B
TypeScript

import { EXPENSE_CATEGORIES } from '@/constants/categoryIcons';
/**
* 카테고리 매핑 함수 - 이전 카테고리명을 새 카테고리명으로 변환
*/
export const mapCategoryToNew = (oldCategory: string): "음식" | "쇼핑" | "교통" | "기타" => {
if (oldCategory === '식비') return '음식';
if (oldCategory === '생활비') return '쇼핑';
if (oldCategory === '교통비') return '교통';
if (EXPENSE_CATEGORIES.includes(oldCategory as any)) return oldCategory as "음식" | "쇼핑" | "교통" | "기타";
// 기본값은 '기타'로 설정
return '기타';
};