Fix budget calculation and display

Ensure daily and weekly budgets are calculated correctly based on the monthly budget, and that the monthly budget is consistent across the app.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-22 12:02:41 +00:00
parent cbee1f4fb9
commit 0bc53208b5
3 changed files with 45 additions and 13 deletions

View File

@@ -8,8 +8,11 @@ import { safelyLoadBudgetData } from '../budgetUtils';
*/
export const useBudgetState = () => {
// 초기 데이터 로드 시 safelyLoadBudgetData 함수 사용
const [budgetData, setBudgetData] = useState<BudgetData>(safelyLoadBudgetData());
const [selectedTab, setSelectedTab] = useState<BudgetPeriod>("daily"); // 초기값을 daily로 변경
const initialBudgetData = safelyLoadBudgetData();
console.log('초기 예산 데이터 로드:', initialBudgetData);
const [budgetData, setBudgetData] = useState<BudgetData>(initialBudgetData);
const [selectedTab, setSelectedTab] = useState<BudgetPeriod>("daily"); // 초기값은 daily
const [isInitialized, setIsInitialized] = useState(false);
const [lastUpdateTime, setLastUpdateTime] = useState(0);