알림목록 종목별 정렬시 시간별로 정렬되도록 수정
This commit is contained in:
@@ -45,6 +45,7 @@ import {
|
||||
getTradeNotificationGridPreset,
|
||||
type TradeNotificationGridPresetId,
|
||||
} from '../utils/tradeNotificationGridPresets';
|
||||
import { sortTradeNotifications } from '../utils/tradeListSort';
|
||||
|
||||
type RightTab = 'trade' | 'orderbook';
|
||||
|
||||
@@ -88,24 +89,6 @@ function fillBothSides(
|
||||
setFillSell({ market, price, side: 'sell', seq: seq + 1 });
|
||||
}
|
||||
|
||||
function sortNotifications(
|
||||
items: TradeNotificationItem[],
|
||||
sort: TradeNotificationListSort,
|
||||
): TradeNotificationItem[] {
|
||||
const arr = [...items];
|
||||
if (sort === 'market') {
|
||||
return arr.sort((a, b) => {
|
||||
const byMarket = a.market.localeCompare(b.market, 'ko');
|
||||
if (byMarket !== 0) return byMarket;
|
||||
return b.receivedAt - a.receivedAt;
|
||||
});
|
||||
}
|
||||
if (sort === 'oldest') {
|
||||
return arr.sort((a, b) => a.receivedAt - b.receivedAt);
|
||||
}
|
||||
return arr.sort((a, b) => b.receivedAt - a.receivedAt);
|
||||
}
|
||||
|
||||
export const TradeNotificationListPage: React.FC<Props> = ({
|
||||
theme,
|
||||
onGoToChart,
|
||||
@@ -273,7 +256,7 @@ export const TradeNotificationListPage: React.FC<Props> = ({
|
||||
}, [allNotifications, filter, candleFilter]);
|
||||
|
||||
const sorted = useMemo(
|
||||
() => sortNotifications(filtered, listSort),
|
||||
() => sortTradeNotifications(filtered, listSort),
|
||||
[filtered, listSort],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user