Fixes some issues during edits of user profile

This commit is contained in:
2024-09-04 13:46:02 -04:00
parent eb9ed1f9a8
commit c2df527d4c
7 changed files with 65 additions and 32 deletions

View File

@@ -18,12 +18,12 @@
<span class="value">Un portrait vous permet de personnaliser votre profil</span>
<span>
<img
:src="userStore.portraitUrl"
:src="userStore.user.portraitUrl"
alt="Profile Image"
class="rounded-full"
width="48px"
height="48px">
</span>
height="48px"/>
</span>
</button>
<button
@@ -41,7 +41,7 @@
<span class="value">{{ userStore.user.alias }}</span>
<span><v-icon>mdi-chevron-right</v-icon></span>
</button>
<button
class="editableValue"
@click="openEditBirthday">
@@ -94,27 +94,32 @@
<!-- Modal -->
<v-dialog v-model="dialogEditPortraitShown" max-width="600px">
<portrait-dialog
:portrait-url="userStore.user.portraitUrl"
@close="handleCloseEditPortrait"
@save="handleSaveEditPortrait"
></portrait-dialog>
</v-dialog>
<v-dialog v-model="dialogEditFullnameShown" max-width="600px">
<fullname-dialog
:firstname="userStore.user.firstname"
:lastname="userStore.user.lastname"
@close="handleCloseEditFullname"
@save="handleSaveEditFullname"
></fullname-dialog>
</v-dialog>
<v-dialog v-model="dialogEditAliasShown" max-width="600px">
<alias-dialog
:alias="userStore.user.alias"
@close="handleCloseEditAlias"
@save="handleSaveEditAlias"
></alias-dialog>
</v-dialog>
<v-dialog v-model="dialogEditBirthdayShown" max-width="600px">
<birthday-dialog
:birth-date="userStore.user.birthDate"
@close="handleCloseEditBirthday"
@save="handleSaveEditBirthday"
></birthday-dialog>
@@ -122,6 +127,7 @@
<v-dialog v-model="dialogEditPhoneShown" max-width="600px">
<phone-dialog
:phone="userStore.user.phoneNumber"
@close="handleCloseEditPhone"
@save="handleSaveEditPhone"
></phone-dialog>
@@ -129,6 +135,7 @@
<v-dialog v-model="dialogEditEmailShown" max-width="600px">
<email-dialog
:email="userStore.user.email"
@close="handleCloseEditEmail"
@save="handleSaveEditEmail"
></email-dialog>
@@ -136,11 +143,11 @@
<v-dialog v-model="dialogEditAddressShown" max-width="600px">
<address-dialog
:address="userStore.user.address"
@close="handleCloseEditAddress"
@save="handleSaveEditAddress"
></address-dialog>
</v-dialog>
</template>
<script setup>
@@ -168,8 +175,8 @@ function handleCloseEditPortrait() {
dialogEditPortraitShown.value = false
}
function handleSaveEditPortrait(portraitUrl) {
console.log(`going to save portrait: ${portraitUrl}`)
function handleSaveEditPortrait(portraitData) {
userStore.changePortrait(portraitData)
dialogEditPortraitShown.value = false
}
@@ -273,11 +280,9 @@ function handleSaveEditAddress(address) {
userStore.changeAddress(address)
dialogEditAddressShown.value = false
}
</script>
<style>
.editableValue {
@apply py-2 px-4 border-gray-400 shadow flex items-center transition duration-200 ease-in-out w-full;
@apply hover:bg-[#A6147D] hover:text-white hover:opacity-90;
@@ -290,5 +295,4 @@ function handleSaveEditAddress(address) {
.value {
@apply flex-auto pr-6 text-left;
}
</style>

View File

@@ -29,14 +29,8 @@ import {ref} from 'vue';
const props = defineProps(['address'])
const emit = defineEmits(['close', 'save'])
const title = ref(props.title);
const address = ref(props.address);
const requestClose = () => emit('close')
const requestSave = () => emit('save', address.value)
</script>
<style scoped>
</style>

View File

@@ -23,7 +23,6 @@
</v-card>
</template>
<script setup>
import {ref} from 'vue';

View File

@@ -1,5 +1,4 @@
<template>
<v-card>
<v-card-title>
Numéro de téléphone
@@ -23,7 +22,6 @@
</v-card-actions>
</v-card>
</template>
<script setup>
@@ -32,7 +30,7 @@ import {ref} from 'vue';
const props = defineProps(['phone'])
const emit = defineEmits(['close', 'save'])
const phone = ref(props.email)
const phone = ref(props.phone)
const requestClose = () => emit('close')
const requestSave = () => emit('save', phone.value)

View File

@@ -5,10 +5,19 @@
</v-card-title>
<div class="m-4">
<v-text-field
<img
:src="portraitData"
class="mb-5 w-full transition duration-200 ease-in-out transform"
alt="Aperçu de la bannière"
/>
<v-file-input
@change="onSelectedFileChanged"
v-model="selectedFile"
variant="outlined"
v-model="portraitUrl"
></v-text-field>
accept="image/*"
label="Votre bannière"
></v-file-input>
</div>
<v-card-actions>
@@ -29,8 +38,21 @@ import {ref} from 'vue';
const props = defineProps(['portraitUrl'])
const emit = defineEmits(['close', 'save'])
const portraitUrl = ref(props.portraitUrl)
const portraitData = ref(props.portraitUrl)
const selectedFile = ref({})
const onSelectedFileChanged = () => {
if (selectedFile.value) {
const reader = new FileReader()
reader.onload = (event) => {
portraitData.value = event.target.result
}
reader.readAsDataURL(selectedFile.value)
} else {
portraitData.value = null
}
}
const requestClose = () => emit('close')
const requestSave = () => emit('save', portraitUrl.value)
const requestSave = () => emit('save', selectedFile.value)
</script>

View File

@@ -36,7 +36,7 @@ const props = defineProps({
const emits = defineEmits(['closeRequested'])
const selectedFile = ref("")
const selectedFile = ref({})
const fileUrl = ref(props.creator.images.banner)
const onFileSelected = () => {