Fix budget display and button
- Fix the budget display issue where monthly budgets were showing four amounts instead of one. - Resolve the functionality of the "Edit Budget" button.
This commit is contained in:
@@ -14,12 +14,20 @@ const BudgetInputButton: React.FC<BudgetInputButtonProps> = ({
|
||||
budgetButtonText,
|
||||
toggleBudgetInput
|
||||
}) => {
|
||||
const handleButtonClick = (e: React.MouseEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
console.log('예산 수정 버튼 클릭됨');
|
||||
toggleBudgetInput();
|
||||
};
|
||||
|
||||
if (isBudgetSet) {
|
||||
return (
|
||||
<div className="mt-6">
|
||||
<button
|
||||
onClick={toggleBudgetInput}
|
||||
onClick={handleButtonClick}
|
||||
className="text-neuro-income hover:underline flex items-center text-base font-semibold group"
|
||||
type="button"
|
||||
>
|
||||
<CirclePlus size={26} className="mr-2 text-neuro-income transition-transform group-hover:scale-110" />
|
||||
<span className="text-base font-semibold">{budgetButtonText}</span>
|
||||
@@ -31,7 +39,12 @@ const BudgetInputButton: React.FC<BudgetInputButtonProps> = ({
|
||||
return (
|
||||
<div className="py-4 text-center">
|
||||
<div className="text-gray-400 mb-4">아직 예산이 설정되지 않았습니다</div>
|
||||
<Button onClick={toggleBudgetInput} variant="default" className="bg-neuro-income hover:bg-neuro-income/90 animate-pulse shadow-lg">
|
||||
<Button
|
||||
onClick={handleButtonClick}
|
||||
variant="default"
|
||||
className="bg-neuro-income hover:bg-neuro-income/90 animate-pulse shadow-lg"
|
||||
type="button"
|
||||
>
|
||||
<CirclePlus className="mr-2" size={24} />
|
||||
<span className="animate-pulse">{budgetButtonText}</span>
|
||||
</Button>
|
||||
|
||||
@@ -23,35 +23,43 @@ const BudgetInputForm: React.FC<BudgetInputFormProps> = ({
|
||||
}) => {
|
||||
if (!showBudgetInput) return null;
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
handleSaveCategoryBudgets();
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mt-4">
|
||||
<div className="neuro-card p-4">
|
||||
<div>
|
||||
<h3 className="text-base font-medium mb-3">카테고리별 월간 예산 설정</h3>
|
||||
<p className="text-sm text-gray-500 mb-4">카테고리별로 월간 예산을 설정하세요. 일일, 주간 예산은 자동으로 계산됩니다.</p>
|
||||
<CategoryBudgetInputs
|
||||
categoryBudgets={categoryBudgets}
|
||||
handleCategoryInputChange={handleCategoryInputChange}
|
||||
/>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div>
|
||||
<h3 className="text-base font-medium mb-3">카테고리별 월간 예산 설정</h3>
|
||||
<p className="text-sm text-gray-500 mb-4">카테고리별로 월간 예산을 설정하세요. 일일, 주간 예산은 자동으로 계산됩니다.</p>
|
||||
<CategoryBudgetInputs
|
||||
categoryBudgets={categoryBudgets}
|
||||
handleCategoryInputChange={handleCategoryInputChange}
|
||||
/>
|
||||
|
||||
<div className="mt-4 border-t border-gray-300 pt-3">
|
||||
<div className="flex justify-between items-center mb-4">
|
||||
<h3 className="font-medium text-sm px-[34px]">월간 총 예산:</h3>
|
||||
<p className="font-bold text-neuro-income text-base px-[10px]">{formatCurrency(calculateTotalBudget())}</p>
|
||||
</div>
|
||||
<div className="mt-4 border-t border-gray-300 pt-3">
|
||||
<div className="flex justify-between items-center mb-4">
|
||||
<h3 className="font-medium text-sm px-[34px]">월간 총 예산:</h3>
|
||||
<p className="font-bold text-neuro-income text-base px-[10px]">{formatCurrency(calculateTotalBudget())}</p>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
onClick={handleSaveCategoryBudgets}
|
||||
size="sm"
|
||||
className="bg-neuro-income hover:bg-neuro-income/90 text-white mx-[6px]"
|
||||
>
|
||||
<Check size={18} className="mr-1" />
|
||||
저장하기
|
||||
</Button>
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
type="submit"
|
||||
size="sm"
|
||||
className="bg-neuro-income hover:bg-neuro-income/90 text-white mx-[6px]"
|
||||
>
|
||||
<Check size={18} className="mr-1" />
|
||||
저장하기
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user