Skip to content

Commit

Permalink
Utilized avatar pictures, closes #30
Browse files Browse the repository at this point in the history
  • Loading branch information
Jovert Lota Palonpon committed Apr 4, 2019
1 parent 48188d1 commit dc39f2b
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 24 deletions.
36 changes: 29 additions & 7 deletions resources/js/views/__backoffice/partials/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
Settings as SettingsIcon,
} from '@material-ui/icons';

import * as RandomUtils from '../../../utils/Random';
import {
LightbulbOff as LightbulbOffIcon,
LightbulbOn as LightbulbOnIcon,
Expand Down Expand Up @@ -507,13 +508,34 @@ const Header = props => {
}
color="inherit"
>
<Avatar className={classes.avatar}>
<Typography>
{`${user.firstname.charAt(
0,
)}${user.lastname.charAt(0)}`}
</Typography>
</Avatar>
{user.hasOwnProperty('thumbnail_url') &&
user.thumbnail_url !== null ? (
<Avatar
alt={user.name}
src={user.thumbnail_url}
/>
) : (
<Avatar
style={{
fontSize: 17,
backgroundColor: RandomUtils._color(
user.firstname.length -
user.created_at.charAt(
user.created_at
.length - 2,
),
),
}}
>
<Typography>
{`${user.firstname.charAt(
0,
)}${user.lastname.charAt(
0,
)}`}
</Typography>
</Avatar>
)}
</IconButton>

<AccountMenu {...props} />
Expand Down
43 changes: 26 additions & 17 deletions resources/js/views/__backoffice/users/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,23 +403,32 @@ class List extends Component {
wrap="nowrap"
>
<Grid item style={{ marginRight: 10 }}>
<Avatar
style={{
fontSize: 17,
backgroundColor: RandomUtils._color(
user.firstname.length -
user.created_at.charAt(
user.created_at.length - 2,
),
),
}}
>
<Typography>
{`${user.firstname.charAt(
0,
)}${user.lastname.charAt(0)}`}
</Typography>
</Avatar>
{user.hasOwnProperty('thumbnail_url') &&
user.thumbnail_url !== null ? (
<Avatar
alt={user.name}
src={user.thumbnail_url}
/>
) : (
<Avatar
style={{
fontSize: 17,
backgroundColor: RandomUtils._color(
user.firstname.length -
user.created_at.charAt(
user.created_at.length -
2,
),
),
}}
>
<Typography>
{`${user.firstname.charAt(
0,
)}${user.lastname.charAt(0)}`}
</Typography>
</Avatar>
)}
</Grid>

<Grid item>{user.name}</Grid>
Expand Down

0 comments on commit dc39f2b

Please sign in to comment.