added basic filter to projects so gitlab and uncategorized are separate
This commit is contained in:
parent
8789390c67
commit
9e12a95bfe
@ -1,8 +1,10 @@
|
||||
<h2>Projects on git</h2>
|
||||
<p>These are my projects as can be found on my <a href="https://gitlab.inkletblot.com/explore">gitlab</a>. Mainly my programming projects that are quality enough for me to be happy for the world to see them. There are more in the works but they are currently private.</p>
|
||||
<app-project-card *ngFor="let project of gitlabProjects()" [project]="project">
|
||||
</app-project-card>
|
||||
|
||||
<h2>Projects of a personal nature</h2>
|
||||
<p>This is (will be) a summary of my personal projects be they my homelab, general electronics projects, or anything else.</p>
|
||||
|
||||
<app-project-card *ngFor="let project of uncategorizedProjects" [project]="project">
|
||||
<app-project-card *ngFor="let project of uncategorizedProjects()" [project]="project">
|
||||
</app-project-card>
|
||||
@ -14,7 +14,9 @@ import { ProjectsService } from './projects.service';
|
||||
export class ProjectsComponent implements OnInit, OnDestroy {
|
||||
_unsubscribe$: Subject<boolean> = new Subject();
|
||||
|
||||
uncategorizedProjects: Array<Project>;
|
||||
allProjects: Array<Project>;
|
||||
private _gitlabProjects: Array<Project> = new Array<Project>();
|
||||
private _uncategorizedProjects: Array<Project> = new Array<Project>();
|
||||
|
||||
constructor(private navService: NavService, private projectsService: ProjectsService) { }
|
||||
|
||||
@ -24,8 +26,9 @@ export class ProjectsComponent implements OnInit, OnDestroy {
|
||||
this.projectsService.allProjects$
|
||||
.pipe(takeUntil(this._unsubscribe$))
|
||||
.subscribe((result: Project[]) => {
|
||||
this.uncategorizedProjects = result;
|
||||
this.allProjects = result;
|
||||
});
|
||||
|
||||
this.projectsService.getProjects();
|
||||
}
|
||||
|
||||
@ -34,4 +37,26 @@ export class ProjectsComponent implements OnInit, OnDestroy {
|
||||
this._unsubscribe$.complete();
|
||||
}
|
||||
|
||||
filterProjects(): void {
|
||||
this._gitlabProjects = [];
|
||||
this._uncategorizedProjects = [];
|
||||
this.allProjects.forEach((project) => {
|
||||
if (project.category === 'gitlab') {
|
||||
this._gitlabProjects.push(project);
|
||||
} else {
|
||||
this._uncategorizedProjects.push(project);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
gitlabProjects(): Array<Project> {
|
||||
this.filterProjects();
|
||||
return this._gitlabProjects;
|
||||
}
|
||||
|
||||
uncategorizedProjects(): Array<Project> {
|
||||
this.filterProjects();
|
||||
return this._uncategorizedProjects;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user