Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add user deafult avatar

Krzysztof Bialoglowiczd26cc7609abc
diff --git a/saleor/static/dashboard-next/staff/components/StaffProperties/StaffProperties.tsx b/saleor/static/dashboard-next/staff/components/StaffProperties/StaffProperties.tsx
index 7d46f3c54a..af87587138 100644
--- a/saleor/static/dashboard-next/staff/components/StaffProperties/StaffProperties.tsx
+++ b/saleor/static/dashboard-next/staff/components/StaffProperties/StaffProperties.tsx
@@ -13,7 +13,7 @@ import SVG from "react-inlinesvg";
import CardTitle from "../../../components/CardTitle";
import i18n from "../../../i18n";
-import { maybe } from "../../../misc";
+import { maybe, getUserInitials } from "../../../misc";
import { StaffMemberDetails_user } from "../../types/StaffMemberDetails";
import * as photoIcon from "../../../../images/photo-icon.svg";
@@ -36,6 +36,18 @@ const styles = (theme: Theme) =>
position: "relative",
width: 120
},
+ avatarDefault: {
+ "& p": {
+ color: "#fff",
+ fontSize: 35,
+ fontWeight: "bold",
+ lineHeight: "120px"
+ },
+ background: theme.palette.primary.main,
+ height: 120,
+ textAlign: "center",
+ width: 120
+ },
avatarHover: {
"& p": {
"&:hover": {
@@ -116,10 +128,16 @@ const StaffProperties = withStyles(styles, { name: "StaffProperties" })(
<div className={classes.root}>
<div>
<div className={classes.avatar}>
- <img
- className={classes.avatarImage}
- src={maybe(() => staffMember.avatar.url)}
- />
+ {maybe(() => staffMember.avatar.url) ? (
+ <img
+ className={classes.avatarImage}
+ src={maybe(() => staffMember.avatar.url)}
+ />
+ ) : (
+ <div className={classes.avatarDefault}>
+ <Typography>{getUserInitials(data)}</Typography>
+ </div>
+ )}
<div className={classes.avatarHover}>
<SVG src={photoIcon} />
<Typography onClick={clickImgInput}>