tigger пре 1 година
родитељ
комит
71b57f63dd
3 измењених фајлова са 3 додато и 25 уклоњено
  1. 2 2
      src/app/app.component.html
  2. 0 22
      src/app/app.component.ts
  3. 1 1
      src/dependencies/angularlib

+ 2 - 2
src/app/app.component.html

@@ -112,7 +112,7 @@
     {name:'theme',label:'main'|tr:'Blue',color:"#3F51B6"},
     {name:'theme',label:'main'|tr:'Blue',color:"#3F51B6"},
     {name:'theme-pink',label:'pink'|tr:'Pink',color:"#e91e63"}
     {name:'theme-pink',label:'pink'|tr:'Pink',color:"#e91e63"}
   ]; track $index) {
   ]; track $index) {
-    <button mat-menu-item (click)="changeTheme(theme.name)">
+    <button mat-menu-item (click)="cs.theming.changeTheme(theme.name)">
       <mat-icon style="color:{{theme.color}}">fiber_manual_record</mat-icon>
       <mat-icon style="color:{{theme.color}}">fiber_manual_record</mat-icon>
       {{theme.label}}</button>
       {{theme.label}}</button>
   }
   }
@@ -123,7 +123,7 @@
     {name:'dark-theme',label:'main'|tr:'Blue',color:"#3F51B6"},
     {name:'dark-theme',label:'main'|tr:'Blue',color:"#3F51B6"},
     {name:'dark-theme-pink',label:'pink'|tr:'Pink',color:"#e91e63"}
     {name:'dark-theme-pink',label:'pink'|tr:'Pink',color:"#e91e63"}
   ]; track $index) {
   ]; track $index) {
-    <button mat-menu-item (click)="changeTheme(theme.name)">
+    <button mat-menu-item (click)="cs.theming.changeTheme(theme.name)">
       <mat-icon style="color:{{theme.color}}">fiber_manual_record</mat-icon>
       <mat-icon style="color:{{theme.color}}">fiber_manual_record</mat-icon>
       {{theme.label}}</button>
       {{theme.label}}</button>
   }
   }

+ 0 - 22
src/app/app.component.ts

@@ -75,7 +75,6 @@ export class AppComponent extends BaseComponent implements OnInit {
   }
   }
 
 
   ngOnInit(): void {
   ngOnInit(): void {
-    this.setDefaultTheme();
     this.router.events.pipe(untilDestroy(this),
     this.router.events.pipe(untilDestroy(this),
     filter((event) => event instanceof RoutesRecognized),
     filter((event) => event instanceof RoutesRecognized),
     map((res:any) => {
     map((res:any) => {
@@ -111,27 +110,6 @@ export class AppComponent extends BaseComponent implements OnInit {
     this.store.dispatch(new ChangeLanguage(language));
     this.store.dispatch(new ChangeLanguage(language));
   }
   }
 
 
-  protected setDefaultTheme() {
-    if (localStorage.getItem('theme')) {
-      this.theme = localStorage.getItem('theme') as string;
-      const body = document.getElementsByTagName('body')[0];
-      body.classList.add(this.theme);
-    }
-  }
-
-  /**
-   * change application theme
-   * @param {string} theme theme name 
-   */
-  protected changeTheme(theme: string) {
-    const body = document.getElementsByTagName('body')[0];
-    body.classList.remove(this.theme);
-    this.theme = theme;
-    body.classList.add(this.theme);
-    localStorage.setItem('theme',this.theme);
-    this.store.dispatch(new ChangeTheme(this.theme));
-  }
-
   protected addNotification() {
   protected addNotification() {
     this.store.dispatch(new Notification.Add({
     this.store.dispatch(new Notification.Add({
       message:{title:generateId(),desc:generateId(),timestamp: new Date()}
       message:{title:generateId(),desc:generateId(),timestamp: new Date()}

+ 1 - 1
src/dependencies/angularlib

@@ -1 +1 @@
-Subproject commit c88d02ba2fbd0bf97834cd2a11fb0f5a73e88a65
+Subproject commit a3a655bb4703c53ad0fe7f9aabc884cc0af965c8