diff --git a/src/components/analytics/CategorySpendingList.tsx b/src/components/analytics/CategorySpendingList.tsx index 42de0c5..1cc8aaa 100644 --- a/src/components/analytics/CategorySpendingList.tsx +++ b/src/components/analytics/CategorySpendingList.tsx @@ -25,10 +25,13 @@ const CategorySpendingList: React.FC = ({ // 카테고리별 색상 매핑 const getCategoryColor = (title: string) => { + // 카테고리 이름에 따라 적절한 색상 반환 switch (title) { - case '식비': return '#81c784'; - case '생활비': return '#AED581'; + case '음식': return '#81c784'; + case '쇼핑': return '#AED581'; case '교통비': return '#2E7D32'; + case '식비': return '#81c784'; // 이전 이름과의 호환성 유지 + case '생활비': return '#AED581'; // 이전 이름과의 호환성 유지 default: return '#4CAF50'; } }; @@ -37,31 +40,38 @@ const CategorySpendingList: React.FC = ({
{categories.some(cat => cat.current > 0) ? (
- {categories.map((category) => ( -
-
-
- - {category.title} - {CATEGORY_DESCRIPTIONS[category.title] && ( - - {CATEGORY_DESCRIPTIONS[category.title]} - - )} - + {categories.map((category) => { + // 카테고리 이름을 직접 표시 + const categoryName = category.title; + // 카테고리 설명 찾기 + const description = CATEGORY_DESCRIPTIONS[categoryName] || ''; + + return ( +
+
+
+ + {categoryName} + {description && ( + + {description} + + )} + +
+
+

+ {formatCurrency(category.current)} +

+

+ {totalExpense > 0 ? Math.round(category.current / totalExpense * 100) : 0}% +

+
-
-

- {formatCurrency(category.current)} -

-

- {totalExpense > 0 ? Math.round(category.current / totalExpense * 100) : 0}% -

-
-
- ))} + ); + })}
) : (
diff --git a/src/constants/categoryIcons.tsx b/src/constants/categoryIcons.tsx index 47144cd..cbaad45 100644 --- a/src/constants/categoryIcons.tsx +++ b/src/constants/categoryIcons.tsx @@ -18,6 +18,8 @@ export const CATEGORY_DESCRIPTIONS: Record = { 음식: '(식비, 음료)', 쇼핑: '', 교통비: '(차량 유지비)', + 식비: '(식비, 음료)', // 이전 이름과의 호환성 유지 + 생활비: '', // 이전 이름과의 호환성 유지 }; // 기본 카테고리 예산 설정