전략편집기 수정
This commit is contained in:
@@ -45,7 +45,6 @@ export const TradeSignalSnackbar: React.FC<Props> = ({
|
||||
toastNotifications,
|
||||
dismissToast,
|
||||
dismissToasts,
|
||||
dismissAllToasts,
|
||||
openDetail,
|
||||
} = useTradeNotification();
|
||||
|
||||
@@ -94,17 +93,23 @@ export const TradeSignalSnackbar: React.FC<Props> = ({
|
||||
}, [totalPages]);
|
||||
|
||||
const dismissAll = useCallback(() => {
|
||||
dismissAllToasts();
|
||||
if (toastNotifications.length === 0) return;
|
||||
dismissToasts(toastNotifications.map(n => n.id));
|
||||
setPageIndex(0);
|
||||
positionsRef.current = {};
|
||||
}, [dismissAllToasts]);
|
||||
}, [dismissToasts, toastNotifications]);
|
||||
|
||||
const dismissCurrentPage = useCallback(() => {
|
||||
dismissToasts(pageItems.map(i => i.id));
|
||||
const ids = pageItems.map(i => i.id);
|
||||
if (ids.length === 0) return;
|
||||
dismissToasts(ids);
|
||||
positionsRef.current = Object.fromEntries(
|
||||
Object.entries(positionsRef.current).filter(([id]) => !pageItems.some(p => p.id === id)),
|
||||
Object.entries(positionsRef.current).filter(([id]) => !ids.includes(id)),
|
||||
);
|
||||
}, [dismissToasts, pageItems]);
|
||||
const remaining = toastNotifications.length - ids.length;
|
||||
const newTotalPages = Math.max(1, Math.ceil(remaining / pageSize));
|
||||
setPageIndex(p => Math.min(p, newTotalPages - 1));
|
||||
}, [dismissToasts, pageItems, toastNotifications.length, pageSize]);
|
||||
|
||||
const handleDragStart = useCallback((e: React.PointerEvent, key: string) => {
|
||||
if (e.button !== 0) return;
|
||||
@@ -221,17 +226,19 @@ export const TradeSignalSnackbar: React.FC<Props> = ({
|
||||
type="button"
|
||||
className="tsn-dismiss-page"
|
||||
onClick={dismissCurrentPage}
|
||||
title={`현재 화면 알림 ${pageItems.length}건 닫기`}
|
||||
disabled={pageItems.length === 0}
|
||||
title={`현재 화면에 보이는 알림 ${pageItems.length}건 닫기`}
|
||||
>
|
||||
알림창닫기 ({pageItems.length})
|
||||
알림창 닫기 ({pageItems.length})
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="tsn-dismiss-all"
|
||||
onClick={dismissAll}
|
||||
title={`대기 중인 알림 ${toastNotifications.length}건 전체 닫기`}
|
||||
disabled={toastNotifications.length === 0}
|
||||
title={`대기 중인 알림 ${toastNotifications.length}건 전체 닫기 (모든 페이지)`}
|
||||
>
|
||||
전체닫기 ({toastNotifications.length})
|
||||
전체 닫기 ({toastNotifications.length})
|
||||
</button>
|
||||
</div>
|
||||
{showSlideNav && (
|
||||
|
||||
Reference in New Issue
Block a user