Skip to content

Commit

Permalink
Fixed Profile toggle issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vanesssalai authored Jul 12, 2024
1 parent ac81648 commit b8849ef
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/pages/userprofile/UserProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ function UserProfile() {
)}
</div>
</div>
<div className="profile-toggle">
<div className="profile-toggle">
<div
className={`toggle ${!viewToggle == "listing" ? 'active' : ''}`}
className={`toggle ${viewToggle == "listing" ? 'active' : ''}`}
onClick={() => setViewToggle('listing')}
>
Listings
Expand All @@ -306,27 +306,27 @@ function UserProfile() {
</div>
</div>
<div className="user-content">
{viewToggle === "listing" ? (
<div className="user-reviews">
{userReviews.length > 0 ? (
<ReviewList
heading={`${userInfo.username}'s Reviews`}
reviews={userReviews}
averageScore={averageScore}
numberOfReviews={numberOfReviews}
/>
) : (
<h2>This user has no reviews ( ˘・з・)</h2>
)}
</div>
) : viewToggle === "review" ? (
<div className="users-listings">
{userListings.length > 0 ? (
<ProductList heading={`${userInfo.username}'s Listings`} products={userListings} />
) : (
<h2>This user has no listings ( ˘・з・)</h2>
)}
</div>
{viewToggle === "listing" ? (
<div className="users-listings">
{userListings.length > 0 ? (
<ProductList heading={`${userInfo.username}'s Listings`} products={userListings} />
) : (
<h2>This user has no listings ( ˘・з・)</h2>
)}
</div>
) : viewToggle === "review" ? (
<div className="user-reviews">
{userReviews.length > 0 ? (
<ReviewList
heading={`${userInfo.username}'s Reviews`}
reviews={userReviews}
averageScore={averageScore}
numberOfReviews={numberOfReviews}
/>
) : (
<h2>This user has no reviews ( ˘・з・)</h2>
)}
</div>
) : (
<div className="users-forum-posts">
{userForumPosts.length > 0 ? (
Expand All @@ -348,4 +348,4 @@ function UserProfile() {
);
}

export default UserProfile;
export default UserProfile;

0 comments on commit b8849ef

Please sign in to comment.