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 | import { Avatar, AvatarProps } from "@mui/material";
import { CheckIcon, CrossIcon, QuestionIcon } from "components/Icons";
import { HostRequestStatus } from "proto/conversations_pb";
import { HostRequest } from "proto/requests_pb";
import React from "react";
import { theme } from "theme";
interface HostRequestStatusIconProps extends AvatarProps {
hostRequest: HostRequest.AsObject;
}
export default function HostRequestStatusIcon({
hostRequest,
...props
}: HostRequestStatusIconProps) {
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 }}
sizes=" "
sx={{ fontSize: theme.typography.pxToRem(16), height: 18, width: 18 }}
>
{icon}
</Avatar>
);
}
|