알림목록 그리드 데이터 수신 표시
This commit is contained in:
@@ -8,6 +8,7 @@ import { useLiveReceiveFlash } from '../../hooks/useLiveReceiveFlash';
|
|||||||
import { useTradeNotificationSignalSnapshot } from '../../hooks/useTradeNotificationSignalSnapshot';
|
import { useTradeNotificationSignalSnapshot } from '../../hooks/useTradeNotificationSignalSnapshot';
|
||||||
import type { StrategyDto } from '../../utils/backendApi';
|
import type { StrategyDto } from '../../utils/backendApi';
|
||||||
import { resolveNotificationStrategy } from '../../utils/resolveNotificationStrategy';
|
import { resolveNotificationStrategy } from '../../utils/resolveNotificationStrategy';
|
||||||
|
import { normalizeMarketCode } from '../../utils/strategyHydrate';
|
||||||
import type { TradeNotificationItem } from '../../contexts/TradeNotificationContext';
|
import type { TradeNotificationItem } from '../../contexts/TradeNotificationContext';
|
||||||
import {
|
import {
|
||||||
buildSignalDetailRows,
|
buildSignalDetailRows,
|
||||||
@@ -134,6 +135,8 @@ const TradeNotificationListRow: React.FC<Props> = ({
|
|||||||
}, [item.id]);
|
}, [item.id]);
|
||||||
|
|
||||||
const panelActive = isListLayout && inView;
|
const panelActive = isListLayout && inView;
|
||||||
|
const gridActive = !isListLayout && inView;
|
||||||
|
const marketCode = normalizeMarketCode(item.market);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!panelActive || !isListLayout) {
|
if (!panelActive || !isListLayout) {
|
||||||
@@ -182,10 +185,12 @@ const TradeNotificationListRow: React.FC<Props> = ({
|
|||||||
const chartExpanded = isListLayout && expandedChartKey != null;
|
const chartExpanded = isListLayout && expandedChartKey != null;
|
||||||
const chartActive = isListLayout && chartsEnabled && panelActive;
|
const chartActive = isListLayout && chartsEnabled && panelActive;
|
||||||
const signalCardEnabled = isListLayout && panelActive && !chartExpanded;
|
const signalCardEnabled = isListLayout && panelActive && !chartExpanded;
|
||||||
const ticker = tickers?.get(item.market);
|
const ticker = tickers?.get(marketCode) ?? tickers?.get(item.market);
|
||||||
const expandedIndicator = indicatorCards.find(c => c.id === expandedChartKey);
|
const expandedIndicator = indicatorCards.find(c => c.id === expandedChartKey);
|
||||||
|
|
||||||
const signalSnapshotEnabled = signalCardEnabled && item.strategyId != null;
|
const signalSnapshotEnabled = item.strategyId != null && (
|
||||||
|
signalCardEnabled || gridActive
|
||||||
|
);
|
||||||
const { snapshot, loading: signalLoading } = useTradeNotificationSignalSnapshot(
|
const { snapshot, loading: signalLoading } = useTradeNotificationSignalSnapshot(
|
||||||
item.market,
|
item.market,
|
||||||
item.strategyId,
|
item.strategyId,
|
||||||
@@ -200,7 +205,7 @@ const TradeNotificationListRow: React.FC<Props> = ({
|
|||||||
setChartActivitySeq(n => n + 1);
|
setChartActivitySeq(n => n + 1);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const liveReceiveEnabled = panelActive && chartLiveReceiveHighlight;
|
const liveReceiveEnabled = inView && chartLiveReceiveHighlight;
|
||||||
const receiveSignal = useMemo(() => {
|
const receiveSignal = useMemo(() => {
|
||||||
if (!liveReceiveEnabled) return null;
|
if (!liveReceiveEnabled) return null;
|
||||||
return [
|
return [
|
||||||
@@ -218,8 +223,8 @@ const TradeNotificationListRow: React.FC<Props> = ({
|
|||||||
]);
|
]);
|
||||||
const receiving = useLiveReceiveFlash(receiveSignal, liveReceiveEnabled);
|
const receiving = useLiveReceiveFlash(receiveSignal, liveReceiveEnabled);
|
||||||
const highlightReceiving = chartLiveReceiveHighlight && receiving;
|
const highlightReceiving = chartLiveReceiveHighlight && receiving;
|
||||||
const gridLiveStatus: VirtualLiveStatus = panelActive
|
const gridLiveStatus: VirtualLiveStatus = gridActive
|
||||||
? (ticker != null ? 'live' : 'connecting')
|
? (ticker?.tradePrice != null || snapshot?.updatedAt ? 'live' : 'connecting')
|
||||||
: 'idle';
|
: 'idle';
|
||||||
|
|
||||||
const indicatorChartCount = indicatorCards.length;
|
const indicatorChartCount = indicatorCards.length;
|
||||||
@@ -255,7 +260,7 @@ const TradeNotificationListRow: React.FC<Props> = ({
|
|||||||
<span className="tnl-summary-sym">{sym || secondary}</span>
|
<span className="tnl-summary-sym">{sym || secondary}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="tnl-summary-head-actions">
|
<div className="tnl-summary-head-actions">
|
||||||
{!isListLayout && panelActive && (
|
{!isListLayout && gridActive && (
|
||||||
<VirtualLiveBadge
|
<VirtualLiveBadge
|
||||||
status={gridLiveStatus}
|
status={gridLiveStatus}
|
||||||
receiving={highlightReceiving}
|
receiving={highlightReceiving}
|
||||||
|
|||||||
@@ -1492,6 +1492,14 @@
|
|||||||
|
|
||||||
.tnl-summary-card--grid .tnl-summary-head-actions .vtd-live-badge {
|
.tnl-summary-card--grid .tnl-summary-head-actions .vtd-live-badge {
|
||||||
margin-right: 2px;
|
margin-right: 2px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tnl-summary-card--grid .tnl-summary-head-actions {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: flex-end;
|
||||||
|
row-gap: 4px;
|
||||||
|
max-width: 55%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tnl-row--gallery.tnl-row--selected .tnl-hscroll-pane,
|
.tnl-row--gallery.tnl-row--selected .tnl-hscroll-pane,
|
||||||
|
|||||||
Reference in New Issue
Block a user