Commit 889e0c89 authored by mdsecurity's avatar mdsecurity
Browse files

things update every minute instead of every screen update

parent 4ec4d92c
import { Component, OnInit} from '@angular/core';
import { DataProviderService } from '../../data-provider.service';
import { Place } from '../../Place';
import { Place } from '../../place';
@Component({
selector: 'app-area',
templateUrl: './area.component.html',
......
......@@ -16,21 +16,20 @@
<div class="title-container">
<div class="place-title">{{place.name | removeBrackets}}</div>
</div>
<div *ngIf="place.isOpen(); else elseBlock">
<div *ngIf="isOpen; else elseBlock">
<div class="place-open-badge">
<div class="place-status">OPEN</div>
<div class="place-divider"></div>
<div class="place-time-remaining">~{{place.openFor().hour}}Hrs</div>
<div class="place-time-remaining">~{{openFor.hour}}Hrs</div>
</div>
</div>
<ng-template #elseBlock>
hello
<!--<div class="closed-shader"></div>
<div class="closed-shader"></div>
<div class="place-open-badge" style="width:102px;background-color:#C4B9B9;">
<div class="place-status">CLOSED</div>
<div class="place-divider"></div>
<div class="place-time-remaining">~{{place.openFor().hour}}Hrs</div>
</div>-->
<div class="place-time-remaining">~{{openFor.hour}}Hrs</div>
</div>
</ng-template>
<div class="place-location">{{place.location }}</div>
......
import { Component, OnInit, Input } from '@angular/core';
import { Place } from '../../../place';
import { Time } from '../../../time';
import { DataProviderService } from '../../../data-provider.service';
import { MdDialog } from '@angular/material';
import { FeedbackDialogComponent } from './feedback-dialog/feedback-dialog.component';
import {DomSanitizer} from '@angular/platform-browser';
import { DomSanitizer } from '@angular/platform-browser';
import { Observable } from 'rxjs/Rx';
@Component({
selector: 'app-place-card',
templateUrl: './place-card.component.html',
......@@ -13,14 +14,17 @@ import {DomSanitizer} from '@angular/platform-browser';
export class PlaceCardComponent implements OnInit {
@Input() private place: Place;
private status: string;
private show;
private week: string[] = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"];
private url;
constructor(private dataProvider: DataProviderService, public dialog: MdDialog,private sanitizer: DomSanitizer) { }
private openFor = new Time();
private isOpen;
private url;
constructor(private dataProvider: DataProviderService, public dialog: MdDialog, private sanitizer: DomSanitizer) { }
ngOnInit() {
this.url = this.sanitizer.bypassSecurityTrustUrl('https://unsplash.it/200/300?image='+Math.floor((Math.random()*999+1)));
this.url = this.sanitizer.bypassSecurityTrustUrl('https://unsplash.it/200/300?image=' + Math.floor((Math.random() * 999 + 1)));
let timer = Observable.timer(0,60000);
timer.subscribe(t => {
this.openFor = this.place.openFor();
this.isOpen = this.place.isOpen()
});
}
openInContext() {
this.dataProvider.setContext(this.place);
......
......@@ -79,7 +79,6 @@ export class Place {
}
}
}
console.log('false');
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment