Rename folders

This commit is contained in:
Jesse Lucas
2020-03-29 16:51:12 -04:00
parent 7a657bf3c7
commit 03c6fb2f82
35 changed files with 65 additions and 45 deletions
@@ -0,0 +1,47 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import Folder from '../../folder'
import { cardElevation } from '../../style'
import { FolderService } from 'src/app/folder.service';
import { DonutChartComponent } from '../donut-chart/donut-chart.component';
@Component({
selector: 'app-folder-chart',
templateUrl: './folder-chart.component.html',
styleUrls: ['./folder-chart.component.scss']
})
export class FolderChartComponent implements OnInit {
@ViewChild(DonutChartComponent) donutChart: DonutChartComponent;
chartID: string = 'foldersChart';
states: Map<string, number>;
elevation: string = cardElevation;
constructor(private folderService: FolderService) {
this.states = new Map();
}
ngOnInit(): void {
for (let state in Folder.StateType) {
console.log(state);
}
}
ngAfterViewInit() {
this.folderService.getAll().subscribe(
folder => {
// TODO: Clear existing data
this.donutChart.data([40]);
// Get StateType and convert to string
const stateType: Folder.StateType = Folder.getStateType(folder);
const state: string = Folder.stateTypeToString(stateType);
// Instantiate empty count states
if (!this.states.has(state)) {
this.states.set(state, 0);
}
const count: number = this.states.get(state) + 1;
this.states.set(state, count);
}
);
}
}