Add conditional
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { CommonModule, isPlatformBrowser } from '@angular/common';
|
import { CommonModule, isPlatformBrowser } from '@angular/common';
|
||||||
import { Component, computed, inject, PLATFORM_ID } from '@angular/core';
|
import { Component, computed, inject, PLATFORM_ID, Signal, signal } from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { $t, updatePreset, updateSurfacePalette } from '@primeng/themes';
|
import { $t, updatePreset, updateSurfacePalette } from '@primeng/themes';
|
||||||
import Aura from '@primeng/themes/aura';
|
import Aura from '@primeng/themes/aura';
|
||||||
@@ -8,6 +8,8 @@ import Nora from '@primeng/themes/nora';
|
|||||||
import { PrimeNG } from 'primeng/config';
|
import { PrimeNG } from 'primeng/config';
|
||||||
import { SelectButtonModule } from 'primeng/selectbutton';
|
import { SelectButtonModule } from 'primeng/selectbutton';
|
||||||
import { LayoutService } from '../service/layout.service';
|
import { LayoutService } from '../service/layout.service';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
|
|
||||||
const presets = {
|
const presets = {
|
||||||
Aura,
|
Aura,
|
||||||
@@ -79,7 +81,7 @@ declare type SurfacesType = {
|
|||||||
<span class="text-sm text-muted-color font-semibold">Presets</span>
|
<span class="text-sm text-muted-color font-semibold">Presets</span>
|
||||||
<p-selectbutton [options]="presets" [ngModel]="selectedPreset()" (ngModelChange)="onPresetChange($event)" [allowEmpty]="false" size="small" />
|
<p-selectbutton [options]="presets" [ngModel]="selectedPreset()" (ngModelChange)="onPresetChange($event)" [allowEmpty]="false" size="small" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-2">
|
<div *ngIf="showMenuModeButton()" class="flex flex-col gap-2">
|
||||||
<span class="text-sm text-muted-color font-semibold">Menu Mode</span>
|
<span class="text-sm text-muted-color font-semibold">Menu Mode</span>
|
||||||
<p-selectbutton [ngModel]="menuMode()" (ngModelChange)="onMenuModeChange($event)" [options]="menuModeOptions" [allowEmpty]="false" size="small" />
|
<p-selectbutton [ngModel]="menuMode()" (ngModelChange)="onMenuModeChange($event)" [options]="menuModeOptions" [allowEmpty]="false" size="small" />
|
||||||
</div>
|
</div>
|
||||||
@@ -90,6 +92,9 @@ declare type SurfacesType = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
export class AppConfigurator {
|
export class AppConfigurator {
|
||||||
|
|
||||||
|
router = inject(Router);
|
||||||
|
|
||||||
config: PrimeNG = inject(PrimeNG);
|
config: PrimeNG = inject(PrimeNG);
|
||||||
|
|
||||||
layoutService: LayoutService = inject(LayoutService);
|
layoutService: LayoutService = inject(LayoutService);
|
||||||
@@ -100,6 +105,8 @@ export class AppConfigurator {
|
|||||||
|
|
||||||
presets = Object.keys(presets);
|
presets = Object.keys(presets);
|
||||||
|
|
||||||
|
showMenuModeButton = signal(!this.router.url.includes('auth'));
|
||||||
|
|
||||||
menuModeOptions = [
|
menuModeOptions = [
|
||||||
{ label: 'Static', value: 'static' },
|
{ label: 'Static', value: 'static' },
|
||||||
{ label: 'Overlay', value: 'overlay' }
|
{ label: 'Overlay', value: 'overlay' }
|
||||||
|
|||||||
Reference in New Issue
Block a user