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:
gpt-engineer-app[bot]
2025-03-22 11:08:04 +00:00
parent e900fa77a1
commit ef239e6126
5 changed files with 64 additions and 39 deletions

View File

@@ -51,11 +51,6 @@ export const useBudgetTabContent = ({
useEffect(() => {
const handleBudgetDataUpdated = () => {
console.log(`BudgetTabContent: 전역 예산 데이터 이벤트 감지, 현재 targetAmount=${targetAmount}`);
// 입력 폼이 열려있고 예산이 설정된 경우 폼 닫기
if (showBudgetInput && targetAmount > 0) {
console.log('예산이 설정되어 입력 폼을 닫습니다.');
setShowBudgetInput(false);
}
};
window.addEventListener('budgetDataUpdated', handleBudgetDataUpdated);
@@ -64,13 +59,6 @@ export const useBudgetTabContent = ({
// 예산 설정 여부 확인 - 데이터 targetAmount가 실제로 0보다 큰지 확인
const isBudgetSet = targetAmount > 0;
useEffect(() => {
if (isBudgetSet && showBudgetInput) {
console.log('예산이 설정되었으므로 입력 폼을 닫습니다.');
setShowBudgetInput(false);
}
}, [isBudgetSet, showBudgetInput]);
// 실제 백분율 계산 (초과해도 실제 퍼센트로 표시)
const actualPercentage = targetAmount > 0 ? Math.round((spentAmount / targetAmount) * 100) : 0;