Fix add missing avatars (#3351)
This commit is contained in:
parent
d95a800b4b
commit
368678c7c4
16 changed files with 96 additions and 217 deletions
|
@ -698,10 +698,6 @@
|
||||||
"context": "payment status",
|
"context": "payment status",
|
||||||
"string": "Fully paid"
|
"string": "Fully paid"
|
||||||
},
|
},
|
||||||
"2r4cTE": {
|
|
||||||
"context": "button",
|
|
||||||
"string": "Enable Dark Mode"
|
|
||||||
},
|
|
||||||
"2rJcFa": {
|
"2rJcFa": {
|
||||||
"context": "delete app",
|
"context": "delete app",
|
||||||
"string": "Deleting this app, you will remove installation of the app. If you are paying for app subscription, remember to unsubscribe from the app in Saleor Marketplace."
|
"string": "Deleting this app, you will remove installation of the app. If you are paying for app subscription, remember to unsubscribe from the app in Saleor Marketplace."
|
||||||
|
@ -4842,10 +4838,6 @@
|
||||||
"context": "title",
|
"context": "title",
|
||||||
"string": "Reserved stock"
|
"string": "Reserved stock"
|
||||||
},
|
},
|
||||||
"X8+Lpa": {
|
|
||||||
"context": "button",
|
|
||||||
"string": "Account Settings"
|
|
||||||
},
|
|
||||||
"X8qjg3": {
|
"X8qjg3": {
|
||||||
"context": "inactive",
|
"context": "inactive",
|
||||||
"string": "Inactive"
|
"string": "Inactive"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { useUser } from "@dashboard/auth";
|
import { useUser } from "@dashboard/auth";
|
||||||
|
import { UserAvatar } from "@dashboard/components/UserAvatar";
|
||||||
import { getUserInitials, getUserName } from "@dashboard/misc";
|
import { getUserInitials, getUserName } from "@dashboard/misc";
|
||||||
import { Avatar, Box, Text } from "@saleor/macaw-ui/next";
|
import { Box, Text } from "@saleor/macaw-ui/next";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import { UserControls } from "./Controls";
|
import { UserControls } from "./Controls";
|
||||||
|
@ -21,11 +22,7 @@ export const UserInfo = () => {
|
||||||
justifyContent="space-between"
|
justifyContent="space-between"
|
||||||
>
|
>
|
||||||
<Box display="flex" gap={6} alignItems="center">
|
<Box display="flex" gap={6} alignItems="center">
|
||||||
{user?.avatar?.url ? (
|
<UserAvatar initials={getUserInitials(user)} url={user?.avatar?.url} />
|
||||||
<Avatar.User scheme="decorative3" src={user.avatar.url} />
|
|
||||||
) : (
|
|
||||||
<Avatar.User initials={getUserInitials(user)} scheme="decorative3" />
|
|
||||||
)}
|
|
||||||
<Box __width={128} className="ellipsis">
|
<Box __width={128} className="ellipsis">
|
||||||
<Text variant="bodyStrong" size="small">
|
<Text variant="bodyStrong" size="small">
|
||||||
{getUserName(user, true)}
|
{getUserName(user, true)}
|
||||||
|
|
|
@ -3,10 +3,12 @@ import { Button } from "@dashboard/components/Button";
|
||||||
import { getUserInitials } from "@dashboard/misc";
|
import { getUserInitials } from "@dashboard/misc";
|
||||||
import { CardContent, TextField } from "@material-ui/core";
|
import { CardContent, TextField } from "@material-ui/core";
|
||||||
import { makeStyles } from "@saleor/macaw-ui";
|
import { makeStyles } from "@saleor/macaw-ui";
|
||||||
import { Avatar, vars } from "@saleor/macaw-ui/next";
|
import { vars } from "@saleor/macaw-ui/next";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { FormattedMessage, useIntl } from "react-intl";
|
import { FormattedMessage, useIntl } from "react-intl";
|
||||||
|
|
||||||
|
import { UserAvatar } from "../UserAvatar";
|
||||||
|
|
||||||
const useStyles = makeStyles(
|
const useStyles = makeStyles(
|
||||||
theme => ({
|
theme => ({
|
||||||
avatar: {
|
avatar: {
|
||||||
|
@ -91,10 +93,9 @@ export const TimelineAddNote: React.FC<TimelineAddNoteProps> = props => {
|
||||||
return (
|
return (
|
||||||
<div className={classes.noteRoot}>
|
<div className={classes.noteRoot}>
|
||||||
<CardContent className={classes.noteTitle}>
|
<CardContent className={classes.noteTitle}>
|
||||||
<Avatar.User
|
<UserAvatar
|
||||||
|
url={user?.avatar?.url}
|
||||||
initials={getUserInitials(user)}
|
initials={getUserInitials(user)}
|
||||||
scheme="decorative2"
|
|
||||||
src={user?.avatar?.url}
|
|
||||||
className={classes.avatar}
|
className={classes.avatar}
|
||||||
/>
|
/>
|
||||||
<TextField
|
<TextField
|
||||||
|
|
|
@ -2,10 +2,11 @@ import { useUser } from "@dashboard/auth";
|
||||||
import { getUserInitials } from "@dashboard/misc";
|
import { getUserInitials } from "@dashboard/misc";
|
||||||
import { Card, CardContent, Typography } from "@material-ui/core";
|
import { Card, CardContent, Typography } from "@material-ui/core";
|
||||||
import { makeStyles } from "@saleor/macaw-ui";
|
import { makeStyles } from "@saleor/macaw-ui";
|
||||||
import { Avatar, vars } from "@saleor/macaw-ui/next";
|
import { vars } from "@saleor/macaw-ui/next";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import { DateTime } from "../Date";
|
import { DateTime } from "../Date";
|
||||||
|
import { UserAvatar } from "../UserAvatar";
|
||||||
|
|
||||||
const useStyles = makeStyles(
|
const useStyles = makeStyles(
|
||||||
theme => ({
|
theme => ({
|
||||||
|
@ -87,10 +88,9 @@ export const TimelineNote: React.FC<TimelineNoteProps> = props => {
|
||||||
return (
|
return (
|
||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
{user && (
|
{user && (
|
||||||
<Avatar.User
|
<UserAvatar
|
||||||
initials={getUserInitials(currentUser)}
|
initials={getUserInitials(currentUser)}
|
||||||
scheme="decorative2"
|
url={currentUser?.avatar?.url}
|
||||||
src={currentUser?.avatar?.url}
|
|
||||||
className={classes.avatar}
|
className={classes.avatar}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
19
src/components/UserAvatar/UserAvatar.tsx
Normal file
19
src/components/UserAvatar/UserAvatar.tsx
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import { Avatar } from "@saleor/macaw-ui/next";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
interface UserAvatarProps {
|
||||||
|
url?: string;
|
||||||
|
initials?: string;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const UserAvatar: React.FC<UserAvatarProps> = ({
|
||||||
|
url,
|
||||||
|
initials,
|
||||||
|
...rest
|
||||||
|
}) =>
|
||||||
|
url ? (
|
||||||
|
<Avatar.User scheme="decorative3" src={url} {...rest} />
|
||||||
|
) : (
|
||||||
|
<Avatar.User scheme="decorative3" initials={initials} {...rest} />
|
||||||
|
);
|
1
src/components/UserAvatar/index.ts
Normal file
1
src/components/UserAvatar/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export * from "./UserAvatar";
|
|
@ -1,66 +0,0 @@
|
||||||
import { UserFragment } from "@dashboard/graphql";
|
|
||||||
import { getUserInitials, getUserName } from "@dashboard/misc";
|
|
||||||
import { staffMemberDetailsUrl } from "@dashboard/staff/urls";
|
|
||||||
import { FormControlLabel, Switch } from "@material-ui/core";
|
|
||||||
import { UserChipMenu, UserChipMenuItem } from "@saleor/macaw-ui";
|
|
||||||
import React from "react";
|
|
||||||
import { FormattedMessage, useIntl } from "react-intl";
|
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
|
|
||||||
export interface UserChipProps {
|
|
||||||
isDarkThemeEnabled: boolean;
|
|
||||||
user: UserFragment;
|
|
||||||
onLogout: () => void;
|
|
||||||
onThemeToggle: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const UserChip: React.FC<UserChipProps> = ({
|
|
||||||
isDarkThemeEnabled,
|
|
||||||
user,
|
|
||||||
onLogout,
|
|
||||||
onThemeToggle,
|
|
||||||
}) => {
|
|
||||||
const intl = useIntl();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<UserChipMenu
|
|
||||||
initials={getUserInitials(user)}
|
|
||||||
name={getUserName(user, true)}
|
|
||||||
avatar={user?.avatar?.url}
|
|
||||||
>
|
|
||||||
<UserChipMenuItem data-test-id="account-settings-button">
|
|
||||||
<Link to={staffMemberDetailsUrl(user?.id)}>
|
|
||||||
<FormattedMessage
|
|
||||||
id="X8+Lpa"
|
|
||||||
defaultMessage="Account Settings"
|
|
||||||
description="button"
|
|
||||||
/>
|
|
||||||
</Link>
|
|
||||||
</UserChipMenuItem>
|
|
||||||
<UserChipMenuItem onClick={onLogout} data-test-id="log-out-button">
|
|
||||||
<FormattedMessage
|
|
||||||
id="qLbse5"
|
|
||||||
defaultMessage="Log out"
|
|
||||||
description="button"
|
|
||||||
/>
|
|
||||||
</UserChipMenuItem>
|
|
||||||
<UserChipMenuItem
|
|
||||||
leaveOpen
|
|
||||||
data-test-id="theme-switch"
|
|
||||||
data-test-is-dark={isDarkThemeEnabled}
|
|
||||||
>
|
|
||||||
<FormControlLabel
|
|
||||||
control={<Switch checked={isDarkThemeEnabled} disableRipple />}
|
|
||||||
label={intl.formatMessage({
|
|
||||||
id: "2r4cTE",
|
|
||||||
defaultMessage: "Enable Dark Mode",
|
|
||||||
description: "button",
|
|
||||||
})}
|
|
||||||
onChange={onThemeToggle}
|
|
||||||
/>
|
|
||||||
</UserChipMenuItem>
|
|
||||||
</UserChipMenu>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
UserChip.displayName = "UserChip";
|
|
||||||
export default UserChip;
|
|
|
@ -1,2 +0,0 @@
|
||||||
export * from "./UserChip";
|
|
||||||
export { default } from "./UserChip";
|
|
|
@ -23,7 +23,7 @@ export const permissionFragment = gql`
|
||||||
export const permissionGroupMember = gql`
|
export const permissionGroupMember = gql`
|
||||||
fragment PermissionGroupMember on User {
|
fragment PermissionGroupMember on User {
|
||||||
...StaffMember
|
...StaffMember
|
||||||
avatar(size: 48) {
|
avatar(size: 128) {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ export const staffMemberDetailsFragment = gql`
|
||||||
code
|
code
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
avatar(size: 120) {
|
avatar(size: 512) {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ export const staffMemberDetailsFragment = gql`
|
||||||
export const staffMemberAvatarFragment = gql`
|
export const staffMemberAvatarFragment = gql`
|
||||||
fragment StaffMemberAvatar on User {
|
fragment StaffMemberAvatar on User {
|
||||||
...StaffMember
|
...StaffMember
|
||||||
avatar(size: 120) {
|
avatar(size: 512) {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1834,7 +1834,7 @@ export const StaffMemberFragmentDoc = gql`
|
||||||
export const PermissionGroupMemberFragmentDoc = gql`
|
export const PermissionGroupMemberFragmentDoc = gql`
|
||||||
fragment PermissionGroupMember on User {
|
fragment PermissionGroupMember on User {
|
||||||
...StaffMember
|
...StaffMember
|
||||||
avatar(size: 48) {
|
avatar(size: 128) {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2461,7 +2461,7 @@ export const StaffMemberDetailsFragmentDoc = gql`
|
||||||
code
|
code
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
avatar(size: 120) {
|
avatar(size: 512) {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2469,7 +2469,7 @@ export const StaffMemberDetailsFragmentDoc = gql`
|
||||||
export const StaffMemberAvatarFragmentDoc = gql`
|
export const StaffMemberAvatarFragmentDoc = gql`
|
||||||
fragment StaffMemberAvatar on User {
|
fragment StaffMemberAvatar on User {
|
||||||
...StaffMember
|
...StaffMember
|
||||||
avatar(size: 120) {
|
avatar(size: 512) {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15088,7 +15088,7 @@ export const StaffListDocument = gql`
|
||||||
cursor
|
cursor
|
||||||
node {
|
node {
|
||||||
...StaffMember
|
...StaffMember
|
||||||
avatar(size: 48) {
|
avatar(size: 128) {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1331,7 +1331,7 @@ export const StaffMemberFragmentDoc = gql`
|
||||||
export const StaffMemberAvatarFragmentDoc = gql`
|
export const StaffMemberAvatarFragmentDoc = gql`
|
||||||
fragment StaffMemberAvatar on User {
|
fragment StaffMemberAvatar on User {
|
||||||
...StaffMember
|
...StaffMember
|
||||||
avatar(size: 120) {
|
avatar(size: 512) {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2243,7 +2243,7 @@ export const PermissionFragmentDoc = gql`
|
||||||
export const PermissionGroupMemberFragmentDoc = gql`
|
export const PermissionGroupMemberFragmentDoc = gql`
|
||||||
fragment PermissionGroupMember on User {
|
fragment PermissionGroupMember on User {
|
||||||
...StaffMember
|
...StaffMember
|
||||||
avatar(size: 48) {
|
avatar(size: 128) {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2870,7 +2870,7 @@ export const StaffMemberDetailsFragmentDoc = gql`
|
||||||
code
|
code
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
avatar(size: 120) {
|
avatar(size: 512) {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import ConfirmButton from "@dashboard/components/ConfirmButton";
|
||||||
import ResponsiveTable from "@dashboard/components/ResponsiveTable";
|
import ResponsiveTable from "@dashboard/components/ResponsiveTable";
|
||||||
import Skeleton from "@dashboard/components/Skeleton";
|
import Skeleton from "@dashboard/components/Skeleton";
|
||||||
import TableRowLink from "@dashboard/components/TableRowLink";
|
import TableRowLink from "@dashboard/components/TableRowLink";
|
||||||
|
import { UserAvatar } from "@dashboard/components/UserAvatar";
|
||||||
import { SearchStaffMembersQuery } from "@dashboard/graphql";
|
import { SearchStaffMembersQuery } from "@dashboard/graphql";
|
||||||
import useElementScroll, {
|
import useElementScroll, {
|
||||||
isScrolledToBottom,
|
isScrolledToBottom,
|
||||||
|
@ -31,9 +32,9 @@ import {
|
||||||
TableBody,
|
TableBody,
|
||||||
TableCell,
|
TableCell,
|
||||||
TextField,
|
TextField,
|
||||||
Typography,
|
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import { ConfirmButtonTransitionState, makeStyles } from "@saleor/macaw-ui";
|
import { ConfirmButtonTransitionState, makeStyles } from "@saleor/macaw-ui";
|
||||||
|
import { Box, Text } from "@saleor/macaw-ui/next";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import InfiniteScroll from "react-infinite-scroll-component";
|
import InfiniteScroll from "react-infinite-scroll-component";
|
||||||
|
@ -43,16 +44,6 @@ import { messages } from "./messages";
|
||||||
|
|
||||||
const useStyles = makeStyles(
|
const useStyles = makeStyles(
|
||||||
theme => ({
|
theme => ({
|
||||||
avatar: {
|
|
||||||
alignItems: "center",
|
|
||||||
borderRadius: "100%",
|
|
||||||
display: "grid",
|
|
||||||
float: "left",
|
|
||||||
height: 32,
|
|
||||||
justifyContent: "center",
|
|
||||||
overflow: "hidden",
|
|
||||||
width: 32,
|
|
||||||
},
|
|
||||||
avatarCell: {
|
avatarCell: {
|
||||||
padding: 0,
|
padding: 0,
|
||||||
width: 32,
|
width: 32,
|
||||||
|
@ -113,9 +104,6 @@ const useStyles = makeStyles(
|
||||||
table: {
|
table: {
|
||||||
marginBottom: theme.spacing(3),
|
marginBottom: theme.spacing(3),
|
||||||
},
|
},
|
||||||
statusText: {
|
|
||||||
color: "#9E9D9D",
|
|
||||||
},
|
|
||||||
wideCell: {
|
wideCell: {
|
||||||
width: "80%",
|
width: "80%",
|
||||||
},
|
},
|
||||||
|
@ -258,37 +246,30 @@ const AssignMembersDialog: React.FC<AssignMembersDialogProps> = ({
|
||||||
/>
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.avatarCell}>
|
<TableCell className={classes.avatarCell}>
|
||||||
<div className={classes.avatar}>
|
<UserAvatar
|
||||||
{!!member?.avatar?.url ? (
|
url={member?.avatar?.url}
|
||||||
<img
|
initials={getUserInitials(member)}
|
||||||
className={classes.avatarImage}
|
/>
|
||||||
src={member.avatar.url}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<div className={classes.avatarDefault}>
|
|
||||||
<Typography>{getUserInitials(member)}</Typography>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colName}>
|
<TableCell className={classes.colName}>
|
||||||
<Typography>
|
<Box
|
||||||
{getUserName(member) || <Skeleton />}
|
display="flex"
|
||||||
</Typography>
|
flexDirection="column"
|
||||||
<Typography
|
justifyContent="center"
|
||||||
variant={"caption"}
|
|
||||||
className={classes.statusText}
|
|
||||||
>
|
>
|
||||||
{!!member ? (
|
<Text>{getUserName(member) || <Skeleton />}</Text>
|
||||||
member.isActive ? (
|
<Text variant="caption" color="textNeutralSubdued">
|
||||||
intl.formatMessage(messages.staffActive)
|
{!!member ? (
|
||||||
|
member.isActive ? (
|
||||||
|
intl.formatMessage(messages.staffActive)
|
||||||
|
) : (
|
||||||
|
intl.formatMessage(messages.staffInactive)
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
intl.formatMessage(messages.staffInactive)
|
<Skeleton />
|
||||||
)
|
)}
|
||||||
) : (
|
</Text>
|
||||||
<Skeleton />
|
</Box>
|
||||||
)}
|
|
||||||
</Typography>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRowLink>
|
</TableRowLink>
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,7 +6,9 @@ import Skeleton from "@dashboard/components/Skeleton";
|
||||||
import TableCellHeader from "@dashboard/components/TableCellHeader";
|
import TableCellHeader from "@dashboard/components/TableCellHeader";
|
||||||
import TableHead from "@dashboard/components/TableHead";
|
import TableHead from "@dashboard/components/TableHead";
|
||||||
import TableRowLink from "@dashboard/components/TableRowLink";
|
import TableRowLink from "@dashboard/components/TableRowLink";
|
||||||
|
import { UserAvatar } from "@dashboard/components/UserAvatar";
|
||||||
import { PermissionGroupMemberFragment } from "@dashboard/graphql";
|
import { PermissionGroupMemberFragment } from "@dashboard/graphql";
|
||||||
|
import { commonStatusMessages } from "@dashboard/intl";
|
||||||
import {
|
import {
|
||||||
getUserInitials,
|
getUserInitials,
|
||||||
getUserName,
|
getUserName,
|
||||||
|
@ -25,6 +27,7 @@ import {
|
||||||
Typography,
|
Typography,
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import { DeleteIcon, IconButton, makeStyles } from "@saleor/macaw-ui";
|
import { DeleteIcon, IconButton, makeStyles } from "@saleor/macaw-ui";
|
||||||
|
import { Box, Text, vars } from "@saleor/macaw-ui/next";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { FormattedMessage, useIntl } from "react-intl";
|
import { FormattedMessage, useIntl } from "react-intl";
|
||||||
|
@ -38,20 +41,11 @@ const useStyles = makeStyles(
|
||||||
colEmail: {
|
colEmail: {
|
||||||
width: 300,
|
width: 300,
|
||||||
},
|
},
|
||||||
colName: {
|
|
||||||
width: "auto",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
avatar: {
|
colName: {
|
||||||
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
borderRadius: "100%",
|
gap: vars.space[5],
|
||||||
display: "grid",
|
|
||||||
float: "left",
|
|
||||||
height: 47,
|
|
||||||
justifyContent: "center",
|
|
||||||
marginRight: theme.spacing(1),
|
|
||||||
overflow: "hidden",
|
|
||||||
width: 47,
|
|
||||||
},
|
},
|
||||||
avatarDefault: {
|
avatarDefault: {
|
||||||
"& div": {
|
"& div": {
|
||||||
|
@ -68,15 +62,11 @@ const useStyles = makeStyles(
|
||||||
width: "100%",
|
width: "100%",
|
||||||
},
|
},
|
||||||
colActions: {
|
colActions: {
|
||||||
paddingRight: theme.spacing(),
|
|
||||||
textAlign: "right",
|
textAlign: "right",
|
||||||
},
|
},
|
||||||
helperText: {
|
helperText: {
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
},
|
},
|
||||||
statusText: {
|
|
||||||
color: "#9E9D9D",
|
|
||||||
},
|
|
||||||
tableRow: {},
|
tableRow: {},
|
||||||
}),
|
}),
|
||||||
{ name: "PermissionGroup" },
|
{ name: "PermissionGroup" },
|
||||||
|
@ -218,41 +208,22 @@ const PermissionGroupMemberList: React.FC<PermissionGroupProps> = props => {
|
||||||
/>
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colName}>
|
<TableCell className={classes.colName}>
|
||||||
<div className={classes.avatar}>
|
<UserAvatar
|
||||||
{user?.avatar?.url ? (
|
initials={getUserInitials(user)}
|
||||||
<img
|
url={user?.avatar?.url}
|
||||||
className={classes.avatarImage}
|
/>
|
||||||
src={user?.avatar?.url}
|
<Box display="flex" flexDirection="column">
|
||||||
/>
|
<Text>{getUserName(user) || <Skeleton />}</Text>
|
||||||
) : (
|
<Text variant="caption" color="textNeutralSubdued">
|
||||||
<div className={classes.avatarDefault}>
|
{!user ? (
|
||||||
<Typography>{getUserInitials(user)}</Typography>
|
<Skeleton />
|
||||||
</div>
|
) : user.isActive ? (
|
||||||
)}
|
intl.formatMessage(commonStatusMessages.active)
|
||||||
</div>
|
) : (
|
||||||
<Typography>
|
intl.formatMessage(commonStatusMessages.notActive)
|
||||||
{getUserName(user) || <Skeleton />}
|
)}
|
||||||
</Typography>
|
</Text>
|
||||||
<Typography
|
</Box>
|
||||||
variant={"caption"}
|
|
||||||
className={classes.statusText}
|
|
||||||
>
|
|
||||||
{!user ? (
|
|
||||||
<Skeleton />
|
|
||||||
) : user.isActive ? (
|
|
||||||
intl.formatMessage({
|
|
||||||
id: "9Zlogd",
|
|
||||||
defaultMessage: "Active",
|
|
||||||
description: "staff member status",
|
|
||||||
})
|
|
||||||
) : (
|
|
||||||
intl.formatMessage({
|
|
||||||
id: "7WzUxn",
|
|
||||||
defaultMessage: "Inactive",
|
|
||||||
description: "staff member status",
|
|
||||||
})
|
|
||||||
)}
|
|
||||||
</Typography>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colEmail}>
|
<TableCell className={classes.colEmail}>
|
||||||
{user?.email || <Skeleton />}
|
{user?.email || <Skeleton />}
|
||||||
|
|
|
@ -3,7 +3,9 @@ import Skeleton from "@dashboard/components/Skeleton";
|
||||||
import TableCellHeader from "@dashboard/components/TableCellHeader";
|
import TableCellHeader from "@dashboard/components/TableCellHeader";
|
||||||
import { TablePaginationWithContext } from "@dashboard/components/TablePagination";
|
import { TablePaginationWithContext } from "@dashboard/components/TablePagination";
|
||||||
import TableRowLink from "@dashboard/components/TableRowLink";
|
import TableRowLink from "@dashboard/components/TableRowLink";
|
||||||
|
import { UserAvatar } from "@dashboard/components/UserAvatar";
|
||||||
import { StaffListQuery } from "@dashboard/graphql";
|
import { StaffListQuery } from "@dashboard/graphql";
|
||||||
|
import { commonStatusMessages } from "@dashboard/intl";
|
||||||
import {
|
import {
|
||||||
getUserInitials,
|
getUserInitials,
|
||||||
getUserName,
|
getUserName,
|
||||||
|
@ -22,7 +24,7 @@ import {
|
||||||
TableHead,
|
TableHead,
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import { makeStyles } from "@saleor/macaw-ui";
|
import { makeStyles } from "@saleor/macaw-ui";
|
||||||
import { Avatar, Box, Text } from "@saleor/macaw-ui/next";
|
import { Box, Text } from "@saleor/macaw-ui/next";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { FormattedMessage, useIntl } from "react-intl";
|
import { FormattedMessage, useIntl } from "react-intl";
|
||||||
|
@ -122,19 +124,10 @@ const StaffList: React.FC<StaffListProps> = props => {
|
||||||
>
|
>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Box display="flex" alignItems="center" gap={5}>
|
<Box display="flex" alignItems="center" gap={5}>
|
||||||
{staffMember?.avatar?.url ? (
|
<UserAvatar
|
||||||
<Avatar.User
|
url={staffMember?.avatar?.url}
|
||||||
scheme="decorative3"
|
initials={getUserInitials(staffMember)}
|
||||||
src={staffMember.avatar.url}
|
/>
|
||||||
size="large"
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<Avatar.User
|
|
||||||
initials={getUserInitials(staffMember)}
|
|
||||||
scheme="decorative3"
|
|
||||||
size="large"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<Box display="flex" flexDirection="column">
|
<Box display="flex" flexDirection="column">
|
||||||
<Text>{getUserName(staffMember) || <Skeleton />}</Text>
|
<Text>{getUserName(staffMember) || <Skeleton />}</Text>
|
||||||
<Text
|
<Text
|
||||||
|
@ -143,16 +136,8 @@ const StaffList: React.FC<StaffListProps> = props => {
|
||||||
color="textNeutralSubdued"
|
color="textNeutralSubdued"
|
||||||
>
|
>
|
||||||
{staffMember?.isActive
|
{staffMember?.isActive
|
||||||
? intl.formatMessage({
|
? intl.formatMessage(commonStatusMessages.active)
|
||||||
id: "9Zlogd",
|
: intl.formatMessage(commonStatusMessages.notActive)}
|
||||||
defaultMessage: "Active",
|
|
||||||
description: "staff member status",
|
|
||||||
})
|
|
||||||
: intl.formatMessage({
|
|
||||||
id: "7WzUxn",
|
|
||||||
defaultMessage: "Inactive",
|
|
||||||
description: "staff member status",
|
|
||||||
})}
|
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
@ -21,7 +21,7 @@ export const staffList = gql`
|
||||||
cursor
|
cursor
|
||||||
node {
|
node {
|
||||||
...StaffMember
|
...StaffMember
|
||||||
avatar(size: 48) {
|
avatar(size: 128) {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue