All files / app/features/mod ModPanel.tsx

0% Statements 0/14
0% Branches 0/10
0% Functions 0/4
0% Lines 0/11

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81                                                                                                                                                                 
import { styled, Typography } from "@mui/material";
import Divider from "components/Divider";
import LabelAndText from "components/LabelAndText";
import StyledLink from "components/StyledLink";
import { useTranslation } from "i18n";
import { GLOBAL, MOD } from "i18n/namespaces";
import { UserDetails } from "proto/admin_pb";
import { User } from "proto/api_pb";
 
interface ModPanelProps {
  user: User.AsObject;
  userDetails: UserDetails.AsObject;
}
 
const StyledWrapper = styled("div")(({ theme }) => ({
  marginTop: theme.spacing(1),
}));
 
const StyledDivider = styled(Divider)(({ theme }) => ({
  marginTop: theme.spacing(3),
}));
 
const StyledStrongStatus = styled("b")(({ theme }) => ({
  color: "red",
  textTransform: "uppercase",
}));
 
export default function ModPanel({ userDetails }: ModPanelProps) {
  const { t } = useTranslation([GLOBAL, MOD]);
  return (
    <StyledWrapper>
      <Typography variant="h1">{t("mod:panel.heading")}</Typography>
      <LabelAndText label={t("mod:panel.username")} text={<code>@{userDetails.username}</code>} />
      <LabelAndText label={t("mod:panel.user_id")} text={<code>{userDetails.userId}</code>} />
      <LabelAndText
        label={t("mod:panel.email")}
        text={
          <StyledLink href={"mailto:" + userDetails.email}>
            <code>{userDetails.email}</code>
          </StyledLink>
        }
      />
      <LabelAndText label={t("mod:panel.birthdate")} text={<code>{userDetails.birthdate}</code>} />
      <LabelAndText
        label={t("mod:panel.ui_language_preference")}
        text={<code>{userDetails.uiLanguagePreference}</code>}
      />
      <LabelAndText
        label={t("mod:banned")}
        text={userDetails.banned ? <StyledStrongStatus>{t("mod:banned")}</StyledStrongStatus> : t("global:no")}
      />
      <LabelAndText
        label={t("mod:deleted")}
        text={userDetails.deleted ? <StyledStrongStatus>{t("mod:deleted")}</StyledStrongStatus> : t("global:no")}
      />
      <LabelAndText
        label={t("mod:do_not_email")}
        text={
          userDetails.doNotEmail ? <StyledStrongStatus>{t("mod:do_not_email")}</StyledStrongStatus> : t("global:no")
        }
      />
      <LabelAndText
        label={t("mod:panel.has_strong_verification")}
        text={userDetails.hasStrongVerification ? t("global:yes") : t("global:no")}
      />
      <LabelAndText
        label={t("mod:panel.birthdate_verification_status")}
        text={userDetails.birthdateVerificationStatus}
      />
      <LabelAndText label={t("mod:panel.gender_verification_status")} text={userDetails.genderVerificationStatus} />
      <LabelAndText
        label={t("mod:panel.has_passport_sex_gender_exception")}
        text={userDetails.hasPassportSexGenderException ? t("global:yes") : t("global:no")}
      />
      <LabelAndText label={t("mod:panel.pending_mod_notes_count")} text={userDetails.pendingModNotesCount} />
      <LabelAndText label={t("mod:panel.acknowledged_mod_notes_count")} text={userDetails.acknowledgedModNotesCount} />
      <StyledDivider />
    </StyledWrapper>
  );
}