From a0139f41576809cb647c2d5314be4b522c6ad55b Mon Sep 17 00:00:00 2001 From: jamesjulich <51384945+jamesjulich@users.noreply.github.com> Date: Thu, 9 Sep 2021 00:59:17 -0500 Subject: [PATCH] Adds comments. --- src/app/atoms/image-upload/ImageUpload.jsx | 1 + src/app/molecules/profile-editor/ProfileEditor.jsx | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/app/atoms/image-upload/ImageUpload.jsx b/src/app/atoms/image-upload/ImageUpload.jsx index 1393052..ef8bfa6 100644 --- a/src/app/atoms/image-upload/ImageUpload.jsx +++ b/src/app/atoms/image-upload/ImageUpload.jsx @@ -14,6 +14,7 @@ function ImageUpload({ }) { const uploadImageRef = useRef(null); + // Uploads the selected image and passes the resulting URI to the onUpload function provided in component props. function uploadImage(e) { const file = e.target.files.item(0); if (file !== null) { // TODO Add upload progress spinner diff --git a/src/app/molecules/profile-editor/ProfileEditor.jsx b/src/app/molecules/profile-editor/ProfileEditor.jsx index 818ed93..4bbf00f 100644 --- a/src/app/molecules/profile-editor/ProfileEditor.jsx +++ b/src/app/molecules/profile-editor/ProfileEditor.jsx @@ -23,6 +23,7 @@ function ProfileEditor({ let username = mx.getUser(mx.getUserId()).displayName; + // Sets avatar URL and updates the avatar component in profile editor to reflect new upload function handleUpload(e) { mx.setAvatarUrl(e.content_uri); updateImgSrc(mx.mxcUrlToHttp(e.content_uri)); @@ -36,6 +37,7 @@ function ProfileEditor({ } } + // Enables/disables save button depending on whether or not the username is different than the current. function onDisplayNameInputChange() { setDisabled((username === displayNameRef.current.value) || displayNameRef.current.value === '' || displayNameRef.current.value == null); }