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

@@ -76,9 +76,24 @@ const addToRemoveQueue = (toastId: string) => {
export const reducer = (state: State, action: Action): State => {
switch (action.type) {
case "ADD_TOAST":
// 동일한 내용의 토스트가 있으면 추가하지 않음
if (state.toasts.some(t =>
t.title === action.toast.title &&
t.description === action.toast.description &&
t.open === true
)) {
return state;
}
// 이전 토스트 모두 닫기
const updatedToasts = state.toasts.map(t => ({
...t,
open: false
}));
return {
...state,
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
toasts: [action.toast, ...updatedToasts].slice(0, TOAST_LIMIT),
}
case "UPDATE_TOAST":