Загрузка данных


import { getThemeStore } from '@src/theme';
import { SettingField, SettingsTab, SettingsValues } from '@src/types';

export interface VolumeProfileStyle {
  areaFillColor: string;
  buyFillColor: string;
  sellFillColor: string;
  pocLineColor: string;
  borderColor: string;
}

export type VolumeProfileSettings = SettingsValues & VolumeProfileStyle;

export function createDefaultSettings(): VolumeProfileSettings {
  const { colors } = getThemeStore();

  return {
    areaFillColor: colors.volumeProfileAreaFill,
    buyFillColor: colors.volumeProfileBuyFill,
    sellFillColor: colors.volumeProfileSellFill,
    pocLineColor: colors.volumeProfilePocLine,
    borderColor: colors.chartLineColor,
  };
}

export function getVolumeProfileSettingsTabs(settings: VolumeProfileSettings): SettingsTab[] {
  const fields: SettingField[] = [
    {
      key: 'areaFillColor',
      label: 'Цвет области',
      type: 'color',
      defaultValue: settings.areaFillColor,
    },
    {
      key: 'buyFillColor',
      label: 'Цвет buy-зоны',
      type: 'color',
      defaultValue: settings.buyFillColor,
    },
    {
      key: 'sellFillColor',
      label: 'Цвет sell-зоны',
      type: 'color',
      defaultValue: settings.sellFillColor,
    },
    {
      key: 'pocLineColor',
      label: 'Цвет POC-линии',
      type: 'color',
      defaultValue: settings.pocLineColor,
    },
    {
      key: 'borderColor',
      label: 'Цвет границы',
      type: 'color',
      defaultValue: settings.borderColor,
    },
  ];

  return [{ key: 'style', label: 'Стиль', fields }];
}