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

User stats enhancement #505

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,63 @@ const styles = theme => ({
root: {
flex: '1 0 auto',
},
classFlex: {
display: 'flex',
[theme.breakpoints.down('657')]: {
flexDirection: 'column',
alignItems: 'center',
},
},
profileHeaderStyle: {
paddingTop: '1.5em',
paddingBottom: '1.5em',
background: 'rgba(255,204,0,1)',
background:
'linear-gradient(to bottom, rgba(255,204,0,1) 0%, rgba(255,229,133,1) 25%, rgba(255,255,255,1) 61%, rgba(255,255,255,1) 100%)',
[theme.breakpoints.down('511')]: {
paddingTop: '4em',
},
'linear-gradient(to bottom, rgba(255,204,0,1) 0%, rgba(255,229,133,1) 25%, rgba(255,255,255,1) 61%, rgba(255,255,255,1) 100%)',
},
avatarBoxStyle: {
width: '100%',
minWidth: '35%',
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
},
profileShareButtonStyle: {
borderRadius: '50% !important',
},
avatarStyle: {
width: '100%',
height: '100%',
paddingTop: '1.5em',
paddingBottom: '1.5em',
width: '80%',
height: '80%',
paddingLeft: '1em',
paddingRight: '1em',
'& img': {
width: '10em',
width: '8em',
backgroundColor: 'white',
height: '10em',
height: '8em',
borderRadius: '50%',
boxShadow: `0 3px 5px 2px rgba(0, 0, 0, .12)`,
},
},
ProfileDetailStyle: {
width: '100%',
minWidth: '30%',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
alignItems: 'start',
justifyContent: 'center',
marginRight: '1.5em',
[theme.breakpoints.down('657')]: {
justifyContent: 'center',
alignItems: 'center',
marginTop: '1.5em'
},
},
userNameStyle: {
fontWeight: 900,
fontSize: '2rem',
position: 'relative',
[theme.breakpoints.down('470')]: {
overflowWrap: 'anywhere',

[theme.breakpoints.down('750')]: {
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
Expand All @@ -54,24 +70,50 @@ const styles = theme => ({
tagsContainerStyle: {
display: 'flex',
flexWrap: 'wrap',
paddingTop: '0.5em',
paddingBottom: '0.5em',
[theme.breakpoints.down('657')]: {
paddingTop: '0',
paddingBottom: '0',
},
},
removeTagMargin: {
marginLeft: '0 !important',
},
centerTag: {
alignItems: 'center',
},
emailStyle: {
overflowWrap: 'anywhere',
},
emailStyle: { marginBottom: '0.5em' },
dividerStyle: {
width: '100vw',
},
moreInfoBoxStyle: {
height: '3em',
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
justifyContent: 'space-evenly',
alignItems: 'end',
flexWrap: 'wrap',
[theme.breakpoints.down('657')]: {
marginTop: '1.3em',
},
},
moreInfoStyle: {
marginLeft: '0.5em',
marginRight: '0.5em',
fontWeight: 'bold',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
},
moreInfoStyle1: {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe give it a more relevant name than moreInfoStyle1 - such as moreInfoTitle`?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

noted.

fontWeight: '500',
fontSize: '0.9rem',
color: '#00B8C4',
paddingLeft: '5px',
paddingRight: '5px',
},
moreInfoStyle2: {
Copy link
Member

Choose a reason for hiding this comment

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

This could be moreInfoCount?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

noted.

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 there is no way to reconcile the distance, we might try to put them in some distinct containers to show some sort of separation? We can experiment with stuff like this as well:

Also, @tuxology I needed a little help in here, you see there is some padding involve on the Count_values which makes it look a little bit distant from the title. So I was trying to remove the padding but couldn't do much(padding is also not inherited, I tried inspecting it ). Can you suggest something or anything which I might be missing so that it can look more closer and similar to the mockup.

Screenshot (42)

Screenshot (41)

Copy link
Member

Choose a reason for hiding this comment

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

Maybe its not padding but line-height? maybe for this specific container, can you try to reduce it and see how it behaves?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tuxology you see I remove the line-height here, but still, it is same
Screenshot (176)_LI

Copy link
Member

Choose a reason for hiding this comment

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

@Deepanshu039 OK, lets just proceed with this for now. We can do the design stuff later. I feel there is a lot of more stuff to implement for now such as Badges API, latest user activity (probably via API) etc. These are more pressing issues

fontWeight: '550',
fontSize: '3.5em',
color: '#00B8C4',
},
profileLowerStyle: {
margin: '1em',
Expand Down Expand Up @@ -128,7 +170,21 @@ const styles = theme => ({
textDecorationNone: {
textDecoration: 'none',
},
floatRight: { float: 'right' },
floatRight:
{
float: 'right',
},
secondaryButtonMargin:
{
marginTop: '1em',
},
verticalOption:
{
float: 'right' ,
[theme.breakpoints.down('657')]: {
float: 'none',
},
},
displayNone: { display: 'none' },
largeLabel: {
fontSize: '1.3rem',
Expand Down
79 changes: 57 additions & 22 deletions zubhub_frontend/zubhub/src/views/profile/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,30 @@ function Profile(props) {
<Box className={classes.root}>
<Paper className={classes.profileHeaderStyle}>
<Container maxWidth="md">
{props.auth.username === profile.username ? (
{props.auth.username === profile.username ? (
<>
<CustomButton
className={classes.floatRight}
<CustomButton
className={classes.verticalOption}
onClick={e => handleSetState(handleMoreMenuOpen(e))}
>
<MoreVertIcon />
<MoreVertIcon />
</CustomButton>
</>
) : (<></>)
}
<Box className={classes.classFlex}>
<Box className={classes.avatarBoxStyle}>
<Avatar
className={classes.avatarStyle}
src={profile.avatar}
alt={profile.username}
/>

<Box>
{props.auth.username === profile.username ? (
<>
<CustomButton
className={classes.floatRight}
className={classes.secondaryButtonMargin}
variant="contained"
margin="normal"
primaryButtonStyle
Expand Down Expand Up @@ -187,7 +201,7 @@ function Profile(props) {
</>
) : (
<CustomButton
className={classes.floatRight}
className={classes.secondaryButtonMargin}
variant="outlined"
margin="normal"
secondaryButtonStyle
Expand All @@ -200,14 +214,15 @@ function Profile(props) {
: t('profile.follow')}
</CustomButton>
)}
<Box className={classes.avatarBoxStyle}>
<Avatar
className={classes.avatarStyle}
src={profile.avatar}
alt={profile.username}
/>

</Box>

</Box>
<Box className={classes.ProfileDetailStyle}>
<Box className={clsx(classes.ProfileDetailStyle,{
[classes.centerTag]: props.auth.username !== profile.username,
}
)}>

<Typography
className={classes.userNameStyle}
component="h1"
Expand All @@ -221,7 +236,7 @@ function Profile(props) {
key={tag}
className={clsx(common_classes.baseTagStyle, {
[common_classes.extendedTagStyle]: !isBaseTag(tag),
})}
}, classes.removeTagMargin)}
component="h2"
>
{tag}
Expand All @@ -238,8 +253,8 @@ function Profile(props) {
</Typography>
</>
) : null}
<Divider className={classes.dividerStyle} />
<Box className={classes.moreInfoBoxStyle}>
</Box>
<Box className={classes.moreInfoBoxStyle}>
<Link
className={classes.textDecorationNone}
to={`/creators/${profile.username}/projects`}
Expand All @@ -248,7 +263,12 @@ function Profile(props) {
className={classes.moreInfoStyle}
component="h5"
>
{profile.projects_count} {t('profile.projectsCount')}
<box className={classes.moreInfoStyle1}>
{t('profile.projectsCount')}
</box>
<box className={classes.moreInfoStyle2}>
{profile.projects_count}
</box>
</Typography>
</Link>
<Link
Expand All @@ -259,7 +279,12 @@ function Profile(props) {
className={classes.moreInfoStyle}
component="h5"
>
{profile.followers.length} {t('profile.followersCount')}
<box className={classes.moreInfoStyle1}>
{t('profile.followersCount')}
</box>
<box className={classes.moreInfoStyle2}>
{profile.followers.length}
</box>
</Typography>
</Link>
<Link
Expand All @@ -270,7 +295,12 @@ function Profile(props) {
className={classes.moreInfoStyle}
component="h5"
>
{profile.following_count} {t('profile.followingCount')}
<box className={classes.moreInfoStyle1}>
{t('profile.followingCount')}
</box>
<box className={classes.moreInfoStyle2}>
{profile.following_count}
</box>
</Typography>
</Link>
{profile.members_count !== null ? (
Expand All @@ -282,11 +312,16 @@ function Profile(props) {
className={classes.moreInfoStyle}
component="h5"
>
{profile.members_count} {t('profile.membersCount')}
<box className={classes.moreInfoStyle1}>
{t('profile.membersCount')}
</box>
<box className={classes.moreInfoStyle2}>
{profile.members_count}
</box>
</Typography>
</Link>
) : null}
</Box>
</Box>
</Box>
</Container>
</Paper>
Expand Down Expand Up @@ -341,7 +376,7 @@ function Profile(props) {
)
}
>
{t('profile.projects.viewAll')}
{t('profile.projects.viewAll')}
</CustomButton>
</Typography>
<Grid container>
Expand Down