Adds comments.

This commit is contained in:
jamesjulich 2021-09-09 00:59:17 -05:00
parent 6c78060876
commit a0139f4157
2 changed files with 3 additions and 0 deletions

View file

@ -14,6 +14,7 @@ function ImageUpload({
}) { }) {
const uploadImageRef = useRef(null); const uploadImageRef = useRef(null);
// Uploads the selected image and passes the resulting URI to the onUpload function provided in component props.
function uploadImage(e) { function uploadImage(e) {
const file = e.target.files.item(0); const file = e.target.files.item(0);
if (file !== null) { // TODO Add upload progress spinner if (file !== null) { // TODO Add upload progress spinner

View file

@ -23,6 +23,7 @@ function ProfileEditor({
let username = mx.getUser(mx.getUserId()).displayName; 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) { function handleUpload(e) {
mx.setAvatarUrl(e.content_uri); mx.setAvatarUrl(e.content_uri);
updateImgSrc(mx.mxcUrlToHttp(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() { function onDisplayNameInputChange() {
setDisabled((username === displayNameRef.current.value) || displayNameRef.current.value === '' || displayNameRef.current.value == null); setDisabled((username === displayNameRef.current.value) || displayNameRef.current.value === '' || displayNameRef.current.value == null);
} }