diff --git a/src/pages/profiles/ProfileDetail.js b/src/pages/profiles/ProfileDetail.js index 77fedb5..a09b1d4 100644 --- a/src/pages/profiles/ProfileDetail.js +++ b/src/pages/profiles/ProfileDetail.js @@ -75,20 +75,39 @@ function ProfileDetail() { : profile?.lastname ? profile?.lastname : profile?.owner} - {/* render " (me)" if logged-in user is viewing their own profile */} - {currentUser?.username === profile?.owner - ? " (me)" - : ""} + {/* add " (me)" if logged-in user is viewing their own profile */} + {currentUser?.username === profile?.owner ? " (me)" : ""} - {/* show role, pronouns & about info if available */} - {profile?.role &&
Role: {profile?.role}
} - {profile?.pronouns &&
Pronouns: {profile?.pronouns}
} - {profile?.about && ( -
-
About
{profile?.about} -
+ {/* show all fields if logged-in user is viewing their own profile */} + {currentUser?.username === profile?.owner ? ( + <> +
username: {profile?.owner}
+
First name: {profile?.firstname || "not defined"}
+
+ Last name: {profile?.lastname || "not defined"} +
+
Role: {profile?.role || "not defined"}
+
Pronouns: {profile?.pronouns || "not defined"}
+
+
About
{profile?.about || "Not filled in"} +
+ + ) : ( + <> + {/* for other user's profiels, show role, pronouns & about info + if available */} + {profile?.role &&
Role: {profile?.role}
} + {profile?.pronouns && ( +
Pronouns: {profile?.pronouns}
+ )} + {profile?.about && ( +
+
About
{profile?.about || "Not filled in"} +
+ )} + )}
@@ -107,12 +126,12 @@ function ProfileDetail() { <>

- {profile?.tasks_count} tasks assigned to {" "} + {profile?.tasks_count} tasks assigned to{" "} {/* render "me" if logged-in user is viewing their own profile, else render firstname if available, elif lastname, else username */} {currentUser?.username === profile?.owner - ? "me" - : profile?.firstname + ? "me" + : profile?.firstname ? profile?.firstname : profile?.lastname ? profile?.lastname