From 5f125de8d7d84118f5ebf7b72fc3c92d4ffed7c6 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 22 Mar 2025 11:13:26 +0000 Subject: [PATCH] Fix budget total calculation Ensure budget total calculation aligns with weekly or monthly budget settings. --- src/components/BudgetProgressCard.tsx | 9 ++++++++- src/hooks/budget/useBudgetTabContent.ts | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/BudgetProgressCard.tsx b/src/components/BudgetProgressCard.tsx index 5a73826..c6745c1 100644 --- a/src/components/BudgetProgressCard.tsx +++ b/src/components/BudgetProgressCard.tsx @@ -47,6 +47,13 @@ const BudgetProgressCard: React.FC = ({ return () => clearTimeout(timeoutId); }, [budgetData]); + // 컴포넌트 마운트 시 월간 탭을 기본으로 설정 + useEffect(() => { + if (selectedTab !== 'monthly') { + setSelectedTab('monthly'); + } + }, []); + // budgetDataUpdated 이벤트 감지 useEffect(() => { const handleBudgetDataUpdated = () => { @@ -76,7 +83,7 @@ const BudgetProgressCard: React.FC = ({ return (
- + 0) { + // 월간 예산 기준으로 전달 onSaveBudget(totalBudget, updatedCategoryBudgets); setShowBudgetInput(false);