전략편집기 수정
This commit is contained in:
@@ -42,8 +42,9 @@ interface TradeNotificationContextValue {
|
||||
unreadCount: number;
|
||||
addNotification: (signal: TradeSignalInfo & { dbId?: number }) => void;
|
||||
dismissToast: (id: string) => void;
|
||||
/** 지정 id 알림만 닫기 (현재 페이지 등) */
|
||||
/** 지정 id 알림만 팝업 대기열에서 닫기 (읽음 처리) */
|
||||
dismissToasts: (ids: string[]) => void;
|
||||
/** 팝업 대기열(toastNotifications) 전체 닫기 — 모든 페이지 포함 */
|
||||
dismissAllToasts: () => void;
|
||||
markAsRead: (id: string) => void;
|
||||
markAllAsRead: () => void;
|
||||
@@ -250,10 +251,21 @@ export const TradeNotificationProvider: React.FC<ProviderProps> = ({
|
||||
}, []);
|
||||
|
||||
const dismissAllToasts = useCallback(() => {
|
||||
const ids = toastNotificationsRef.current.map(n => n.id);
|
||||
if (ids.length === 0) return;
|
||||
dismissToasts(ids);
|
||||
}, [dismissToasts]);
|
||||
const snapshot = toastNotificationsRef.current;
|
||||
if (snapshot.length === 0) return;
|
||||
const idSet = new Set(snapshot.map(n => n.id));
|
||||
|
||||
setReadIds(r => {
|
||||
const next = new Set(r);
|
||||
idSet.forEach(i => next.add(i));
|
||||
saveReadIds(next);
|
||||
return next;
|
||||
});
|
||||
setToastNotifications([]);
|
||||
setAllNotifications(all =>
|
||||
all.map(n => (idSet.has(n.id) ? { ...n, isRead: true } : n)),
|
||||
);
|
||||
}, []);
|
||||
|
||||
const markAllAsRead = useCallback(() => {
|
||||
setAllNotifications(prev => {
|
||||
|
||||
Reference in New Issue
Block a user