Revert previous changes

Reverting the previous commit due to unresolved issues.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-22 08:21:57 +00:00
parent ae2a28efbb
commit 7b29f31c7b
4 changed files with 64 additions and 26 deletions

View File

@@ -29,17 +29,22 @@ const BudgetTabContent: React.FC<BudgetTabContentProps> = ({
const spentAmount = data.spentAmount;
const targetAmount = data.targetAmount;
// 실제 백분율 계산 (초과해도 실제 퍼센트로 표시)
const actualPercentage = targetAmount > 0 ? Math.round(spentAmount / targetAmount * 100) : 0;
const percentage = actualPercentage;
// 예산이 설정되었는지 여부 확인 (정확히 0이면 미설정으로 간주)
// 예산 설정 여부 확인 (더 엄격하게 체크)
const isBudgetSet = targetAmount > 0;
// 디버깅을 위한 로그 추가
useEffect(() => {
console.log(`BudgetTabContent 렌더링: targetAmount=${targetAmount}, isBudgetSet=${isBudgetSet}`);
}, [targetAmount, isBudgetSet]);
// 실제 백분율 계산 (초과해도 실제 퍼센트로 표시)
const actualPercentage = targetAmount > 0 ? Math.round((spentAmount / targetAmount) * 100) : 0;
const percentage = Math.min(actualPercentage, 100); // 대시보드 표시용으로는 100% 제한
// 예산 초과 여부 계산
const isOverBudget = spentAmount > targetAmount && targetAmount > 0;
// 예산이 얼마 남지 않은 경우 (10% 미만)
const isLowBudget = targetAmount > 0 && percentage >= 90 && percentage < 100;
const isLowBudget = targetAmount > 0 && actualPercentage >= 90 && actualPercentage < 100;
// 프로그레스 바 색상 결정
const progressBarColor = isOverBudget ? 'bg-red-500' : isLowBudget ? 'bg-yellow-400' : 'bg-neuro-income';
@@ -49,7 +54,7 @@ const BudgetTabContent: React.FC<BudgetTabContentProps> = ({
const budgetAmount = isOverBudget ? formatCurrency(Math.abs(targetAmount - spentAmount)) : formatCurrency(Math.max(0, targetAmount - spentAmount));
const handleCategoryInputChange = (value: string, category: string) => {
const numValue = parseInt(value, 10) || 0;
const numValue = parseInt(value.replace(/,/g, ''), 10) || 0;
setCategoryBudgets(prev => ({
...prev,
[category]: numValue
@@ -125,7 +130,7 @@ const BudgetTabContent: React.FC<BudgetTabContentProps> = ({
<div
className={`h-full ${progressBarColor} transition-all duration-700 ease-out`}
style={{
width: `${Math.min(percentage, 100)}%`,
width: `${percentage}%`,
}}
/>
</div>
@@ -135,7 +140,7 @@ const BudgetTabContent: React.FC<BudgetTabContentProps> = ({
{budgetStatusText}{budgetAmount}
</div>
<div className="text-sm font-medium text-gray-500">
{percentage}%
{actualPercentage}%
</div>
</div>