diff --git a/src/components/AddTransactionButton.tsx b/src/components/AddTransactionButton.tsx index aebb027..fe2da16 100644 --- a/src/components/AddTransactionButton.tsx +++ b/src/components/AddTransactionButton.tsx @@ -1,4 +1,3 @@ - import React, { useState, useEffect } from 'react'; import { PlusIcon } from 'lucide-react'; import { Dialog, DialogContent, DialogHeader, DialogTitle } from './ui/dialog'; @@ -155,7 +154,7 @@ const AddTransactionButton = () => { }}> - 지출 추가 + 지출 입력 = ({ { if (value) onValueChange(value); @@ -27,7 +27,7 @@ const ExpenseCategorySelector: React.FC = ({
{categoryIcons[category]} diff --git a/src/components/transaction/TransactionFormFields.tsx b/src/components/transaction/TransactionFormFields.tsx index c075eb1..b4c647c 100644 --- a/src/components/transaction/TransactionFormFields.tsx +++ b/src/components/transaction/TransactionFormFields.tsx @@ -10,7 +10,7 @@ import { categoryIcons, EXPENSE_CATEGORIES } from '@/constants/categoryIcons'; export const transactionFormSchema = z.object({ title: z.string().min(1, '제목을 입력해주세요'), amount: z.string().min(1, '금액을 입력해주세요'), - category: z.enum(['음식', '쇼핑', '교통비', '기타']), + category: z.enum(['음식', '쇼핑', '교통', '기타']), }); export type TransactionFormValues = z.infer; @@ -40,7 +40,7 @@ const TransactionFormFields: React.FC = ({ form }) = render={({ field }) => ( 카테고리 -
+
{EXPENSE_CATEGORIES.map((category) => (
{ +export const mapCategoryToNew = (oldCategory: string): "음식" | "쇼핑" | "교통" | "기타" => { if (oldCategory === '식비') return '음식'; if (oldCategory === '생활비') return '쇼핑'; - if (EXPENSE_CATEGORIES.includes(oldCategory as any)) return oldCategory as "음식" | "쇼핑" | "교통비" | "기타"; + if (oldCategory === '교통비') return '교통'; + if (EXPENSE_CATEGORIES.includes(oldCategory as any)) return oldCategory as "음식" | "쇼핑" | "교통" | "기타"; // 기본값은 '기타'로 설정 return '기타'; }; diff --git a/src/constants/categoryIcons.tsx b/src/constants/categoryIcons.tsx index 6d073e5..6f63833 100644 --- a/src/constants/categoryIcons.tsx +++ b/src/constants/categoryIcons.tsx @@ -6,29 +6,30 @@ import { Coffee, Home, Car, Package, Banknote } from 'lucide-react'; export const categoryIcons: Record = { 음식: , 쇼핑: , - 교통비: , + 교통: , 기타: , 수입: , }; // 지출 카테고리 목록 - 4개로 확장 -export const EXPENSE_CATEGORIES = ['음식', '쇼핑', '교통비', '기타']; +export const EXPENSE_CATEGORIES = ['음식', '쇼핑', '교통', '기타']; // 카테고리 부가 설명 정의 export const CATEGORY_DESCRIPTIONS: Record = { 음식: '(식비, 음료)', 쇼핑: '', - 교통비: '(차량 유지비)', + 교통: '(차량 유지비)', 기타: '(기타 지출)', 식비: '(식비, 음료)', // 이전 이름과의 호환성 유지 생활비: '', // 이전 이름과의 호환성 유지 + 교통비: '(차량 유지비)', // 이전 이름과의 호환성 유지 }; // 기본 카테고리 예산 설정 export const DEFAULT_CATEGORY_BUDGETS = { 음식: 400000, 쇼핑: 600000, - 교통비: 200000, + 교통: 200000, 기타: 100000 };