Remove colors

This commit is contained in:
2025-02-08 02:38:41 -05:00
parent f4794fb817
commit 7f4e7ead40
36 changed files with 855 additions and 1138 deletions

View File

@@ -1,18 +1,17 @@
<template>
<div v-if="creatorProfileStore.creator?.id === brandingStore.value.id" class="flex justify-end space-x-2 mb-5 pa-1">
<div v-if="creatorProfileStore.creator?.id === brandingStore.value.id"
class="flex justify-end space-x-2 mb-5 pa-1">
<!-- Bouton principal : Éditer ou Enregistrer -->
<button
v-if="isLoggedIn"
@click="isEditMode ? saveChanges() : toggleEditMode()"
class="px-4 py-2 rounded-md hover:opacity-90"
:style="{ backgroundColor: brandingStore.colors.secondary, color: brandingStore.colors.onSecondary }"
class="px-4 py-2 rounded-md hover:opacity-90 bg-hSecondary text-hOnSecondary"
>
<v-icon>mdi-home-edit</v-icon>
{{ isEditMode ? 'Enregistrer' : 'Éditer la page' }}
</button>
<button
v-if="isEditMode && isLoggedIn"
@click="cancelEdit"
@@ -23,359 +22,282 @@
</div>
<!-- MainPage -->
<div v-if="!isEditMode" class=" flex flex-col" >
<div class="flex flex-col max-w-[650px] mx-auto px-6 bg-hBackground text-hOnBackground">
<div v-if=" mainTitle || mainImageUrl || mainImageText || videoSubtitleMain || videoUrlMain || mainVideoText || imagesSubtitle || image1Url || image2Url || image3Url || image4Url || imagesText || videoSubtitle || videoUrl || videoText" :style="{ backgroundColor: brandingStore.colors.primary, color: brandingStore.colors.onPrimary }" class="rounded-2xl py-4" >
<!-- Main image -->
<div v-if="mainTitle || mainImageUrl || mainImageText " class="py-4" :style="{ backgroundColor: brandingStore.colors.primary, color: brandingStore.colors.onPrimary }">
<div v-if="mainTitle">
<h1 class="text-4xl font-bold text-center py-4 mb-4">{{ mainTitle }}</h1>
</div>
<h1 class="flex justify-start text-2xl font-bold text-center mb-4">Qui sommes-nous</h1>
<div class="flex justify-center items-center">
<img
v-if="mainImageUrl"
:src="mainImageUrl"
alt="Image principale"
class=" max-w-full h-auto cursor-pointer flex center"
@click="openFullscreen(mainImageUrl)"/>
</div>
<div>
<!-- Main image Bloc D'information-->
<div class="py-4" >
<p v-if="mainImageText" class="text-lg text-justify pa-6">
{{ mainImageText }}
</p>
</div>
<div v-if="!isEditMode">
<p class="py-4 text-justify" v-if="mainImageText ">
{{ mainImageText }}
</p>
</div>
<v-textarea v-if="isEditMode" label="Description" variant="outlined" v-model="editableMainImageText"
class="w-full p-2 py-6 "></v-textarea>
<!-- Main video -->
<div v-if="videoSubtitleMain || videoUrlMain || mainVideoText " :style="{ backgroundColor: brandingStore.colors.surface, color: brandingStore.colors.onSurface }">
<h2 v-if="videoSubtitleMain" class="text-3xl font-semibold text-center py-6">
{{ videoSubtitleMain }}
</h2>
<div class="flex flex-row items-center space-x-4">
<!-- image principale-->
<div v-if="!isEditMode" class="flex justify-center items-center w-1/2">
<img
v-if="mainImageUrl"
:src="mainImageUrl"
alt="Image principale"
class="max-w-full h-auto cursor-pointer"
@click="openFullscreen(mainImageUrl)" />
</div>
<div v-if="isEditMode" class="relative flex justify-center">
<label >
<input type="file" @change="updateImage('mainImageUrl', $event)" class="hidden"/>
<img :src="mainImageUrl || fallbackImage"
alt="Image principale"
class=" max-w-full h-auto cursor-pointer max-h-96"/>
</label>
<button v-if="isEditMode" @click="deleteImage('mainImageUrl')"
class="absolute top-10 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600">
X
</button>
</div>
<div v-if="videoUrlMain" class="video-container">
<iframe
:src="videoUrlMain"
title="YouTube video player"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
class="video-frame">
</iframe>
</div>
<p v-if="mainVideoText" class="text-lg text-justify pa-6 mb-4">
{{ mainVideoText }}
</p>
</div>
<div class="w-1/2 flex flex-col justify-center">
<h2 v-if="videoSubtitleMain" class="text-xl font-semibold text-center">
Pourquoi nous supporter
</h2>
<!-- Images -->
<div v-if="imagesSubtitle || image1Url || image2Url || image3Url || image4Url || imagesText " :style="{ backgroundColor: brandingStore.colors.primary, color: brandingStore.colors.onPrimary }">
<div>
<h2 v-if="imagesSubtitle" class="text-xl font-semibold text-center mb-6">
{{ imagesSubtitle }}
</h2>
</div>
<!-- images-->
<div class="pa-2">
<FullscreenImage ref="fullscreenImage" :image-url="currentImage"/>
<div>
<!-- Affichage des images -->
<div class="flex flex-wrap gap-4">
<!-- Première image -->
<div class="relative w-full sm:flex-1 sm:min-w-[calc(25%-1rem)]" v-if="image1Url"
@click="openFullscreen(image1Url)">
<img :src="image1Url" alt="Image 1" class="rounded-md max-w-full h-auto cursor-pointer"/>
<div v-if="!isEditMode">
<p v-if="mainVideoText" class="text-lg text-justify mt-5 mb-4">
{{ mainVideoText }}
</p>
</div>
<!-- Deuxième image -->
<div class="relative w-full sm:flex-1 sm:min-w-[calc(25%-1rem)]" v-if="image2Url"
@click="openFullscreen(image2Url)">
<img :src="image2Url" alt="Image 2" class="rounded-md max-w-full h-auto cursor-pointer"/>
<div v-if="isEditMode">
<v-textarea
label="Description"
v-model="editableMainVideoText"
class="p-2 rounded-md mt-4"
variant="outlined"
rows="10"
></v-textarea>
</div>
</div>
</div>
<!-- Troisième image -->
<div class="relative w-full sm:flex-1 sm:min-w-[calc(25%-1rem)]" v-if="image3Url"
@click="openFullscreen(image3Url)">
<img :src="image3Url" alt="Image 3" class="rounded-md max-w-full h-auto cursor-pointer"/>
</div>
<div >
<div v-if="!isEditMode" class="py-5 text-lg font-bold">
{{ videoSubtitle }}
</div>
<div v-if="isEditMode">
<v-text-field
label="Titre"
variant="outlined"
v-model="editableVideoSubtitle"
class="w-full p-2"
></v-text-field>
</div>
<!-- Quatrième image -->
<div class="relative w-full sm:flex-1 sm:min-w-[calc(25%-1rem)]" v-if="image4Url"
@click="openFullscreen(image4Url)">
<img :src="image4Url" alt="Image 4" class="rounded-md max-w-full h-auto cursor-pointer"/>
</div>
<v-textarea v-if="isEditMode" rows="10" variant="outlined" v-model="editableImagesText" class="w-full p-2 border rounded-md"></v-textarea>
<div v-if="!isEditMode">
<p v-if="imagesText " class="text-lg text-justify">
{{ imagesText }}
</p>
</div>
</div>
</div>
<div>
<p v-if="imagesText" class="text-lg text-justify pa-6">
{{ imagesText }}
</p>
</div>
</div>
<!--SecondVideo-->
<div v-if="videoSubtitle || videoUrl || videoText " :style="{ backgroundColor: brandingStore.colors.surface, color: brandingStore.colors.onSurface }">
<h2 v-if="videoSubtitle" class="text-xl font-semibold text-center py-6">
{{ videoSubtitle }}
</h2>
<div class="flex justify-center items-center h-full">
<iframe
v-if="videoUrl"
:src="videoUrl"
title="YouTube video player"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
class="rounded-md"
style="width: 600px; height: 337px;"
></iframe>
</div>
<p v-if="videoText" class="text-lg text-justify pa-6">
{{ videoText }}
</p>
</div>
<!-- Contact Info-->
<div v-if="editablePhoneNumber || editableEmail" class="mb-6" :style="{ backgroundColor: brandingStore.colors.primary, color: brandingStore.colors.onPrimary }">
<!-- mobile-->
<div v-if="smAndDown">
<div class="flex flex-col space-y-10 mt-12 justify-center items-center">
<!-- Affichage du téléphone -->
<div v-if="editablePhoneNumber" class="flex items-center space-x-2">
<i class="mdi mdi-phone-outline text-2xl"></i>
<span>{{ editablePhoneNumber }}</span>
</div>
<!-- Affichage de l'email -->
<div v-if="editableEmail" class="flex items-center space-x-2">
<i class="mdi mdi-email-outline text-2xl"></i>
<a
:href="`mailto:${editableEmail}`"
class="no-underline text-current"
>
{{ editableEmail }}
</a>
</div>
<!-- media-->
<div v-if="!isEditMode">
<div v-if="videoUrlMain" class="video-container">
<iframe
:src="videoUrlMain"
title="YouTube video player"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
class="video-frame">
</iframe>
</div>
</div>
<!--pc-->
<div v-if="!smAndDown">
<div class="flex space-x-64 space-y-4 mt-9 justify-center items-center">
<!-- Affichage du téléphone -->
<div v-if="editablePhoneNumber" class="flex items-center space-x-2">
<i class="mdi mdi-phone-outline text-2xl"></i>
<span>{{ editablePhoneNumber }}</span>
</div>
<!-- Affichage de l'email -->
<div v-if="editableEmail" class="flex items-center space-x-2">
<i class="mdi mdi-email-outline text-2xl"></i>
<a
:href="`mailto:${editableEmail}`"
class="no-underline text-current"
>
{{ editableEmail }}
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Editmode-->
<div v-if="isEditMode" class="space-y-10">
<!--Main image-->
<div class="rounded-2xl"
:style="{ backgroundColor: brandingStore.colors.primary, color: brandingStore.colors.onPrimary }">
<div v-if="isEditMode">
<div class="text-2xl pa-4">Image principale</div>
<v-text-field label="Titre" variant="outlined" v-model="editableMainTitle" class="w-full p-2"></v-text-field>
</div>
<div class="relative flex justify-center">
<label v-if="isEditMode">
<input type="file" @change="updateImage('mainImageUrl', $event)" class="hidden"/>
<img :src="mainImageUrl || fallbackImage"
alt="Image principale"
class=" max-w-full h-auto cursor-pointer max-h-96"/>
</label>
<button v-if="isEditMode" @click="deleteImage('mainImageUrl')"
class="absolute top-10 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600">
X
</button>
</div>
<v-textarea label="Description" variant="outlined" v-model="editableMainImageText"
class="w-full p-2 py-6 "></v-textarea>
</div>
<!--Main VideoUrl-->
<div class="rounded-2xl"
:style="{ backgroundColor: brandingStore.colors.primary, color: brandingStore.colors.onPrimary}">
<!--Titre Video-->
<div class="text-2xl pa-4">Vidéo Princpiale</div>
<v-text-field
label="Titre"
variant="outlined"
v-model="editableVideoSubtitleMain"
class="w-full p-2 border rounded-md"></v-text-field>
<!--urlvideo-->
<v-text-field
label="URL Video"
variant="outlined"
v-if="isEditMode"
type="text"
v-model="editableVideoUrlMain"
class="w-full p-2 rounded-md"
/>
<!-- Texte sous video principale -->
<v-text-field
label="Description"
v-model="editableMainVideoText" class="w-full p-2 rounded-md h-24"
variant="outlined"
></v-text-field>
</div>
<!-- 4 images-->
<div class="rounded-2xl"
:style="{ backgroundColor: brandingStore.colors.primary, color: brandingStore.colors.onPrimary}">
<div v-if="isEditMode">
<div class="text-2xl pa-4">Galerie d'images</div>
<v-text-field label="Titre" variant="outlined" v-model="editableImagesSubtitle" class="w-full p-2 rounded-md"></v-text-field>
<v-text-field
label="URL Video"
variant="outlined"
v-if="isEditMode"
type="text"
v-model="editableVideoUrlMain"
class="w-full p-2 rounded-md"
/>
</div>
<!--images-->
<div class=" text-2xl pa-2
">Images
</div>
<div class="pa-2 grid grid-cols-1 gap-4 md:grid-cols-4">
<!-- Première image -->
<div class="relative">
<label>
<input type="file" @change="updateImage('image1Url', $event)" class="hidden"/>
<img :src="image1Url || fallbackImage"
alt="Image 1"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</label>
<button @click="deleteImage('image1Url')"
class="absolute top-2 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600">
X
</button>
</div>
<!-- Images -->
<!-- Deuxième image -->
<div class="relative">
<label>
<input type="file" @change="updateImage('image2Url', $event)" class="hidden"/>
<img :src="image2Url || fallbackImage"
alt="Image 2"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</label>
<button @click="deleteImage('image2Url')"
class="absolute top-2 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600">
X
</button>
</div>
<div v-if="!isEditMode">
<div v-if="imagesSubtitle || image1Url || image2Url || image3Url || image4Url || imagesText " >
<!-- images-->
<div class="py-2">
<FullscreenImage ref="fullscreenImage" :image-url="currentImage"/>
<div>
<!-- Affichage des images -->
<div class="flex gap-2">
<!-- Première image -->
<div class="relative w-full sm:flex-1 " v-if="image1Url"
@click="openFullscreen(image1Url)">
<img :src="image1Url" alt="Image 1" class="rounded-md max-w-full h-auto cursor-pointer"/>
</div>
<!-- Troisième image -->
<div class="relative">
<label>
<input type="file" @change="updateImage('image3Url', $event)" class="hidden"/>
<img :src="image3Url || fallbackImage"
alt="Image 3"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</label>
<button @click="deleteImage('image3Url')"
class="absolute top-2 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600">
X
</button>
</div>
<!-- Deuxième image -->
<div class="relative w-full sm:flex-1 " v-if="image2Url"
@click="openFullscreen(image2Url)">
<img :src="image2Url" alt="Image 2" class="rounded-md max-w-full h-auto cursor-pointer"/>
</div>
<!-- Quatrième image -->
<div class="relative">
<label>
<input type="file" @change="updateImage('image4Url', $event)" class="hidden"/>
<img :src="image4Url || fallbackImage"
alt="Image 4"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</label>
<button @click="deleteImage('image4Url')"
class="absolute top-2 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600">
X
</button>
<!-- Troisième image -->
<div class="relative w-full sm:flex-1 " v-if="image3Url"
@click="openFullscreen(image3Url)">
<img :src="image3Url" alt="Image 3" class="rounded-md max-w-full h-auto cursor-pointer"/>
</div>
<!-- Quatrième image -->
<div class="relative w-full sm:flex-1 " v-if="image4Url"
@click="openFullscreen(image4Url)">
<img :src="image4Url" alt="Image 4" class="rounded-md max-w-full h-auto cursor-pointer"/>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Description-->
<div class="text-2xl pa-2"> Description</div>
<v-textarea variant="outlined" v-model="editableImagesText" class="w-full p-2 border rounded-md"></v-textarea>
<div v-if="isEditMode" class="rounded-2xl">
<!--images-->
<div class=" text-2xl pa-2">Images</div>
<div class="pa-2 grid grid-cols-1 gap-4 md:grid-cols-4">
<!-- Première image -->
<div class="relative">
<label>
<input type="file" @change="updateImage('image1Url', $event)" class="hidden"/>
<img :src="image1Url || fallbackImage"
alt="Image 1"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</label>
<button @click="deleteImage('image1Url')"
class="absolute top-2 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600">
X
</button>
</div>
</div>
<!-- Deuxième image -->
<div class="relative">
<label>
<input type="file" @change="updateImage('image2Url', $event)" class="hidden"/>
<img :src="image2Url || fallbackImage"
alt="Image 2"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</label>
<button @click="deleteImage('image2Url')"
class="absolute top-2 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600">
X
</button>
</div>
<!-- Second Video -->
<div class="rounded-2xl"
:style="{ backgroundColor: brandingStore.colors.primary, color: brandingStore.colors.onPrimary }">
<div class="text-2xl pa-4">Vidéo Secondaire</div>
<!-- Troisième image -->
<div class="relative">
<label>
<input type="file" @change="updateImage('image3Url', $event)" class="hidden"/>
<img :src="image3Url || fallbackImage"
alt="Image 3"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</label>
<button @click="deleteImage('image3Url')"
class="absolute top-2 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600">
X
</button>
</div>
<v-text-field
label="Titre"
variant="outlined"
v-model="editableVideoSubtitle"
class="w-full p-2"
></v-text-field>
<!-- Quatrième image -->
<div class="relative">
<label>
<input type="file" @change="updateImage('image4Url', $event)" class="hidden"/>
<img :src="image4Url || fallbackImage"
alt="Image 4"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</label>
<button @click="deleteImage('image4Url')"
class="absolute top-2 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600">
X
</button>
</div>
</div>
<v-text-field
label="URL Vidéo"
variant="outlined"
v-if="isEditMode"
v-model="editableVideoUrl"
class="w-full p-2"
></v-text-field>
<!-- Description-->
<div class="text-2xl pa-2"> Description</div>
</div>
<v-textarea
label="Description"
variant="outlined"
v-model="editableVideoText"
class="w-full p-2 py-6"
></v-textarea>
</div>
<!--Edit-->
<div v-if="isEditMode">
<v-text-field
label="Numéro de Téléphone"
variant="outlined"
v-model="editablePhoneNumber"
class="w-full p-2"
></v-text-field>
<!-- Informations de Contact -->
<div class="rounded-2xl"
:style="{ backgroundColor: brandingStore.colors.primary, color: brandingStore.colors.onPrimary }">
<div class="text-2xl pa-4">Informations de Contact</div>
<v-text-field
label="Adresse Email"
variant="outlined"
v-model="editableEmail"
class="w-full p-2"
></v-text-field>
</div>
<v-text-field
label="Numéro de Téléphone"
variant="outlined"
v-model="editablePhoneNumber"
class="w-full p-2"
></v-text-field>
<!-- Contact Info-->
<div v-if="!isEditMode">
<div v-if="phoneNumber || email" class="mb-6" >
<!-- mobile-->
<div v-if="smAndDown">
<div class="flex flex-col space-y-10 mt-12 justify-center items-center">
<!-- Affichage du téléphone -->
<div v-if="phoneNumber" class="flex items-center space-x-2">
<i class="mdi mdi-phone-outline text-2xl"></i>
<span>{{ phoneNumber }}</span>
</div>
<!-- Affichage de l'email -->
<div v-if="email" class="flex items-center space-x-2">
<i class="mdi mdi-email-outline text-2xl"></i>
<a
:href="`mailto:${email}`"
class="no-underline text-current"
>
{{ email }}
</a>
</div>
</div>
</div>
<!--pc-->
<div v-if="!smAndDown">
<div class="flex space-x-4 space-y-4 mt-5 justify-center items-center w-full">
<!-- Affichage du téléphone -->
<div v-if="phoneNumber" class="flex items-center space-x-2 w-1/2 justify-start">
<i class="mdi mdi-phone-outline text-2xl"></i>
<span>{{ phoneNumber }}</span>
</div>
<v-text-field
label="Adresse Email"
variant="outlined"
v-model="editableEmail"
class="w-full p-2"
></v-text-field>
<!-- Affichage de l'email -->
<div v-if="email" class="flex items-center space-x-2 w-1/2 justify-center">
<i class="mdi mdi-email-outline text-2xl"></i>
<a :href="`mailto:${email}`" class="no-underline text-current">
{{ email }}
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
@@ -388,8 +310,6 @@ import {watch} from "vue";
import FullscreenImage from "@/views/creators/FullscreenImage.vue";
const {smAndDown} = useDisplay();
const isMobileView = ref(smAndDown.value);
const creatorProfileStore = useCreatorProfileStore();
const brandingStore = useBrandingStore();
@@ -399,25 +319,12 @@ const isLoading = ref(true);
const isLoggedIn = true;
const isEditMode = ref(false);
const currentImage = ref("");
const fullscreenImage = ref(null);
function openFullscreen(imageUrl) {
currentImage.value = imageUrl;
fullscreenImage.value.open();
}
watch(smAndDown, (newVal) => {
isMobileView.value = newVal;
});
// Image de fallback pour l'éditeur
const fallbackImage = "/medias/emptyimage.png";
// Variables réactives pour les données
const editablePhoneNumber = ref("");
const editableEmail = ref("");
const mainTitle = ref("");
const mainImageUrl = ref("");
const mainImageText = ref("");
@@ -431,26 +338,27 @@ const imagesText = ref("");
const videoSubtitle = ref("");
const videoSubtitleMain = ref("");
const videoUrlMain = ref("");
const videoUrl = ref("");
const videoText = ref("");
const phoneNumber = ref("");
const email = ref("");
const editableImages = ref([null, null, null, null]);
// Editable fields
const editableMainTitle = ref("");
const editableMainImageText = ref("");
const editableMainVideoText = ref("");
const editableImagesSubtitle = ref("");
const editableImagesText = ref("");
const editableVideoSubtitle = ref("");
const editableVideoSubtitleMain = ref("");
const editableVideoText = ref("");
const editableVideoUrlMain = ref("");
const editableVideoUrl = ref("");
const editablePhoneNumber = ref("");
const editableEmail = ref("");
const editableImages = ref([null, null, null, null]);
function openFullscreen(imageUrl) {
currentImage.value = imageUrl;
fullscreenImage.value.open();
}
watch(smAndDown, () => {});
// Activer/désactiver le mode édition
function toggleEditMode() {
@@ -460,27 +368,19 @@ function toggleEditMode() {
editableMainTitle.value = mainTitle.value;
editableMainImageText.value = mainImageText.value;
editableMainVideoText.value = mainVideoText.value;
editableImagesSubtitle.value = imagesSubtitle.value;
editableImagesText.value = imagesText.value;
editableVideoSubtitle.value = videoSubtitle.value;
editableVideoSubtitleMain.value = videoSubtitleMain.value;
editableVideoText.value = videoText.value;
editableVideoUrlMain.value = videoUrlMain.value;
editableVideoUrl.value = videoUrl.value;
editablePhoneNumber.value = phoneNumber.value;
editableEmail.value = email.value;
} else {
// Sauvegarder les modifications ou réinitialiser les URLs des images supprimées
// Sauvegarder les modifications
mainTitle.value = editableMainTitle.value;
mainImageText.value = editableMainImageText.value;
mainVideoText.value = editableMainVideoText.value;
imagesSubtitle.value = editableImagesSubtitle.value;
imagesText.value = editableImagesText.value;
videoSubtitle.value = editableVideoSubtitle.value;
videoSubtitleMain.value = editableVideoSubtitleMain.value;
videoText.value = editableVideoText.value;
videoUrlMain.value = editableVideoUrlMain.value;
videoUrl.value = editableVideoUrl.value;
phoneNumber.value = editablePhoneNumber.value;
email.value = editableEmail.value;
@@ -493,7 +393,6 @@ function toggleEditMode() {
}
}
// Supprimer une image
function deleteImage(field) {
switch (field) {
@@ -515,12 +414,10 @@ function deleteImage(field) {
}
}
// Mettre à jour une image
function updateImage(field, event) {
const file = event.target.files[0];
if (file) {
// Stocker le fichier dans editableImages pour l'envoi
switch (field) {
case "mainImageUrl":
editableImages.value[0] = file;
@@ -546,7 +443,6 @@ function updateImage(field, event) {
}
}
// Charger les données au montage
onMounted(() => {
mainTitle.value = brandingStore.presentationInfos.title;
@@ -561,11 +457,7 @@ onMounted(() => {
imagesText.value = brandingStore.presentationInfos.imagesText;
videoSubtitle.value = brandingStore.presentationInfos.videoSubtitle;
videoSubtitleMain.value = brandingStore.presentationInfos.videoSubtitleMain;
videoUrl.value = brandingStore.presentationInfos.videoUrl;
videoUrlMain.value = brandingStore.presentationInfos.videoUrlMain;
videoText.value = brandingStore.presentationInfos.videoText;
editablePhoneNumber.value = brandingStore.presentationInfos.phoneNumber;
editableEmail.value = brandingStore.presentationInfos.email;
phoneNumber.value = brandingStore.presentationInfos.phoneNumber;
email.value = brandingStore.presentationInfos.email;
});
@@ -584,13 +476,9 @@ async function saveChanges() {
formData.append("Title", editableMainTitle.value || "");
formData.append("MainImageText", editableMainImageText.value || "");
formData.append("MainVideoText", editableMainVideoText.value || "");
formData.append("ImagesSubtitle", editableImagesSubtitle.value || "");
formData.append("ImagesText", editableImagesText.value || "");
formData.append("VideoSubtitle", editableVideoSubtitle.value || "");
formData.append("VideoSubtitleMain", editableVideoSubtitleMain.value || "");
formData.append("VideoUrlMain", editableVideoUrlMain.value || "");
formData.append("VideoUrl", editableVideoUrl.value || "");
formData.append("VideoText", editableVideoText.value || "");
// Ajout des URLs d'images supprimées
formData.append("MainImageUrl", mainImageUrl.value || ""); // Peut contenir un string vide
@@ -607,10 +495,8 @@ async function saveChanges() {
if (editableImages.value[4]) formData.append("Image4", editableImages.value[4]);
try {
// Désactiver le bouton de sauvegarde pour éviter les clics multiples
isLoading.value = true;
// Envoyer les données au backend
const response = await client.post(
`/api/creators/${creatorProfileStore.creator.id}/presentation-infos`,
formData,
@@ -621,51 +507,37 @@ async function saveChanges() {
mainTitle.value = editableMainTitle.value;
mainImageText.value = editableMainImageText.value;
mainVideoText.value = editableMainVideoText.value;
imagesSubtitle.value = editableImagesSubtitle.value;
imagesText.value = editableImagesText.value;
videoSubtitle.value = editableVideoSubtitle.value;
videoSubtitleMain.value = editableVideoSubtitleMain.value;
videoText.value = editableVideoText.value;
videoUrlMain.value = editableVideoUrlMain.value;
videoUrl.value = editableVideoUrl.value;
phoneNumber.value = editablePhoneNumber.value;
email.value = editableEmail.value;
console.log("Données sauvegardées :", response.data);
// Réinitialiser le mode édition
isEditMode.value = false;
// Rafraîchir après une légère pause pour s'assurer des mises à jour visuelles
} catch (error) {
console.error("Erreur lors de la sauvegarde :", error);
} finally {
// Réactiver les interactions
isLoading.value = false;
}
}
function cancelEdit() {
// Restaurer les valeurs d'origine
editableMainTitle.value = mainTitle.value;
editableMainImageText.value = mainImageText.value;
editableMainVideoText.value = mainVideoText.value;
editableImagesSubtitle.value = imagesSubtitle.value;
editableImagesText.value = imagesText.value;
editableVideoSubtitle.value = videoSubtitle.value;
editableVideoSubtitleMain.value = videoSubtitleMain.value;
editableVideoText.value = videoText.value;
editableVideoUrlMain.value = videoUrlMain.value;
editableVideoUrl.value = videoUrl.value;
editablePhoneNumber.value = phoneNumber.value;
editableEmail.value = email.value;
// Désactiver le mode édition
isEditMode.value = false;
}
</script>
<style scoped>
@@ -684,4 +556,4 @@ function cancelEdit() {
border: 0;
border-radius: 0.5rem; /* Pour les bords arrondis */
}
</style>
</style>