2020-12-17 20:53:22 +00:00
|
|
|
import darktheme from '../AppDarkTheme.module.css';
|
|
|
|
import lighttheme from '../AppLightTheme.module.css';
|
2020-08-03 23:31:43 +00:00
|
|
|
|
2020-08-12 17:50:25 +00:00
|
|
|
/**
|
|
|
|
* This class is available for all components in project
|
|
|
|
* it contains general infos about app - like theme
|
|
|
|
*/
|
2020-08-05 22:00:55 +02:00
|
|
|
class StaticInfos {
|
2021-02-23 16:01:29 +00:00
|
|
|
private darktheme: boolean = true;
|
|
|
|
private videopath: string = ""
|
2020-07-27 21:14:56 +02:00
|
|
|
|
2020-08-12 17:50:25 +00:00
|
|
|
/**
|
|
|
|
* check if the current theme is the dark theme
|
|
|
|
* @returns {boolean} is dark theme?
|
|
|
|
*/
|
2021-02-23 16:01:29 +00:00
|
|
|
isDarkTheme(): boolean {
|
|
|
|
return this.darktheme;
|
2020-07-24 22:47:21 +02:00
|
|
|
};
|
2020-07-27 21:14:56 +02:00
|
|
|
|
2020-08-12 17:50:25 +00:00
|
|
|
/**
|
|
|
|
* setter to enable or disable the dark or light theme
|
|
|
|
* @param enable enable the dark theme?
|
|
|
|
*/
|
2021-02-23 16:01:29 +00:00
|
|
|
enableDarkTheme(enable = true): void {
|
|
|
|
this.darktheme = enable;
|
2021-03-14 12:49:24 +00:00
|
|
|
this.handlers.map(func => {
|
|
|
|
return func();
|
|
|
|
})
|
2020-07-27 21:14:56 +02:00
|
|
|
}
|
2020-08-03 23:31:43 +00:00
|
|
|
|
2020-08-12 17:50:25 +00:00
|
|
|
/**
|
|
|
|
* get the currently selected theme stylesheet
|
|
|
|
* @returns {*} the style object of the current active theme
|
|
|
|
*/
|
2021-02-23 16:01:29 +00:00
|
|
|
getThemeStyle(): { [_: string]: string } {
|
2020-08-03 23:31:43 +00:00
|
|
|
return this.isDarkTheme() ? darktheme : lighttheme;
|
|
|
|
}
|
2021-02-23 16:01:29 +00:00
|
|
|
|
2021-03-14 12:49:24 +00:00
|
|
|
handlers: (() => void)[] = [];
|
|
|
|
onThemeChange(func: () => void): void {
|
|
|
|
this.handlers.push(func);
|
|
|
|
}
|
|
|
|
|
2021-02-23 16:01:29 +00:00
|
|
|
/**
|
|
|
|
* set the current videopath
|
|
|
|
* @param vidpath videopath with beginning and ending slash
|
|
|
|
*/
|
|
|
|
setVideoPath(vidpath: string): void {
|
|
|
|
this.videopath = vidpath;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* return the current videopath
|
|
|
|
*/
|
|
|
|
getVideoPath(): string {
|
|
|
|
return this.videopath;
|
|
|
|
}
|
2020-07-24 22:47:21 +02:00
|
|
|
}
|
|
|
|
|
2020-08-05 22:00:55 +02:00
|
|
|
const GlobalInfos = new StaticInfos();
|
|
|
|
export default GlobalInfos;
|