Files
wondif_vue/app/pages/mediation/chantons.vue
2026-05-20 00:45:23 +02:00

242 lines
7.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="chantons--page">
<!-- ================== -->
<!-- FILS D'ARIANE -->
<!-- ================== -->
<PageSection tone="" content-size="default" class="breadcrum_wp">
<Breadcrumb/>
</PageSection>
<!-- ================== -->
<!-- EN-TêTE -->
<!-- ================== -->
<section class="fiche_header_simple_wp">
<div class="fiche_header_wp_gauche"></div>
<div class="fiche_header_inner">
<div class="fiche_header_titres">
<div>
<DsHeading as="h1" tone="default" textcase="uppercase" class="concert-card__title">
{{chantons_donnees_servies.header_titre}}
</DsHeading>
</div>
<DsText as="p" align="justify">
{{chantons_donnees_servies.header_text}}
</DsText>
</div>
<div class="fiche_header_img">
<DsMedia
v-if="chantons_donnees_servies?.header_illustration?.url"
:src="chantons_donnees_servies.header_illustration.url"
:alt="chantons_donnees_servies.header_illustration.alternativeText || ''"
fit="cover"
ratio="square"
/>
<div v-else class="img_placeholder" aria-hidden="true" />
</div>
</div>
<div class="fiche_header_wp_droite"></div>
</section>
<!-- ================== -->
<!-- AFFICHAGE DES PARTIE EN DÉCALLAGE AVEC LE CONTENU PROVENANT DE STRAPI -->
<!-- ================== -->
<template v-for="(t, index) in tiroirs" :key="index">
<PageSection :content="false" :class="{ 'decalage-section--spaced': index > 0 }">
<Decalage
:tone="t.decalage_couleur"
title-tone="invert"
:position="t.decalage_sens"
button-tone="invert"
:ensavoirplus-target="t.tiroir_ouvert ? undefined : `texte_cache_${index + 3}`"
:ensavoirplus-group="t.tiroir_ouvert ? undefined : 'chantons-details'"
>
<template #title>
{{ t.decalage_titre }}
</template>
<DsText as="p" tone="invert" :align="t.decalage_sens">
{{ t.decalage_texte }}
</DsText>
</Decalage>
</PageSection>
<PageSection
:id="`texte_cache_${index + 3}`"
:data-ensavoirplus-group="t.tiroir_ouvert ? undefined : 'chantons-details'"
tone=""
content-size="default"
padded_size=""
:class="{ 'decalage_ensavoirplus--hidden': !t.tiroir_ouvert }"
>
<section v-if="t.tiroir_galerie.length" class="img-gallery_wp">
<div class="img-gallery">
<DsMedia
v-for="img in t.tiroir_galerie"
:key="img.id || img.url"
:src="img.url"
:alt="img.alternativeText"
/>
</div>
</section>
<SectionContent class="fiche_description">
<StrapiBlocksConvert :blocks="t.tiroir_description" />
</SectionContent>
<section v-if="t.tiroir_videos.length" class="youtube_wp">
<div class="youtube-list">
<div v-for="v in t.tiroir_videos" :key="v.id" class="youtube-item">
<iframe
:src="v.lien_youtube"
title="Vidéo YouTube"
loading="lazy"
referrerpolicy="strict-origin-when-cross-origin"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen
/>
</div>
</div>
</section>
</PageSection>
</template>
<!-- ================== -->
<!-- CONTACT -->
<!-- ================== -->
<PageSection tone="" content-size="default" padded_size="md" class="contact_spe_wp">
<ContactSpecifique
titre="Contacter le service des actions culturelles"
nom="Vanessa Gasztowtt"
poste="Responsable de laction éducative et culturelle
et de la programmation jeune public"
numero=""
mail="vanessa.gasztowtt@orchestre-ile.com"
adresse=""
/>
</PageSection>
</div>
</template>
<script setup>
import DsHeading from '@root/design-system/primitives/DsHeading.vue'
import DsText from '@root/design-system/primitives/DsText.vue'
import DsMedia from '@root/design-system/primitives/DsMedia.vue'
import { computed } from 'vue'
// ======================================
// RÉCUPÉRATION DES DONNÉES DANS STRAPI
// ======================================
const endpoint = "/api/__strapi__/chantons"
const populate = {
header_illustration: true,
tiroirs_chantons: {
decalage_parametres: true,
tiroir_galerie: true,
tiroir_videos: true,
},
}
const { items: chantons, pending, error } = useStrapi(
endpoint,
{
locale: "fr-FR",
populate,
limit: 1,
}
)
// ======================================
// PRÉPARATION DES DONNÉES POUR AFFICHAGE DANS LA PAGE
// ======================================
const chantons_donnees_servies = computed(() => chantons.value?.[0] || {})
const tiroirs = computed(() =>
(chantons.value?.[0]?.tiroirs_chantons || []).map((tiroir_item) => ({
decalage_titre: tiroir_item.decalage_parametres?.decalage_titre,
decalage_texte: tiroir_item.decalage_parametres?.decalage_texte,
tiroir_ouvert: Boolean(tiroir_item.decalage_parametres?.tiroir_ouvert),
decalage_sens:
tiroir_item.decalage_parametres?.decalage_sens === "droite" ? "right" : "left",
decalage_couleur:
tiroir_item.decalage_parametres?.decalage_couleur === "rouge"
? "brand"
: tiroir_item.decalage_parametres?.decalage_couleur === "vert clair"
? "brandreverse"
: tiroir_item.decalage_parametres?.decalage_couleur === "jaune"
? "jaune"
: "dark",
tiroir_description: tiroir_item.tiroir_description,
tiroir_galerie: (tiroir_item.tiroir_galerie || []).map((tiroir_item_img) => ({
id: tiroir_item_img.id,
url: tiroir_item_img.url,
alt: tiroir_item_img.alternativeText,
})),
tiroir_videos: (tiroir_item.tiroir_videos || [])
.map((tiroir_item_video) => {
const id = getYoutubeId(tiroir_item_video?.lien_youtube)
if (!id) return null
return {
id: tiroir_item_video.id || id,
lien_youtube: `https://www.youtube-nocookie.com/embed/${id}?rel=0&modestbranding=1&iv_load_policy=3&playsinline=1`,
}
})
.filter(Boolean),
}))
)
function getYoutubeId(url = "") {
try {
const u = new URL(url)
if (u.hostname.includes("youtu.be")) return u.pathname.slice(1)
if (u.pathname.startsWith("/shorts/")) return u.pathname.split("/")[2]
if (u.pathname.startsWith("/embed/")) return u.pathname.split("/")[2]
return u.searchParams.get("v")
} catch {
return null
}
}
</script>
<style lang="scss">
// =======================
// SPÉCIFIQUE À CETTE PAGE
// =======================
.chantons--page {
.chiffres_wp {
background-color: var(--c-background-vert);
margin-bottom: 50px;
}
.fiche_description {
display: flex;
justify-content: center;
padding-bottom: 10px;
padding-left: 10px;
padding-right: 10px;
> * {
max-width: 640px;
display: flex;
flex-direction: column;
}
}
.contact_spe_wp {
background-color: var(--c-background-jaune-clair);
margin-top: 50px;
margin-bottom: 40px;
}
}
/* ============================ */
/* GALERIES */
/* ============================ */
</style>