From ba9e9a5663b9e2774f3498a943794a565c03418f Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Fri, 20 Dec 2024 18:39:51 +0100 Subject: [PATCH] Attempt to get model verbose name from urlmodel on empty store --- frontend/src/lib/components/Breadcrumbs/Breadcrumbs.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/Breadcrumbs/Breadcrumbs.svelte b/frontend/src/lib/components/Breadcrumbs/Breadcrumbs.svelte index 3f18044eb..795f125a0 100644 --- a/frontend/src/lib/components/Breadcrumbs/Breadcrumbs.svelte +++ b/frontend/src/lib/components/Breadcrumbs/Breadcrumbs.svelte @@ -2,6 +2,7 @@ import { afterNavigate } from '$app/navigation'; import { page } from '$app/stores'; import { breadcrumbs, type Breadcrumb } from '$lib/utils/breadcrumbs'; + import { URL_MODEL_MAP } from '$lib/utils/crud'; import { safeTranslate } from '$lib/utils/i18n'; import { pageTitle } from '$lib/utils/stores'; @@ -20,7 +21,8 @@ return safeTranslate( $page.data.title || $page.data.str || $page.data.name || $breadcrumbs.length > 1 ? $breadcrumbs[$breadcrumbs.length - 1]?.label - : $page.url.pathname.split('/').pop() + : (URL_MODEL_MAP[$page.url.pathname.split('/').pop() as string]?.verboseNamePlural ?? + $page.url.pathname.split('/').pop()) ); }