Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presson view profile Page and Side Bar #71

Merged
merged 2 commits into from
Oct 24, 2024

Conversation

Presson-coder
Copy link
Contributor

Pull Request Title: Add Detailed User Profile Page and Sidebar Information

Description:

This pull request introduces a new view profile page that provides detailed information about a specific user profile. The page includes sections for followers, following, posts, and likes. Additionally, similar information is displayed on the sidebar of the home page.

Changes Made:

  1. View Profile Page:

    • Added a new profile page that displays detailed information about a user.
    • Sections included:
      • Followers: List of users following the profile.
      • Following: List of users the profile is following.
      • Posts: User's posts with details.
      • Likes: Posts liked by the user.
  2. Home Page Sidebar:

    • Updated the sidebar to display similar profile information.
    • Sidebar sections included:
      • Followers: Summary of followers.
      • Following: Summary of following.
      • Username: Username of the user.

Testing:

  • Verified the profile page displays correct information for different users.
  • Tested responsiveness and UI on various devices and screen sizes.

Additional Notes:

  • The sidebar is currently displaying information for a hardcoded user ID. This will be updated to dynamically display the details of the logged-in user once authentication is implemented.

Let me know if you need any further adjustments!

…tion about a specific profile such as their followers, who they follow, their posts, their likes and also displayed similar info on the side bar of the home page
Comment on lines +13 to +16
const username = "chitchat-test";
const password = "7lBeZIE=";
const credentials = encodeCredentials(username, password);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Presson-coder Can we fetch the profile details without hardcoding the credentials? The code should use the current user's credentials to make API requests instead of a hard-coded credential.

Can we save the credentials in a secure storage, retrieve them and pass them to the hook whenever it is called?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oww on that one I needed the endpoint for login which I assume its not there yet. So when its there ,we will make that data dynamic and we will display the data of the currently logged in user and subsequently make requests using their respective credentials.

So on that one I was just doing it that way so that I make requests with the user you created

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a login endpoint here: http://chitchat-api.vndprojects.com/api-auth/login/

I don't have a problem with testing auth using this user account. However, to test more securely, I suggest passing the credentials of whatever user we're using without hard-coding them.

@Presson-coder is this possible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sure thanks, I didn't know that the endpoint was there. Let me work on that and update you.

"created_at": "2024-02-08T15:17:16.231555Z",
"likes_count": 0
},
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Presson-coder, is this for testing purposes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh that file! I was just using it to be seeing the nature of the endpoints and responses locally but otherwise is of no use ,could have deleted it after I was done.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Presson-coder No problem, I understand. If you're using it for local testing, let's remove it from git while keeping it in your filesystem so you can continue to test against it. Do:

git rm --cached frontend/utils/data.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sure thank you

Copy link
Collaborator

@terrameijar terrameijar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Presson-coder Excellent work on this PR! I'm not fluent in React but this code looks good. I left some comments about how we're handling credentials and I'd like to hear your thoughts on identifying users.

I can't view any profile information when I view the UI locally. dev tools show an error when fetching the profile details at this URL:

http://localhost:5173/profile/undefined/profiles/6
image

I could be missing a configuration step here.

@Presson-coder
Copy link
Contributor Author

Then I don't know @terrameijar could the profiles endpoint return more data in the in the following and followers object e.g profile picture and bio or some data because currently we only have url and username. Except its fine like that

"follows": [
{
"username": "chitchat-test1",
"url": "http://chitchat-api.vndprojects.com/api/profiles/12/"
}
],
"followers": [
{
"username": "chitchat-test1",
"url": "http://chitchat-api.vndprojects.com/api/profiles/12/"
}

@mpumzee mpumzee merged commit 16ffbb1 into PythonBulawayo:develop Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants