From bf2edc3c03abf67046f85ec7cdda91e9fe8d78b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sat, 20 Nov 2021 23:01:28 +0100 Subject: [PATCH] [avatare] delete avatare, improve show avatar --- .gitignore | 2 + src/components/UpdateUser.vue | 13 ++- src/components/Widget.vue | 10 +- src/components/settings/MainUserSettings.vue | 98 +++++++++++++++++--- src/pages/AdminSettings.vue | 14 ++- src/pages/Settings.vue | 9 ++ 6 files changed, 127 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index a724e6a..703e601 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ yarn-error.log # No need for sharing this yarn.lock +.idea + diff --git a/src/components/UpdateUser.vue b/src/components/UpdateUser.vue index 669ad43..af03710 100644 --- a/src/components/UpdateUser.vue +++ b/src/components/UpdateUser.vue @@ -15,6 +15,7 @@ import { defineComponent, ref, onMounted } from 'vue'; import MainUserSettings from './settings/MainUserSettings.vue'; import UserSelector from './UserSelector.vue'; import { useMainStore, useUserStore } from '@flaschengeist/api'; +import { Notify } from 'quasar'; export default defineComponent({ name: 'UpdateUser', @@ -25,12 +26,20 @@ export default defineComponent({ const user = ref(mainStore.currentUser); onMounted(() => { - void userStore.getUsers(true) - }) + void userStore.getUsers(true); + }); async function updateUser(value: FG.User) { await userStore.updateUser(value); user.value = value; + Notify.create({ + group: false, + type: 'positive', + message: 'Ă„nderungen gespeichert', + timeout: 4000, + progress: true, + actions: [{ icon: 'mdi-close', color: 'white' }], + }); } return { diff --git a/src/components/Widget.vue b/src/components/Widget.vue index 79dca5c..3133c81 100644 --- a/src/components/Widget.vue +++ b/src/components/Widget.vue @@ -4,7 +4,12 @@
- + +
@@ -41,6 +46,7 @@ export default defineComponent({ const avatar = ref(true); const name = ref(mainStore.currentUser.firstname); const avatarLink = ref(mainStore.currentUser.avatar_url); + const avatarError = ref(false); function error() { avatar.value = false; @@ -65,7 +71,7 @@ export default defineComponent({ .filter((user) => user.userid !== mainStore.currentUser.userid) ); - return { avatar, avatarLink, error, name, hasBirthday, birthday, api }; + return { avatar, avatarLink, error, name, hasBirthday, birthday, api, avatarError }; }, }); diff --git a/src/components/settings/MainUserSettings.vue b/src/components/settings/MainUserSettings.vue index 7d48135..8f5e4ed 100644 --- a/src/components/settings/MainUserSettings.vue +++ b/src/components/settings/MainUserSettings.vue @@ -66,12 +66,22 @@ filled label="Avatar" accept=".jpg, image/*" - max-file-size="204800" - hint="Bilddateien, max. 200 KiB" + hint="Bilddateien nur JPEG" + :clearable="avatar.name !== '' || deleteAvatar" + @update:model-value="imagePreview" + @clear="clear" @rejected="onAvatarRejected" > -