disable selector when forcing custom theme

This commit is contained in:
Mononaut 2024-05-07 23:31:51 +00:00
parent 4c697d0008
commit 788a95b260
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
2 changed files with 14 additions and 8 deletions

View File

@ -17,7 +17,7 @@ export class ThemeService {
private storageService: StorageService, private storageService: StorageService,
private stateService: StateService, private stateService: StateService,
) { ) {
const theme = this.storageService.getValue('theme-preference') || this.stateService.env.customize?.theme || 'default'; const theme = this.stateService.env.customize?.theme || this.storageService.getValue('theme-preference') || 'default';
this.apply(theme); this.apply(theme);
} }
@ -44,7 +44,9 @@ export class ThemeService {
this.style = null; this.style = null;
} }
} }
if (!this.stateService.env.customize?.theme) {
this.storageService.setValue('theme-preference', theme); this.storageService.setValue('theme-preference', theme);
}
this.themeChanged$.next(this.theme); this.themeChanged$.next(this.theme);
} }
} }

View File

@ -27,17 +27,21 @@
<div class="selector"> <div class="selector">
<app-rate-unit-selector></app-rate-unit-selector> <app-rate-unit-selector></app-rate-unit-selector>
</div> </div>
@if (!env.customize?.theme) {
<div class="selector d-none d-sm-flex"> <div class="selector d-none d-sm-flex">
<app-theme-selector></app-theme-selector> <app-theme-selector></app-theme-selector>
</div> </div>
}
<a *ngIf="stateService.isMempoolSpaceBuild" class="btn btn-purple sponsor d-none d-sm-flex justify-content-center" [routerLink]="['/login' | relativeUrl]"> <a *ngIf="stateService.isMempoolSpaceBuild" class="btn btn-purple sponsor d-none d-sm-flex justify-content-center" [routerLink]="['/login' | relativeUrl]">
<span *ngIf="loggedIn" i18n="shared.my-account" class="nowrap">My Account</span> <span *ngIf="loggedIn" i18n="shared.my-account" class="nowrap">My Account</span>
<span *ngIf="!loggedIn" i18n="shared.sign-in" class="nowrap">Sign In</span> <span *ngIf="!loggedIn" i18n="shared.sign-in" class="nowrap">Sign In</span>
</a> </a>
</div> </div>
@if (!env.customize?.theme) {
<div class="selector d-flex d-sm-none justify-content-center ml-auto mr-auto mt-0"> <div class="selector d-flex d-sm-none justify-content-center ml-auto mr-auto mt-0">
<app-theme-selector></app-theme-selector> <app-theme-selector></app-theme-selector>
</div> </div>
}
@if (!enterpriseInfo?.footer_img) { @if (!enterpriseInfo?.footer_img) {
<a *ngIf="stateService.isMempoolSpaceBuild" class="btn btn-purple sponsor d-flex d-sm-none justify-content-center ml-auto mr-auto mt-0 mb-2" [routerLink]="['/login' | relativeUrl]"> <a *ngIf="stateService.isMempoolSpaceBuild" class="btn btn-purple sponsor d-flex d-sm-none justify-content-center ml-auto mr-auto mt-0 mb-2" [routerLink]="['/login' | relativeUrl]">
<span *ngIf="loggedIn" i18n="shared.my-account" class="nowrap">My Account</span> <span *ngIf="loggedIn" i18n="shared.my-account" class="nowrap">My Account</span>