/** * MainChartSettingsModal * 메인 차트(캔들스틱) 설정 다이얼로그 — TradingView Settings 와 유사. * 탭: Symbol (캔들 색상) / 스타일 / 가시성 (미래 확장용) */ import React, { useState } from 'react'; import type { MainChartStyle } from '../types'; import { useDraggablePanel } from '../hooks/useDraggablePanel'; interface Props { style: MainChartStyle; onSave: (style: MainChartStyle) => void; onCancel: () => void; } type Tab = 'symbol'; const TABS: { id: Tab; label: string }[] = [ { id: 'symbol', label: '심볼 (Symbol)' }, ]; const ColorSwatch: React.FC<{ value: string; onChange: (v: string) => void }> = ({ value, onChange }) => { const hex6 = value.slice(0, 7); return ( onChange(e.target.value)} /> ); }; const MainChartSettingsModal: React.FC = ({ style, onSave, onCancel }) => { const [tab, setTab] = useState('symbol'); const [draft, setDraft] = useState({ ...style }); const { panelRef, dragging, onHeaderPointerDown, headerTouchStyle, panelStyle, headerCursor, } = useDraggablePanel({ centerOnMount: true }); const set = (key: keyof MainChartStyle) => (v: string) => setDraft(prev => ({ ...prev, [key]: v })); const handleOk = () => onSave(draft); const handleDefaults = () => setDraft({ upColor: '#ff6b6b', downColor: '#4dabf7', borderUpColor: '#ff6b6b', borderDownColor: '#4dabf7', wickUpColor: '#ff6b6b', wickDownColor: '#4dabf7', }); return ( e.target === e.currentTarget && onCancel()}> e.stopPropagation()} > 차트 설정 (Settings) ✕ {TABS.map(t => ( setTab(t.id)} > {t.label} ))} {tab === 'symbol' && ( <> 캔들 (CANDLES) 상승 (Up) 하락 (Down) > )} 기본값 취소 확인 ); }; export default MainChartSettingsModal;