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 | 691x 691x 691x 691x 691x 691x 691x | import NiceModal from "@ebay/nice-modal-react";
import { Box, Stack } from "@mui/material";
import { useAppDispatch, useAppSelector } from "@redux/hooks";
import {
selectMasquerade,
setMasqueradeSkipModal,
} from "@redux/slices/enterprise/merchants";
import GiveCheckbox from "@shared/GiveCheckbox/GiveCheckbox";
import GiveText from "@shared/Text/GiveText";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import { GIVE_CONFIRMATION_POP_UP } from "modals/modal_names";
function ControlModeOptOut({
checked,
onToggle,
}: {
checked: boolean;
onToggle: () => void;
}) {
return (
<Stack direction="row" gap="12px" alignItems="center" flex={1}>
<GiveCheckbox size="medium" value={checked} onChange={onToggle} />
<GiveText variant="bodyS" color="black">
Do not show this again
</GiveText>
</Stack>
);
}
export default function useMasqueradeModal() {
const { isMobileView } = useCustomThemeV2();
const dispatch = useAppDispatch();
const { skipModal } = useAppSelector(selectMasquerade);
const toggleSkip = () => dispatch(setMasqueradeSkipModal(!skipModal));
const renderOptOut = (
<ControlModeOptOut checked={skipModal} onToggle={toggleSkip} />
);
const showModal = (merchantName?: string) => {
NiceModal.show(GIVE_CONFIRMATION_POP_UP, {
modalType: "control-mode",
title: "Control Mode",
description: (
<>
You are controlling{" "}
<GiveText variant="bodyS" color="primary" component="span">
{merchantName}.
</GiveText>{" "}
You can see all their content and perform actions on their behalf.
{isMobileView && <Box pt="20px">{renderOptOut}</Box>}
</>
),
hideCancel: !isMobileView,
leftActionComponent: !isMobileView ? renderOptOut : undefined,
});
};
return showModal;
}
|