fix(bundles): simplify features block

This commit is contained in:
Dmitry Nehaychik 2019-02-06 11:47:51 +03:00
parent 0949ecc67c
commit 9fc42b19c0
5 changed files with 20 additions and 38 deletions

View file

@ -33,13 +33,6 @@ export class DescriptionsService {
description: 'Continuous updates and fixes from the development team to keep your tech up to date. The friendly and active community support team are ready to guide you through your challenges',
},
];
/* tslint:enable:max-line-length */
getDescriptions(): Observable<Descriptions[]> {
return observableOf(this.descriptions);
}
/* tslint:disable:max-line-length */
private bundleDescriptions: Descriptions[] = [
{
icon: 'umbrella-outline',
@ -62,7 +55,12 @@ export class DescriptionsService {
description: 'We prepared this Backend pack as development basement which lets your team concentrate on business logic and data models.',
},
];
/* tslint:enable:max-line-length */
/* tslint:disable:max-line-length */
getDescriptions(): Observable<Descriptions[]> {
return observableOf(this.descriptions);
}
getBundleDescriptions(): Observable<Descriptions[]> {
return observableOf(this.bundleDescriptions);

View file

@ -241,7 +241,7 @@
</a>
</div>
<ngx-landing-description-section *ngIf="descriptions" [descriptions]="descriptions" ></ngx-landing-description-section>
<ngx-landing-description-section *ngIf="descriptions | async" [descriptions]="descriptions | async"></ngx-landing-description-section>
<ngx-landing-section-title>
Architecture Design

View file

@ -4,22 +4,22 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import { AfterViewInit, Component, ElementRef, Inject, OnDestroy } from '@angular/core';
import { Descriptions, DescriptionsService } from '../../../@core/data/service/descriptions.service';
import { delay, filter, take, takeWhile } from 'rxjs/operators';
import { AfterViewInit, Component, ElementRef, Inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs';
import { delay, filter, take } from 'rxjs/operators';
import { NB_WINDOW } from '@nebular/theme';
import { Descriptions, DescriptionsService } from '../../../@core/data/service/descriptions.service';
@Component({
selector: 'ngx-backend-bundles-section',
templateUrl: 'backend-bundles-section.component.html',
styleUrls: ['./backend-bundles-section.component.scss'],
})
export class BackendBundlesSectionComponent implements AfterViewInit {
export class BackendBundlesSectionComponent implements OnDestroy, AfterViewInit {
private alive = true;
descriptions: Descriptions[];
descriptions: Observable<Descriptions[]> = this.descriptionsService.getDescriptions();
selectedLicenseType = 'Personal';
personalLicense = 'Personal';
@ -56,9 +56,6 @@ export class BackendBundlesSectionComponent implements OnDestroy, AfterViewInit
private activatedRoute: ActivatedRoute,
private el: ElementRef<HTMLElement>,
@Inject(NB_WINDOW) private window) {
this.descriptionsService.getBundleDescriptions()
.pipe(takeWhile(() => this.alive))
.subscribe((descriptions) => this.descriptions = descriptions);
}
isCommercial() {
@ -77,10 +74,6 @@ export class BackendBundlesSectionComponent implements OnDestroy, AfterViewInit
});
}
ngOnDestroy() {
this.alive = false;
}
private getMailToText(bundleName: string) {
return 'mailto:support@akveo.com' +
`?subject=${this.selectedLicenseType} ${bundleName} Bundle` +

View file

@ -2,7 +2,7 @@
<ngx-landing-main-info></ngx-landing-main-info>
</div>
<ngx-landing-description-section *ngIf="descriptions" [descriptions]="descriptions" ></ngx-landing-description-section>
<ngx-landing-description-section *ngIf="descriptions | async" [descriptions]="descriptions | async" ></ngx-landing-description-section>
<ngx-landing-theme-section></ngx-landing-theme-section>

View file

@ -4,27 +4,18 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import { Component, OnDestroy } from '@angular/core';
import { Component } from '@angular/core';
import { Observable } from 'rxjs';
import { Descriptions, DescriptionsService } from '../../../@core/data/service/descriptions.service';
import { takeWhile } from 'rxjs/operators';
@Component({
selector: 'ngx-landing-sections-container',
templateUrl: './ngx-landing-sections-container.component.html',
styleUrls: ['./ngx-landing-sections-container.component.scss'],
})
export class NgxLandingSectionsContainerComponent implements OnDestroy {
export class NgxLandingSectionsContainerComponent {
private alive = true;
descriptions: Descriptions[];
descriptions: Observable<Descriptions[]> = this.descriptionsService.getDescriptions();
constructor(private descriptionsService: DescriptionsService) {
this.descriptionsService.getDescriptions()
.pipe(takeWhile(() => this.alive))
.subscribe((descriptions) => this.descriptions = descriptions);
}
ngOnDestroy() {
this.alive = false;
}
constructor(private descriptionsService: DescriptionsService) { }
}