From a4d830982009090a41d49b7522622e186b91213f Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Mon, 17 Jul 2023 15:36:18 +0800 Subject: [PATCH] Improved avatar photo in user info --- .../user_profile_placeholder.png} | Bin src/routes/UserInfo/UserInfo.tsx | 21 +++++++++++++----- src/styles.tsx | 6 +++-- 3 files changed, 20 insertions(+), 7 deletions(-) rename src/{routes/UserInfo/image/3135715.png => img/user_profile_placeholder.png} (100%) diff --git a/src/routes/UserInfo/image/3135715.png b/src/img/user_profile_placeholder.png similarity index 100% rename from src/routes/UserInfo/image/3135715.png rename to src/img/user_profile_placeholder.png diff --git a/src/routes/UserInfo/UserInfo.tsx b/src/routes/UserInfo/UserInfo.tsx index 17eba0f..e80947c 100644 --- a/src/routes/UserInfo/UserInfo.tsx +++ b/src/routes/UserInfo/UserInfo.tsx @@ -33,6 +33,7 @@ export default function UserInfo() { year_level: data[1].year_level, semester: data[1].semester, course: data[1].course, + avatar: data[1].avatar, }); }, }); @@ -45,7 +46,20 @@ export default function UserInfo() { year_level: "", semester: "", course: "", + avatar: "", }); + function Avatar() { + if (user.avatar) { + return ; + } else { + return ( + + ); + } + } return ( @@ -53,10 +67,7 @@ export default function UserInfo() { {user.first_name + " " + user.last_name} - + @@ -177,7 +188,7 @@ export default function UserInfo() { onPress={() => setIsEditable(!isEditable)} > - {isEditable ? "Save" : "Edit Profile"} + {isEditable && UserInfo.isSuccess ? "Save" : "Edit Profile"} diff --git a/src/styles.tsx b/src/styles.tsx index 29c380b..9f91780 100644 --- a/src/styles.tsx +++ b/src/styles.tsx @@ -119,9 +119,11 @@ const styles = StyleSheet.create({ alignSelf: "center", }, profile: { - height: 80, - width: 80, + height: 96, + width: 96, alignSelf: "center", + borderRadius: 150 / 2, + overflow: "hidden", }, input: { height: 40,