Skip to content

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

Add first and last name to details page

Lukasz Szewczyk5e797c136d0d
diff --git a/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx b/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
index 5bf9aea6c4..119b846e38 100644
--- a/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
+++ b/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
@@ -81,7 +81,9 @@ const StaffDetailsPage = withStyles(styles, { name: "StaffDetailsPage" })(
{({ data, change, hasChanged, submit }) => (
<Container width="md">
<PageHeader
- title={maybe(() => staffMember.email)}
+ title={maybe(
+ () => `${staffMember.firstName} ${staffMember.lastName}`
+ )}
onBack={onBack}
/>
<div className={classes.root}>
diff --git a/saleor/static/dashboard-next/staff/components/StaffProperties/StaffProperties.tsx b/saleor/static/dashboard-next/staff/components/StaffProperties/StaffProperties.tsx
index 5799bb1aae..fd78812240 100644
--- a/saleor/static/dashboard-next/staff/components/StaffProperties/StaffProperties.tsx
+++ b/saleor/static/dashboard-next/staff/components/StaffProperties/StaffProperties.tsx
@@ -32,12 +32,15 @@ const styles = (theme: Theme) =>
pointerEvents: "none"
},
prop: {
- marginBottom: theme.spacing.unit * 0
+ marginBottom: theme.spacing.unit * 2 + "px"
},
propGrid: {
display: "grid",
gridColumnGap: theme.spacing.unit * 2 + "px",
- gridTemplateColumns: "1fr 1fr"
+ gridTemplateColumns: "1fr 1fr",
+ [theme.breakpoints.down("xs")]: {
+ gridTemplateColumns: "1fr"
+ }
},
root: {
display: "grid",
@@ -60,22 +63,38 @@ const StaffProperties = withStyles(styles, { name: "StaffProperties" })(
<div>
<div className={classes.avatar}>
<Typography className={classes.avatarText}>
- {maybe(() => staffMember.email.slice(0, 2).toUpperCase()) || ""}
+ {maybe(
+ () =>
+ `${staffMember.firstName[0].toUpperCase()}${staffMember.lastName[0].toUpperCase()}`
+ ) || ""}
</Typography>
</div>
</div>
<div>
<div className={classes.propGrid}>
- <div>
- <div className={classes.prop}>
- <Typography variant="body2">{i18n.t("E-mail")}</Typography>
- {maybe(() => staffMember.email) === undefined ? (
- <Skeleton />
- ) : (
- <Typography>{staffMember.email}</Typography>
- )}
- </div>
- <div />
+ <div className={classes.prop}>
+ <Typography variant="body2">{i18n.t("First Name")}</Typography>
+ {maybe(() => staffMember.firstName) === undefined ? (
+ <Skeleton />
+ ) : (
+ <Typography>{staffMember.firstName}</Typography>
+ )}
+ </div>
+ <div className={classes.prop}>
+ <Typography variant="body2">{i18n.t("Last Name")}</Typography>
+ {maybe(() => staffMember.lastName) === undefined ? (
+ <Skeleton />
+ ) : (
+ <Typography>{staffMember.lastName}</Typography>
+ )}
+ </div>
+ <div className={classes.prop}>
+ <Typography variant="body2">{i18n.t("E-mail")}</Typography>
+ {maybe(() => staffMember.email) === undefined ? (
+ <Skeleton />
+ ) : (
+ <Typography>{staffMember.email}</Typography>
+ )}
</div>
</div>
</div>
diff --git a/saleor/static/dashboard-next/staff/fixtures.ts b/saleor/static/dashboard-next/staff/fixtures.ts
index 67e1ae9270..6c203daa76 100644
--- a/saleor/static/dashboard-next/staff/fixtures.ts
+++ b/saleor/static/dashboard-next/staff/fixtures.ts
@@ -136,8 +136,10 @@ export const staffMembers: StaffList_staffUsers_edges_node[] = [
export const staffMember: StaffMemberDetails_user = {
__typename: "User",
+ firstName: "Jacob",
id: "VXNlcjoyMQ==",
isActive: true,
+ lastName: "Smith",
permissions: [
{
code: PermissionEnum.IMPERSONATE_USERS,
diff --git a/saleor/static/dashboard-next/staff/types/StaffMemberDetails.ts b/saleor/static/dashboard-next/staff/types/StaffMemberDetails.ts
index 83a3a91915..62bbb1e297 100644
--- a/saleor/static/dashboard-next/staff/types/StaffMemberDetails.ts
+++ b/saleor/static/dashboard-next/staff/types/StaffMemberDetails.ts
@@ -19,6 +19,8 @@ export interface StaffMemberDetails_user {
email: string;
isActive: boolean;
permissions: (StaffMemberDetails_user_permissions | null)[] | null;
+ firstName: string;
+ lastName: string;
}
export interface StaffMemberDetails_shop_permissions {