Fix budget display issue

The budget display in the budget card was not showing correctly when the budget was not set. This commit fixes the issue.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-22 07:48:57 +00:00
parent 9e5406afff
commit f39733bfcd
3 changed files with 60 additions and 19 deletions

View File

@@ -32,10 +32,12 @@ const BudgetTabContent: React.FC<BudgetTabContentProps> = ({
// 실제 백분율 계산 (초과해도 실제 퍼센트로 표시)
const actualPercentage = targetAmount > 0 ? Math.round(spentAmount / targetAmount * 100) : 0;
const percentage = actualPercentage;
const isFirstBudget = targetAmount === 0;
// 예산이 설정되었는지 여부 확인 (0이면 미설정으로 간주)
const isBudgetSet = targetAmount > 0;
// 예산 초과 여부 계산
const isOverBudget = spentAmount > targetAmount;
const isOverBudget = spentAmount > targetAmount && targetAmount > 0;
// 예산이 얼마 남지 않은 경우 (10% 미만)
const isLowBudget = targetAmount > 0 && percentage >= 90 && percentage < 100;
@@ -108,11 +110,11 @@ const BudgetTabContent: React.FC<BudgetTabContentProps> = ({
};
// 예산 여부에 따른 텍스트 결정
const budgetButtonText = targetAmount > 0 ? "예산 수정하기" : "예산 입력하기";
const budgetButtonText = isBudgetSet ? "예산 수정하기" : "예산 입력하기";
return (
<div>
{targetAmount > 0 ? (
{isBudgetSet ? (
<>
<div className="flex justify-between items-center mb-3">
<div className="text-base font-bold">{formatCurrency(spentAmount)}</div>