2024-07-31 00:33:21 +02:00
|
|
|
<template>
|
2024-10-07 03:19:22 +02:00
|
|
|
<Transition>
|
2024-10-17 02:50:39 +02:00
|
|
|
<div v-if="!loading && (contentType === 'etape' || contentType === 'static')">
|
2024-10-07 03:19:22 +02:00
|
|
|
<div class="content-wrapper">
|
2024-10-17 02:50:39 +02:00
|
|
|
<ModaleHeader
|
|
|
|
:contentType="contentType"
|
|
|
|
:content="content"
|
|
|
|
:couleur="content.couleur || brandColor" />
|
2024-10-07 03:19:22 +02:00
|
|
|
<main>
|
2024-10-17 02:50:39 +02:00
|
|
|
<div v-for="partie in content.parties" class="partie">
|
2024-10-07 03:19:22 +02:00
|
|
|
<ModaleCarteSensible
|
|
|
|
v-if="partie.type === 'carte_sensible'"
|
|
|
|
:partie="partie" />
|
|
|
|
<ModaleTitreTexte
|
|
|
|
v-if="partie.type === 'titre_texte'"
|
|
|
|
:partie="partie"
|
2024-10-17 02:50:39 +02:00
|
|
|
:couleur="content.couleur || brandColor" />
|
2024-10-07 03:19:22 +02:00
|
|
|
<ModaleChiffresCles
|
|
|
|
v-if="partie.type === 'chiffres_cles'"
|
|
|
|
:partie="partie"
|
2024-10-17 02:50:39 +02:00
|
|
|
:couleur="content.couleur || brandColor" />
|
2024-10-07 03:19:22 +02:00
|
|
|
<ModaleDiaporama
|
|
|
|
v-if="partie.type === 'diaporama'"
|
2024-10-07 23:39:50 +02:00
|
|
|
:partie="partie"
|
2024-10-17 02:50:39 +02:00
|
|
|
:couleur="content.couleur || brandColor" />
|
2024-10-07 03:19:22 +02:00
|
|
|
<ModaleEntretien
|
|
|
|
v-if="partie.type === 'entretien'"
|
|
|
|
:partie="partie"
|
2024-10-17 02:50:39 +02:00
|
|
|
:couleur="content.couleur || brandColor" />
|
2024-10-07 03:19:22 +02:00
|
|
|
<ModaleExergue
|
|
|
|
v-if="partie.type === 'exergue'"
|
|
|
|
:partie="partie"
|
2024-10-17 02:50:39 +02:00
|
|
|
:couleur="content.couleur || brandColor" />
|
2024-10-07 03:19:22 +02:00
|
|
|
<ModaleVideos
|
|
|
|
v-if="partie.type === 'video'"
|
|
|
|
:partie="partie" />
|
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
<ModaleFooter
|
2024-10-17 02:50:39 +02:00
|
|
|
:contentType="contentType"
|
|
|
|
:content="content"
|
|
|
|
:couleur="content.couleur || brandColor"
|
|
|
|
/>
|
2024-09-29 21:36:21 +02:00
|
|
|
</div>
|
2024-10-07 03:19:22 +02:00
|
|
|
</div>
|
|
|
|
</Transition>
|
2024-07-31 00:33:21 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2024-10-07 03:19:22 +02:00
|
|
|
import { computed, watch, onMounted } from 'vue';
|
2024-10-17 02:50:39 +02:00
|
|
|
|
2024-08-05 21:08:09 +02:00
|
|
|
import { storeToRefs } from 'pinia';
|
|
|
|
import { useContentStore } from '../stores/content';
|
2024-10-19 04:08:11 +02:00
|
|
|
import { useMapStore } from '../stores/map';
|
2024-10-19 03:49:16 +02:00
|
|
|
import { useLayoutStore } from '../stores/layout';
|
2024-09-29 21:36:21 +02:00
|
|
|
|
2024-10-07 03:19:22 +02:00
|
|
|
import ModaleHeader from './components/ModaleHeader.vue';
|
|
|
|
import ModaleFooter from './components/ModaleFooter.vue';
|
|
|
|
|
|
|
|
import ModaleCarteSensible from './components/parties/ModaleCarteSensible.vue';
|
|
|
|
import ModaleTitreTexte from './components/parties/ModaleTitreTexte.vue';
|
|
|
|
import ModaleChiffresCles from './components/parties/ModaleChiffresCles.vue';
|
|
|
|
import ModaleDiaporama from './components/parties/ModaleDiaporama.vue';
|
|
|
|
import ModaleEntretien from './components/parties/ModaleEntretien.vue';
|
|
|
|
import ModaleExergue from './components/parties/ModaleExergue.vue';
|
|
|
|
import ModaleVideos from './components/parties/ModaleVideos.vue';
|
2024-09-29 21:36:21 +02:00
|
|
|
|
2024-08-05 21:08:09 +02:00
|
|
|
const store = useContentStore();
|
2024-10-07 23:39:50 +02:00
|
|
|
const mapState = useMapStore();
|
2024-10-19 03:49:16 +02:00
|
|
|
const layoutStore = useLayoutStore();
|
|
|
|
|
|
|
|
// pour importer le breakpoint
|
|
|
|
// const { minDesktopWidth } = storeToRefs(layoutStore);
|
|
|
|
// console.log(minDesktopWidth);
|
|
|
|
|
2024-07-31 00:33:21 +02:00
|
|
|
|
2024-10-17 02:50:39 +02:00
|
|
|
const {
|
|
|
|
contentType,
|
|
|
|
content,
|
|
|
|
loading,
|
|
|
|
error,
|
|
|
|
} = storeToRefs(store);
|
2024-07-31 00:33:21 +02:00
|
|
|
|
2024-10-17 02:50:39 +02:00
|
|
|
const { map, duration } = storeToRefs(mapState);
|
2024-07-31 02:13:40 +02:00
|
|
|
|
2024-10-07 23:39:50 +02:00
|
|
|
let isModaleEtape, wasModaleEtape;
|
|
|
|
|
2024-10-07 03:19:22 +02:00
|
|
|
const brandColor = "#80c8bf";
|
2024-08-05 21:08:09 +02:00
|
|
|
|
2024-10-07 03:19:22 +02:00
|
|
|
const handleColorChange = () => {
|
|
|
|
watch(
|
2024-10-17 02:50:39 +02:00
|
|
|
() => content.value.couleur,
|
|
|
|
() => {
|
|
|
|
if (contentType.value === 'etape' && content.value.couleur) {
|
|
|
|
document.documentElement.style.setProperty('--etape-couleur', content.value.couleur || brandColor);
|
|
|
|
}
|
2024-07-31 02:13:40 +02:00
|
|
|
}
|
2024-10-07 03:19:22 +02:00
|
|
|
);
|
2024-09-29 21:36:21 +02:00
|
|
|
};
|
|
|
|
|
2024-10-07 23:39:50 +02:00
|
|
|
const handleMapMovement = () => {
|
|
|
|
watch(
|
2024-10-17 02:50:39 +02:00
|
|
|
() => loading.value,
|
2024-10-07 23:39:50 +02:00
|
|
|
() => {
|
2024-10-17 02:50:39 +02:00
|
|
|
if (!loading.value) {
|
|
|
|
isModaleEtape = contentType.value === 'etape';
|
|
|
|
|
|
|
|
if (!wasModaleEtape && isModaleEtape) {
|
|
|
|
// national -> détail
|
|
|
|
document.documentElement.style.setProperty('--modale-enter-delay', `${duration.value}s`);
|
|
|
|
mapState.zoomToPlace(content.value.coordinates.lat, content.value.coordinates.lon);
|
|
|
|
} else if (wasModaleEtape && isModaleEtape) {
|
|
|
|
// détail -> détail
|
|
|
|
document.documentElement.style.setProperty('--modale-leave-delay', 0);
|
|
|
|
document.documentElement.style.setProperty('--modale-enter-delay', `${duration.value * 2}s`);
|
|
|
|
mapState.resetMap(map.value);
|
|
|
|
setTimeout(() => {
|
|
|
|
mapState.zoomToPlace(content.value.coordinates.lat, content.value.coordinates.lon);
|
|
|
|
}, duration.value * 1000);
|
|
|
|
|
|
|
|
} else if (wasModaleEtape && !isModaleEtape) {
|
|
|
|
// détail -> national
|
|
|
|
document.documentElement.style.setProperty('--modale-leave-delay', 0);
|
|
|
|
document.documentElement.style.setProperty('--modale-enter-delay', `${duration.value}s`);
|
|
|
|
mapState.resetMap();
|
|
|
|
} else if (!wasModaleEtape && !isModaleEtape) {
|
|
|
|
// national -> national
|
|
|
|
console.log('national -> national');
|
|
|
|
document.documentElement.style.setProperty('--modale-leave-delay', 0);
|
|
|
|
document.documentElement.style.setProperty('--modale-enter-delay', '0.5s');
|
|
|
|
}
|
|
|
|
|
|
|
|
wasModaleEtape = isModaleEtape;
|
|
|
|
}
|
2024-10-07 23:39:50 +02:00
|
|
|
},
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2024-10-07 03:19:22 +02:00
|
|
|
onMounted(() => {
|
2024-10-17 02:50:39 +02:00
|
|
|
isModaleEtape = contentType.value === 'etape';
|
|
|
|
wasModaleEtape = isModaleEtape;
|
|
|
|
handleColorChange();
|
|
|
|
handleMapMovement();
|
2024-10-07 03:19:22 +02:00
|
|
|
});
|
|
|
|
</script>
|
2024-07-31 02:13:40 +02:00
|
|
|
|
2024-10-17 02:50:39 +02:00
|
|
|
<style scoped scss>
|
2024-10-07 23:39:50 +02:00
|
|
|
.v-enter-active {
|
2024-10-17 02:50:39 +02:00
|
|
|
transition: margin-top 0.5s ease-out var(--modale-enter-delay);
|
2024-10-07 23:39:50 +02:00
|
|
|
}
|
|
|
|
|
2024-07-31 02:13:40 +02:00
|
|
|
.v-leave-active {
|
2024-10-17 02:50:39 +02:00
|
|
|
transition: margin-top 0.5s ease-in var(--modale-leave-delay);
|
2024-07-31 02:13:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.v-enter-from,
|
|
|
|
.v-leave-to {
|
2024-10-17 02:50:39 +02:00
|
|
|
margin-top: 150vh;
|
2024-07-31 02:13:40 +02:00
|
|
|
}
|
|
|
|
|
2024-10-07 23:39:50 +02:00
|
|
|
.v-enter-to,
|
2024-07-31 02:13:40 +02:00
|
|
|
.v-leave-from {
|
2024-10-17 02:50:39 +02:00
|
|
|
margin-top: 0vh;
|
2024-07-31 02:13:40 +02:00
|
|
|
}
|
|
|
|
</style>
|