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 | 1x 7x 7x 7x 7x 7x 7x 1x 1x 1x 1x 7x | import NiceModal from "@ebay/nice-modal-react";
import { Stack } from "@mui/material";
import { PencilSimpleIcon } from "@phosphor-icons/react";
import GiveLink from "@shared/Link/GiveLink";
import GiveText from "@shared/Text/GiveText";
import GiveTruncateText from "@shared/Text/GiveTruncateText";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import { useAppTheme } from "@theme/v2/Provider";
import { CHANGE_EMAIL_MODAL, SECURITY_CHECK_MODAL } from "modals/modal_names";
import React from "react";
import { EmailCardProps, getStatus } from "./utils";
import { upperFirst } from "lodash";
import { sendTfaVerificationCode } from "@services/api/2FA/tfaVerifications";
import { useMutation } from "react-query";
const Email: React.FC<EmailCardProps> = ({
email,
status,
disabled = false,
}) => {
const { palette } = useAppTheme();
const { isMobileView } = useCustomThemeV2();
const { text, icon: statusIcon } = getStatus(status, palette);
const tfaVerificationsMutation = useMutation(sendTfaVerificationCode);
const icon = statusIcon;
const handleClick = () => {
Iif (disabled) return;
NiceModal.show(SECURITY_CHECK_MODAL, {
variant: "changeEmail",
onConfirm: () => {
tfaVerificationsMutation.mutate("email");
NiceModal.show(CHANGE_EMAIL_MODAL, { sendCodeOnMount: false });
},
});
};
return (
<Stack
direction="row"
alignItems="center"
justifyContent="space-between"
spacing={2}
>
<Stack>
<GiveText variant="bodyS">Email</GiveText>
<Stack
direction={isMobileView ? "column" : "row"}
alignItems={isMobileView ? "flex-start" : "center"}
gap={1}
>
<GiveTruncateText lineClamp={1} variant="bodyS" color="secondary">
{email}
</GiveTruncateText>
<Stack direction="row" alignItems="center" gap="4px">
{icon}
<GiveText
variant="bodyS"
color={status === "verified" ? "success1" : "primary"}
>
{upperFirst(text)}
</GiveText>
</Stack>
</Stack>
</Stack>
<GiveLink
Icon={PencilSimpleIcon}
color="secondary"
disabled={disabled}
onClick={handleClick}
sx={{ alignItems: "center", textWrap: "nowrap" }}
link="#"
>
Change Email
</GiveLink>
</Stack>
);
};
export default Email;
|