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

Made GitHub username clickable #424

Closed
wants to merge 3 commits into from

Conversation

djanda97
Copy link

@djanda97 djanda97 commented Mar 7, 2021

Summary

  • Added the userProfile variable to hold the user's GitHub profile URL.
  • Wrapped the userName variable in <a></a> with a link to the URL provided from the userProfile variable.

Ticket Link

Fixes #408

@djanda97 djanda97 requested a review from hanzei as a code owner March 7, 2021 23:59
@mattermod
Copy link
Contributor

Hello @djanda97,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@djanda97
Copy link
Author

djanda97 commented Mar 8, 2021

@mickmister I haven't setup my environment for this plugin to test my changes locally yet, but is this the sort of addition that you had in mind for #408?

Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Thanks @djanda97! I have just a few requests


if (item.user) {
userName = item.user.login;
userProfile = `https://github.com/${userName}`;
Copy link
Contributor

@mickmister mickmister Mar 8, 2021

Choose a reason for hiding this comment

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

What do you think about this instead:

if (item.user) {
    userName = item.user.login;
} else if (item.owner) {
    userName = item.owner.login;
}

const userProfile = `https://github.com/${userName}`;

Copy link
Author

Choose a reason for hiding this comment

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

Good catch!

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually userName may not be defined. So maybe just construct the URL inline since it's only used once:

<a
    href={`https://github.com/${userName}`}
>
    {userName}
</a>

@@ -158,7 +160,7 @@ function GithubItems(props) {
style={style.subtitle}
>
{item.created_at && ('Opened ' + formatTimeSince(item.created_at) + ' ago')}
{userName && ' by ' + userName}
{userName && <a href={userProfile}> by {userName}</a>}
Copy link
Contributor

Choose a reason for hiding this comment

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

The linter is complaining about the JSX/string formatting here:

163:56 error Missing JSX expression container around literal string: “by” react/jsx-no-literals

Maybe try something like this:

Suggested change
{userName && <a href={userProfile}> by {userName}</a>}
{userName && (
<>
{' by '}
<a href={userProfile}>{userName}</a>
</>
)}

Copy link
Author

Choose a reason for hiding this comment

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

Once I get my environment setup, I'll go ahead and test out this change.

@mickmister
Copy link
Contributor

I tested out what the styling looks like when the username is wrapped in an anchor tag, and It looks like the username is a bit dark. I'm wondering if we can make it so that specific word is not dark, while the words around it are dark as they are now. @abhijit-singh Do you have any thoughts on this?

image

@mickmister
Copy link
Contributor

@djanda97 Do you mind commenting on the ticket #408 so I may assign you?

Also feel free to ask questions on our community server at https://community.mattermost.com/core/channels/github-plugin e.g. questions on setting up the plugin.

@hanzei hanzei added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Mar 8, 2021
@hanzei hanzei requested a review from abhijit-singh March 9, 2021 11:44
@hanzei hanzei added the 1: UX Review Requires review by a UX Designer label Mar 9, 2021
@abhijit-singh
Copy link

I tested out what the styling looks like when the username is wrapped in an anchor tag, and It looks like the username is a bit dark. I'm wondering if we can make it so that specific word is not dark, while the words around it are dark as they are now. @abhijit-singh Do you have any thoughts on this?

@mickmister I agree that the username should not be that dark and be more visible. But I think it is using the Link Colour variable from the theme colours and we shouldn't be changing that. A couple of things that can be tried to make it better -

  • Increase the opacity of the Username to 1 (currently it seems to be 0.56)
    or
  • Use a different theme colour variable for the Username, I played around with it and the Center Channel Text colour variable works best. Additionally, it might be a good idea to wrap the Username in a <strong> tag so the font-weight becomes bold.

@djanda97

@mattermod
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

/cc @jasonblais @jfrerich @emilyacook

@hanzei hanzei removed their request for review March 29, 2021 11:55
@hanzei
Copy link
Contributor

hanzei commented Mar 29, 2021

Removing myself from the reviewers list util the UX questions are resolved.

@djanda97
Copy link
Author

I tested out what the styling looks like when the username is wrapped in an anchor tag, and It looks like the username is a bit dark. I'm wondering if we can make it so that specific word is not dark, while the words around it are dark as they are now. @abhijit-singh Do you have any thoughts on this?

@mickmister I agree that the username should not be that dark and be more visible. But I think it is using the Link Colour variable from the theme colours and we shouldn't be changing that. A couple of things that can be tried to make it better -

  • Increase the opacity of the Username to 1 (currently it seems to be 0.56)

or

  • Use a different theme colour variable for the Username, I played around with it and the Center Channel Text colour variable works best. Additionally, it might be a good idea to wrap the Username in a <strong> tag so the font-weight becomes bold.

@djanda97

Thanks for the feedback @abhijit-singh. It might be a while until I can find some time to work on this PR. Once I do, I will try implementing the solutions you listed above.

@hanzei hanzei removed the request for review from abhijit-singh August 20, 2021 08:48
@hanzei hanzei added Work In Progress Not yet ready for review and removed 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester 1: UX Review Requires review by a UX Designer labels Oct 1, 2021
@adithyaakrishna
Copy link

@djanda97 Could you please lmk if there's any update on this? If not can I take this up?

@djanda97
Copy link
Author

djanda97 commented Oct 30, 2021

Hi @adithyaakrishna, I haven't made any progress on this PR, so feel free to pick it up!

@mickmister
Copy link
Contributor

@adithyaakrishna Would you like to take up this ticket? You can clone this PR's code using the hub command:

git clone [email protected]:mattermost/mattermost-plugin-github.git

# or set the url of origin if you already have this checked out

git remote set-url origin [email protected]:mattermost/mattermost-plugin-github.git
git remote add adithyaakrishna [email protected]:adithyaakrishna/mattermost-plugin-github.git

Then you can run hub pr checkout 424 to check out the correct branch used in this PR. Then you can base a branch off of this branch and push to your own fork, and create a new PR from your fork.

@hanzei
Copy link
Contributor

hanzei commented Nov 15, 2021

I'm going to close this PR as @adithyaakrishna is working on a new one. Still, thanks @djanda97 for working on this!

@hanzei hanzei added 3: QA Review Requires review by a QA tester and removed Lifecycle/1:stale labels Nov 15, 2021
@hanzei hanzei added Lifecycle/3:orphaned and removed Work In Progress Not yet ready for review 3: QA Review Requires review by a QA tester labels Nov 15, 2021
@hanzei hanzei closed this Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make username clickable in RHS PRs/Issues
6 participants