décalage

This commit is contained in:
2026-02-24 23:58:32 +01:00
parent db365010e9
commit b0352c963c
12 changed files with 282 additions and 17 deletions

View File

@@ -2,7 +2,7 @@
<div v-if="items.length > 1" aria-label="Fil dAriane" class="breadcrumb">
<ul class="breadcrumb__list">
<li v-for="(item, i) in items" :key="item.to" class="breadcrumb__item">
<NuxtLink v-if="i < items.length - 1" :to="item.to">
<NuxtLink v-if="i < items.length - 1 && !item.noLink" :to="item.to">
<img
v-if="i === 0"
src="/img/icones/house-grey.svg"
@@ -32,6 +32,27 @@
professionnels: "Professionnels"
}
function resolveTo(part, index, parts, acc) {
if (part === 'concerts') {
const next = parts[index + 1] || ''
if (next.startsWith('concert-')) {
const from = typeof route.query.from === 'string' ? route.query.from : ''
if (from === 'agenda') return '/concerts/agenda'
if (from === 'saison') return '/concerts/saison'
if (from === 'jeune-public') return '/concerts/jeune-public'
}
}
if (part === 'orchestre') {
const next = parts[index + 1] || ''
if (next.startsWith('artiste-') || next.startsWith('artisteinvitee-') || next.startsWith('artistesinvitees-')) {
const from = typeof route.query.from === 'string' ? route.query.from : ''
if (from === 'musiciens') return '/orchestre/musiciens'
if (from === 'artistesinvitees') return '/orchestre/artistesinvitees'
}
}
return acc
}
function humanize(segment) {
return segment
.replace(/-/g, ' ')
@@ -41,6 +62,7 @@
const items = computed(() => {
const parts = route.path.split('/').filter(Boolean)
const crumbs = [{ to: '/', label: 'Accueil' }]
const from = typeof route.query.from === 'string' ? route.query.from : ''
let acc = ''
parts.forEach((part, index) => {
@@ -50,7 +72,35 @@
? props.currentLabel
: (labelMap[part] || humanize(decodeURIComponent(part)))
crumbs.push({ to: acc, label })
const noLink = part === 'orchestre' || part === 'concerts'
crumbs.push({ to: resolveTo(part, index, parts, acc), label, noLink })
if (part === 'concerts') {
const next = parts[index + 1] || ''
if (next.startsWith('concert-')) {
if (from === 'agenda') {
crumbs.push({ to: '/concerts/agenda', label: 'Agenda' })
}
if (from === 'saison') {
crumbs.push({ to: '/concerts/saison', label: 'Saison' })
}
if (from === 'jeune-public') {
crumbs.push({ to: '/concerts/jeune-public', label: 'Jeune public' })
}
}
}
if (part === 'orchestre') {
const next = parts[index + 1] || ''
if (next.startsWith('artiste-') || next.startsWith('artisteinvitee-')) {
if (from === 'musiciens') {
crumbs.push({ to: '/orchestre/musiciens', label: 'Les musiciens' })
}
if (from === 'artistesinvitees') {
crumbs.push({ to: '/orchestre/artistesinvitees', label: 'Les artistes invités' })
}
}
}
})
return crumbs