import { Box } from "@mui/material";
import { Status } from "../../types/api";
import StatusChip from "./StatusChip";
import { Typography } from "../Atoms/Typography";
import { useScreenDimension } from "../../hooks/useDimensions";
import { useTranslation } from "../../contexts/I18nContext";
interface GovernanceActionStatusProps {
status: Status;
actionId: string;
isCard?: boolean;
}
export default function GovernanceActionStatus({
status,
actionId,
isCard = true,
}: GovernanceActionStatusProps) {
const { isMobile } = useScreenDimension();
const { t } = useTranslation();
const getStatusChips = () => {
const { ratified_epoch, enacted_epoch, dropped_epoch, expired_epoch } =
status;
if (!ratified_epoch && !enacted_epoch && !dropped_epoch && !expired_epoch) {
return ;
}
if (ratified_epoch && enacted_epoch) {
return (
);
}
if (ratified_epoch && !enacted_epoch) {
return ;
}
if (!ratified_epoch && enacted_epoch) {
return ;
}
if (expired_epoch && dropped_epoch) {
return (
);
}
if (dropped_epoch) {
return ;
}
if (expired_epoch) {
return ;
}
return null;
};
return (
.MuiTypography-root": {
marginBottom: "4px",
},
}}
>
{t("outcome.status.title")}
{getStatusChips()}
);
}