Tweaking banner component

This commit is contained in:
PascalMarchesseault
2024-08-08 00:59:10 -04:00
parent 31f186ada9
commit 6409303139
3 changed files with 73 additions and 33 deletions

View File

@@ -21,7 +21,7 @@
{{ creator.about.title }} {{ creator.about.title }}
</div> </div>
<v-btn icon @click="cancelPost" class="ml-auto mr-2" variant="text"> <v-btn icon @click="AboutUs = false" class="ml-auto mr-2" variant="text">
<v-icon>mdi-close</v-icon> <v-icon>mdi-close</v-icon>
</v-btn> </v-btn>
</div> </div>

View File

@@ -39,6 +39,7 @@
<div class="flex flex-col items-center lg:flex-row lg:items-center lg:justify-between"> <div class="flex flex-col items-center lg:flex-row lg:items-center lg:justify-between">
<!-- Profile Image Wrapper --> <!-- Profile Image Wrapper -->
<div class="relative flex justify-center lg:w-auto lg:justify-start"> <div class="relative flex justify-center lg:w-auto lg:justify-start">
<!-- Profile Image --> <!-- Profile Image -->
<div class="absolute lg:ml-72 transform -translate-y-1/2 lg:-translate-y-1/2 z-20"> <div class="absolute lg:ml-72 transform -translate-y-1/2 lg:-translate-y-1/2 z-20">
<img <img
@@ -53,20 +54,27 @@
<!-- User Info --> <!-- User Info -->
<div class="mt-2 flex flex-col items-center lg:items-start lg:ml-64"> <div class="mt-2 flex flex-col items-center lg:items-start lg:ml-64">
<div class="text-3xl font-bold text-center lg:text-left md:mt-24 lg:mt-0 sm:mt-24 mt-24 text-white cap "> <div class="text-3xl font-bold text-center lg:text-left md:mt-24 lg:mt-0 sm:mt-24 mt-24 text-white cap ">
<p class="capitalize">{{ creator.name }}</p> <p class="capitalize ">{{ creator.name }} </p>
</div>
<div class="text-lg text-white">{{ creator.subscriberCount }} Abonnés</div> <div class="text-lg text-white">{{ creator.subscriberCount }} Abonnés</div>
</div> </div>
</div>
<div class="px-6 mt-2">
<subscribe-button :creator="creator"></subscribe-button>
</div>
<div class="flex flex-row align-center">
</div>
<!-- Buttons --> <!-- Buttons -->
<div class="flex flex-wrap items-center mt-2 sm:mt-8 md:mt-4 lg:mt-0 lg:ml-auto space-x-2 sm:space-x-4"> <div class="flex flex-wrap items-center mt-2 sm:mt-8 md:mt-4 lg:mt-0 lg:ml-auto space-x-2 sm:space-x-4">
<creator-about :creator="creator"></creator-about>
<subscribe-button :creator="creator"></subscribe-button>
<publish-content-button :creator="creator"></publish-content-button> <publish-content-button :creator="creator"></publish-content-button>
<div class="text-white text-2xl">{{ creator.about.title }}</div>
<creator-about :creator="creator"></creator-about>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,53 +1,85 @@
<script setup> <script setup>
import {useSubscriptionStore} from "@/stores/subscriptionStore.js"; import {useSubscriptionStore} from "@/stores/subscriptionStore.js";
import {computed} from "vue"; import {computed, ref} from "vue";
const props = defineProps({ const props = defineProps({
creator: {type: Object, required: true}, creator: {type: Object, required: true},
}); });
const subscriptionStore = useSubscriptionStore() const subscriptionStore = useSubscriptionStore();
const isSubscribe = computed(() => !subscriptionStore.isSubscribeTo(props.creator.id)) const isSubscribe = computed(() => !subscriptionStore.isSubscribeTo(props.creator.id));
function subscribeToCreator() { function subscribeToCreator() {
subscriptionStore.subscribeTo(props.creator.id) subscriptionStore.subscribeTo(props.creator.id);
} }
// Référence pour contrôler l'affichage du modal
const showUnsubscribeModal = ref(false);
function unsubscribeFromCreator() { function unsubscribeFromCreator() {
subscriptionStore.unsubscribeFrom(props.creator.id) subscriptionStore.unsubscribeFrom(props.creator.id);
// Fermer le modal après désabonnement
showUnsubscribeModal.value = false;
} }
</script> </script>
<template> <template>
<template v-if="isSubscribe"> <template v-if="isSubscribe">
<v-btn class="action mr-4" <v-btn
@click="subscribeToCreator()" class="action mr-4"
style="transition: background-color 0.3s ease;"> variant="outlined"
@click="subscribeToCreator"
color="white"
>
S'ABONNER S'ABONNER
</v-btn> </v-btn>
</template> </template>
<template v-else> <template v-else>
<v-btn class="action mr-4" <v-btn
@click="unsubscribeFromCreator()" class="action mr-4"
style="transition: background-color 0.3s ease;"> variant="outlined"
@click="showUnsubscribeModal = true"
style="transition: background-color 0.3s ease;"
color="white"
>
SE DESABONNER SE DESABONNER
</v-btn> </v-btn>
</template> </template>
<v-dialog v-model="showUnsubscribeModal" max-width="500">
<v-card class="text-center rounded-xl"
:style="{
border: `3px solid ${creator.colors.menu}`
}">
<div class="flex items-center justify-between py-4 text-2xl font-bold border-b mb-2">
<div class="flex-1 text-center">
Déabonnement
</div>
</div>
<v-card-title>Confirmation</v-card-title>
<v-card-text>Êtes-vous sûr de vouloir vous désabonner ?</v-card-text>
<v-card-actions class="justify-center px-4 pb-4">
<v-btn text class="flex-grow-1" variant="outlined"
style="background-color: rgba(255, 255, 255, 0.1); color: rgba(0, 0, 0, 0.4);"
@click="unsubscribeFromCreator">Oui
</v-btn>
<v-btn color="secondary" class="flex-grow-1"
:style="{ borderColor: creator.colors.menu, color: creator.colors.menu }" variant="outlined"
@click="showUnsubscribeModal = false "> <div :style="{color: creator.colors.menu}">non</div>
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template> </template>
<style scoped> <style scoped>
.action { .action {
@apply py-2 px-4 rounded bg-gray-100 hover:bg-gray-300 @apply py-2 px-4 rounded;
} border: 1px solid currentColor;
}
</style> </style>