ghostfolio/apps/client/src/app/pages/landing/landing-page.component.ts

71 lines
2.0 KiB
TypeScript
Raw Normal View History

import { Component, OnDestroy, OnInit } from '@angular/core';
2021-04-13 21:53:58 +02:00
import { Router } from '@angular/router';
import { DataService } from '@ghostfolio/client/services/data.service';
import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service';
2021-04-13 21:53:58 +02:00
import { format } from 'date-fns';
import { Subject } from 'rxjs';
@Component({
host: { class: 'mb-5' },
selector: 'gf-landing-page',
styleUrls: ['./landing-page.scss'],
templateUrl: './landing-page.html'
2021-04-13 21:53:58 +02:00
})
export class LandingPageComponent implements OnDestroy, OnInit {
2021-04-13 21:53:58 +02:00
public currentYear = format(new Date(), 'yyyy');
public demoAuthToken: string;
public testimonials = [
{
author: 'Philipp',
country: 'Germany 🇩🇪',
quote: `Super slim app with a great user interface. On top of that, it's open source.`
},
{
author: 'Onur',
country: 'Switzerland 🇨🇭',
2021-11-20 10:38:30 +01:00
quote: `Ghostfolio looks like the perfect portfolio tracker I've been searching for all these years.`
},
{
author: 'Ivo',
country: 'Netherlands 🇳🇱',
quote: `A fantastic open source app to track my investments across platforms. Love the simplicity of its design and the depth of the insights.`
},
{
author: 'Damjan',
country: 'Slovenia 🇸🇮',
quote: `Ghostfolio helps me track all my investments in one place, it has a built-in portfolio analyzer and a very neat, seamless user interface.`
}
];
2021-04-13 21:53:58 +02:00
private unsubscribeSubject = new Subject<void>();
/**
* @constructor
*/
public constructor(
private dataService: DataService,
private router: Router,
private tokenStorageService: TokenStorageService
2021-04-13 21:53:58 +02:00
) {}
/**
* Initializes the controller
*/
public ngOnInit() {
const { demoAuthToken } = this.dataService.fetchInfo();
2021-04-13 21:53:58 +02:00
this.demoAuthToken = demoAuthToken;
2021-04-13 21:53:58 +02:00
}
public setToken(aToken: string) {
this.tokenStorageService.saveToken(aToken, true);
2021-04-13 21:53:58 +02:00
this.router.navigate(['/']);
}
public ngOnDestroy() {
this.unsubscribeSubject.next();
this.unsubscribeSubject.complete();
}
}