Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | import { Avatar, AvatarProps } from "@mui/material"; import classNames from "classnames"; import { CheckIcon, CrossIcon, QuestionIcon } from "components/Icons"; import { HostRequestStatus } from "proto/conversations_pb"; import { HostRequest } from "proto/requests_pb"; import React from "react"; import makeStyles from "utils/makeStyles"; const useStyles = makeStyles((theme) => ({ avatar: { fontSize: theme.typography.pxToRem(16), height: 18, width: 18, }, })); interface HostRequestStatusIconProps extends AvatarProps { hostRequest: HostRequest.AsObject; } export default function HostRequestStatusIcon({ hostRequest, ...props }: HostRequestStatusIconProps) { const classes = useStyles(); const s = hostRequest.status; let icon = null; let color = null; if (s === HostRequestStatus.HOST_REQUEST_STATUS_ACCEPTED) { icon = <CheckIcon fontSize="inherit" />; color = "gray"; } else if (s === HostRequestStatus.HOST_REQUEST_STATUS_REJECTED) { icon = <CrossIcon fontSize="inherit" />; color = "red"; } else if (s === HostRequestStatus.HOST_REQUEST_STATUS_PENDING) { icon = <QuestionIcon fontSize="inherit" />; color = "gray"; } else if (s === HostRequestStatus.HOST_REQUEST_STATUS_CANCELLED) { icon = <CrossIcon fontSize="inherit" />; color = "gray"; } else if (s === HostRequestStatus.HOST_REQUEST_STATUS_CONFIRMED) { icon = <CheckIcon fontSize="inherit" />; color = "green"; } else throw new Error(`Unhandled host request case: ${s}`); return ( <Avatar {...props} style={{ backgroundColor: color }} className={classNames(classes.avatar, props.className)} sizes=" " > {icon} </Avatar> ); } |