투자관리 화면 수정

This commit is contained in:
Macbook
2026-05-31 17:02:39 +09:00
parent 78f00dbaa5
commit d6c2f3e451
8 changed files with 251 additions and 13 deletions
@@ -0,0 +1,69 @@
import type { IndicatorConfig } from '../types';
/** 투자관리 차트 탭 — 캔들 오버레이 표시/숨김 (저장 없음, 화면 세션만) */
export type PaperOverlayToggleKey = 'ma' | 'ichimoku' | 'bollinger';
export type PaperOverlayVisibility = Record<PaperOverlayToggleKey, boolean>;
export const DEFAULT_PAPER_OVERLAY_VISIBILITY: PaperOverlayVisibility = {
ma: true,
ichimoku: true,
bollinger: true,
};
const MA_TYPES = new Set(['SMA', 'EMA']);
export const PAPER_OVERLAY_TOGGLE_ORDER: PaperOverlayToggleKey[] = [
'ma',
'ichimoku',
'bollinger',
];
export const PAPER_OVERLAY_LABELS: Record<PaperOverlayToggleKey, string> = {
ma: '이동평균선',
ichimoku: '일목균형표',
bollinger: '볼린저 밴드',
};
/** 우측 툴바 표시 설정 그룹 메뉴 헤더 */
export const PAPER_OVERLAY_MENU_TITLE = '표시 설정';
export function paperOverlayKeyForType(type: string): PaperOverlayToggleKey | null {
if (MA_TYPES.has(type)) return 'ma';
if (type === 'IchimokuCloud') return 'ichimoku';
if (type === 'BollingerBands') return 'bollinger';
return null;
}
export function applyPaperOverlayVisibility(
indicators: IndicatorConfig[],
visibility: PaperOverlayVisibility,
): IndicatorConfig[] {
return indicators.map(ind => {
const key = paperOverlayKeyForType(ind.type);
if (!key) return ind;
const visible = visibility[key];
return { ...ind, hidden: !visible };
});
}
/** 투자관리 차트 — 표시 설정 메뉴에 항상 노출할 오버레이 (지표 인스턴스 유무와 무관) */
const PAPER_OVERLAY_ALWAYS_MENU: PaperOverlayToggleKey[] = ['ma', 'bollinger'];
export function listPaperOverlayToggleItems(
indicators: IndicatorConfig[],
visibility: PaperOverlayVisibility,
): Array<{ key: PaperOverlayToggleKey; label: string; visible: boolean }> {
const present = new Set<PaperOverlayToggleKey>(PAPER_OVERLAY_ALWAYS_MENU);
for (const ind of indicators) {
const key = paperOverlayKeyForType(ind.type);
if (key) present.add(key);
}
return PAPER_OVERLAY_TOGGLE_ORDER
.filter(key => present.has(key))
.map(key => ({
key,
label: PAPER_OVERLAY_LABELS[key],
visible: visibility[key],
}));
}