Implement additional improvements

This commit implements additional improvements as requested.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 10:52:53 +00:00
parent cc0af1aee0
commit 53096ae26e
6 changed files with 408 additions and 319 deletions

View File

@@ -1,18 +1,8 @@
import React from 'react';
import { Coffee, Home, Car } from 'lucide-react';
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';
import { FormControl } from '@/components/ui/form';
// Define expense categories
export const EXPENSE_CATEGORIES = ['식비', '생활비', '교통비'];
// Define category icons mapping
export const categoryIcons: Record<string, React.ReactNode> = {
: <Coffee size={18} />,
: <Home size={18} />,
: <Car size={18} />,
};
import { categoryIcons, EXPENSE_CATEGORIES } from '@/constants/categoryIcons';
interface ExpenseCategorySelectorProps {
value: string;

View File

@@ -2,15 +2,15 @@
import React from 'react';
import { FormField, FormItem, FormLabel, FormControl, FormMessage } from '@/components/ui/form';
import { Input } from '@/components/ui/input';
import { Coffee, Home, Car } from 'lucide-react';
import { UseFormReturn } from 'react-hook-form';
import { z } from 'zod';
import { categoryIcons, EXPENSE_CATEGORIES } from '@/constants/categoryIcons';
// Form schema for validation
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<typeof transactionFormSchema>;
@@ -21,12 +21,6 @@ export const formatWithCommas = (value: string) => {
return numericValue.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
};
export const categoryIcons: Record<string, React.ReactNode> = {
: <Coffee size={18} />,
: <Home size={18} />,
: <Car size={18} />,
};
interface TransactionFormFieldsProps {
form: UseFormReturn<TransactionFormValues>;
}
@@ -78,7 +72,7 @@ const TransactionFormFields: React.FC<TransactionFormFieldsProps> = ({ form }) =
<FormItem>
<FormLabel></FormLabel>
<div className="grid grid-cols-3 gap-2">
{['식비', '생활비', '교통비'].map((category) => (
{EXPENSE_CATEGORIES.map((category) => (
<div
key={category}
className={`flex items-center gap-2 p-2 rounded-md cursor-pointer border ${

View File

@@ -1,12 +1,7 @@
import React from 'react';
import { Coffee, Home, Car } from 'lucide-react';
export const categoryIcons: Record<string, React.ReactNode> = {
: <Coffee size={18} />,
: <Home size={18} />,
: <Car size={18} />,
};
import { Coffee } from 'lucide-react';
import { categoryIcons } from '@/constants/categoryIcons';
interface TransactionIconProps {
category: string;