mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
Set theme already on the login page #587
This commit is contained in:
parent
99590487b2
commit
d35d9e88e6
@ -1,12 +1,12 @@
|
||||
import {Component, OnDestroy, OnInit} from '@angular/core';
|
||||
import {AuthenticationService} from './model/network/authentication.service';
|
||||
import {Router} from '@angular/router';
|
||||
import {Config} from '../../common/config/public/Config';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {ShareService} from './ui/gallery/share.service';
|
||||
import 'hammerjs';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {NavigationService} from './model/navigation.service';
|
||||
import {ThemeService} from './model/theme.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pi-gallery2',
|
||||
@ -17,12 +17,13 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
private subscription: Subscription = null;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private authenticationService: AuthenticationService,
|
||||
private shareService: ShareService,
|
||||
private navigation: NavigationService,
|
||||
private title: Title
|
||||
private title: Title,
|
||||
private themeService: ThemeService
|
||||
) {
|
||||
themeService.init();
|
||||
}
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
|
@ -14,8 +14,12 @@ export class ThemeService {
|
||||
public readonly matcher = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
|
||||
constructor(private cachingService: GalleryCacheService) {
|
||||
if (cachingService.getThemeMode()) {
|
||||
this.setMode(cachingService.getThemeMode());
|
||||
this.init();
|
||||
}
|
||||
|
||||
public init() {
|
||||
if (this.cachingService.getThemeMode()) {
|
||||
this.setMode(this.cachingService.getThemeMode());
|
||||
} else {
|
||||
this.setMode(Config.Gallery.Themes.defaultMode);
|
||||
}
|
||||
|
@ -8,8 +8,6 @@
|
||||
|
||||
.card {
|
||||
min-width: 400px;
|
||||
background-color: #F7F7F7;
|
||||
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.error-message {
|
||||
|
@ -24,9 +24,6 @@
|
||||
|
||||
.card {
|
||||
min-width: 400px;
|
||||
background-color: #F7F7F7;
|
||||
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
|
||||
|
||||
}
|
||||
|
||||
.error-message {
|
||||
|
Loading…
x
Reference in New Issue
Block a user