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

fix: add id to checkbox, add link to profiles #1449

Conversation

a0m0rajab
Copy link
Contributor

@a0m0rajab a0m0rajab commented Jul 30, 2023

Description

This PR adds redirect to profile page like the next:

  • In the feed page, the mention/tag to username redirects to OpenSauced profile
  • In the user page, the mention/tag redirects to GitHub Profle

Beside the redirects, it fixes the label/input connection issue in the pages with multiple checkboxes, if the check box has no ID. the default id would be checkbox which will break the UI due to having multiple similar IDs, I fixed this by using the label as ID, to avoid any issue in the future and make the ID as an optional for programmer for easier coding.

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation Update
  • 🎨 Style
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ”₯ Performance Improvements
  • βœ… Test
  • πŸ€– Build
  • πŸ” CI
  • πŸ“¦ Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

Fixes #1447
Fixes #1199
Fixes #1448

Mobile & Desktop Screenshots/Recordings

This link in the profile page is redirecting to GitHub:
image

To test:

This link in the feed page redirects to OpenSauced Profile:
image

To test

The checkbox elements and labels are connected to their related inputs:
image

To Test you need to do the next:

Deploy Test Links:

Added tests?

  • πŸ‘ yes
  • πŸ™… no, because they aren't needed
  • πŸ™‹ no, because I need help

Added to documentation?

  • πŸ“œ README.md
  • πŸ““ docs.opensauced.pizza
  • πŸ• dev.to/opensauced
  • πŸ“• storybook
  • πŸ™… no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

@netlify
Copy link

netlify bot commented Jul 30, 2023

❌ Deploy Preview for oss-insights failed.

Built without sensitive environment variables

Name Link
πŸ”¨ Latest commit 9a90431
πŸ” Latest deploy log https://app.netlify.com/sites/oss-insights/deploys/64c7f2272551bb00081f523d

@netlify
Copy link

netlify bot commented Jul 30, 2023

βœ… Deploy Preview for design-insights ready!

Name Link
πŸ”¨ Latest commit 9a90431
πŸ” Latest deploy log https://app.netlify.com/sites/design-insights/deploys/64c7f22722785300082729c9
😎 Deploy Preview https://deploy-preview-1449--design-insights.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

htmlFor={id}
className="ml-3 text-sm font-medium leading-none cursor-pointer text-light-slate-12 peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
({ className, label, id, ...props }, ref) => {
id = id ? id : label?.replaceAll(" ", "_").toLowerCase();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line is the line that I changed here, plus the ID call in the function, yet git did not detect it only (not sure why)

Copy link
Contributor

Choose a reason for hiding this comment

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

You should turn this to a function that returns the conditional statements here

Suggested change
id = id ? id : label?.replaceAll(" ", "_").toLowerCase();
const getId = ()=> id ? id : label?.replaceAll(" ", "_").toLowerCase();

Then in the component attributes, set it to id={getId()}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am going to implement this, but was wondering why we would take this approach?

Copy link
Contributor

Choose a reason for hiding this comment

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

The variable name needs updating to avoid conflicts with the reserved id keyword from the props.

We could have easily said const newId = id ? id : label?.replaceAll(" ", "_").toLowerCase(); but it makes more sense with a function since we are performing some checks to determine the used id.

<label
htmlFor={id}
className="ml-3 text-sm font-medium leading-none cursor-pointer text-light-slate-12 peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
({ className, label, id, ...props }, ref) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the id had checkbox as default value, I removed it from here.

htmlFor={id}
className="ml-3 text-sm font-medium leading-none cursor-pointer text-light-slate-12 peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
({ className, label, id, ...props }, ref) => {
id = id ? id : label?.replaceAll(" ", "_").toLowerCase();
Copy link
Contributor

Choose a reason for hiding this comment

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

You should turn this to a function that returns the conditional statements here

Suggested change
id = id ? id : label?.replaceAll(" ", "_").toLowerCase();
const getId = ()=> id ? id : label?.replaceAll(" ", "_").toLowerCase();

Then in the component attributes, set it to id={getId()}

@@ -54,7 +54,7 @@ const ContributorProfileInfo = ({
{isConnected && <Badge text="beta" />}
</div>
<div className="flex items-center text-sm gap-3">
<span className="text-light-slate-11 text-sm">{`@${githubName}`}</span>
<a className="text-light-slate-11 text-sm" href={`https://github.com/${githubName}`}>{`@${githubName}`}</a>
Copy link
Contributor

@babblebey babblebey Jul 31, 2023

Choose a reason for hiding this comment

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

Suggested change
<a className="text-light-slate-11 text-sm" href={`https://github.com/${githubName}`}>{`@${githubName}`}</a>
<a className="text-light-slate-11 text-sm" href={`/user/${username}`}>{`@${githubName}`}</a>

I don't think the @[username] UI element speaks/communicate well enough of the location it takes a user to on click action, I think its best for User Experience to either have this just link back to the same profile on open-sauced/insights or not link at all.

I understand your thought of having a link to the Contributor' GitHub profile from insights Yes, but I would suggest we create a link to the profile explicitly with an Icon/button somewhere on the UserCard, best in the Socials section below the About, this because the @[username] link alone doesn't tell me by itself its a link to the contributors' github profile.

This compared to the current set-up better informs the users of what they're clicking on and where its should take them to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we have the user back to their profile, then it would not make sense to add a link here.
https://deploy-preview-1449--oss-insights.netlify.app/user/a0m0rajab/highlights

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @babblebey on this. We should ignore making a link to Github from the user's profile for now. we can revisit this in the future and maybe add some design help from @isabensusan.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bdougie already agreed on that in the previous issue though,

Copy link
Member

Choose a reason for hiding this comment

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

I agreed on the PR, code review is part of the process.

I also stand by my previous feedback in the issue. It is not clear what the goal is in this PR. The title seems like this PR is two features in on PR.

This PR links 3 different issues. I don't know where to begin on the feedback or review.

I'd suggest closing this PR and opening separate PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Re: 3 different issues,

I thought this is an accepted pattern since I saw it before in the AI repo
image

open-sauced/ai#163

Re: new PR.
Opened three different PRs.

Copy link
Member

Choose a reason for hiding this comment

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

I thought this is an accepted pattern since I saw it before in the AI repo

This is a repo used by close to 4k users.

We can close multiple issues when it makes sense, but your changes were completely different and your title and descriptions were not cohesive.

There are a lot more πŸ‘€ here than the AI repo.

Please consider the context

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for giving me information about the context! Was looking at all repos from the same perspective πŸ˜„

Copy link
Member

@bdougie bdougie left a comment

Choose a reason for hiding this comment

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

Open one PR per issue.

@bdougie
Copy link
Member

bdougie commented Aug 1, 2023

Please do one PR per feature/issue.

@bdougie bdougie closed this Aug 1, 2023
@a0m0rajab a0m0rajab deleted the fix--checkbox-accesiability,-links-to-pages branch August 1, 2023 11:04
@a0m0rajab
Copy link
Contributor Author

Thanks for that, I opened them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants