77 lines
2.8 KiB
TypeScript
77 lines
2.8 KiB
TypeScript
import { Component, HostListener } from '@angular/core';
|
|
import { MatDialog, MatDialogConfig } from '@angular/material';
|
|
import { VideoPopupComponent } from '../popups/video-popup/video-popup.component';
|
|
import { environment } from '../../../environments/environment';
|
|
import { Countdown } from './countdown';
|
|
|
|
@Component({
|
|
selector: 'home-component',
|
|
templateUrl: './home.component.html',
|
|
styleUrls: ['./home.component.css'],
|
|
})
|
|
export class HomeComponent {
|
|
backgroundTop: string = "0px";
|
|
public get showSpecial() : boolean {
|
|
return true; //COVID-19
|
|
|
|
let maxDate = new Date(2018,8,6); // September 6th 2018 -- Set the month one month behind since JavaScript dates are 0 based
|
|
let now = new Date();
|
|
if (now.getFullYear() > maxDate.getFullYear()) return false;
|
|
if (now.getFullYear() == maxDate.getFullYear()) {
|
|
if (now.getMonth() > maxDate.getMonth()) return false;
|
|
if (now.getMonth() == maxDate.getMonth()) {
|
|
if (now.getDate() > maxDate.getDate()) return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
public get showCallToAction(): boolean {
|
|
let maxDate = new Date(2019,6,8); // July 8th 2018 -- Set the month one month behind since JavaScript dates are 0 based
|
|
let now = new Date();
|
|
if (now.getFullYear() > maxDate.getFullYear()) return false;
|
|
if (now.getFullYear() == maxDate.getFullYear()) {
|
|
if (now.getMonth() > maxDate.getMonth()) return false;
|
|
if (now.getMonth() == maxDate.getMonth()) {
|
|
if (now.getDate() > maxDate.getDate()) return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
public get showVBS(): boolean {
|
|
let maxDate = new Date(2019,7,22); // August 22nd 2018 -- Set the month one month behind since JavaScript dates are 0 based
|
|
let now = new Date();
|
|
if (now.getFullYear() > maxDate.getFullYear()) return false;
|
|
if (now.getFullYear() == maxDate.getFullYear()) {
|
|
if (now.getMonth() > maxDate.getMonth()) return false;
|
|
if (now.getMonth() == maxDate.getMonth()) {
|
|
if (now.getDate() > maxDate.getDate()) return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public countdown: Countdown;
|
|
public liveDates: Date[] = [];
|
|
|
|
constructor(private dialog: MatDialog)
|
|
{
|
|
this.countdown = new Countdown();
|
|
this.liveDates = [];
|
|
}
|
|
|
|
@HostListener('window:scroll', ['$event'])
|
|
onScroll(event){
|
|
let scrollTop = event.target.documentElement.scrollTop || event.target.body.scrollTop || window.pageYOffset;
|
|
//this.backgroundTop = Math.min((scrollTop * .30),100) * -1 + "px";
|
|
}
|
|
|
|
actionClick() {
|
|
let opts = new MatDialogConfig;
|
|
let baseUrl = environment.production === true ? "" : "https://ofbbutte.com/";
|
|
opts.data = { videoSrc: baseUrl + 'static/media/video/Sledding2019.mp4', posterSrc: baseUrl + 'static/media/video/Sledding2019Poster.jpg' };
|
|
opts.closeOnNavigation = true;
|
|
let dialog = this.dialog.open(VideoPopupComponent, opts)
|
|
}
|
|
}
|
|
|