From 54c5472d86de1316bb7106801f9cf358a64a92a7 Mon Sep 17 00:00:00 2001 From: srgooglo Date: Wed, 1 Jun 2022 21:42:22 +0200 Subject: [PATCH] added Cover & Avatar update settings --- packages/app/constants/settings/account.jsx | 66 +++++++++++++++++---- 1 file changed, 56 insertions(+), 10 deletions(-) diff --git a/packages/app/constants/settings/account.jsx b/packages/app/constants/settings/account.jsx index 6b5fafee..cffee7d7 100644 --- a/packages/app/constants/settings/account.jsx +++ b/packages/app/constants/settings/account.jsx @@ -94,10 +94,56 @@ export default [ { "id": "avatar", "group": "account.profile", - "component": "ImageUpload", + "component": "Input", "icon": "Image", "title": "Avatar", - "description": "Change your avatar", + "description": "Change your avatar (Upload an image or use an URL)", + "defaultValue": async () => { + const userData = await User.data() + return userData.avatar + }, + "onUpdate": async (value) => { + const selfId = await User.selfUserId() + + const result = window.app.request.post.updateUser({ + _id: selfId, + update: { + avatar: value + } + }) + + if (result) { + return result + } + }, + "debounced": true, + }, + { + "id": "cover", + "group": "account.profile", + "component": "Input", + "icon": "Image", + "title": "Cover", + "description": "Change your profile cover (Upload an image or use an URL)", + "defaultValue": async () => { + const userData = await User.data() + return userData.cover + }, + "onUpdate": async (value) => { + const selfId = await User.selfUserId() + + const result = window.app.request.post.updateUser({ + _id: selfId, + update: { + cover: value + } + }) + + if (result) { + return result + } + }, + "debounced": true, }, { "id": "cover", @@ -107,14 +153,6 @@ export default [ "title": "Cover", "description": "Change your cover", }, - { - "id": "primaryBadge", - "group": "account.profile", - "component": "Select", - "icon": "Tag", - "title": "Primary badge", - "description": "Change your primary badge", - }, { "id": "description", "group": "account.profile", @@ -148,6 +186,14 @@ export default [ }, "debounced": true, }, + { + "id": "primaryBadge", + "group": "account.profile", + "component": "Select", + "icon": "Tag", + "title": "Primary badge", + "description": "Change your primary badge", + }, { "id": "logout", "footer": true,