|
|
@ -3,7 +3,6 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { map, shareReplay } from 'rxjs/operators';
|
|
|
|
import { map, shareReplay } from 'rxjs/operators';
|
|
|
|
import { DatasharingService } from '../../services/datasharing.service';
|
|
|
|
import { DatasharingService } from '../../services/datasharing.service';
|
|
|
|
import { SelfService } from '../../services/selfservice/self.service';
|
|
|
|
|
|
|
|
import { RequestService } from '../../services/request/request.service';
|
|
|
|
import { RequestService } from '../../services/request/request.service';
|
|
|
|
import { SettingsService } from '../../services/settings/settings.service';
|
|
|
|
import { SettingsService } from '../../services/settings/settings.service';
|
|
|
|
import { environment } from 'src/environments/environment';
|
|
|
|
import { environment } from 'src/environments/environment';
|
|
|
@ -23,7 +22,6 @@ export class MainNavigationComponent implements OnInit {
|
|
|
|
constructor(
|
|
|
|
constructor(
|
|
|
|
public overlayContainer: OverlayContainer,
|
|
|
|
public overlayContainer: OverlayContainer,
|
|
|
|
private data: DatasharingService,
|
|
|
|
private data: DatasharingService,
|
|
|
|
private selfservice: SelfService,
|
|
|
|
|
|
|
|
private settingsService: SettingsService,
|
|
|
|
private settingsService: SettingsService,
|
|
|
|
private requestservice: RequestService,
|
|
|
|
private requestservice: RequestService,
|
|
|
|
private breakpointObserver: BreakpointObserver,
|
|
|
|
private breakpointObserver: BreakpointObserver,
|
|
|
@ -75,6 +73,8 @@ export class MainNavigationComponent implements OnInit {
|
|
|
|
if (this.user.darkmode === true && this.lighttheme) {
|
|
|
|
if (this.user.darkmode === true && this.lighttheme) {
|
|
|
|
this.toggleTheme();
|
|
|
|
this.toggleTheme();
|
|
|
|
this.darkModeButtonChecked = true;
|
|
|
|
this.darkModeButtonChecked = true;
|
|
|
|
|
|
|
|
} else if (!this.user.darkmode && !this.lighttheme) {
|
|
|
|
|
|
|
|
this.settingsService.setDarkModeActive(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.updateLinks();
|
|
|
|
this.updateLinks();
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -86,30 +86,21 @@ export class MainNavigationComponent implements OnInit {
|
|
|
|
this.overlay.classList.add('light-theme');
|
|
|
|
this.overlay.classList.add('light-theme');
|
|
|
|
this.onSetTheme('light-theme');
|
|
|
|
this.onSetTheme('light-theme');
|
|
|
|
this.lighttheme = true;
|
|
|
|
this.lighttheme = true;
|
|
|
|
this.setDarkModeActive(false);
|
|
|
|
this.settingsService.setDarkModeActive(false);
|
|
|
|
} else if (this.overlay.classList.contains('light-theme')) {
|
|
|
|
} else if (this.overlay.classList.contains('light-theme')) {
|
|
|
|
this.overlay.classList.remove('light-theme');
|
|
|
|
this.overlay.classList.remove('light-theme');
|
|
|
|
this.overlay.classList.add('dark-theme');
|
|
|
|
this.overlay.classList.add('dark-theme');
|
|
|
|
this.onSetTheme('dark-theme');
|
|
|
|
this.onSetTheme('dark-theme');
|
|
|
|
this.lighttheme = false;
|
|
|
|
this.lighttheme = false;
|
|
|
|
this.setDarkModeActive(true);
|
|
|
|
this.settingsService.setDarkModeActive(true);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.overlay.classList.add('dark-theme');
|
|
|
|
this.overlay.classList.add('dark-theme');
|
|
|
|
this.onSetTheme('dark-theme');
|
|
|
|
this.onSetTheme('dark-theme');
|
|
|
|
this.lighttheme = false;
|
|
|
|
this.lighttheme = false;
|
|
|
|
this.setDarkModeActive(true);
|
|
|
|
this.settingsService.setDarkModeActive(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setDarkModeActive(active: boolean) {
|
|
|
|
|
|
|
|
const url = environment.graphQLUrl;
|
|
|
|
|
|
|
|
const headers = new Headers();
|
|
|
|
|
|
|
|
headers.set('Content-Type', 'application/json');
|
|
|
|
|
|
|
|
const body = this.settingsService.buildJsonDarkMode('darkmode: ' + '\'' + active + '\'');
|
|
|
|
|
|
|
|
this.http.post(url, body).subscribe(response => {
|
|
|
|
|
|
|
|
console.log(response.text()); });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateLinks() {
|
|
|
|
updateLinks() {
|
|
|
|
this.navLinksLoggedIn = [
|
|
|
|
this.navLinksLoggedIn = [
|
|
|
|
{ path: '', label: 'Home' },
|
|
|
|
{ path: '', label: 'Home' },
|
|
|
|