Skip to content

Commit

Permalink
Set theme already on the login page #587
Browse files Browse the repository at this point in the history
  • Loading branch information
bpatrik committed Aug 9, 2023
1 parent 9959048 commit d35d9e8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
7 changes: 4 additions & 3 deletions src/frontend/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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> {
Expand Down
8 changes: 6 additions & 2 deletions src/frontend/app/model/theme.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 0 additions & 2 deletions src/frontend/app/ui/login/login.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

.card {
min-width: 400px;
background-color: #F7F7F7;
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
}

.error-message {
Expand Down
3 changes: 0 additions & 3 deletions src/frontend/app/ui/sharelogin/share-login.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@

.card {
min-width: 400px;
background-color: #F7F7F7;
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);

}

.error-message {
Expand Down

0 comments on commit d35d9e8

Please sign in to comment.