import Card from "@material-ui/core/Card"; import { createStyles, Theme, withStyles, WithStyles } from "@material-ui/core/styles"; import Table from "@material-ui/core/Table"; import TableBody from "@material-ui/core/TableBody"; import TableCell from "@material-ui/core/TableCell"; import TableFooter from "@material-ui/core/TableFooter"; import TableHead from "@material-ui/core/TableHead"; import TableRow from "@material-ui/core/TableRow"; import Typography from "@material-ui/core/Typography"; import * as classNames from "classnames"; import React from "react"; import Skeleton from "@saleor/components/Skeleton"; import TablePagination from "@saleor/components/TablePagination"; import i18n from "../../../i18n"; import { getUserInitials, getUserName, maybe, renderCollection } from "../../../misc"; import { ListProps } from "../../../types"; import { StaffList_staffUsers_edges_node } from "../../types/StaffList"; const styles = (theme: Theme) => createStyles({ avatar: { alignItems: "center", borderRadius: "100%", display: "grid", float: "left", height: 47, justifyContent: "center", marginRight: theme.spacing.unit * 1 + "px", overflow: "hidden", width: 47 }, avatarDefault: { "& p": { color: "#fff", lineHeight: "47px" }, background: theme.palette.primary.main, height: 47, textAlign: "center", width: 47 }, avatarImage: { pointerEvents: "none", width: "100%" }, statusText: { color: "#9E9D9D" }, tableRow: { cursor: "pointer" }, wideColumn: { width: "80%" } }); interface StaffListProps extends ListProps, WithStyles { staffMembers: StaffList_staffUsers_edges_node[]; } const StaffList = withStyles(styles, { name: "StaffList" })( ({ classes, disabled, onNextPage, onPreviousPage, onRowClick, pageInfo, staffMembers }: StaffListProps) => ( {i18n.t("Name", { context: "object" })} {i18n.t("Email Address", { context: "object" })} {renderCollection( staffMembers, staffMember => (
{maybe(() => staffMember.avatar.url) ? ( staffMember.avatar.url)} /> ) : (
{getUserInitials(staffMember)}
)}
{getUserName(staffMember) || } {maybe( () => staffMember.isActive ? i18n.t("Active", { context: "status" }) : i18n.t("Inactive", { context: "status" }), )}
{maybe( () => staffMember.email, )}
), () => ( {i18n.t("No staff members found")} ) )}
) ); StaffList.displayName = "StaffList"; export default StaffList;