костыльно выключена почта. Костыльно выключена на неё проверка

This commit is contained in:
Nastya 2024-10-24 16:46:05 +03:00
parent 1c909863ae
commit af79d4dae3
2 changed files with 19 additions and 2 deletions

@ -30,6 +30,10 @@ type Props = {
currentQuestion: AnyTypedQuizQuestion; currentQuestion: AnyTypedQuizQuestion;
onShowResult: () => void; onShowResult: () => void;
}; };
//Костыль для особого квиза. Для него не нужно показывать email адрес
const isDisableEmail = window.location.pathname.includes("/377c7570-1bee-4320-ac1e-d731b6223ce8");
console.log("isDisableEmail");
console.log(isDisableEmail);
export const ContactForm = ({ currentQuestion, onShowResult }: Props) => { export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
const theme = useTheme(); const theme = useTheme();
@ -115,7 +119,10 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
async function handleShowResultsClick() { async function handleShowResultsClick() {
const FC = settings.cfg.formContact.fields; const FC = settings.cfg.formContact.fields;
if (FC["email"].used !== EMAIL_REGEXP.test(email)) {
console.log("некорректная");
console.log(!isDisableEmail && FC["email"].used !== EMAIL_REGEXP.test(email));
if (!isDisableEmail && FC["email"].used !== EMAIL_REGEXP.test(email)) {
return enqueueSnackbar("введена некорректная почта"); return enqueueSnackbar("введена некорректная почта");
} }
@ -251,6 +258,9 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
setText={setText} setText={setText}
adress={adress} adress={adress}
setAdress={setAdress} setAdress={setAdress}
crutch={{
disableEmail: isDisableEmail,
}}
/> />
</Box> </Box>
<Box <Box

@ -19,6 +19,9 @@ type InputsProps = {
setText: Dispatch<SetStateAction<string>>; setText: Dispatch<SetStateAction<string>>;
adress: string; adress: string;
setAdress: Dispatch<SetStateAction<string>>; setAdress: Dispatch<SetStateAction<string>>;
crutch: {
disableEmail: boolean;
};
}; };
export const Inputs = ({ export const Inputs = ({
@ -32,10 +35,14 @@ export const Inputs = ({
setText, setText,
adress, adress,
setAdress, setAdress,
crutch,
}: InputsProps) => { }: InputsProps) => {
const { settings } = useQuizSettings(); const { settings } = useQuizSettings();
const FC = settings.cfg.formContact.fields; const FC = settings.cfg.formContact.fields;
console.log("crutch.disableEmail");
console.log(crutch.disableEmail);
if (!FC) return null; if (!FC) return null;
const Name = ( const Name = (
<CustomInput <CustomInput
@ -95,7 +102,7 @@ export const Inputs = ({
return ( return (
<> <>
{FC["name"].used ? Name : <></>} {FC["name"].used ? Name : <></>}
{FC["email"].used ? Email : <></>} {FC["email"].used && !crutch.disableEmail ? Email : <></>}
{FC["phone"].used ? Phone : <></>} {FC["phone"].used ? Phone : <></>}
{FC["text"].used ? Text : <></>} {FC["text"].used ? Text : <></>}
{FC["address"].used ? Adress : <></>} {FC["address"].used ? Adress : <></>}