mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-17 07:50:12 +01:00
feat(bundles): fixes and adjustments
This commit is contained in:
parent
631a856200
commit
841d57d0ec
11 changed files with 99 additions and 84 deletions
|
|
@ -4,9 +4,11 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*/
|
||||
|
||||
import { Component, OnDestroy } from '@angular/core';
|
||||
import { AfterViewInit, Component, ElementRef, Inject, OnDestroy } from '@angular/core';
|
||||
import { Descriptions, DescriptionsService } from '../../../@core/data/service/descriptions.service';
|
||||
import { takeWhile } from 'rxjs/operators';
|
||||
import { delay, filter, take, takeWhile } from 'rxjs/operators';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { NB_WINDOW } from '@nebular/theme';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-backend-bundles-section',
|
||||
|
|
@ -14,15 +16,11 @@ import { takeWhile } from 'rxjs/operators';
|
|||
styleUrls: ['./backend-bundles-section.component.scss'],
|
||||
})
|
||||
|
||||
export class BackendBundlesSectionComponent implements OnDestroy {
|
||||
export class BackendBundlesSectionComponent implements OnDestroy, AfterViewInit {
|
||||
|
||||
private alive = true;
|
||||
descriptions: Descriptions[];
|
||||
|
||||
ngOnDestroy() {
|
||||
this.alive = false;
|
||||
}
|
||||
|
||||
selectedLicenseType = 'Personal';
|
||||
personalLicense = 'Personal';
|
||||
commercialLicense = 'Commercial';
|
||||
|
|
@ -30,15 +28,8 @@ export class BackendBundlesSectionComponent implements OnDestroy {
|
|||
ecomName = 'E-Commerce:';
|
||||
iotName = 'IoT:';
|
||||
|
||||
netName = '.NET + NGX Admin';
|
||||
netCoreName = '.NET Core + NGX Admin';
|
||||
|
||||
|
||||
constructor(private descriptionsService: DescriptionsService) {
|
||||
this.descriptionsService.getBundleDescriptions()
|
||||
.pipe(takeWhile(() => this.alive))
|
||||
.subscribe((descriptions) => this.descriptions = descriptions);
|
||||
}
|
||||
netName = '.NET + ngx-admin';
|
||||
netCoreName = '.NET Core + ngx-admin';
|
||||
|
||||
get firstBundleMail(): string {
|
||||
return this.getMailToText('.NET E-commerce');
|
||||
|
|
@ -61,14 +52,39 @@ export class BackendBundlesSectionComponent implements OnDestroy {
|
|||
thirdCardFlipped: boolean = false;
|
||||
fourthCardFlipped: boolean = false;
|
||||
|
||||
constructor(private descriptionsService: DescriptionsService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private el: ElementRef<HTMLElement>,
|
||||
@Inject(NB_WINDOW) private window) {
|
||||
this.descriptionsService.getBundleDescriptions()
|
||||
.pipe(takeWhile(() => this.alive))
|
||||
.subscribe((descriptions) => this.descriptions = descriptions);
|
||||
}
|
||||
|
||||
stopPropagation(e) {
|
||||
e.stopPropagation();
|
||||
// e.stopPropagation();
|
||||
}
|
||||
|
||||
isCommercial() {
|
||||
return this.selectedLicenseType === 'Commercial';
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.activatedRoute.fragment
|
||||
.pipe(
|
||||
filter(fragment => fragment === 'backend-bundles'),
|
||||
delay(500),
|
||||
take(1),
|
||||
)
|
||||
.subscribe((fragment: string) => {
|
||||
this.window.scrollTo(0, this.el.nativeElement.offsetTop);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.alive = false;
|
||||
}
|
||||
|
||||
private getMailToText(bundleName: string) {
|
||||
return 'mailto:support@akveo.com' +
|
||||
`?subject=${this.selectedLicenseType} ${bundleName} Bundle` +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue