모의투자 로직 변경
This commit is contained in:
@@ -33,6 +33,7 @@ import {
|
||||
import TradeAlertPopupPreview from './TradeAlertPopupPreview';
|
||||
import TrendSearchSettingsPanel from './trendSearch/TrendSearchSettingsPanel';
|
||||
import type { TrendSearchAppSettings } from '../utils/trendSearchAppSettings';
|
||||
import { isTradingSettingsCategory } from '../utils/tradingAccess';
|
||||
import {
|
||||
CHART_LEGEND_SETTING_ITEMS,
|
||||
type ChartLegendVisibility,
|
||||
@@ -168,6 +169,9 @@ interface SettingsPageProps {
|
||||
onTrendSearchSettingsChange?: (s: TrendSearchAppSettings) => void;
|
||||
/** 설정 화면 진입 시 선택할 카테고리 (예: 모의투자 화면에서 링크) */
|
||||
initialCategory?: SettingsCategoryId;
|
||||
/** 정식 로그인 여부 (게스트는 매매·전략 설정 탭 차단) */
|
||||
isFormalLogin?: boolean;
|
||||
onRequireFormalLogin?: () => void;
|
||||
}
|
||||
|
||||
// ── 카테고리 정의 ────────────────────────────────────────────────────────────
|
||||
@@ -1743,6 +1747,8 @@ const SettingsPage: React.FC<SettingsPageProps> = ({
|
||||
trendSearchSettings,
|
||||
onTrendSearchSettingsChange,
|
||||
initialCategory,
|
||||
isFormalLogin = true,
|
||||
onRequireFormalLogin,
|
||||
}) => {
|
||||
const categories = filterCategories(menuPermissions);
|
||||
const [active, setActive] = useState<CategoryId>(initialCategory ?? 'general');
|
||||
@@ -1757,10 +1763,14 @@ const SettingsPage: React.FC<SettingsPageProps> = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (!initialCategory) return;
|
||||
if (!isFormalLogin && isTradingSettingsCategory(initialCategory)) {
|
||||
onRequireFormalLogin?.();
|
||||
return;
|
||||
}
|
||||
if (categories.some(c => c.id === initialCategory)) {
|
||||
setActive(initialCategory);
|
||||
}
|
||||
}, [initialCategory, categories]);
|
||||
}, [initialCategory, categories, isFormalLogin, onRequireFormalLogin]);
|
||||
|
||||
useEffect(() => {
|
||||
if (active !== 'indicators') setIndicatorSaveUi(null);
|
||||
@@ -1948,7 +1958,13 @@ const SettingsPage: React.FC<SettingsPageProps> = ({
|
||||
<button
|
||||
key={cat.id}
|
||||
className={`stg-sidebar-item ${active === cat.id ? 'stg-sidebar-item--active' : ''}`}
|
||||
onClick={() => setActive(cat.id)}
|
||||
onClick={() => {
|
||||
if (!isFormalLogin && isTradingSettingsCategory(cat.id)) {
|
||||
onRequireFormalLogin?.();
|
||||
return;
|
||||
}
|
||||
setActive(cat.id);
|
||||
}}
|
||||
>
|
||||
<span className="stg-sidebar-icon">{cat.icon}</span>
|
||||
<span className="stg-sidebar-label" style={{ fontSize: 13.5, fontWeight: 'inherit' }}>{cat.label}</span>
|
||||
|
||||
Reference in New Issue
Block a user