mobile download
This commit is contained in:
@@ -40,30 +40,18 @@ import LayoutPicker from './LayoutPicker';
|
||||
import { DEFAULT_SYNC, type LayoutDef, type SyncOptions } from '../utils/layoutTypes';
|
||||
import { loadStrategies } from '../utils/backendApi';
|
||||
|
||||
const LOCAL_BT_KEY = 'gc_strat_v2';
|
||||
|
||||
interface BtStrategy { id?: number; name: string; source: 'db' | 'local'; buyCondition?: unknown; sellCondition?: unknown; }
|
||||
interface BtStrategy { id?: number; name: string; source: 'db'; buyCondition?: unknown; sellCondition?: unknown; }
|
||||
|
||||
function loadBtStrategies(): Promise<BtStrategy[]> {
|
||||
return loadStrategies()
|
||||
.then(list => {
|
||||
if (list && list.length > 0) {
|
||||
return list.map(s => ({ id: s.id, name: s.name, source: 'db' as const, buyCondition: s.buyCondition, sellCondition: s.sellCondition }));
|
||||
}
|
||||
// localStorage 폴백
|
||||
try {
|
||||
const local: { id?: number; name: string; buyCondition?: unknown; sellCondition?: unknown }[] =
|
||||
JSON.parse(localStorage.getItem(LOCAL_BT_KEY) ?? '[]');
|
||||
return local.map(s => ({ id: s.id, name: s.name, source: 'local' as const, buyCondition: s.buyCondition, sellCondition: s.sellCondition }));
|
||||
} catch { return []; }
|
||||
})
|
||||
.catch(() => {
|
||||
try {
|
||||
const local: { id?: number; name: string; buyCondition?: unknown; sellCondition?: unknown }[] =
|
||||
JSON.parse(localStorage.getItem(LOCAL_BT_KEY) ?? '[]');
|
||||
return local.map(s => ({ id: s.id, name: s.name, source: 'local' as const, buyCondition: s.buyCondition, sellCondition: s.sellCondition }));
|
||||
} catch { return []; }
|
||||
});
|
||||
.then(list => (list ?? []).map(s => ({
|
||||
id: s.id,
|
||||
name: s.name,
|
||||
source: 'db' as const,
|
||||
buyCondition: s.buyCondition,
|
||||
sellCondition: s.sellCondition,
|
||||
})))
|
||||
.catch(() => []);
|
||||
}
|
||||
|
||||
export interface ToolbarProps {
|
||||
@@ -98,6 +86,8 @@ export interface ToolbarProps {
|
||||
/** 매매 시그널 알림 (미확인 개수) */
|
||||
tradeNotifyUnread?: number;
|
||||
onOpenTradeNotifications?: () => void;
|
||||
/** 모바일 앱 다운로드 */
|
||||
onOpenAppDownload?: () => void;
|
||||
/** 자석모드 현재 상태 */
|
||||
magnetMode?: 'off' | 'weak' | 'strong';
|
||||
/** 자석모드 토글 (off↔strong) */
|
||||
@@ -233,6 +223,14 @@ const IcBell = () => (
|
||||
<circle cx="7.5" cy="13" r="0.8" fill="currentColor" stroke="none"/>
|
||||
</svg>
|
||||
);
|
||||
/** 모바일 앱 다운로드 */
|
||||
const IcAppDownload = () => (
|
||||
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round">
|
||||
<rect x="4" y="1.5" width="7" height="12" rx="1.5"/>
|
||||
<line x1="7.5" y1="9" x2="7.5" y2="12"/>
|
||||
<polyline points="5.5,10.5 7.5,12.5 9.5,10.5"/>
|
||||
</svg>
|
||||
);
|
||||
/** 매매 시그널 알림 (번개 아이콘으로 가격 알림 벨과 구분) */
|
||||
const IcTradeSignal = () => (
|
||||
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
|
||||
@@ -785,7 +783,7 @@ const Toolbar: React.FC<ToolbarProps> = ({
|
||||
onFitContent, onScrollToNow, onAddIndicator, onAddIndicators, onIndicatorOrderChange, onRemoveByType,
|
||||
onAutoFib, onClearFib, onScreenshot,
|
||||
onToggleStats, onToggleWatch, onToggleAlert,
|
||||
tradeNotifyUnread = 0, onOpenTradeNotifications,
|
||||
tradeNotifyUnread = 0, onOpenTradeNotifications, onOpenAppDownload,
|
||||
magnetMode = 'off', onToggleMagnet,
|
||||
onFullscreen, onUndo, onRedo, canUndo, canRedo, onClearDrawings,
|
||||
onToggleGrid,
|
||||
@@ -1091,7 +1089,6 @@ const Toolbar: React.FC<ToolbarProps> = ({
|
||||
<li key={i} className="bt-drop-item">
|
||||
<span className="bt-drop-name">
|
||||
{s.name}
|
||||
{s.source === 'local' && <span className="bt-drop-local-badge">로컬</span>}
|
||||
</span>
|
||||
<button
|
||||
className={`bt-drop-run${isRunning ? ' running' : ''}`}
|
||||
@@ -1283,6 +1280,16 @@ const Toolbar: React.FC<ToolbarProps> = ({
|
||||
</svg>
|
||||
</button>
|
||||
)}
|
||||
{onOpenAppDownload && (
|
||||
<button
|
||||
className="tv-icon-btn"
|
||||
onClick={onOpenAppDownload}
|
||||
title="GoldenChart 모바일 앱 다운로드"
|
||||
aria-label="앱 다운로드"
|
||||
>
|
||||
<IcAppDownload />
|
||||
</button>
|
||||
)}
|
||||
{onOpenTradeNotifications && (
|
||||
<span className="tv-trade-notify-wrap">
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user