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

Feat: Issue#27 view user personal details #38

Conversation

mtreacy002
Copy link
Member

@mtreacy002 mtreacy002 commented Jul 12, 2020

Description

Add feature: View user's personal details

Fixes #27

Type of Change:

  • Code
  • User Interface

Code/Quality Assurance Only

  • New feature (non-breaking change which adds functionality pre-approved by mentors)

How Has This Been Tested?

  • login as user
  • go to My Space -> My Profile page
  • See Personal Details
    ezgif com-video-to-gif (1)

Checklist:

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials

Code/Quality Assurance Only

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@mtreacy002 mtreacy002 self-assigned this Jul 12, 2020
@mtreacy002 mtreacy002 added Category: Coding Changes to code base or refactored code that doesn't fix a bug. Category: User Interface Improvements or additions to design. Program: GSOC Related to work completed during the Google Summer of Code Program. labels Jul 12, 2020
@mtreacy002 mtreacy002 added this to the GSoC: Coding Phase II milestone Jul 12, 2020
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . Here's the view personal details as per issue #27 . @meenakshi-dhanani . I'm wondering what type of tests are needed for this one as I couldn't see them (tests) being mentioned in the issue's acceptance criteria. Or should it be tackle in a separate issue?

const [skills, setSkills] = useState(null);
const [resumeUrl, setResumeUrl] = useState(null);
const [photoUrl, setPhotoUrl] = useState(null);

Copy link
Contributor

Choose a reason for hiding this comment

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

why not just have const [personalDetails, setPersonalDetails] = useState(null);

and set whatever comes in response as the personalDetails?

I don't see the benefit in cluttering with so many use states

Copy link
Member Author

Choose a reason for hiding this comment

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

@meenakshi-dhanani , I tried your suggestion. Using const [personalDetails, setPersonalDetails] = useState(null) or useState({}) but none of these options get the data out from the response. Here's the screenshot of what I've done.
Screen Shot 2020-07-13 at 12 27 26 am

Screen Shot 2020-07-13 at 12 42 50 am

Do you have any other suggestion?

Copy link
Member Author

Choose a reason for hiding this comment

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

And here's the result of thee page when rendered (with empty data)
Screen Shot 2020-07-13 at 12 43 46 am

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll check it out, as a convention if your setter is setPersonalDetails then your variable would be personalDetails and not personal_details

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @meenakshi-dhanani . I tried with the correct naming convention. Still didn't work (cannot get data out of fetch using setPersonalDetails)

  • using null

Screen Shot 2020-07-14 at 11 24 07 am

Screen Shot 2020-07-14 at 11 25 35 am

  • using {}

Screen Shot 2020-07-14 at 11 27 53 am

Screen Shot 2020-07-14 at 11 28 03 am

Do you have any other suggestion?

Copy link
Contributor

Choose a reason for hiding this comment

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

Check the Todo file in this sandbox - https://codesandbox.io/s/xenodochial-rain-fet6s?file=/src/Todo.js

Here, I am not setting time and title separately.

Copy link
Member Author

Choose a reason for hiding this comment

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

@meenakshi-dhanani . Have you try it using the fetch from API? Does it work on your end? I've pushed the latest code with your alternative solution in case you want to give it a try. Let me know if it works for you. If you want to catch up for troubleshoot, I'm available. Ta

Copy link
Member Author

@mtreacy002 mtreacy002 left a comment

Choose a reason for hiding this comment

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

Update @meenakshi-dhanani . Can you give other suggestion? naming convention doesn't solve the issue of not able getting data out of fetch using dict or null. So far it only works when data is set individually inside fetch as what I 've done in the PR.

const [skills, setSkills] = useState(null);
const [resumeUrl, setResumeUrl] = useState(null);
const [photoUrl, setPhotoUrl] = useState(null);

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @meenakshi-dhanani . I tried with the correct naming convention. Still didn't work (cannot get data out of fetch using setPersonalDetails)

  • using null

Screen Shot 2020-07-14 at 11 24 07 am

Screen Shot 2020-07-14 at 11 25 35 am

  • using {}

Screen Shot 2020-07-14 at 11 27 53 am

Screen Shot 2020-07-14 at 11 28 03 am

Do you have any other suggestion?

@mtreacy002 mtreacy002 force-pushed the issue#27-view-user-personal-details branch from 255aed8 to a250273 Compare July 14, 2020 23:51
// const [name, setName] = useState(null);
// const [ircId, setIrcId] = useState(null);
// const [mentor, setMentor] = useState(null);
// const [mentee, setMentee] = useState(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please even while trying no comments. If something doesn't work it's never lost. You can always get it from the previous commit

Copy link
Member Author

Choose a reason for hiding this comment

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

got it. fixed now.

@mtreacy002
Copy link
Member Author

Update @meenakshi-dhanani . I just realized what's missing. I've now applied useEffect for fetch and it works (setting the data using dict for fetch). Sorry for the hassle. Please re-review.

@mtreacy002 mtreacy002 changed the title WIP | Feat: Issue#27 view user personal details Feat: Issue#27 view user personal details Jul 17, 2020
@mtreacy002
Copy link
Member Author

mtreacy002 commented Jul 17, 2020

@meenakshi-dhanani. I'm going to open a new branch for testing this view user personal details. Since I'm going to carry this PR code across, I'm going to merge the 6 commits here into one to avoid rebase hell. I'll force pushed the single commit soon.

@mtreacy002 mtreacy002 force-pushed the issue#27-view-user-personal-details branch from a76b742 to 16162aa Compare July 17, 2020 01:30
@mtreacy002
Copy link
Member Author

Update @meenakshi-dhanani . I've just pushed the latest code change as we discussed just now in your office hour. Please re-review. 😉

const requestPersonalDetails = {
method: "GET",
headers: {
"Authorization": `Bearer ${Cookies.get("access_token")}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

@mtreacy002 sorry I did not realize the token comes from the cookie. We are creating the AuthContext as a wrapper for any auth related details. If we start getting access_token from cookie directly, every other component that we make will have this same logic. It is the responsibility of the context, to abstract these details out.

Can you send the access_token also from the provider, and use it here?

Copy link
Member Author

Choose a reason for hiding this comment

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

done. It's now added to AuthContext and used in request header from that. 👍

PR#38 rename files/routes and refactor set data using dict

PR#38 apply useEffect to get data using dict

PR#38 remove comments

PR#38 protect personal detail page before login

PR#38 Fix Navbar toggle issue after user logout

PR#38 remove buttons from personal details form and fix navbar

PR#38 add token to AuthContext

PR#38 remove unused import

PR#38 Fix navbar toggle login logout from profile pages
@mtreacy002 mtreacy002 force-pushed the issue#27-view-user-personal-details branch from c0550f5 to 2e2f90a Compare July 18, 2020 00:26
@meenakshi-dhanani
Copy link
Contributor

@ramitsawhney27 I have reviewed the code, I think @foongminwong might not be available, could you test this at your end and if all looks good maybe approve?

@meenakshi-dhanani meenakshi-dhanani merged commit e25d9a4 into anitab-org:develop Jul 19, 2020
@mtreacy002 mtreacy002 deleted the issue#27-view-user-personal-details branch September 12, 2020 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Coding Changes to code base or refactored code that doesn't fix a bug. Category: User Interface Improvements or additions to design. Program: GSOC Related to work completed during the Google Summer of Code Program.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

View User Profile - Personal Details
3 participants