feat(api-detail): fil d'Ariane aligné sur la hiérarchie des catégories
Accueil > [ancêtres de catégorie] > [titre API], ou Accueil > Parcourir > [titre API] si l'API n'a pas de catégorie. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -23,8 +23,14 @@ import { ApiEntry, Category, ApiConvention } from '@datacat/shared';
|
||||
<nav class="fr-breadcrumb fr-mb-3w" aria-label="vous êtes ici">
|
||||
<ol class="fr-breadcrumb__list">
|
||||
<li>
|
||||
<a class="fr-breadcrumb__link" routerLink="/catalog">Catalogue</a>
|
||||
<a class="fr-breadcrumb__link" routerLink="/">Accueil</a>
|
||||
</li>
|
||||
@if (categoryBreadcrumb().length === 0) {
|
||||
<li><a class="fr-breadcrumb__link" routerLink="/browse">Parcourir</a></li>
|
||||
}
|
||||
@for (crumb of categoryBreadcrumb(); track crumb.id) {
|
||||
<li><a class="fr-breadcrumb__link" [routerLink]="['/browse', crumb.id]">{{ crumb.name }}</a></li>
|
||||
}
|
||||
<li>
|
||||
<a class="fr-breadcrumb__link" aria-current="page">
|
||||
{{ api()?.title ?? 'Chargement...' }}
|
||||
@@ -347,6 +353,7 @@ export class ApiDetailComponent implements OnInit, OnDestroy {
|
||||
private categoryService = inject(CategoryService);
|
||||
|
||||
api = signal<ApiEntry | null>(null);
|
||||
categoryBreadcrumb = signal<Category[]>([]);
|
||||
loading = signal(false);
|
||||
error = signal<string | null>(null);
|
||||
regenerating = signal(false);
|
||||
@@ -486,6 +493,12 @@ export class ApiDetailComponent implements OnInit, OnDestroy {
|
||||
this.api.set(entry);
|
||||
this.loading.set(false);
|
||||
this.startPollIfPending();
|
||||
if (entry.categoryId) {
|
||||
this.categoryService.browse(entry.categoryId).subscribe({
|
||||
next: (data) => this.categoryBreadcrumb.set(data.breadcrumb),
|
||||
error: () => {},
|
||||
});
|
||||
}
|
||||
},
|
||||
error: (err) => {
|
||||
this.error.set(err.message ?? 'Erreur lors du chargement');
|
||||
|
||||
Reference in New Issue
Block a user