create-bar-project
Version:
This module helps create a base for web application projects.
52 lines (41 loc) • 1.15 kB
text/typescript
import { themeKey, themes } from 'ui-kit/src/Common/Themes';
import { setStorageItem } from 'Common/Utils/Storage';
import { action, computed, observable } from 'mobx';
import { defaultTheme, Theme } from 'ui-kit/src/Theme';
export default class UiStore {
private blocked = true; // this is true at the start because we try to login at the start of the web application - see App and AdminRoute
private sidebarOpen = false;
private currentTheme: Theme = defaultTheme;
public get getBlockedUi(): boolean {
return this.blocked;
}
public get getSideBarOpen(): boolean {
return this.sidebarOpen;
}
public get theme(): Theme {
return this.currentTheme;
}
public blockUI(): void {
this.blocked = true;
}
public unBlockUI(): void {
this.blocked = false;
}
public setSidebarOpen(value: boolean): void {
this.sidebarOpen = value;
}
public setThemeByName(themeName: themeKey): void {
this.currentTheme = themes[themeName];
setStorageItem('theme', themeName);
}
}