Skip to content
This repository was archived by the owner on Mar 1, 2025. It is now read-only.

Show colored UI avatars for new users#396

Draft
isVivek99 wants to merge 11 commits into
RealDevSquad:developfrom
isVivek99:feature/ui-avataar
Draft

Show colored UI avatars for new users#396
isVivek99 wants to merge 11 commits into
RealDevSquad:developfrom
isVivek99:feature/ui-avataar

Conversation

@isVivek99

@isVivek99 isVivek99 commented Jul 21, 2022

Copy link
Copy Markdown

What is the change?

Changed ui-avatars of new members, . issue 382

Is it bug? No

  • Steps to repro
  • Expected
  • Actual

*Dev Tested?

  • Yes
  • No

*Tested on:

browsers

Platforms

  • Web

Browsers

  • Chrome
  • Safari
  • Brave
  • Firefox

Before / After Change Screenshots

Before

Screenshot 2022-07-21 at 12 44 23 PM

##After

Screenshot 2022-07-21 at 12 44 40 PM

updated (after)

Screenshot 2022-08-25 at 6 55 56 PM

Screenshot 2022-08-25 at 6 56 37 PM

@ivinayakg ivinayakg left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

gave some suggestions, about the code which I belive can help make the code better

Comment thread src/components/member-card/index.js Outdated
Comment thread src/components/new-members/index.js Outdated
Comment thread src/components/new-members/index.js Outdated
developerInfo={newMember}
isMember={false}
isOptionKey={isOptionKey}
colorCombination={cardColorArray[prev]}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

instead of prev which is a non-reactive state, use a random function that generates the random no. between a range and pass that
Math.floor(Math.random() * (cardColorArray.length))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I would have done that In the first place, but since we decided on some kind of a pattern to be used I passed the colors in a sequence. But i dont get why non-reactive state is important here. We are not re-rendering the cards again once they are loaded.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's a good practice in my opinion to be safe from the edge cases

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

can you elaborate more on this , help me get a better context

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I also want to remind @vickydonor-99, we want some sort of hashing function, that distributes the colors, but makes it such that the same color is always applied to the same username.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes @ankushdharkar, haven't got a clear idea about it yet

@shreya-mishra shreya-mishra left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM :)

Comment thread src/components/member-card/card.module.scss Outdated
Comment thread src/components/member-card/card.module.scss Outdated
Comment thread src/components/member-card/index.js Outdated
Comment thread src/components/member-card/index.js Outdated
Comment thread src/components/member-card/index.js Outdated
Comment thread src/components/new-members/index.js Outdated
Comment thread src/components/new-members/index.js Outdated
{ color_primary: '#165692', color_secondary: '#3D8BD3' },
{ color_primary: '#264653', color_secondary: '#387892' },
];
let counter = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why it is exposed to global scope?

Comment thread src/components/member-card/index.js Outdated
Comment thread src/components/member-card/index.js Outdated
Comment thread src/components/member-card/index.js Outdated
@DeRaowl

DeRaowl commented Jul 23, 2022

Copy link
Copy Markdown
Contributor

And if we look into screenshot colors are dark, can we make us of subtle colors?

@ankushdharkar ankushdharkar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why has the package-lock updated?

The package-lock should not be changed, unless:

  • The package.json is updated
  • The PR is doing maintenance/upkeep of codebase

import SuperUserOptions from '@components/member-card/super-user-options';

const Card = ({ developerInfo, isOptionKey }) => {
const Card = ({ developerInfo, isOptionKey, colorCombination }) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am a little confused. We are updating the cards for the users. Why are we adding another prop in member-card for it?

@isVivek99 isVivek99 Jul 24, 2022

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

logic for member and new-member was present in the same card to begin with

Comment thread src/components/member-card/index.js Outdated
Comment thread src/components/member-card/index.js Outdated
Comment on lines +30 to +32
cardElement.style.border = `2px solid ${color_primary}`;
cardElement.style.backgroundColor = color_secondary;
textElement.innerText = `${first_name[0].toUpperCase()} ${last_name[0].toUpperCase()}`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can the styling come from CSS modifiers instead?
We add the modifying class for the color(s), and the CSS included does the rest? Will make our code a lot more declarative in nature, and reduce the number of lines here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

for now i have added inline styles, later might make the suggested change, once I get the idea about the hashing function

Comment thread src/components/member-card/index.js Outdated
@ankushdharkar ankushdharkar changed the title feature/UI avataar Show colored UI avatars for new users Jul 24, 2022
made changes requested in the PR
@isVivek99

isVivek99 commented Jul 24, 2022

Copy link
Copy Markdown
Author

Why has the package-lock updated?

The package-lock should not be changed, unless:

  • The package.json is updated
  • The PR is doing maintenance/upkeep of codebase

I have not updated the package.json, not sure why this happened

@ivinayakg

Copy link
Copy Markdown

Why has the package-lock updated?
The package-lock should not be changed, unless:

  • The package.json is updated
  • The PR is doing maintenance/upkeep of codebase

I have not updated the package.json, not sure why this happened

@vickydonor-99
When we do npm i, it install the packages based on the package.json which doesn't hold the exact package version which is being used in project.
And therefore it may change the package-lock.json to avoid this next time
Do install based on package-lock.json
Or next don't add package.json file in got stage

@isVivek99 isVivek99 closed this Jul 24, 2022
@isVivek99 isVivek99 reopened this Jul 24, 2022
Comment thread src/components/member-card/index.js
Comment thread src/components/member-card/index.js Outdated
Comment on lines +132 to +133
color_primary: '#DB1212',
color_secondary: '#F88181',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we move these constants to a constat file and then import them here and use it? In the future, we might need these default colors elsewhere also. What do you think?

@ankushdharkar ankushdharkar marked this pull request as draft August 2, 2022 00:03
added hash function for consistent colors for members
@isVivek99 isVivek99 marked this pull request as ready for review August 7, 2022 12:30
installed deps acc to pakacge.json
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants