Address unresolved issues

This commit addresses previously reported issues that remain unresolved. Further investigation is required.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-22 08:26:29 +00:00
parent 7b29f31c7b
commit c92d41e8f0
6 changed files with 162 additions and 168 deletions

View File

@@ -1,5 +1,5 @@
import React from 'react';
import React, { useEffect } from 'react';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import BudgetTabContent from './BudgetTabContent';
import { BudgetPeriod } from '@/contexts/budget/BudgetContext';
@@ -31,6 +31,18 @@ const BudgetProgressCard: React.FC<BudgetProgressCardProps> = ({
calculatePercentage,
onSaveBudget
}) => {
// 컴포넌트 마운트 시 예산 데이터 업데이트 이벤트 발생
useEffect(() => {
console.log("BudgetProgressCard 마운트 - 예산 데이터:", budgetData);
// 지연 작업으로 이벤트 발생 (컴포넌트 마운트 후 데이터 갱신)
const timeoutId = setTimeout(() => {
window.dispatchEvent(new Event('budgetDataUpdated'));
}, 500);
return () => clearTimeout(timeoutId);
}, []);
return (
<div className="neuro-card mb-6 overflow-hidden w-full">
<Tabs defaultValue="daily" value={selectedTab} onValueChange={setSelectedTab} className="w-full">

View File

@@ -29,7 +29,7 @@ const BudgetTabContent: React.FC<BudgetTabContentProps> = ({
const spentAmount = data.spentAmount;
const targetAmount = data.targetAmount;
// 예산 설정 여부 확인 (더 엄격하게 체크)
// 예산 설정 여부 확인 (수정: 0보다 큰지만 확인)
const isBudgetSet = targetAmount > 0;
// 디버깅을 위한 로그 추가
@@ -87,6 +87,11 @@ const BudgetTabContent: React.FC<BudgetTabContentProps> = ({
if (totalBudget > 0) {
onSaveBudget(totalBudget, updatedCategoryBudgets);
setShowBudgetInput(false);
// 이벤트 발생 추가 (데이터 저장 후 즉시 UI 업데이트를 위해)
setTimeout(() => {
window.dispatchEvent(new Event('budgetDataUpdated'));
}, 200);
} else {
alert('예산을 입력해주세요.');
}