mobile download

This commit is contained in:
Macbook
2026-05-28 14:44:19 +09:00
parent e2816b037f
commit 3503ef33f5
152 changed files with 11021 additions and 687 deletions
+22 -24
View File
@@ -1,4 +1,5 @@
/** 전략편집기 우측 팔레트 — 보조·복합 지표 목록 (localStorage) */
/** 전략편집기 우측 팔레트 — 보조·복합 지표 목록 (DB ui_preferences) */
import { getUiPreferences, patchUiPreferences } from './uiPreferencesDb';
import { COMPOSITE_INDICATOR_ITEMS } from './compositeIndicators';
export type PaletteItemKind = 'auxiliary' | 'composite';
@@ -18,9 +19,6 @@ export interface PaletteItem {
builtIn?: boolean;
}
const STORAGE_AUX = 'se-palette-auxiliary-v1';
const STORAGE_COMP = 'se-palette-composite-v1';
export const DEFAULT_AUXILIARY_ITEMS: Omit<PaletteItem, 'id' | 'kind'>[] = [
{ value: 'RSI', label: 'RSI', desc: '상대강도지수', builtIn: true },
{ value: 'MACD', label: 'MACD', desc: '이동평균 수렴확산', builtIn: true },
@@ -111,32 +109,32 @@ function mergeMissingBuiltIns(
}
export function loadPaletteItems(kind: PaletteItemKind): PaletteItem[] {
const key = kind === 'auxiliary' ? STORAGE_AUX : STORAGE_COMP;
const defaults = kind === 'auxiliary' ? DEFAULT_AUXILIARY_ITEMS : DEFAULT_COMPOSITE_ITEMS;
try {
const stored = parseStored(localStorage.getItem(key));
if (stored && stored.length > 0) {
return mergeMissingBuiltIns(
stored.map(i => ({
...i,
kind,
...(i.builtIn
? { period: undefined, shortPeriod: undefined, longPeriod: undefined }
: {}),
})),
const prefs = getUiPreferences().strategyEditor;
const raw = kind === 'auxiliary' ? prefs?.paletteAuxiliary : prefs?.paletteComposite;
const stored = raw?.length ? raw : null;
if (stored && stored.length > 0) {
return mergeMissingBuiltIns(
stored.map(i => ({
...i,
kind,
defaults,
);
}
} catch { /* ignore */ }
...(i.builtIn
? { period: undefined, shortPeriod: undefined, longPeriod: undefined }
: {}),
})),
kind,
defaults,
);
}
return seedItems(kind, defaults);
}
export function savePaletteItems(kind: PaletteItemKind, items: PaletteItem[]): void {
const key = kind === 'auxiliary' ? STORAGE_AUX : STORAGE_COMP;
try {
localStorage.setItem(key, JSON.stringify(items));
} catch { /* ignore */ }
if (kind === 'auxiliary') {
patchUiPreferences({ strategyEditor: { paletteAuxiliary: items } });
} else {
patchUiPreferences({ strategyEditor: { paletteComposite: items } });
}
}
export function resetPaletteItems(kind: PaletteItemKind): PaletteItem[] {