Skip to content

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

Fix account dropdown colors, add avatar

Krzysztof Bialoglowicz514677a76dab
diff --git a/saleor/static/dashboard-next/auth/mutations.ts b/saleor/static/dashboard-next/auth/mutations.ts
index 8d4007ba71..6566fee3fc 100644
--- a/saleor/static/dashboard-next/auth/mutations.ts
+++ b/saleor/static/dashboard-next/auth/mutations.ts
@@ -16,6 +16,9 @@ export const fragmentUser = gql`
code
name
}
+ avatar {
+ url
+ }
}
`;
diff --git a/saleor/static/dashboard-next/auth/types/TokenAuth.ts b/saleor/static/dashboard-next/auth/types/TokenAuth.ts
index a282edc472..3cae7fada8 100644
--- a/saleor/static/dashboard-next/auth/types/TokenAuth.ts
+++ b/saleor/static/dashboard-next/auth/types/TokenAuth.ts
@@ -20,6 +20,11 @@ export interface TokenAuth_tokenCreate_user_permissions {
name: string;
}
+export interface TokenAuth_tokenCreate_user_avatar {
+ __typename: "Image";
+ url: string;
+}
+
export interface TokenAuth_tokenCreate_user {
__typename: "User";
id: string;
@@ -29,6 +34,7 @@ export interface TokenAuth_tokenCreate_user {
isStaff: boolean;
note: string | null;
permissions: (TokenAuth_tokenCreate_user_permissions | null)[] | null;
+ avatar: TokenAuth_tokenCreate_user_avatar | null;
}
export interface TokenAuth_tokenCreate {
diff --git a/saleor/static/dashboard-next/auth/types/User.ts b/saleor/static/dashboard-next/auth/types/User.ts
index 6027f7f828..6609b98976 100644
--- a/saleor/static/dashboard-next/auth/types/User.ts
+++ b/saleor/static/dashboard-next/auth/types/User.ts
@@ -14,6 +14,11 @@ export interface User_permissions {
name: string;
}
+export interface User_avatar {
+ __typename: "Image";
+ url: string;
+}
+
export interface User {
__typename: "User";
id: string;
@@ -23,4 +28,5 @@ export interface User {
isStaff: boolean;
note: string | null;
permissions: (User_permissions | null)[] | null;
+ avatar: User_avatar | null;
}
diff --git a/saleor/static/dashboard-next/auth/types/VerifyToken.ts b/saleor/static/dashboard-next/auth/types/VerifyToken.ts
index 52dc496a41..10e83496ed 100644
--- a/saleor/static/dashboard-next/auth/types/VerifyToken.ts
+++ b/saleor/static/dashboard-next/auth/types/VerifyToken.ts
@@ -14,6 +14,11 @@ export interface VerifyToken_tokenVerify_user_permissions {
name: string;
}
+export interface VerifyToken_tokenVerify_user_avatar {
+ __typename: "Image";
+ url: string;
+}
+
export interface VerifyToken_tokenVerify_user {
__typename: "User";
id: string;
@@ -23,6 +28,7 @@ export interface VerifyToken_tokenVerify_user {
isStaff: boolean;
note: string | null;
permissions: (VerifyToken_tokenVerify_user_permissions | null)[] | null;
+ avatar: VerifyToken_tokenVerify_user_avatar | null;
}
export interface VerifyToken_tokenVerify {
diff --git a/saleor/static/dashboard-next/components/AppLayout/AppLayout.tsx b/saleor/static/dashboard-next/components/AppLayout/AppLayout.tsx
index 9ffdd419c8..dd024c2084 100644
--- a/saleor/static/dashboard-next/components/AppLayout/AppLayout.tsx
+++ b/saleor/static/dashboard-next/components/AppLayout/AppLayout.tsx
@@ -1,3 +1,4 @@
+import Avatar from "@material-ui/core/Avatar";
import Chip from "@material-ui/core/Chip";
import ClickAwayListener from "@material-ui/core/ClickAwayListener";
import Grow from "@material-ui/core/Grow";
@@ -231,8 +232,8 @@ const styles = (theme: Theme) =>
display: "flex"
},
userChip: {
- backgroundColor: theme.palette.common.white,
- border: `1px solid ${theme.palette.grey[200]}`
+ backgroundColor: theme.palette.background.paper,
+ color: theme.palette.text.primary
},
userMenuContainer: {
position: "relative"
@@ -383,6 +384,9 @@ const AppLayout = withStyles(styles, {
ref={anchor}
>
<Chip
+ avatar={
+ <Avatar alt="user" src={user.avatar.url} />
+ }
className={classes.userChip}
label={
<>
diff --git a/saleor/static/dashboard-next/theme.ts b/saleor/static/dashboard-next/theme.ts
index afcb0fa1dd..986d89ba07 100644
--- a/saleor/static/dashboard-next/theme.ts
+++ b/saleor/static/dashboard-next/theme.ts
@@ -41,12 +41,12 @@ export default (colors: IThemeColors): Theme =>
backgroundColor: fade(colors.primary, 0.12)
}
},
- flatPrimary: {
+ flat: {
"& span": {
color: colors.textColor
}
},
- flat: {
+ flatPrimary: {
"& span": {
color: colors.textColor
}