위젯 종료버튼 겹침문제 수정
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import type { Timeframe } from '../types';
|
||||
import type { StrategyDto } from './backendApi';
|
||||
import { resolveStrategyTimeframes } from './strategyToChartIndicators';
|
||||
|
||||
/** 위젯 차트 — 종목 우측 시간봉 선택 기본 옵션 */
|
||||
export const WIDGET_CHART_TF_OPTIONS: Timeframe[] = [
|
||||
'1m', '3m', '5m', '10m', '15m', '30m', '1h', '4h', '1D',
|
||||
];
|
||||
|
||||
const TF_ORDER = new Map<Timeframe, number>(
|
||||
WIDGET_CHART_TF_OPTIONS.map((tf, i) => [tf, i]),
|
||||
);
|
||||
|
||||
/** 전략 DSL 시간봉 + 위젯 기본 옵션 병합 (중복 제거, 표준 순서) */
|
||||
export function mergeWidgetTimeframeOptions(strategy?: StrategyDto): Timeframe[] {
|
||||
const merged = new Set<Timeframe>([...WIDGET_CHART_TF_OPTIONS, ...resolveStrategyTimeframes(strategy)]);
|
||||
return [...merged].sort((a, b) => {
|
||||
const ai = TF_ORDER.get(a) ?? 999;
|
||||
const bi = TF_ORDER.get(b) ?? 999;
|
||||
if (ai !== bi) return ai - bi;
|
||||
return a.localeCompare(b);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user