This commit is contained in:
Andras Schmelczer 2019-09-07 21:17:34 +02:00
commit 3101c973eb
6 changed files with 113 additions and 97 deletions

View file

@ -1,7 +1,6 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Page } from '../../../model/page';
import { ModalService } from '../../../services/modal.service';
import { DataService } from '../../../services/data.service';
import { Observable } from 'rxjs/internal/Observable';
import { Range } from '../../../interfaces/range';
import { Subject } from 'rxjs/internal/Subject';
@ -34,7 +33,7 @@ export class PageComponent implements OnInit {
return this.dates.map(d => d.toLocaleDateString());
}
constructor(private modalService: ModalService, public dataService: DataService) {}
constructor(private modalService: ModalService) {}
ngOnInit(): void {
this.page$.subscribe(value => {

View file

@ -22,8 +22,7 @@ export class BlockComponent {
description: this.block.description,
isDone: this.block.isDone
});
console.log(description);
this.block.changeKeys<BlockState>({
this.block.changeKeys({
tag: selected,
description,
isDone

View file

@ -55,7 +55,7 @@ export class TasksComponent implements OnInit {
change.created = new Date();
}
block.changeKeys<BlockState>(change);
block.changeKeys(change);
} catch {
// pass
}

View file

@ -38,6 +38,7 @@ export class TowerComponent implements OnInit {
ngOnInit() {
this.tower$.subscribe(value => {
if (value) {
console.log('update');
this.blocks = value.coloredBlocks
.filter(b => b.isDone)
.map(b => {
@ -48,15 +49,11 @@ export class TowerComponent implements OnInit {
return classedBlock;
});
if (this.tower) {
console.log(this.tower, this.tower.latestVersion, value);
}
if (this.tower && this.tower.latestVersion === value) {
const difference = this.tower.blocks.map((b, index) => {
return b === value.blocks[index];
});
console.log(this.tower.blocks);
if (
(difference.every(i => i) && this.tower.blocks.length + 1 === value.blocks.length) ||
(this.tower.blocks.length === value.blocks.length &&
@ -64,7 +61,7 @@ export class TowerComponent implements OnInit {
) {
const lastBlock = top(this.blocks);
if (lastBlock) {
lastBlock.style = { opacity: '0' };
lastBlock.style = { transform: 'translateY(500%)', opacity: '0' };
lastBlock.cssClass = 'descend';
setTimeout(() => (lastBlock.style = { transform: 'translateY(0)', opacity: '1' }), 0);
}
@ -72,7 +69,6 @@ export class TowerComponent implements OnInit {
}
this.tasks = value.coloredBlocks.filter(block => !block.isDone);
this.tower = value;
}
});
@ -91,7 +87,7 @@ export class TowerComponent implements OnInit {
block.cssClass = 'ascend';
block.style = { transform: 'translateY(500%)', opacity: '0' };
}
if (block.shouldDraw && block.cssClass === 'ascend' && block.created < newDateRange.to) {
if (block.shouldDraw && block.cssClass === 'ascend' && block.created <= newDateRange.to) {
block.cssClass = 'descend';
block.style = { transform: 'translateY(0)', opacity: '1' };
}

View file

@ -52,7 +52,6 @@ export class PagesComponent implements OnInit {
}
selectPage(name: string) {
console.log(name);
if (!name) {
if (this.pages && this.pages.length > 0) {
name = this.pages[0].name;

View file

@ -16,7 +16,7 @@
(keyup)="handleKeys($event)"
/>
<button *ngIf="options.length <= maxItemCount" (click)="addNewOption()">Add</button>
<button *ngIf="options.length <= maxItemCount" (click)="addNewOption()" [disabled]="!newOption">Add</button>
</div>
</div>