mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-02-25 01:14:06 +01:00
parent
f4890b1338
commit
ef740d7b1c
24 changed files with 1580 additions and 116 deletions
|
|
@ -50,9 +50,34 @@ export class DashboardComponent implements OnDestroy {
|
|||
];
|
||||
|
||||
statusCardsByThemes: {
|
||||
default: CardSettings[];
|
||||
cosmic: CardSettings[];
|
||||
corporate: CardSettings[];
|
||||
dark: CardSettings[];
|
||||
'material-dark': CardSettings[];
|
||||
'material-light': CardSettings[];
|
||||
} = {
|
||||
default: this.commonStatusCardsSet,
|
||||
cosmic: this.commonStatusCardsSet,
|
||||
corporate: [
|
||||
{
|
||||
...this.lightCard,
|
||||
type: 'warning',
|
||||
},
|
||||
{
|
||||
...this.rollerShadesCard,
|
||||
type: 'primary',
|
||||
},
|
||||
{
|
||||
...this.wirelessAudioCard,
|
||||
type: 'danger',
|
||||
},
|
||||
{
|
||||
...this.coffeeMakerCard,
|
||||
type: 'info',
|
||||
},
|
||||
],
|
||||
dark: this.commonStatusCardsSet,
|
||||
'material-dark': this.commonStatusCardsSet,
|
||||
'material-light': this.commonStatusCardsSet,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,19 @@
|
|||
import { Component, EventEmitter, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, HostBinding, OnDestroy, OnInit, Output } from '@angular/core';
|
||||
import { Location, LocationStrategy } from '@angular/common';
|
||||
import { NbThemeService } from '@nebular/theme';
|
||||
import { map, takeUntil } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-room-selector',
|
||||
templateUrl: './room-selector.component.html',
|
||||
styleUrls: ['./room-selector.component.scss'],
|
||||
})
|
||||
export class RoomSelectorComponent {
|
||||
export class RoomSelectorComponent implements OnInit, OnDestroy {
|
||||
|
||||
private destroy$ = new Subject<void>();
|
||||
private hideGrid: boolean;
|
||||
|
||||
@Output() select: EventEmitter<number> = new EventEmitter();
|
||||
|
||||
selectedRoom = null;
|
||||
|
|
@ -59,10 +66,35 @@ export class RoomSelectorComponent {
|
|||
],
|
||||
};
|
||||
|
||||
constructor(private location: Location, private locationStrategy: LocationStrategy) {
|
||||
@HostBinding('style.background')
|
||||
get background(): 'none' | null {
|
||||
return this.hideGrid ? 'none' : null;
|
||||
}
|
||||
|
||||
constructor(
|
||||
private location: Location,
|
||||
private locationStrategy: LocationStrategy,
|
||||
private themeService: NbThemeService,
|
||||
) {
|
||||
this.selectRoom('2');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.hideGrid = this.themeService.currentTheme === 'corporate';
|
||||
|
||||
this.themeService.onThemeChange()
|
||||
.pipe(
|
||||
map(({ name }) => name === 'corporate'),
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe((hideGrid: boolean) => this.hideGrid = hideGrid);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
}
|
||||
|
||||
private sortRooms() {
|
||||
this.sortedRooms = this.roomSvg.rooms.slice(0).sort((a, b) => {
|
||||
if (a.id === this.selectedRoom) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export class RoomsComponent implements OnDestroy {
|
|||
});
|
||||
|
||||
this.themeChangeSubscription = this.themeService.onThemeChange()
|
||||
.pipe(map(({ name }) => name === 'material-dark'))
|
||||
.pipe(map(({ name }) => name === 'cosmic' || name === 'dark'))
|
||||
.subscribe((isDark: boolean) => this.isDarkTheme = isDark);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue