Adds comments.
authorjamesjulich <51384945+jamesjulich@users.noreply.github.com>
Thu, 9 Sep 2021 05:59:17 +0000 (00:59 -0500)
committerjamesjulich <51384945+jamesjulich@users.noreply.github.com>
Thu, 9 Sep 2021 05:59:17 +0000 (00:59 -0500)
src/app/atoms/image-upload/ImageUpload.jsx
src/app/molecules/profile-editor/ProfileEditor.jsx

index 139305276f8b58fe78dc6d589c9d8f32ddac9b40..ef8bfa65531f7e02bfe907970e035b6245f5d319 100644 (file)
@@ -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
index 818ed9355bf9fd9ee1fede7eba5d99b973f5b7e8..4bbf00f7d4dcd53a0089cecc81779f35fc842f7d 100644 (file)
@@ -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);
   }