diff --git a/src/components/Dashboard/common/DashboardBreadcrumb.jsx b/src/components/Dashboard/common/DashboardBreadcrumb.jsx
index 8d77bdf..0515cdb 100644
--- a/src/components/Dashboard/common/DashboardBreadcrumb.jsx
+++ b/src/components/Dashboard/common/DashboardBreadcrumb.jsx
@@ -4,6 +4,7 @@ import { Breadcrumb, Button, Flex, Space } from 'antd'
import { Link, useLocation, useNavigate } from 'react-router-dom'
import ArrowLeftIcon from '../../Icons/ArrowLeftIcon'
import ArrowRightIcon from '../../Icons/ArrowRightIcon'
+import { getModelByName } from '../../../database/ObjectModels'
const breadcrumbNameMap = {
production: 'Production',
@@ -11,30 +12,8 @@ const breadcrumbNameMap = {
management: 'Management',
developer: 'Developer',
overview: 'Overview',
- printers: 'Printers',
- hosts: 'Hosts',
- control: 'Control',
info: 'Info',
- jobs: 'Jobs',
- subjobs: 'Sub Jobs',
- gcodefiles: 'G Code Files',
- filaments: 'Filaments',
- parts: 'Parts',
- products: 'Products',
- vendors: 'Vendors',
- materials: 'Materials',
- notetypes: 'Note Types',
- users: 'Users',
- settings: 'Settings',
- auditlogs: 'Audit Logs',
- filamentstocks: 'Filament Stocks',
- partstocks: 'Part Stocks',
- productstocks: 'Products',
- stockevents: 'Stock Events',
- stockaudits: 'Stock Audits',
- sessionstorage: 'Session Storage',
- authcontextdebug: 'Auth Context Debug',
- printservercontextdebug: 'Print Server Context Debug'
+ design: 'Design'
}
const mainSections = ['production', 'inventory', 'management', 'developer']
@@ -44,15 +23,39 @@ const DashboardBreadcrumb = () => {
const navigate = useNavigate()
const pathSnippets = location.pathname.split('/').filter((i) => i)
+ function segmentToModel(segment) {
+ if (segment) {
+ // If segment ends with 's', remove it and get the model
+ if (segment.endsWith('s')) {
+ const singularSegment = segment.slice(0, -1)
+ return getModelByName(singularSegment, true)
+ }
+ // Otherwise, get the model as is
+ return getModelByName(segment, true)
+ }
+ return null
+ }
+
const breadcrumbItems = pathSnippets.map((segment, index) => {
const url = `/${pathSnippets.slice(0, index + 1).join('/')}`
if (segment !== 'dashboard') {
const isMainSection = mainSections.includes(segment)
- const name = breadcrumbNameMap[segment] || segment
+ const model = segmentToModel(segment)
+ const modelLabelPlural = model?.label ? `${model.label}s` : null
+ const name = breadcrumbNameMap[segment] || modelLabelPlural || segment
+ if (isMainSection) {
+ return {
+ title: (
+
+ {name}
+
+ ),
+ key: segment
+ }
+ }
+
return {
- title: isMainSection ? (
- {name}
- ) : (
+ title: (
{name}