Adds PhotoAlbum, CreatorHome, AboutCreator.

This commit is contained in:
2025-04-23 17:45:09 -04:00
parent 247b2b023c
commit 6d3525c2ee
42 changed files with 3176 additions and 818 deletions

View File

@@ -43,10 +43,7 @@ watch(() => languageStore.locale, (newLocale) => {
}
.shell-side {
@apply border border-[#3d3d3d];
@apply lg:max-h-screen;
@apply lg:fixed;
@apply border-b lg:border-b-0 lg:border-r;
@apply lg:fixed lg:max-h-screen;
@apply flex-shrink-0;
}

View File

@@ -57,15 +57,23 @@
@apply bg-hSurface text-hOnSurface;
}
/* Specific styling for dialog cards */
div.card.dialog {
@apply bg-hSurface text-hOnSurface;
@apply rounded-xl;
@apply shadow-lg;
}
div.card-title {
@apply font-sans font-bold text-2xl;
@apply p-2;
@apply text-hOnSurface;
}
div.card-content {
@apply flex flex-col gap-4;
@apply p-2;
@apply overflow-y-auto;
@apply text-hOnSurface;
}
div.card-actions {

View File

@@ -1,8 +1,8 @@
<template>
<div class="p-4 relative"
<div class="p-4 relative"
@mouseenter="showEditButtons = isLoggedIn && creatorProfileStore.creator?.id === brandingStore.value.id"
@mouseleave="showEditButtons = false">
<!-- Edit buttons with absolute positioning -->
<div v-if="showEditButtons || isEditMode"
class="absolute top-4 right-4 flex gap-2">
@@ -12,7 +12,7 @@
v-if="!isEditMode"
class="w-12 h-12 bg-hutopyPrimary rounded-full flex items-center justify-center shadow-lg"
@click="toggleEditMode()"
:title="t('common.edit')"
:title="t('edit')"
>
<v-icon large>mdi-pencil</v-icon>
</button>
@@ -22,7 +22,7 @@
v-if="isEditMode"
class="w-12 h-12 bg-hutopyPrimary rounded-full flex items-center justify-center shadow-lg"
@click="saveChanges()"
:title="t('common.save')"
:title="t('save')"
>
<v-icon large>mdi-check</v-icon>
</button>
@@ -32,279 +32,87 @@
v-if="isEditMode"
class="w-12 h-12 bg-red-500 rounded-full flex items-center justify-center shadow-lg"
@click="cancelEdit"
:title="t('common.cancel')"
:title="t('cancel')"
>
<v-icon large>mdi-close</v-icon>
</button>
</div>
<!-- MainPage -->
<div class="flex flex-col mt-4">
<div class="flex flex-col">
<h1 class="flex justify-start text-2xl font-bold text-center">{{ t('creator.sections.about.title') }}</h1>
<div>
<!-- Main image Bloc D'information-->
<div class="py-4">
<h1 class="flex justify-start text-2xl font-bold text-center mb-4">
{{ t('creator.sections.about.title') }}
</h1>
<div>
<!-- Description Section -->
<div>
<div v-if="!isEditMode">
<p v-if="mainImageText" class="text-lg text-justify">
{{ mainImageText }}
<p v-if="description" class="text-lg text-justify mb-6">
{{ description }}
</p>
</div>
<v-textarea v-if="isEditMode" v-model="editableMainImageText" class="w-full p-2 py-6 " :label="t('creator.sections.about.description')"
<v-textarea v-if="isEditMode"
v-model="editableDescription"
class="w-full p-2 py-6"
:label="t('creator.sections.about.description')"
variant="outlined"></v-textarea>
<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="t('creator.sections.about.mainImage')"
class="max-w-full h-auto cursor-pointer"/>
</div>
<div v-if="isEditMode" class="relative flex justify-center">
<label>
<input class="hidden" type="file" @change="updateImage('mainImageUrl', $event)"/>
<img :src="mainImageUrl || fallbackImage"
:alt="t('creator.sections.about.mainImage')"
class=" max-w-full h-auto cursor-pointer max-h-96"/>
</label>
<button v-if="isEditMode"
class="absolute top-10 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600"
@click="deleteImage('mainImageUrl')">
{{ t('common.delete') }}
</button>
</div>
<div class="w-1/2 flex flex-col justify-center">
<h2 v-if="videoSubtitleMain" class="text-xl font-semibold text-center">
{{ t('creator.sections.support.title') }}
</h2>
<div v-if="!isEditMode">
<p v-if="mainVideoText" class="text-lg text-justify">
{{ mainVideoText }}
</p>
</div>
<div v-if="isEditMode">
<v-textarea
v-model="editableMainVideoText"
class="p-2 rounded-md mt-4"
:label="t('creator.sections.support.description')"
rows="10"
variant="outlined"
></v-textarea>
</div>
</div>
</div>
<div>
<div v-if="!isEditMode" class="py-5 text-lg font-bold">
{{ videoSubtitle }}
</div>
<div v-if="isEditMode">
<v-text-field
v-model="editableVideoSubtitle"
class="w-full p-2"
:label="t('creator.sections.support.subtitle')"
variant="outlined"
></v-text-field>
</div>
<v-textarea v-if="isEditMode"
v-model="editableVideoText"
class="w-full p-2"
:label="t('creator.sections.support.description')"
variant="outlined"
></v-textarea>
</div>
</div>
<!-- media-->
<div v-if="!isEditMode">
<div v-if="videoUrlMain" class="video-container">
<!-- Video Section -->
<div v-if="videoUrl || isEditMode"
:class="['content-section', {
'rounded-t-xl': hasImages || isEditMode,
'rounded-xl': !hasImages && !isEditMode
}]">
<div v-if="!isEditMode && videoUrl" class="video-container">
<iframe
:src="videoUrlMain"
:src="youtubeEmbedUrl"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
class="video-frame"
title="YouTube video player">
</iframe>
</div>
</div>
<div v-if="isEditMode">
<v-text-field
v-model="editableVideoUrlMain"
class="w-full p-2 rounded-md"
:label="t('creator.fields.videoUrl')"
type="text"
variant="outlined"
/>
</div>
<!-- Images -->
<div v-if="!isEditMode">
<div v-if="imagesSubtitle || image1Url || image2Url || image3Url || image4Url || imagesText ">
<!-- images-->
<div class="py-2">
<div>
<!-- Affichage des images -->
<div class="flex gap-2">
<!-- Première image -->
<div v-if="image1Url" class="relative w-full sm:flex-1 ">
<img :src="image1Url"
:alt="t('creator.sections.about.image1')"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</div>
<!-- Deuxième image -->
<div v-if="image2Url" class="relative w-full sm:flex-1 ">
<img :src="image2Url"
:alt="t('creator.sections.about.image2')"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</div>
<!-- Troisième image -->
<div v-if="image3Url" class="relative w-full sm:flex-1 ">
<img :src="image3Url"
:alt="t('creator.sections.about.image3')"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</div>
<!-- Quatrième image -->
<div v-if="image4Url" class="relative w-full sm:flex-1 ">
<img :src="image4Url"
:alt="t('creator.sections.about.image4')"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</div>
</div>
</div>
</div>
<div v-if="isEditMode">
<v-text-field
v-model="editableVideoUrl"
class="w-full p-2"
:label="t('creator.fields.videoUrl')"
type="text"
variant="outlined"
/>
</div>
</div>
<div v-if="isEditMode" class="rounded-2xl">
<!--images-->
<div class=" text-2xl pa-2">{{ t('creator.sections.about.images') }}</div>
<div class="pa-2 grid grid-cols-1 gap-4 md:grid-cols-4">
<!-- Première image -->
<div class="relative">
<label>
<input class="hidden" type="file" @change="updateImage('image1Url', $event)"/>
<img :src="image1Url || fallbackImage"
:alt="t('creator.sections.about.image1')"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</label>
<button class="absolute top-2 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600"
@click="deleteImage('image1Url')">
{{ t('common.delete') }}
</button>
</div>
<!-- Deuxième image -->
<div class="relative">
<label>
<input class="hidden" type="file" @change="updateImage('image2Url', $event)"/>
<img :src="image2Url || fallbackImage"
:alt="t('creator.sections.about.image2')"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</label>
<button class="absolute top-2 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600"
@click="deleteImage('image2Url')">
{{ t('common.delete') }}
</button>
</div>
<!-- Troisième image -->
<div class="relative">
<label>
<input class="hidden" type="file" @change="updateImage('image3Url', $event)"/>
<img :src="image3Url || fallbackImage"
:alt="t('creator.sections.about.image3')"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</label>
<button class="absolute top-2 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600"
@click="deleteImage('image3Url')">
{{ t('common.delete') }}
</button>
</div>
<!-- Quatrième image -->
<div class="relative">
<label>
<input class="hidden" type="file" @change="updateImage('image4Url', $event)"/>
<img :src="image4Url || fallbackImage"
:alt="t('creator.sections.about.image4')"
class="rounded-md max-w-full h-auto cursor-pointer"/>
</label>
<button class="absolute top-2 right-2 px-2 py-1 bg-red-500 text-white hover:bg-red-600"
@click="deleteImage('image4Url')">
{{ t('common.delete') }}
</button>
</div>
</div>
<!-- Description-->
<div class="text-2xl pa-2">{{ t('creator.sections.about.description') }}</div>
</div>
<!--Edit-->
<div v-if="isEditMode">
<v-text-field
v-model="editablePhoneNumber"
class="w-full p-2"
:label="t('creator.fields.phoneNumber')"
variant="outlined"
></v-text-field>
<v-text-field
v-model="editableEmail"
class="w-full p-2"
:label="t('creator.fields.email')"
variant="outlined"
></v-text-field>
</div>
<!-- Contact Info-->
<div v-if="!isEditMode && phoneNumber || email">
<div class="my-10 flex flex-row">
<div v-if="phoneNumber" class="flex items-center space-x-2 w-1/2 justify-center">
<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 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>
<!-- Photos Section using CreatorAlbum component -->
<CreatorAlbum
v-if="hasImages || isEditMode"
:is-edit-mode="isEditMode"
:images="imageUrls"
@update:images="updateImages"
@update:isEditMode="isEditMode = $event"
:class="['content-section', {
'rounded-b-xl': videoUrl || isEditMode,
'rounded-xl': !videoUrl && !isEditMode
}]"
/>
</div>
</div>
</div>
</template>
<script setup>
import {onMounted, ref} from "vue";
import {onMounted, ref, computed} from "vue";
import {useClient} from "@/plugins/api.js";
import {useBrandingStore} from "@/stores/brandingStore.js";
import {useCreatorProfileStore} from "@/stores/creatorProfileStore.js";
import {useAuthStore} from "@/stores/authStore.js";
import {useI18n} from 'vue-i18n';
import CreatorAlbum from './CreatorAlbum.vue';
const { t } = useI18n();
const authStore = useAuthStore();
const {t} = useI18n();
const creatorProfileStore = useCreatorProfileStore();
const brandingStore = useBrandingStore();
const client = useClient();
@@ -314,193 +122,169 @@ const isLoggedIn = true;
const isEditMode = ref(false);
const showEditButtons = ref(false);
const fallbackImage = "/medias/emptyimage.png";
// Variables réactives pour les données
const mainTitle = ref("");
const mainImageUrl = ref("");
const mainImageText = ref("");
const mainVideoText = ref("");
const imagesSubtitle = ref("");
const image1Url = ref("");
const image2Url = ref("");
const image3Url = ref("");
const image4Url = ref("");
const imagesText = ref("");
const videoSubtitle = ref("");
const videoSubtitleMain = ref("");
const videoUrlMain = ref("");
const phoneNumber = ref("");
const email = ref("");
const description = ref("");
const videoUrl = ref("");
const imageUrls = ref([]);
const albumId = ref(null);
const originalPhotos = ref([]);
// Editable fields
const editableMainTitle = ref("");
const editableMainImageText = ref("");
const editableMainVideoText = ref("");
const editableImagesText = ref("");
const editableVideoSubtitle = ref("");
const editableVideoUrlMain = ref("");
const editablePhoneNumber = ref("");
const editableEmail = ref("");
const editableDescription = ref("");
const editableVideoUrl = ref("");
const editableImages = ref([null, null, null, null]);
// Computed property to check if there are images
const hasImages = computed(() => {
// Only consider it has images if there are actual image URLs (not empty strings)
return imageUrls.value.some(img => img && img.trim() !== "");
});
// Computed property for YouTube embed URL
const youtubeEmbedUrl = computed(() => {
if (!videoUrl.value) return "";
return `https://www.youtube.com/embed/${videoUrl.value}`;
});
// Activer/désactiver le mode édition
function toggleEditMode() {
isEditMode.value = !isEditMode.value;
if (isEditMode.value) {
// Charger les valeurs pour l'édition
editableMainTitle.value = mainTitle.value;
editableMainImageText.value = mainImageText.value;
editableMainVideoText.value = mainVideoText.value;
editableImagesText.value = imagesText.value;
editableVideoSubtitle.value = videoSubtitle.value;
editableVideoUrlMain.value = videoUrlMain.value;
editablePhoneNumber.value = phoneNumber.value;
editableEmail.value = email.value;
} else {
// Sauvegarder les modifications
mainTitle.value = editableMainTitle.value;
mainImageText.value = editableMainImageText.value;
mainVideoText.value = editableMainVideoText.value;
imagesText.value = editableImagesText.value;
videoSubtitle.value = editableVideoSubtitle.value;
videoUrlMain.value = editableVideoUrlMain.value;
phoneNumber.value = editablePhoneNumber.value;
email.value = editableEmail.value;
// Réinitialisation des images supprimées à des strings vides si nécessaire
if (mainImageUrl.value === null) mainImageUrl.value = "";
if (image1Url.value === null) image1Url.value = "";
if (image2Url.value === null) image2Url.value = "";
if (image3Url.value === null) image3Url.value = "";
if (image4Url.value === null) image4Url.value = "";
editableDescription.value = description.value;
editableVideoUrl.value = videoUrl.value;
}
}
// Supprimer une image
function deleteImage(field) {
switch (field) {
case "mainImageUrl":
mainImageUrl.value = ""; // Remplace par un string vide
break;
case "image1Url":
image1Url.value = ""; // Remplace par un string vide
break;
case "image2Url":
image2Url.value = ""; // Remplace par un string vide
break;
case "image3Url":
image3Url.value = ""; // Remplace par un string vide
break;
case "image4Url":
image4Url.value = ""; // Remplace par un string vide
break;
}
}
// Mettre à jour une image
function updateImage(field, event) {
const file = event.target.files[0];
if (file) {
switch (field) {
case "mainImageUrl":
editableImages.value[0] = file;
mainImageUrl.value = URL.createObjectURL(file);
break;
case "image1Url":
editableImages.value[1] = file;
image1Url.value = URL.createObjectURL(file);
break;
case "image2Url":
editableImages.value[2] = file;
image2Url.value = URL.createObjectURL(file);
break;
case "image3Url":
editableImages.value[3] = file;
image3Url.value = URL.createObjectURL(file);
break;
case "image4Url":
editableImages.value[4] = file;
image4Url.value = URL.createObjectURL(file);
break;
// Fetch album data
async function fetchAlbumData() {
if (!creatorProfileStore.creator?.id) return;
albumId.value = creatorProfileStore.creator.id;
try {
// Try to get the album
const response = await client.get(`/api/albums/${albumId.value}`);
if (response.data && response.data.photos) {
// Store original photos for comparison
originalPhotos.value = response.data.photos;
// Extract photo URLs from the album photos
imageUrls.value = response.data.photos.map(photo => photo.photoUrl);
} else {
// Initialize with empty slots for adding new photos
imageUrls.value = Array(6).fill("");
originalPhotos.value = [];
}
} catch (error) {
// Album might not exist yet, which is fine
console.log("Album might not exist yet:", error);
// Initialize with empty slots for adding new photos
imageUrls.value = Array(6).fill("");
originalPhotos.value = [];
}
}
// Charger les données au montage
onMounted(() => {
if (brandingStore.presentationInfos === undefined) return;
onMounted(async () => {
if (!brandingStore.value?.presentation) return;
mainTitle.value = brandingStore.presentationInfos.title;
mainImageUrl.value = brandingStore.presentationInfos.mainImageUrl;
mainImageText.value = brandingStore.presentationInfos.mainImageText;
mainVideoText.value = brandingStore.presentationInfos.mainVideoText;
imagesSubtitle.value = brandingStore.presentationInfos.imagesSubtitle;
image1Url.value = brandingStore.presentationInfos.image1Url;
image2Url.value = brandingStore.presentationInfos.image2Url;
image3Url.value = brandingStore.presentationInfos.image3Url;
image4Url.value = brandingStore.presentationInfos.image4Url;
imagesText.value = brandingStore.presentationInfos.imagesText;
videoSubtitle.value = brandingStore.presentationInfos.videoSubtitle;
videoSubtitleMain.value = brandingStore.presentationInfos.videoSubtitleMain;
videoUrlMain.value = brandingStore.presentationInfos.videoUrlMain;
phoneNumber.value = brandingStore.presentationInfos.phoneNumber;
email.value = brandingStore.presentationInfos.email;
description.value = brandingStore.value.presentation.description || "";
videoUrl.value = brandingStore.value.presentation.videoUrl || "";
// Fetch album data
await fetchAlbumData();
});
// Update images from CreatorAlbum component
function updateImages(newImages) {
imageUrls.value = newImages;
}
async function saveChanges() {
if (!creatorProfileStore.creator.id) {
console.error("L'ID du créateur est manquant !");
return;
}
const formData = new FormData();
// Ajout des champs textuels
formData.append("PhoneNumber", editablePhoneNumber.value || "");
formData.append("Email", editableEmail.value || "");
formData.append("Title", editableMainTitle.value || "");
formData.append("MainImageText", editableMainImageText.value || "");
formData.append("MainVideoText", editableMainVideoText.value || "");
formData.append("ImagesText", editableImagesText.value || "");
formData.append("VideoSubtitle", editableVideoSubtitle.value || "");
formData.append("VideoUrlMain", editableVideoUrlMain.value || "");
// Ajout des URLs d'images supprimées
formData.append("MainImageUrl", mainImageUrl.value || ""); // Peut contenir un string vide
formData.append("Image1Url", image1Url.value || "");
formData.append("Image2Url", image2Url.value || "");
formData.append("Image3Url", image3Url.value || "");
formData.append("Image4Url", image4Url.value || "");
// Ajout des fichiers d'images téléversées
if (editableImages.value[0]) formData.append("MainImage", editableImages.value[0]);
if (editableImages.value[1]) formData.append("Image1", editableImages.value[1]);
if (editableImages.value[2]) formData.append("Image2", editableImages.value[2]);
if (editableImages.value[3]) formData.append("Image3", editableImages.value[3]);
if (editableImages.value[4]) formData.append("Image4", editableImages.value[4]);
try {
isLoading.value = true;
const response = await client.post(
// Save presentation info
const presentationResponse = await client.post(
`/api/creators/${creatorProfileStore.creator.id}/presentation-infos`,
formData,
{headers: {"Content-Type": "multipart/form-data"}}
{
description: editableDescription.value || "",
videoUrl: editableVideoUrl.value || ""
}
);
// Mettre à jour les valeurs locales pour refléter les changements
mainTitle.value = editableMainTitle.value;
mainImageText.value = editableMainImageText.value;
mainVideoText.value = editableMainVideoText.value;
imagesText.value = editableImagesText.value;
videoSubtitle.value = editableVideoSubtitle.value;
videoUrlMain.value = editableVideoUrlMain.value;
phoneNumber.value = editablePhoneNumber.value;
email.value = editableEmail.value;
description.value = editableDescription.value;
videoUrl.value = editableVideoUrl.value;
console.log("Données sauvegardées :", response.data);
// Save album photos if they've changed
if (imageUrls.value.length > 0) {
// Create or update the album
const albumId = creatorProfileStore.creator.id;
try {
// Try to create the album first (it will fail if it already exists)
await client.post('/api/albums', {
albumId: albumId,
title: `${creatorProfileStore.creator.name}'s Album`,
description: "Photo album for the creator"
});
} catch (error) {
// Album might already exist, which is fine
console.log("Album might already exist:", error);
}
// Check for deleted photos
const deletedPhotos = originalPhotos.value.filter(originalPhoto => {
// If the photo URL is not in the current images array, it was deleted
return !imageUrls.value.includes(originalPhoto.photoUrl);
});
// Delete removed photos
for (const photo of deletedPhotos) {
try {
await client.delete(`/api/albums/${albumId}/photos/${photo.id}`);
} catch (error) {
console.error("Error deleting photo:", error);
}
}
// Now add or update photos
for (let i = 0; i < imageUrls.value.length; i++) {
const imageUrl = imageUrls.value[i];
if (imageUrl && imageUrl.startsWith('data:')) {
// This is a new image that needs to be uploaded
const photoId = crypto.randomUUID();
const formData = new FormData();
// Convert data URL to file
const response = await fetch(imageUrl);
const blob = await response.blob();
const file = new File([blob], `photo-${i}.jpg`, { type: 'image/jpeg' });
formData.append('file', file);
await client.post(`/api/albums/${albumId}/photos`, formData, {
headers: {
'Content-Type': 'multipart/form-data'
},
params: {
photoId: photoId
}
});
}
}
// Refresh album data after changes
await fetchAlbumData();
}
console.log("Données sauvegardées :", presentationResponse.data);
isEditMode.value = false;
@@ -513,25 +297,25 @@ async function saveChanges() {
function cancelEdit() {
// Restaurer les valeurs d'origine
editableMainTitle.value = mainTitle.value;
editableMainImageText.value = mainImageText.value;
editableMainVideoText.value = mainVideoText.value;
editableImagesText.value = imagesText.value;
editableVideoSubtitle.value = videoSubtitle.value;
editableVideoUrlMain.value = videoUrlMain.value;
editablePhoneNumber.value = phoneNumber.value;
editableEmail.value = email.value;
editableDescription.value = description.value;
editableVideoUrl.value = videoUrl.value;
// Désactiver le mode édition
isEditMode.value = false;
}
</script>
<style scoped>
.content-section {
@apply w-full overflow-hidden;
}
.video-container {
position: relative;
width: 100%;
padding-top: 56.25%; /* Ratio 16:9 (9/16 = 0.5625) */
padding-top: 31.25%; /* Reduced from 56.25% to make it shorter while maintaining aspect ratio */
max-height: 40vh;
}
.video-frame {
@@ -540,106 +324,84 @@ function cancelEdit() {
left: 0;
width: 100%;
height: 100%;
border: 0;
border-radius: 0.5rem; /* Pour les bords arrondis */
border: none;
}
/* Add responsive breakpoints */
@media (max-width: 640px) {
.video-container {
padding-top: 35%;
max-height: 35vh;
}
}
@media (min-width: 1024px) {
.video-container {
padding-top: 30%;
max-height: 38vh;
}
}
</style>
<i18n>
{
"en": {
"common": {
"save": "Save",
"edit": "Edit",
"cancel": "Cancel",
"delete": "Delete"
},
"edit": "Edit",
"save": "Save",
"cancel": "Cancel",
"creator": {
"sections": {
"about": {
"title": "About",
"description": "Description",
"mainImage": "Main image",
"image1": "Image 1",
"image2": "Image 2",
"image3": "Image 3",
"image4": "Image 4",
"images": "Images"
"description": "Description"
},
"support": {
"title": "Support",
"description": "Description",
"subtitle": "Subtitle"
"photos": {
"title": "Photos",
"image": "Image"
}
},
"fields": {
"videoUrl": "Video URL",
"phoneNumber": "Phone Number",
"email": "Email"
"videoUrl": "Video URL"
}
}
},
"fr": {
"common": {
"save": "Enregistrer",
"edit": "Modifier",
"cancel": "Annuler",
"delete": "Supprimer"
},
"edit": "Modifier",
"save": "Enregistrer",
"cancel": "Annuler",
"creator": {
"sections": {
"about": {
"title": "À propos",
"description": "Description",
"mainImage": "Image principale",
"image1": "Image 1",
"image2": "Image 2",
"image3": "Image 3",
"image4": "Image 4",
"images": "Images"
"description": "Description"
},
"support": {
"title": "Support",
"description": "Description",
"subtitle": "Sous-titre"
"photos": {
"title": "Photos",
"image": "Image"
}
},
"fields": {
"videoUrl": "URL de la vidéo",
"phoneNumber": "Numéro de téléphone",
"email": "Email"
"videoUrl": "URL de la vidéo"
}
}
},
"es": {
"common": {
"save": "Guardar",
"edit": "Editar",
"cancel": "Cancelar",
"delete": "Eliminar"
},
"edit": "Editar",
"save": "Guardar",
"cancel": "Cancelar",
"creator": {
"sections": {
"about": {
"title": "Acerca de",
"description": "Descripción",
"mainImage": "Imagen principal",
"image1": "Imagen 1",
"image2": "Imagen 2",
"image3": "Imagen 3",
"image4": "Imagen 4",
"images": "Imágenes"
"description": "Descripción"
},
"support": {
"title": "Soporte",
"description": "Descripción",
"subtitle": "Subtítulo"
"photos": {
"title": "Fotos",
"image": "Imagen"
}
},
"fields": {
"videoUrl": "URL del video",
"phoneNumber": "Número de teléfono",
"email": "Correo electrónico"
"videoUrl": "URL del video"
}
}
}

View File

@@ -9,7 +9,7 @@
>
<img
class="w-full aspect-[4/1] banner object-cover"
:src="brandingStore.value?.images?.banner ?? '/images/placeholders/banner.png'"
:src="brandingStore.value?.bannerUrl ?? '/images/placeholders/banner.png'"
:alt="t('alt')"
>
<!-- Tint Effect -->

View File

@@ -0,0 +1,262 @@
<template>
<div class="album-editor">
<h2 class="text-xl font-semibold mb-4">{{ t('creator.sections.album.title') }}</h2>
<div class="image-grid">
<!-- Upload button -->
<div class="image-wrapper upload-wrapper" @click="triggerFileInput">
<input
type="file"
ref="fileInput"
@change="handleFileUpload"
accept="image/*"
multiple
class="hidden"
/>
<div class="upload-content">
<v-icon size="large">mdi-plus</v-icon>
<span class="text-sm mt-2">{{ t('upload') }}</span>
</div>
</div>
<!-- Draggable images -->
<draggable
v-model="localImages"
class="image-grid"
item-key="id"
@end="handleReorder"
>
<template #item="{ element, index }">
<div class="image-wrapper">
<img :src="element.url" :alt="'Image ' + (index + 1)" />
<div class="image-actions">
<button @click="deleteImage(index)" class="action-btn delete-btn" :title="t('delete')">
<v-icon>mdi-delete</v-icon>
</button>
<button @click="moveImage(index, 'up')"
class="action-btn move-btn"
:disabled="index === 0"
:title="t('moveUp')">
<v-icon>mdi-arrow-up</v-icon>
</button>
<button @click="moveImage(index, 'down')"
class="action-btn move-btn"
:disabled="index === localImages.length - 1"
:title="t('moveDown')">
<v-icon>mdi-arrow-down</v-icon>
</button>
</div>
</div>
</template>
</draggable>
</div>
</div>
</template>
<script setup>
import { ref, onMounted } from "vue";
import { useI18n } from 'vue-i18n';
import draggable from 'vuedraggable';
const props = defineProps({
images: {
type: Array,
required: true
}
});
const emit = defineEmits(['update:images']);
const { t } = useI18n();
const fileInput = ref(null);
// Local copy of images with IDs for drag and drop
const localImages = ref([]);
onMounted(() => {
// Initialize local images with IDs
localImages.value = props.images.map((url, index) => ({
id: index,
url: url
}));
});
// Trigger file input click
function triggerFileInput() {
fileInput.value.click();
}
// Handle file upload
async function handleFileUpload(event) {
const files = Array.from(event.target.files);
for (const file of files) {
if (file.type.startsWith('image/')) {
try {
// Create a data URL for preview
const reader = new FileReader();
reader.onload = (e) => {
const newImage = {
id: Date.now() + Math.random(), // Unique ID
url: e.target.result
};
localImages.value.push(newImage);
emit('update:images', localImages.value.map(img => img.url));
};
reader.readAsDataURL(file);
} catch (error) {
console.error('Error uploading image:', error);
}
}
}
// Reset file input
event.target.value = '';
}
// Delete an image
function deleteImage(index) {
localImages.value.splice(index, 1);
emit('update:images', localImages.value.map(img => img.url));
}
// Move image up or down
function moveImage(index, direction) {
const newIndex = direction === 'up' ? index - 1 : index + 1;
if (newIndex >= 0 && newIndex < localImages.value.length) {
const temp = localImages.value[index];
localImages.value[index] = localImages.value[newIndex];
localImages.value[newIndex] = temp;
emit('update:images', localImages.value.map(img => img.url));
}
}
// Handle reorder after drag and drop
function handleReorder() {
emit('update:images', localImages.value.map(img => img.url));
}
</script>
<style scoped>
.album-editor {
@apply w-full;
}
.image-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0.5rem;
width: 100%;
}
.image-wrapper {
position: relative;
width: 100%;
aspect-ratio: 1;
overflow: hidden;
}
.upload-wrapper {
border: 2px dashed #ccc;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
}
.upload-wrapper:hover {
border-color: #666;
background-color: #f5f5f5;
}
.upload-content {
display: flex;
flex-direction: column;
align-items: center;
color: #666;
}
.image {
width: 100%;
height: 100%;
object-fit: cover;
}
.image-actions {
position: absolute;
top: 0;
right: 0;
display: flex;
gap: 0.25rem;
padding: 0.25rem;
background: rgba(0, 0, 0, 0.5);
opacity: 0;
transition: opacity 0.3s ease;
}
.image-wrapper:hover .image-actions {
opacity: 1;
}
.action-btn {
background: none;
border: none;
color: white;
cursor: pointer;
padding: 0.25rem;
border-radius: 4px;
transition: background-color 0.2s;
}
.action-btn:hover {
background-color: rgba(255, 255, 255, 0.2);
}
.action-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* Responsive adjustments */
@media (min-width: 768px) {
.image-grid {
grid-template-columns: repeat(4, 1fr);
}
}
@media (min-width: 1024px) {
.image-grid {
grid-template-columns: repeat(5, 1fr);
}
}
@media (max-width: 640px) {
.image-grid {
gap: 0.25rem;
}
}
</style>
<i18n>
{
"en": {
"upload": "Upload Photos",
"delete": "Delete",
"moveUp": "Move Up",
"moveDown": "Move Down"
},
"fr": {
"upload": "Télécharger des photos",
"delete": "Supprimer",
"moveUp": "Déplacer vers le haut",
"moveDown": "Déplacer vers le bas"
},
"es": {
"upload": "Subir fotos",
"delete": "Eliminar",
"moveUp": "Mover arriba",
"moveDown": "Mover abajo"
}
}
</i18n>

View File

@@ -0,0 +1,144 @@
<template>
<div v-if="hasImages" class="album-view">
<!-- Album Display -->
<div class="image-grid">
<div v-for="(url, index) in displayedImages"
:key="index"
class="image-wrapper">
<img :src="url"
:alt="t('creator.sections.album.image')"
class="image"/>
</div>
</div>
</div>
</template>
<script setup>
import { computed, ref, onMounted, onUnmounted } from "vue";
import { useI18n } from 'vue-i18n';
const props = defineProps({
images: {
type: Array,
required: true,
default: () => []
}
});
const { t } = useI18n();
// Add a reactive window width
const windowWidth = ref(window.innerWidth);
// Update window width on resize
const handleResize = () => {
windowWidth.value = window.innerWidth;
};
// Add and remove event listener
onMounted(() => {
window.addEventListener('resize', handleResize);
});
onUnmounted(() => {
window.removeEventListener('resize', handleResize);
});
const hasImages = computed(() => {
return props.images.some(url => url);
});
const nonEmptyImages = computed(() => {
return props.images.filter(url => url);
});
// Show different number of images based on reactive window width
const displayedImages = computed(() => {
const images = nonEmptyImages.value;
if (windowWidth.value >= 1024) {
return images.slice(0, 5); // 5 images on large screens
} else if (windowWidth.value >= 768) {
return images.slice(0, 4); // 4 images on medium screens
}
return images.slice(0, 3); // 3 images on smaller screens
});
</script>
<style scoped>
.album-view {
@apply w-full;
}
.image-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0.5rem;
width: 100%;
}
.image-wrapper {
position: relative;
width: 100%;
aspect-ratio: 1;
}
.image {
width: 100%;
height: 100%;
object-fit: cover;
}
/* Responsive adjustments */
@media (min-width: 768px) {
.image-grid {
grid-template-columns: repeat(4, 1fr);
}
}
@media (min-width: 1024px) {
.image-grid {
grid-template-columns: repeat(5, 1fr);
}
}
@media (max-width: 640px) {
.image-grid {
gap: 0.25rem;
}
}
</style>
<i18n>
{
"en": {
"creator": {
"sections": {
"album": {
"title": "Photo Album",
"image": "Album image"
}
}
}
},
"fr": {
"creator": {
"sections": {
"album": {
"title": "Album photo",
"image": "Image de l'album"
}
}
}
},
"es": {
"creator": {
"sections": {
"album": {
"title": "Álbum de fotos",
"image": "Imagen del álbum"
}
}
}
}
}
</i18n>

View File

@@ -91,7 +91,7 @@ const emits = defineEmits(['closeRequested'])
const fileInput = ref(null)
const selectedFile = ref(null)
const fileUrl = ref(props.creator?.images?.banner)
const fileUrl = ref(props.creator?.bannerUrl)
const fallbackUrl = '/images/hutopymedia/banners/hutopyul.png'
const errorMessage = ref('')
const showCropper = ref(false)
@@ -175,7 +175,8 @@ const publish = async () => {
}
)
props.creator.images.banner = `${response.data.blobUrl}?t=${Date.now()}`
props.creator.bannerUrl = `${response.data.blobUrl}?t=${Date.now()}`
fileUrl.value = props.creator.bannerUrl
emits('closeRequested')
} catch (error) {
console.error(error)
@@ -189,8 +190,8 @@ const publish = async () => {
const cancel = () => {
showCropper.value = false
// Reset to original state if we were editing
if (props.creator?.images?.banner) {
fileUrl.value = props.creator.images.banner
if (props.creator?.bannerUrl) {
fileUrl.value = props.creator.bannerUrl
selectedFile.value = null
} else {
fileUrl.value = fallbackUrl

View File

@@ -0,0 +1,102 @@
<template>
<div v-if="hasImages || isEditMode"
class="creator-album"
@click="handleAlbumClick">
<!-- Use AlbumView for display mode -->
<AlbumView v-if="!isEditMode"
:images="images" />
<!-- Use AlbumEditor for edit mode -->
<AlbumEditor v-if="isEditMode"
:images="images"
@update:images="updateImages" />
</div>
</template>
<script setup>
import { computed } from "vue";
import AlbumView from './AlbumView.vue';
import AlbumEditor from './AlbumEditor.vue';
const props = defineProps({
isEditMode: {
type: Boolean,
required: true
},
images: {
type: Array,
required: true,
default: () => []
}
});
const emit = defineEmits(['update:images']);
// Computed property to check if there are images
const hasImages = computed(() => {
return props.images.some(url => url);
});
// Handle album click to enter edit mode
function handleAlbumClick() {
if (!props.isEditMode) {
emit('update:isEditMode', true);
}
}
// Update images from AlbumEditor component
function updateImages(newImages) {
emit('update:images', newImages);
}
</script>
<style scoped>
.creator-album {
@apply w-full;
cursor: pointer;
}
</style>
<i18n>
{
"en": {
"common": {
"delete": "Delete"
},
"creator": {
"sections": {
"album": {
"title": "Photo Album",
"image": "Album image"
}
}
}
},
"fr": {
"common": {
"delete": "Supprimer"
},
"creator": {
"sections": {
"album": {
"title": "Album photo",
"image": "Image de l'album"
}
}
}
},
"es": {
"common": {
"delete": "Eliminar"
},
"creator": {
"sections": {
"album": {
"title": "Álbum de fotos",
"image": "Imagen del álbum"
}
}
}
}
}
</i18n>

View File

@@ -1,23 +1,22 @@
<template>
<div class="creator-home">
<!-- Content sections container -->
<div class="content-sections">
<!-- Donation Section -->
<div class="section sm:hidden">
<div v-if="brandingStore.value?.acceptDonation" class="section sm:hidden">
<DonationButton
v-if="brandingStore.value?.acceptDonation"
:creator-id="brandingStore.value?.id"
:creator-name="brandingStore.value?.name"
:on-cancelled-url="baseURL + '/paymentfailed/' + brandingStore.value?.id"
:on-success-url="baseURL + '/paymentcompleted/' + brandingStore.value?.id"
/>
</div>
<!-- About Creator Section -->
<div class="section">
<AboutCreator />
<AboutCreator/>
</div>
</div>
@@ -26,7 +25,6 @@
<script setup>
import AboutCreator from './AboutCreator.vue';
import { ref } from 'vue';
import DonationButton from "@/views/creators/DonationButton.vue";
import {useBrandingStore} from "@/stores/brandingStore.js";
@@ -58,9 +56,8 @@ const baseURL = window.location.origin;
@apply rounded-2xl;
@apply p-[1px];
background: linear-gradient(135deg, rgba(64, 64, 64, 1) 0%, rgba(64, 64, 64, 0) 20%, rgba(64, 64, 64, 0.5) 100%);
mask:
linear-gradient(#fff 0 0) content-box,
linear-gradient(#fff 0 0);
mask: linear-gradient(#fff 0 0) content-box,
linear-gradient(#fff 0 0);
mask-composite: exclude;
pointer-events: none;
}
@@ -68,27 +65,4 @@ const baseURL = window.location.origin;
</style>
<i18n>
{
"en": {
"creator": {
"home": {
"title": "Creator Home"
}
}
},
"fr": {
"creator": {
"home": {
"title": "Accueil du Créateur"
}
}
},
"es": {
"creator": {
"home": {
"title": "Inicio del Creador"
}
}
}
}
</i18n>

View File

@@ -7,7 +7,7 @@
<div class="rounded-full border-4 border-hPrimary w-[110px] h-[110px]">
<img
:src="brandingStore.value.images?.logo ?? '/images/placeholders/profile.png'"
:src="brandingStore.value?.portraitUrl ?? '/images/placeholders/profile.png'"
:alt="t('logoAlt')"
width="110px"
height="110px"

View File

@@ -94,7 +94,7 @@ const emits = defineEmits(['closeRequested'])
const fileInput = ref(null)
const selectedFile = ref(null)
const fileUrl = ref(props.creator.images.logo)
const fileUrl = ref(props.creator.portraitUrl)
const fallbackUrl = '/images/usersmedia/HutopyProfile/profilepictures/profileHutopyProfile01.png'
const errorMessage = ref('')
const showCropper = ref(false)
@@ -180,7 +180,10 @@ const publish = async () => {
}
)
props.creator.images.logo = `${response.data.blobUrl}?t=${Date.now()}`
props.creator.portraitUrl = `${response.data.blobUrl}?t=${Date.now()}`
if (props.creator.portraitUrl) {
fileUrl.value = props.creator.portraitUrl
}
emits('closeRequested')
} catch (error) {
console.error(error)
@@ -194,8 +197,8 @@ const publish = async () => {
const cancel = () => {
showCropper.value = false
// Reset to original state if we were editing
if (props.creator.images.logo) {
fileUrl.value = props.creator.images.logo
if (props.creator.portraitUrl) {
fileUrl.value = props.creator.portraitUrl
selectedFile.value = null
} else {
fileUrl.value = fallbackUrl

View File

@@ -9,7 +9,7 @@ const { t } = useI18n();
<template>
<footer class="flex flex-col gap-10">
<footer class="flex flex-col gap-10 pt-7 pb-10">
<div class="footer-socials">
<a href="https://www.facebook.com/profile.php?id=61556819217561" target="_blank">
@@ -76,17 +76,17 @@ const { t } = useI18n();
.footer-copyright {
@apply flex justify-center;
@apply text-hOnBackground tracking-widest font-sans text-sm uppercase;
@apply text-hOnBackground tracking-widest font-sans text-sm;
}
.social-icon {
@apply fill-current w-8 h-8;
@apply fill-current w-6 h-6;
@apply text-hOnBackground;
}
.link {
@apply text-hOnBackground;
@apply tracking-widest font-sans text-sm uppercase;
@apply tracking-widest font-sans text-sm;
@apply hover:text-gray-400;
}

View File

@@ -25,32 +25,20 @@ function toggleLanguage() {
<div class="side-logo">
<router-link to="/@hutopy">
<!-- Show full logo on medium and larger screens -->
<img src="/images/hutopy-logo.png"
alt="hutopy logo"
class="hidden sm:block"
height="50">
<!-- Show icon version on small screens -->
<img alt="hutopy icon"
class="block sm:hidden"
height="50"
src="/images/hutopy-icon.png"
width="50">
</router-link>
</div>
<div class="flex-grow flex items-center lg:items-start lg:justify-center p-4">
</div>
<div class="side-menu">
<div class="side-menu-portrait">
<div v-if="authStore.isAuthenticated"
class="side-menu-portrait">
<img :src="userProfileStore.portraitUrl"
alt="Profile Image"
referrerpolicy="no-referrer"
class="rounded-full"
width="32"
height="32">
class="rounded-full">
<span class="profile-label">{{ userProfileStore.alias }}</span>
</div>
@@ -92,6 +80,7 @@ function toggleLanguage() {
<i class="mdi mdi-login"></i>
<span class="label">{{ t('sidebar.signIn') }}</span>
</button>
</router-link>
</template>
<div v-else>
@@ -110,53 +99,63 @@ function toggleLanguage() {
<style scoped>
.side-container {
@apply bg-hSurface text-hOnSurface;
@apply lg:fixed lg:max-h-screen;
@apply flex;
@apply lg:flex-col lg:w-64 lg:max-w-64;
@apply h-16 lg:h-screen;
@apply lg:border-r-2 lg:border-[#2d282d];
}
.side-logo {
@apply flex items-center justify-center;
@apply mx-6 lg:mx-0 lg:mt-2;
@apply flex flex-grow;
@apply items-center justify-start p-4;
@apply lg:items-start lg:justify-center lg:pt-4;
}
.side-menu {
@apply flex gap-4 p-4;
@apply flex gap-4 p-6;
@apply items-center lg:items-stretch;
@apply flex-row-reverse lg:flex-col;
}
.side-menu-portrait {
@apply w-10 h-10;
@apply -ml-1;
@apply flex items-center justify-start;
}
.side-menu-items {
@apply flex;
@apply flex-row lg:flex-col;
@apply lg:gap-2;
@apply lg:w-full;
@apply flex gap-2;
@apply flex-row;
@apply lg:w-full lg:flex-col;
}
.profile-label {
@apply mx-4 text-lg font-sans capitalize;
@apply label;
@apply ml-5;
@apply text-lg font-sans capitalize;
@apply font-semibold;
@apply hidden lg:inline
@apply hidden lg:inline;
}
.label {
@apply text-nowrap;
@apply mx-2;
@apply hidden lg:inline
@apply ml-4;
@apply hidden lg:inline;
}
.menu-item-action {
/* FIXME: The hover value is not semantically correct */
@apply bg-hBackground hover:bg-hSurface;
@apply bg-hSurface text-hOnSurface hover:mix-blend-screen;
@apply capitalize;
@apply flex items-center gap-4 py-2 rounded;
@apply flex items-center gap-3 p-2 rounded-full md:rounded-full;
@apply mx-0;
@apply lg:px-2;
@apply lg:pl-2;
@apply w-10 h-10 justify-center lg:w-full lg:h-auto lg:justify-normal;
i {
@apply text-xl;
}
}
</style>

View File

@@ -357,7 +357,7 @@ function handleDelete() {
<style scoped>
.card {
@apply rounded-lg p-4 w-full max-w-2xl;
@apply rounded-lg p-4 w-full;
}
.card-title {