Change the Creator's Profile to allow edition colors

This commit is contained in:
2024-10-06 00:37:49 -04:00
parent 4900d47dd0
commit b43c2f6e3c
2 changed files with 13 additions and 48 deletions

View File

@@ -5,10 +5,6 @@ import {useClient} from "@/plugins/api.js";
const props = defineProps({ const props = defineProps({
creator: { creator: {
required: true required: true
},
colorName: {
type: String,
default: 'primary'
} }
}); });
@@ -25,7 +21,7 @@ const onBackgroundColor = ref(props.creator.colors.onBackground)
const onErrorColor = ref(props.creator.colors.onError) const onErrorColor = ref(props.creator.colors.onError)
const onSurfaceColor = ref(props.creator.colors.onSurface) const onSurfaceColor = ref(props.creator.colors.onSurface)
const selectedColorName = ref(props.colorName); const selectedColorName = ref('primary');
const selectedBackgroundColor = computed({ const selectedBackgroundColor = computed({
get() { get() {
switch (selectedColorName.value) { switch (selectedColorName.value) {

View File

@@ -11,17 +11,11 @@ import {useCreatorProfileStore} from "@/stores/creatorProfileStore.js";
import {useUserProfileStore} from "@/stores/userProfileStore.js"; import {useUserProfileStore} from "@/stores/userProfileStore.js";
const creatorProfileStore = useCreatorProfileStore() const creatorProfileStore = useCreatorProfileStore()
const colorBannerTop = computed(() => creatorProfileStore.creator.colors.primary || '#a0c0f0')
const colorBannerBottom = computed(() => creatorProfileStore.creator.colors.secondary || '#a0c0f0')
const colorAccent = computed(() => creatorProfileStore.creator.colors.accent || '#a0c0f0')
const colorMenu = computed(() => creatorProfileStore.creator.colors.menu || '#a0c0f0')
const imageBanner = computed(() => creatorProfileStore.creator.images.banner || '/images/placeholders/banner.png') const imageBanner = computed(() => creatorProfileStore.creator.images.banner || '/images/placeholders/banner.png')
const imageLogo = computed(() => creatorProfileStore.creator.images.logo || '/images/placeholders/logo.png') const imageLogo = computed(() => creatorProfileStore.creator.images.logo || '/images/placeholders/logo.png')
const dialog = ref(false); const dialog = ref(false);
const currentComponent = ref('') const currentComponent = ref('')
const colorToEdit = ref(null)
const componentsMap = { const componentsMap = {
BannerPicker, BannerPicker,
@@ -52,9 +46,8 @@ function requestCancel() {
dialog.value = false dialog.value = false
} }
const openDialog = (component, colorName = null) => { const openDialog = (component) => {
currentComponent.value = componentsMap[component] currentComponent.value = componentsMap[component]
colorToEdit.value = colorName
dialog.value = true dialog.value = true
} }
@@ -72,7 +65,6 @@ const closeDialog = () => {
<v-card-text> <v-card-text>
<component :is="currentComponent" <component :is="currentComponent"
:creator="creatorProfileStore.creator" :creator="creatorProfileStore.creator"
:colorName="colorToEdit"
@closeRequested="closeDialog" @closeRequested="closeDialog"
@requestAccept="requestAccept" @requestAccept="requestAccept"
@requestCancel="requestCancel" @requestCancel="requestCancel"
@@ -108,15 +100,17 @@ const closeDialog = () => {
<div class="border rounded-2xl"> <div class="border rounded-2xl">
<div class="py-5 uppercase ml-4">{{ $t('creatorinfopage.banner&profile') }}</div> <div class="py-5 uppercase ml-4">{{ $t('creatorinfopage.banner&profile') }}</div>
<div class="flex flex-col w-full"> <div class="flex flex-col w-full gap-4">
<button
@click="openDialog('ColorsPicker', 'bannerTop')" <v-btn
class="flex justify-end h-10 align-center text-white px-5 hover:brightness-150" variant="elevated"
:style="{ backgroundColor: colorBannerTop }" @click="openDialog('ColorsPicker')"
class="flex h-10 px-5 hover:brightness-150"
> >
<v-icon>mdi-eyedropper-variant</v-icon> Choissisez votre palette de couleurs
</button> </v-btn>
<button> <button>
<img <img
@@ -127,43 +121,16 @@ const closeDialog = () => {
> >
</button> </button>
<button
@click="openDialog('ColorsPicker', 'bannerBottom')"
class="flex justify-end h-10 align-center text-white px-5 hover:brightness-150"
:style="{ backgroundColor: colorBannerBottom }"
>
<v-icon>mdi-eyedropper-variant</v-icon>
</button>
<button class="flex justify-center my-5"> <button class="flex justify-center my-5">
<img <img
@click="openDialog('LogoPicker')" @click="openDialog('LogoPicker')"
class="custom-border hover:brightness-125 active:bg-gray-600 shadow flex items-center transition duration-200 ease-in-out w-48 h-48 rounded-full" class="custom-border hover:brightness-125 active:bg-gray-600 shadow flex items-center transition duration-200 ease-in-out w-48 h-48 rounded-full"
:style="{ borderColor: colorAccent }"
:src="imageLogo" :src="imageLogo"
alt="Profile Image" alt="Profile Image"
> >
</button> </button>
<button
@click="openDialog('ColorsPicker', 'accent')"
class="HoverBtn active:bg-gray-300 py-2 px-4 border-gray-400 shadow flex items-center transition duration-200 ease-in-out w-full">
<span class="pa-2 min-w-32 text-left"><v-icon>mdi-circle-outline</v-icon></span>
<span class="flex-auto text-left pr-6">{{ $t('creatorinfopage.borderpicturecolor') }}</span>
<span class="flex-none">
<v-icon>mdi-eyedropper-variant</v-icon>
</span>
</button>
<button
@click="openDialog('ColorsPicker', 'menu')"
class="HoverBtn active:bg-gray-300 py-2 px-4 border-gray-400 shadow flex items-center transition duration-200 ease-in-out w-full rounded-b-2xl">
<span class="flex-none pa-2 min-w-32 text-left"> <v-icon>mdi-menu</v-icon></span>
<span class="flex-auto text-left pr-6">{{ $t('creatorinfopage.menucolor') }}</span>
<span class="flex-none">
<v-icon>mdi-eyedropper-variant</v-icon>
</span>
</button>
</div> </div>
</div> </div>
@@ -257,7 +224,9 @@ const closeDialog = () => {
</button> </button>
</div> </div>
</div> </div>
</div> </div>
<div v-else class="w-full max-w-[800px]"> <div v-else class="w-full max-w-[800px]">