refactoring des items
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, inject, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { TitleCasePipe } from '@angular/common';
|
import { TitleCasePipe } from '@angular/common';
|
||||||
import { UntilDestroy } from '@ngneat/until-destroy';
|
import { UntilDestroy } from '@ngneat/until-destroy';
|
||||||
import { SectorFacade } from '@app/ui/sectors/sector.facade';
|
import { SectorFacade } from '@app/ui/sectors/sector.facade';
|
||||||
@@ -6,19 +6,22 @@ import { SectorFacade } from '@app/ui/sectors/sector.facade';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-chips',
|
selector: 'app-chips',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
|
providers: [SectorFacade],
|
||||||
imports: [TitleCasePipe],
|
imports: [TitleCasePipe],
|
||||||
templateUrl: './chips.component.html',
|
templateUrl: './chips.component.html',
|
||||||
styleUrl: './chips.component.scss',
|
styleUrl: './chips.component.scss',
|
||||||
})
|
})
|
||||||
@UntilDestroy()
|
@UntilDestroy()
|
||||||
export class ChipsComponent implements OnInit {
|
export class ChipsComponent implements OnChanges {
|
||||||
@Input({ required: true }) sectorId: string | null = null;
|
@Input({ required: true }) sectorId: string | null = null;
|
||||||
|
|
||||||
private readonly sectorFacade = new SectorFacade();
|
private readonly sectorFacade = inject(SectorFacade);
|
||||||
protected sector = this.sectorFacade.sector;
|
protected sector = this.sectorFacade.sector;
|
||||||
|
protected readonly loading = this.sectorFacade.loading;
|
||||||
|
protected readonly error = this.sectorFacade.error;
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
if (this.sectorId) {
|
if (this.sectorId && !this.loading().isLoading) {
|
||||||
this.sectorFacade.loadOne(this.sectorId);
|
this.sectorFacade.loadOne(this.sectorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,24 +69,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<!-- Profession -->
|
<!-- Profession -->
|
||||||
<p class="text-sm font-semibold text-gray-600 dark:text-gray-300 mb-4">
|
<p class="text-sm font-semibold text-gray-600 dark:text-gray-300 mb-2">
|
||||||
{{ profile.profession || 'Profession non renseignée' }}
|
{{ profile.profession || 'Profession non renseignée' }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Partie inférieure avec infos -->
|
<!-- Partie inférieure avec infos -->
|
||||||
<div class="px-6 pb-6 space-y-3 border-t border-gray-100 dark:border-gray-700 pt-4">
|
<div class="px-6 pb-6 space-y-3 border-t border-gray-100 dark:border-gray-700">
|
||||||
<!-- Secteur -->
|
<div class="pt-3">
|
||||||
<div class="flex justify-center">
|
<button
|
||||||
<app-chips [sectorId]="profile.secteur" />
|
class="block w-full select-none rounded-lg bg-pink-500 py-3.5 px-7 text-center align-middle font-sans text-sm font-bold uppercase text-white shadow-md shadow-pink-500/20 transition-all hover:shadow-lg hover:shadow-pink-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
|
||||||
|
type="button"
|
||||||
|
data-ripple-light="true"
|
||||||
|
>
|
||||||
|
<small>En savoir plus</small>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Réseaux sociaux -->
|
|
||||||
@if (profile.reseaux) {
|
|
||||||
<div class="flex justify-center">
|
|
||||||
<app-reseaux [reseaux]="profile.reseaux" />
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Indicateur de hover (bordure animée) -->
|
<!-- Indicateur de hover (bordure animée) -->
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { Component, inject, Input, OnInit } from '@angular/core';
|
import { Component, inject, Input, OnInit } from '@angular/core';
|
||||||
import { Router, RouterLink } from '@angular/router';
|
import { Router, RouterLink } from '@angular/router';
|
||||||
import { UntilDestroy } from '@ngneat/until-destroy';
|
import { UntilDestroy } from '@ngneat/until-destroy';
|
||||||
import { ChipsComponent } from '@app/shared/components/chips/chips.component';
|
|
||||||
import { ReseauxComponent } from '@app/shared/components/reseaux/reseaux.component';
|
|
||||||
import { environment } from '@env/environment';
|
import { environment } from '@env/environment';
|
||||||
import { ProfileViewModel } from '@app/ui/profiles/profile.presenter.model';
|
import { ProfileViewModel } from '@app/ui/profiles/profile.presenter.model';
|
||||||
import { UserFacade } from '@app/ui/users/user.facade';
|
import { UserFacade } from '@app/ui/users/user.facade';
|
||||||
@@ -11,7 +9,7 @@ import { UserFacade } from '@app/ui/users/user.facade';
|
|||||||
selector: 'app-vertical-profile-item',
|
selector: 'app-vertical-profile-item',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
providers: [UserFacade],
|
providers: [UserFacade],
|
||||||
imports: [ChipsComponent, ReseauxComponent, RouterLink],
|
imports: [RouterLink],
|
||||||
templateUrl: './vertical-profile-item.component.html',
|
templateUrl: './vertical-profile-item.component.html',
|
||||||
styleUrl: './vertical-profile-item.component.scss',
|
styleUrl: './vertical-profile-item.component.scss',
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { inject, signal } from '@angular/core';
|
import { inject, Injectable, signal } from '@angular/core';
|
||||||
import { SECTOR_REPOSITORY_TOKEN } from '@app/infrastructure/sectors/sector-repository.token';
|
import { SECTOR_REPOSITORY_TOKEN } from '@app/infrastructure/sectors/sector-repository.token';
|
||||||
import { ListSectorUsecase } from '@app/usecase/sectors/list-sector.usecase';
|
import { ListSectorUsecase } from '@app/usecase/sectors/list-sector.usecase';
|
||||||
import { GetSectorUseCase } from '@app/usecase/sectors/get-sector.usecase';
|
import { GetSectorUseCase } from '@app/usecase/sectors/get-sector.usecase';
|
||||||
@@ -9,6 +9,7 @@ import { SectorPresenterModel } from '@app/ui/sectors/sector.presenter.model';
|
|||||||
import { Sector } from '@app/domain/sectors/sector.model';
|
import { Sector } from '@app/domain/sectors/sector.model';
|
||||||
import { SectorPresenter } from '@app/ui/sectors/sector.presenter';
|
import { SectorPresenter } from '@app/ui/sectors/sector.presenter';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class SectorFacade {
|
export class SectorFacade {
|
||||||
private readonly sectorRepo = inject(SECTOR_REPOSITORY_TOKEN);
|
private readonly sectorRepo = inject(SECTOR_REPOSITORY_TOKEN);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user