profiles => format clean archi
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
<div class="min-h-screen py-4 font-sans">
|
||||
<div class="max-w-4xl max-lg:max-w-2xl max-sm:max-w-sm mx-auto">
|
||||
<h2 class="text-2xl font-bold text-gray-800 mb-8">Explorer les projets</h2>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
|
||||
@for (project of projects; track project) {
|
||||
<app-project-item [project]="project"/>
|
||||
} @empty {
|
||||
<p>Aucun projet</p>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="min-h-screen py-4 font-sans">
|
||||
<div class="max-w-4xl max-lg:max-w-2xl max-sm:max-w-sm mx-auto">
|
||||
<h2 class="text-2xl font-bold text-gray-800 mb-8">Explorer les projets</h2>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
@for (project of projects; track project) {
|
||||
<app-project-item [project]="project" />
|
||||
} @empty {
|
||||
<p>Aucun projet</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ProjectListComponent } from './project-list.component';
|
||||
|
||||
describe('ProjectListComponent', () => {
|
||||
let component: ProjectListComponent;
|
||||
let fixture: ComponentFixture<ProjectListComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ProjectListComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ProjectListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
||||
await fixture.whenStable();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ProjectListComponent } from './project-list.component';
|
||||
|
||||
describe('ProjectListComponent', () => {
|
||||
let component: ProjectListComponent;
|
||||
let fixture: ComponentFixture<ProjectListComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ProjectListComponent],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ProjectListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
||||
await fixture.whenStable();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,31 +1,28 @@
|
||||
import {Component, inject, Input, OnInit} from '@angular/core';
|
||||
import {UntilDestroy} from "@ngneat/until-destroy";
|
||||
import {ProjectItemComponent} from "@app/shared/components/project-item/project-item.component";
|
||||
import {JsonPipe} from "@angular/common";
|
||||
import {ProjectService} from "@app/core/services/project/project.service";
|
||||
import {Project} from "@app/shared/models/project";
|
||||
|
||||
@Component({
|
||||
selector: 'app-project-list',
|
||||
standalone: true,
|
||||
imports: [
|
||||
ProjectItemComponent,
|
||||
JsonPipe
|
||||
],
|
||||
templateUrl: './project-list.component.html',
|
||||
styleUrl: './project-list.component.scss'
|
||||
})
|
||||
@UntilDestroy()
|
||||
export class ProjectListComponent implements OnInit{
|
||||
@Input({required: true}) userProjectId: string = "";
|
||||
|
||||
protected readonly projectService = inject(ProjectService);
|
||||
|
||||
protected projects: Project[] = []
|
||||
|
||||
ngOnInit(): void {
|
||||
this.projectService.getProjectByUserId(this.userProjectId).subscribe(
|
||||
value => this.projects = value
|
||||
);
|
||||
}
|
||||
}
|
||||
import { Component, inject, Input, OnInit } from '@angular/core';
|
||||
import { UntilDestroy } from '@ngneat/until-destroy';
|
||||
import { ProjectItemComponent } from '@app/shared/components/project-item/project-item.component';
|
||||
import { JsonPipe } from '@angular/common';
|
||||
import { ProjectService } from '@app/core/services/project/project.service';
|
||||
import { Project } from '@app/shared/models/project';
|
||||
|
||||
@Component({
|
||||
selector: 'app-project-list',
|
||||
standalone: true,
|
||||
imports: [ProjectItemComponent, JsonPipe],
|
||||
templateUrl: './project-list.component.html',
|
||||
styleUrl: './project-list.component.scss',
|
||||
})
|
||||
@UntilDestroy()
|
||||
export class ProjectListComponent implements OnInit {
|
||||
@Input({ required: true }) userProjectId = '';
|
||||
|
||||
protected readonly projectService = inject(ProjectService);
|
||||
|
||||
protected projects: Project[] = [];
|
||||
|
||||
ngOnInit(): void {
|
||||
this.projectService
|
||||
.getProjectByUserId(this.userProjectId)
|
||||
.subscribe((value) => (this.projects = value));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user