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

Issue 2421 post users avatar #2430

Merged

Conversation

AmasiaNalbandian
Copy link
Contributor

@AmasiaNalbandian AmasiaNalbandian commented Nov 1, 2021

Issue This PR Addresses

Fixes #2421

Type of Change

  • Bugfix: Change which fixes an issue
  • New Feature: Change which adds functionality
  • Documentation Update: Change which improves documentation
  • UI: Change which improves UI

Description

This PR adds a new feature which creates avatars of all users, repositories, and organizations involved in a blog post. The avatars are interactable(click event) and will open the users page in a new tab.

Below are some screenshots:
Dark Mode:
dark mode

Light Mode:
light mode

Checklist

  • Quality: This PR builds and passes our npm test and works locally
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not (if applicable)
  • Documentation: This PR includes updated/added documentation to user exposed functionality or configuration variables are added/changed or an explanation of why it does not(if applicable)

@AmasiaNalbandian AmasiaNalbandian added the Blocked Can't do this, until something else is done label Nov 1, 2021
@gitpod-io
Copy link

gitpod-io bot commented Nov 1, 2021

})
);

const getUserImage = (user: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Two things:

  1. If your function returns the value of an expression, you don't need { return ... } and can simply do => expr:
const getUserImage = (user: string) => `https://github.com/${user}.png`
  1. Add an argument here to accept a size value, and include it in the URL so we don't load an image larger than we need: https://github.com/${user}/png?size={size}. You can default it to 25.
const getUserImage = (user: string, size: number = 25) => `https://github.com/${user}.png?size={size}`

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 played around with this a bit.
I wanted to make the code can be reused elsewhere, where the size may change. I made the avatarsize prop for the whole component, so we will pull the image from github in that size, but also pass that same size to the Telescope avatar. the prop avatarsize is optional, but the default will be 25.

<li key={user} className={classes.user}>
<div>
<TelescopeAvatar
img={getUserImage(user)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's pass in a name here of user

@@ -2,7 +2,7 @@ import { MouseEventHandler } from 'react';
import { Avatar } from '@material-ui/core';

type TelescopeAvatarProps = {
name: string;
name?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not do these changes to the TelescopeAvatar

@humphd
Copy link
Contributor

humphd commented Nov 1, 2021

Here's what it looks like, for other reviewers:

Screen Shot 2021-11-01 at 9 04 08 AM

@humphd
Copy link
Contributor

humphd commented Nov 1, 2021

@AmasiaNalbandian don't merge master into your branch, rebase onto master. See workflow docs https://github.com/Seneca-CDOT/telescope/blob/master/docs/git-workflow.md

@AmasiaNalbandian AmasiaNalbandian removed the Blocked Can't do this, until something else is done label Nov 2, 2021
@AmasiaNalbandian AmasiaNalbandian marked this pull request as ready for review November 2, 2021 04:02
@AmasiaNalbandian AmasiaNalbandian self-assigned this Nov 2, 2021
package.json Outdated
@@ -52,7 +52,7 @@
"homepage": "https://github.com/Seneca-CDOT/telescope#readme",
"dependencies": {
"@bull-board/api": "3.6.0",
"@bull-board/express": "3.6.0",
"@bull-board/express": "3.7.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

You've got changes in here that don't belong. Please rebase and squash your branch on master:

git checkout upstream
git pull upstream master
git checkout issue-2421-post-users-avatar
git rebase -i master
# fix conflicts if any and finish rebase...
git push origin -f issue-2421-post-users-avatar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

checkout upstream was not working... but i believe it's gone now.

@AmasiaNalbandian AmasiaNalbandian changed the base branch from master to 1312 November 2, 2021 13:57
@AmasiaNalbandian AmasiaNalbandian changed the base branch from 1312 to master November 2, 2021 13:57
@humphd
Copy link
Contributor

humphd commented Nov 2, 2021

@AmasiaNalbandian you have 26 commits here, it should be 1. Please squash.

humphd
humphd previously approved these changes Nov 3, 2021
Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

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

This looks good to me. Let's see if CI is happy, and get another reviewer to sign off on it.

humphd
humphd previously approved these changes Nov 3, 2021
Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

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

Great job on fixing the git commits. Looks good.

@DukeManh
Copy link
Contributor

DukeManh commented Nov 3, 2021

The staging server is down, I can't test this right now.

@manekenpix
Copy link
Member

This is nice. In a follow-up, it'd be nice to add displaying a user name when you hover over a user avatar (right now it's hard to know what you're clicking on)

@humphd
Copy link
Contributor

humphd commented Nov 3, 2021

Filed #2442 on the hover issue.

Can I get another approval so we can merge this tonight?

@manekenpix
Copy link
Member

@AmasiaNalbandian can you rebase this?

@humphd humphd merged commit 03b6e31 into Seneca-CDOT:master Nov 3, 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.

Add GitHub avatars for users mentioned in posts
6 participants