mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-31 22:58:49 +01:00
feat: call to action cards ab test (#2000)
This commit is contained in:
parent
67c9f796dc
commit
6ba11331d3
5 changed files with 35 additions and 7 deletions
|
|
@ -14,6 +14,7 @@ export class AbService {
|
|||
static readonly VARIANT_HIGHLIGHT_HIRE = 'highlight-hire';
|
||||
static readonly VARIANT_DEVELOPERS_HIRE = 'developers-hire';
|
||||
static readonly VARIANT_SOLUTION_HIRE = 'solution-hire';
|
||||
static readonly VARIANT_HIDE_CALL_ACTION = 'call-action-hide';
|
||||
// static readonly VARIANT_BANNER_HIRE = 'banner-hire';
|
||||
|
||||
private static readonly EVENT_NAME = 'ab-variant';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<div class="row">
|
||||
<div class="row" *ngIf="showCallAction">
|
||||
<div class="col-12 col-md-6">
|
||||
<ngx-call-action-card [title]="'Need a custom solution?'"
|
||||
[type]="'pantone'"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import {Component, OnDestroy} from '@angular/core';
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { NbThemeService } from '@nebular/theme';
|
||||
import { takeWhile } from 'rxjs/operators' ;
|
||||
import { SolarData } from '../../@core/data/solar';
|
||||
import { AbService } from '../../@core/utils/ab.service';
|
||||
|
||||
interface CardSettings {
|
||||
title: string;
|
||||
|
|
@ -14,9 +15,10 @@ interface CardSettings {
|
|||
styleUrls: ['./dashboard.component.scss'],
|
||||
templateUrl: './dashboard.component.html',
|
||||
})
|
||||
export class DashboardComponent implements OnDestroy {
|
||||
export class DashboardComponent implements OnInit, OnDestroy {
|
||||
|
||||
private alive = true;
|
||||
showCallAction = true;
|
||||
|
||||
solarValue: number;
|
||||
lightCard: CardSettings = {
|
||||
|
|
@ -77,7 +79,8 @@ export class DashboardComponent implements OnDestroy {
|
|||
};
|
||||
|
||||
constructor(private themeService: NbThemeService,
|
||||
private solarService: SolarData) {
|
||||
private solarService: SolarData,
|
||||
private abService: AbService) {
|
||||
this.themeService.getJsTheme()
|
||||
.pipe(takeWhile(() => this.alive))
|
||||
.subscribe(theme => {
|
||||
|
|
@ -91,6 +94,12 @@ export class DashboardComponent implements OnDestroy {
|
|||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.abService.onAbEvent(AbService.VARIANT_HIDE_CALL_ACTION)
|
||||
.pipe(takeWhile(() => this.alive))
|
||||
.subscribe(() => this.showCallAction = false );
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.alive = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<div class="row">
|
||||
<div class="row" *ngIf="showCallAction">
|
||||
<div class="col-12 col-md-6">
|
||||
<ngx-call-action-card [title]="'Need a custom solution?'"
|
||||
[type]="'pantone'"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,26 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { takeWhile } from 'rxjs/operators';
|
||||
import { AbService } from '../../@core/utils/ab.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-ecommerce',
|
||||
templateUrl: './e-commerce.component.html',
|
||||
})
|
||||
export class ECommerceComponent {
|
||||
export class ECommerceComponent implements OnInit, OnDestroy {
|
||||
|
||||
private alive = true;
|
||||
showCallAction = true;
|
||||
|
||||
constructor (private abService: AbService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.abService.onAbEvent(AbService.VARIANT_HIDE_CALL_ACTION)
|
||||
.pipe(takeWhile(() => this.alive))
|
||||
.subscribe(() => this.showCallAction = false );
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.alive = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue