Feature/setup black friday 2022 deal (#1452)
* Setup Black Friday 2022 deal * Update changelogpull/1454/head
parent
c9bdf46b2b
commit
3b4f8c69bb
@ -0,0 +1,20 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { AuthGuard } from '@ghostfolio/client/core/auth.guard';
|
||||
|
||||
import { BlackFriday2022PageComponent } from './black-friday-2022-page.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
canActivate: [AuthGuard],
|
||||
component: BlackFriday2022PageComponent,
|
||||
path: '',
|
||||
title: 'Black Friday 2022'
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class BlackFriday2022RoutingModule {}
|
@ -0,0 +1,21 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { DataService } from '@ghostfolio/client/services/data.service';
|
||||
|
||||
@Component({
|
||||
host: { class: 'page' },
|
||||
selector: 'gf-black-friday-2022-page',
|
||||
styleUrls: ['./black-friday-2022-page.scss'],
|
||||
templateUrl: './black-friday-2022-page.html'
|
||||
})
|
||||
export class BlackFriday2022PageComponent {
|
||||
public discount: number;
|
||||
|
||||
public constructor(private dataService: DataService) {
|
||||
const { subscriptions } = this.dataService.fetchInfo();
|
||||
|
||||
const coupon = subscriptions?.[0]?.coupon ?? 0;
|
||||
const price = subscriptions?.[0]?.price ?? 1;
|
||||
|
||||
this.discount = Math.floor((coupon / price) * 100) / 100;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { GfPremiumIndicatorModule } from '@ghostfolio/ui/premium-indicator';
|
||||
|
||||
import { BlackFriday2022RoutingModule } from './black-friday-2022-page-routing.module';
|
||||
import { BlackFriday2022PageComponent } from './black-friday-2022-page.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [BlackFriday2022PageComponent],
|
||||
imports: [
|
||||
BlackFriday2022RoutingModule,
|
||||
CommonModule,
|
||||
GfPremiumIndicatorModule,
|
||||
MatButtonModule,
|
||||
RouterModule
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class BlackFriday2022PageModule {}
|
@ -0,0 +1,3 @@
|
||||
:host {
|
||||
display: block;
|
||||
}
|
After Width: | Height: | Size: 188 KiB |
Loading…
Reference in new issue