mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-11 02:33:51 +00:00
44 lines
948 B
TypeScript
44 lines
948 B
TypeScript
import { defineStore } from 'pinia';
|
|
|
|
import { setTimezone } from '@/shared/formatters';
|
|
|
|
const STORE_UI_SETTINGS = 'ftUISettings';
|
|
|
|
export enum OpenTradeVizOptions {
|
|
showPill = 'showPill',
|
|
asTitle = 'asTitle',
|
|
noOpenTrades = 'noOpenTrades',
|
|
}
|
|
|
|
export interface SettingsType {
|
|
openTradesInTitle?: string;
|
|
timezone?: string;
|
|
backgroundSync?: boolean;
|
|
}
|
|
|
|
export const useSettingsStore = defineStore('uiSettings', {
|
|
// other options...
|
|
state: () => {
|
|
return {
|
|
openTradesInTitle: OpenTradeVizOptions.showPill as string,
|
|
timezone: 'UTC',
|
|
backgroundSync: true,
|
|
};
|
|
},
|
|
actions: {
|
|
setOpenTradesInTitle(locked: string) {
|
|
this.openTradesInTitle = locked;
|
|
},
|
|
setTimeZone(timezone: string) {
|
|
setTimezone(timezone);
|
|
this.timezone = timezone;
|
|
},
|
|
setBackgroundSync(value: boolean) {
|
|
this.backgroundSync = value;
|
|
},
|
|
},
|
|
persist: {
|
|
key: STORE_UI_SETTINGS,
|
|
},
|
|
});
|