Fix analytics graph and toast

- Corrected analytics graph to only display budget data when budget is entered.
- Fixed issue where expense toast notifications were appearing twice.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-16 08:56:39 +00:00
parent e392557b9c
commit da9120ba61
4 changed files with 29 additions and 31 deletions

View File

@@ -1,7 +1,8 @@
import React, { useState } from 'react';
import { PlusIcon } from 'lucide-react';
import { Dialog, DialogContent, DialogHeader, DialogTitle } from './ui/dialog';
import { toast } from '@/components/ui/use-toast';
import { toast } from '@/hooks/use-toast';
import { useBudget } from '@/contexts/BudgetContext';
import { supabase } from '@/lib/supabase';
import { isSyncEnabled } from '@/utils/syncUtils';
@@ -76,6 +77,7 @@ const AddTransactionButton = () => {
// 브라우저 이벤트 발생시켜 다른 페이지에서도 업데이트되도록 함
window.dispatchEvent(new Event('budgetDataUpdated'));
window.dispatchEvent(new Event('transactionAdded'));
window.dispatchEvent(new Event('transactionUpdated'));
} catch (error) {
console.error('지출 추가 중 오류 발생:', error);
toast({

View File

@@ -45,7 +45,7 @@ const MonthlyComparisonChart: React.FC<MonthlyComparisonChartProps> = ({
// 데이터 여부 확인 로직 개선 - 데이터가 비어있거나 모든 값이 0인 경우도 고려
const hasValidData = monthlyData &&
monthlyData.length > 0 &&
monthlyData.some(item => item.budget > 0 || item.expense > 0);
monthlyData.some(item => (item.budget > 0 || item.expense > 0));
return (
<div className="neuro-card h-72 w-full">