Skip to content

Commit

Permalink
Attempt to get model verbose name from urlmodel on empty store
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Dec 20, 2024
1 parent cd66535 commit ba9e9a5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/src/lib/components/Breadcrumbs/Breadcrumbs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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())
);
}
Expand Down

0 comments on commit ba9e9a5

Please sign in to comment.