fix(header): resolve breadcrumb labels for devices and melodies correctly
- devices: breadcrumb now falls back through console_name -> device_name -> device_id, matching every other device display label in the console - melodies/archetypes: breadcrumb was reading a bare d.name field that doesn't exist on the melody schema (name lives at d.information.name.<locale>), so these breadcrumbs always showed blank. Now uses getLocalizedValue like the rest of the melodies UI. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import { Link, useLocation, useNavigate } from 'react-router-dom'
|
||||
import { useAuth } from '@/hooks/useAuth'
|
||||
import api from '@/lib/api'
|
||||
import HeaderSearch from '@/components/ui/HeaderSearch'
|
||||
import { getLocalizedValue } from '@/lib/melodyUtils'
|
||||
|
||||
// ─── Breadcrumb config ────────────────────────────────────────────────────────
|
||||
|
||||
@@ -52,10 +53,10 @@ const ENTITY_RESOLVERS = {
|
||||
customers: { path: (id) => `/crm/customers/${id}`, label: (d) => [d.name, d.surname].filter(Boolean).join(' ') || d.organization || null },
|
||||
products: { path: (id) => `/crm/products/${id}`, label: (d) => d.name || null },
|
||||
quotations: { path: (id) => `/crm/quotations/${id}`, label: (d) => d.quotation_number || null },
|
||||
devices: { path: (id) => `/devices/${id}`, label: (d) => d.name || d.device_id || null },
|
||||
devices: { path: (id) => `/devices/${id}`, label: (d) => d.console_name || d.device_name || d.device_id || null },
|
||||
orders: { path: (id) => `/crm/orders/${id}`, label: (d) => d.order_number || null },
|
||||
melodies: { path: (id) => `/melodies/${id}`, label: (d) => d.name || null },
|
||||
archetypes: { path: (id) => `/builder/melodies/${id}`, label: (d) => d.name || null },
|
||||
melodies: { path: (id) => `/melodies/${id}`, label: (d) => getLocalizedValue(d.information?.name, 'en', '') || null },
|
||||
archetypes: { path: (id) => `/builder/melodies/${id}`, label: (d) => getLocalizedValue(d.information?.name, 'en', '') || null },
|
||||
users: { path: (id) => `/users/${id}`, label: (d) => d.name || d.display_name || null },
|
||||
notes: { path: (id) => `/equipment/notes/${id}`, label: (d) => d.title || d.subject || null },
|
||||
staff: { path: (id) => `/staff/${id}`, label: (d) => d.name || null },
|
||||
|
||||
Reference in New Issue
Block a user