From 48fb75423a74cfc850376c23f852e90ae86446fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Mon, 13 Mar 2023 15:20:58 +0100 Subject: [PATCH] Fix staff avatars (#3314) --- src/components/Sidebar/user/Info.tsx | 10 +-- src/index.css | 1 + src/staff/components/StaffList/StaffList.tsx | 85 ++++++------------- .../StaffProperties/StaffProperties.tsx | 10 +-- 4 files changed, 39 insertions(+), 67 deletions(-) diff --git a/src/components/Sidebar/user/Info.tsx b/src/components/Sidebar/user/Info.tsx index 0bc32289c..986b87b93 100644 --- a/src/components/Sidebar/user/Info.tsx +++ b/src/components/Sidebar/user/Info.tsx @@ -21,11 +21,11 @@ export const UserInfo = () => { justifyContent="space-between" > - + {user?.avatar?.url ? ( + + ) : ( + + )} {getUserName(user, true)} diff --git a/src/index.css b/src/index.css index cd942f6e7..d890f6979 100644 --- a/src/index.css +++ b/src/index.css @@ -11,6 +11,7 @@ html { body { color: var(--mu-colors-foreground-text-neutral-plain) !important; overscroll-behavior-y: none; + -webkit-font-smoothing: subpixel-antialiased; } .hide-scrollbar::-webkit-scrollbar { diff --git a/src/staff/components/StaffList/StaffList.tsx b/src/staff/components/StaffList/StaffList.tsx index ab76d8efe..2d2af040d 100644 --- a/src/staff/components/StaffList/StaffList.tsx +++ b/src/staff/components/StaffList/StaffList.tsx @@ -7,7 +7,6 @@ import { StaffListQuery } from "@dashboard/graphql"; import { getUserInitials, getUserName, - maybe, renderCollection, } from "@dashboard/misc"; import { @@ -21,53 +20,26 @@ import { TableCell, TableFooter, TableHead, - Typography, } from "@material-ui/core"; import { makeStyles } from "@saleor/macaw-ui"; +import { Avatar, Box, Text } from "@saleor/macaw-ui/next"; import clsx from "clsx"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; const useStyles = makeStyles( - theme => ({ - avatar: { - alignItems: "center", - borderRadius: "100%", - display: "grid", - float: "left", - height: 47, - justifyContent: "center", - marginRight: theme.spacing(1), - overflow: "hidden", - width: 47, - }, - avatarDefault: { - "& div": { - color: theme.palette.primary.contrastText, - lineHeight: "47px", - }, - background: theme.palette.primary.main, - height: 47, - textAlign: "center", - width: 47, - }, - avatarImage: { - pointerEvents: "none", - width: "100%", - }, + { colEmail: { width: 400, }, - statusText: { - color: "#9E9D9D", - }, + tableRow: { cursor: "pointer", }, wideColumn: { width: "80%", }, - }), + }, { name: "StaffList" }, ); @@ -149,29 +121,28 @@ const StaffList: React.FC = props => { key={staffMember ? staffMember.id : "skeleton"} > -
- {maybe(() => staffMember.avatar.url) ? ( - staffMember.avatar.url)} + + {staffMember?.avatar?.url ? ( + ) : ( -
- {getUserInitials(staffMember)} -
+ )} -
- - {getUserName(staffMember) || } - - - {maybe( - () => - staffMember.isActive + + {getUserName(staffMember) || } + + {staffMember?.isActive ? intl.formatMessage({ id: "9Zlogd", defaultMessage: "Active", @@ -181,13 +152,13 @@ const StaffList: React.FC = props => { id: "7WzUxn", defaultMessage: "Inactive", description: "staff member status", - }), - , - )} - + })} +
+
+
- {maybe(() => staffMember.email, )} + {staffMember?.email} ), diff --git a/src/staff/components/StaffProperties/StaffProperties.tsx b/src/staff/components/StaffProperties/StaffProperties.tsx index 8052774ad..919ce23df 100644 --- a/src/staff/components/StaffProperties/StaffProperties.tsx +++ b/src/staff/components/StaffProperties/StaffProperties.tsx @@ -6,16 +6,16 @@ import { UserFragment, } from "@dashboard/graphql"; import { commonMessages } from "@dashboard/intl"; +import { getUserInitials } from "@dashboard/misc"; import { getFormErrors } from "@dashboard/utils/errors"; import getStaffErrorMessage from "@dashboard/utils/errors/staff"; import { Card, CardContent, TextField, Typography } from "@material-ui/core"; import { makeStyles } from "@saleor/macaw-ui"; +import { vars } from "@saleor/macaw-ui/next"; import React from "react"; import SVG from "react-inlinesvg"; import { FormattedMessage, useIntl } from "react-intl"; -import { getUserInitials } from "../../../misc"; - const useStyles = makeStyles( theme => ({ avatar: { @@ -44,12 +44,12 @@ const useStyles = makeStyles( }, avatarDefault: { "& div": { - color: theme.palette.primary.contrastText, + color: vars.colors.foreground.textNeutralContrasted, fontSize: 35, - fontWeight: "bold", + fontWeight: 580, lineHeight: "120px", }, - background: theme.palette.primary.main, + background: vars.colors.background.decorativeSurfacePlain3, height: 120, textAlign: "center", width: 120,