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', 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[] = [ private bundleDescriptions: Descriptions[] = [
{ {
icon: 'umbrella-outline', 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.', 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[]> { getBundleDescriptions(): Observable<Descriptions[]> {
return observableOf(this.bundleDescriptions); return observableOf(this.bundleDescriptions);

View file

@ -241,7 +241,7 @@
</a> </a>
</div> </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> <ngx-landing-section-title>
Architecture Design Architecture Design

View file

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

View file

@ -2,7 +2,7 @@
<ngx-landing-main-info></ngx-landing-main-info> <ngx-landing-main-info></ngx-landing-main-info>
</div> </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> <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. * 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 { Descriptions, DescriptionsService } from '../../../@core/data/service/descriptions.service';
import { takeWhile } from 'rxjs/operators';
@Component({ @Component({
selector: 'ngx-landing-sections-container', selector: 'ngx-landing-sections-container',
templateUrl: './ngx-landing-sections-container.component.html', templateUrl: './ngx-landing-sections-container.component.html',
styleUrls: ['./ngx-landing-sections-container.component.scss'], styleUrls: ['./ngx-landing-sections-container.component.scss'],
}) })
export class NgxLandingSectionsContainerComponent implements OnDestroy { export class NgxLandingSectionsContainerComponent {
private alive = true; descriptions: Observable<Descriptions[]> = this.descriptionsService.getDescriptions();
descriptions: Descriptions[];
constructor(private descriptionsService: DescriptionsService) { constructor(private descriptionsService: DescriptionsService) { }
this.descriptionsService.getDescriptions()
.pipe(takeWhile(() => this.alive))
.subscribe((descriptions) => this.descriptions = descriptions);
}
ngOnDestroy() {
this.alive = false;
}
} }