инфо открывается при наведении
Some checks failed
Deploy / CreateImage (push) Failing after 43s
Deploy / DeployService (push) Has been skipped

This commit is contained in:
Nastya 2025-06-06 16:25:06 +03:00
parent 595f4b041b
commit 98bf92466b
4 changed files with 35 additions and 118 deletions

@ -1,4 +1,4 @@
import { Box, FormControl, FormLabel, FormGroup, FormControlLabel, Checkbox, Select, MenuItem, useTheme, Button, useMediaQuery, IconButton } from "@mui/material"; import { Box, FormControl, FormLabel, RadioGroup, FormControlLabel, Radio, Select, MenuItem, useTheme, Button, useMediaQuery, IconButton } from "@mui/material";
import { InfoPopover } from '@ui_kit/InfoPopover'; import { InfoPopover } from '@ui_kit/InfoPopover';
import CheckboxIcon from "@icons/Checkbox"; import CheckboxIcon from "@icons/Checkbox";
import { useState } from "react"; import { useState } from "react";
@ -15,7 +15,7 @@ interface GenderAndAgeSelectorProps {
export default function GenderAndAgeSelector({ handleAdd }: GenderAndAgeSelectorProps) { export default function GenderAndAgeSelector({ handleAdd }: GenderAndAgeSelectorProps) {
const theme = useTheme(); const theme = useTheme();
const [age, setAge] = useState<string>(''); const [age, setAge] = useState<string>('');
const [gender, setGender] = useState<string[]>([]); const [gender, setGender] = useState<string>('');
const [selectOpen, setSelectOpen] = useState<boolean>(false); const [selectOpen, setSelectOpen] = useState<boolean>(false);
const quiz = useCurrentQuiz(); const quiz = useCurrentQuiz();
const { enqueueSnackbar } = useSnackbar(); const { enqueueSnackbar } = useSnackbar();
@ -32,7 +32,7 @@ export default function GenderAndAgeSelector({ handleAdd }: GenderAndAgeSelector
const [result, error] = await auditoryAdd({ const [result, error] = await auditoryAdd({
quizId: quiz.backendId, quizId: quiz.backendId,
body: { body: {
sex: gender.includes("male"), sex: gender === "male",
age age
} }
}); });
@ -46,13 +46,13 @@ export default function GenderAndAgeSelector({ handleAdd }: GenderAndAgeSelector
handleAdd({ handleAdd({
id: result.ID, id: result.ID,
quiz_id: quiz.backendId, quiz_id: quiz.backendId,
sex: gender.includes("male"), sex: gender === "male",
age, age,
deleted: false, deleted: false,
}); });
enqueueSnackbar('Ссылка успешно добавлена', { variant: 'success' }); enqueueSnackbar('Ссылка успешно добавлена', { variant: 'success' });
// Очищаем форму // Очищаем форму
setGender([]); setGender('');
setAge(''); setAge('');
} }
} catch (error) { } catch (error) {
@ -79,9 +79,9 @@ export default function GenderAndAgeSelector({ handleAdd }: GenderAndAgeSelector
mr: '3px', mr: '3px',
}} }}
component="legend">Пол</FormLabel> component="legend">Пол</FormLabel>
<InfoPopover /> {/* <InfoPopover /> */}
</Box> </Box>
<FormGroup <RadioGroup
sx={{ sx={{
width: "155px", width: "155px",
justifyContent: "space-between", justifyContent: "space-between",
@ -89,6 +89,10 @@ export default function GenderAndAgeSelector({ handleAdd }: GenderAndAgeSelector
ml: "-9px" ml: "-9px"
}} }}
row row
aria-label="gender"
name="row-radio-buttons-group"
value={gender}
onChange={(e) => setGender(e.target.value)}
> >
<FormControlLabel <FormControlLabel
sx={{ sx={{
@ -115,20 +119,8 @@ export default function GenderAndAgeSelector({ handleAdd }: GenderAndAgeSelector
}, },
m: 0, m: 0,
}} }}
control={ value="male"
<Checkbox control={<Radio icon={<CheckboxIcon />} checkedIcon={<CheckboxIcon checked />} />}
checked={gender.includes('male')}
onChange={(e) => {
if (e.target.checked) {
setGender([...gender, 'male']);
} else {
setGender(gender.filter(g => g !== 'male'));
}
}}
icon={<CheckboxIcon />}
checkedIcon={<CheckboxIcon checked />}
/>
}
label="М" label="М"
/> />
<FormControlLabel <FormControlLabel
@ -155,23 +147,11 @@ export default function GenderAndAgeSelector({ handleAdd }: GenderAndAgeSelector
}, },
m: 0, m: 0,
}} }}
control={ value="female"
<Checkbox control={<Radio icon={<CheckboxIcon />} checkedIcon={<CheckboxIcon checked />} />}
checked={gender.includes('female')}
onChange={(e) => {
if (e.target.checked) {
setGender([...gender, 'female']);
} else {
setGender(gender.filter(g => g !== 'female'));
}
}}
icon={<CheckboxIcon />}
checkedIcon={<CheckboxIcon checked />}
/>
}
label="Ж" label="Ж"
/> />
</FormGroup> </RadioGroup>
</FormControl> </FormControl>
<FormControl sx={{ maxWidth: "420px", width: "100%", marginLeft: isMobile ? "0" : "120px", minWidth: "265px" }} variant="filled"> <FormControl sx={{ maxWidth: "420px", width: "100%", marginLeft: isMobile ? "0" : "120px", minWidth: "265px" }} variant="filled">
@ -189,7 +169,7 @@ export default function GenderAndAgeSelector({ handleAdd }: GenderAndAgeSelector
color: '#4D4D4D', color: '#4D4D4D',
}, },
}}>Возраст</FormLabel> }}>Возраст</FormLabel>
<InfoPopover /> {/* <InfoPopover /> */}
</Box> </Box>
<AgeInputWithSelect value={age} onChange={setAge} onErrorChange={setAgeError} /> <AgeInputWithSelect value={age} onChange={setAge} onErrorChange={setAgeError} />
</FormControl> </FormControl>
@ -198,7 +178,7 @@ export default function GenderAndAgeSelector({ handleAdd }: GenderAndAgeSelector
<Button <Button
onClick={addItem} onClick={addItem}
variant="contained" variant="contained"
disabled={gender.length === 0 || !age || ageError} disabled={!gender || !age || ageError}
sx={{ sx={{
bgcolor: theme.palette.brightPurple.main, bgcolor: theme.palette.brightPurple.main,
borderRadius: "8px", borderRadius: "8px",

@ -1,61 +0,0 @@
import React from 'react';
import { Box, Typography, useTheme } from '@mui/material';
import { useMediaQuery } from '@mui/material';
import MaleIcon from '@mui/icons-material/Male';
import FemaleIcon from '@mui/icons-material/Female';
import PeopleIcon from '@mui/icons-material/People';
interface GenderButtonProps {
selected: boolean;
onClick: () => void;
icon: 'male' | 'female' | 'both';
label: string;
}
export const GenderButton: React.FC<GenderButtonProps> = ({ selected, onClick, icon, label }) => {
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
const getIcon = () => {
switch (icon) {
case 'male':
return <MaleIcon sx={{ fontSize: isMobile ? '20px' : '24px' }} />;
case 'female':
return <FemaleIcon sx={{ fontSize: isMobile ? '20px' : '24px' }} />;
case 'both':
return <PeopleIcon sx={{ fontSize: isMobile ? '20px' : '24px' }} />;
default:
return null;
}
};
return (
<Box
onClick={onClick}
sx={{
display: 'flex',
alignItems: 'center',
gap: '8px',
padding: isMobile ? '8px 12px' : '10px 16px',
borderRadius: '8px',
cursor: 'pointer',
bgcolor: selected ? theme.palette.brightPurple.main : 'transparent',
border: `1px solid ${selected ? theme.palette.brightPurple.main : theme.palette.grey[300]}`,
'&:hover': {
bgcolor: selected ? theme.palette.brightPurple.main : theme.palette.grey[100],
},
}}
>
{getIcon()}
<Typography
sx={{
fontSize: isMobile ? '14px' : '16px',
fontWeight: 500,
color: selected ? theme.palette.common.white : theme.palette.text.primary,
}}
>
{label}
</Typography>
</Box>
);
};

@ -73,7 +73,7 @@ export default function PersonalizationAI() {
} }
} }
const handleAdd = (item:AuditoryItem) => { const handleAdd = (item: AuditoryItem) => {
setAuditory(old => ([...old, item])) setAuditory(old => ([...old, item]))
} }
@ -103,7 +103,7 @@ export default function PersonalizationAI() {
return ( return (
<> <>
<Container id="PersonalizationAI" maxWidth={false} sx={{ minHeight: "100%", p: "20px", height: " calc(100vh - 80px)", overflow: "auto", pt: "55px"}}> <Container id="PersonalizationAI" maxWidth={false} sx={{ minHeight: "100%", p: "20px", height: " calc(100vh - 80px)", overflow: "auto", pt: "55px" }}>
<Typography variant="h5" color={theme.palette.grey3.main} fontWeight={700} sx={{ fontSize: 24, letterSpacing: "-0.2px" }}> <Typography variant="h5" color={theme.palette.grey3.main} fontWeight={700} sx={{ fontSize: 24, letterSpacing: "-0.2px" }}>
Персонализация вопросов с помощью AI Персонализация вопросов с помощью AI
</Typography> </Typography>
@ -114,9 +114,7 @@ export default function PersonalizationAI() {
wordSpacing: "0.1px", wordSpacing: "0.1px",
lineHeight: "21.4px" lineHeight: "21.4px"
}}> }}>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Данный раздел позволяет вам создавать персонализированный опрос под каждую целевую аудиторию отдельно, наш AI перефразирует ваши вопросы согласно настройкам. Для этого нужно выбрать пол и возраст вашей аудитории и получите персональную ссылку с нужными настройками в списке ниже. Так же вы можете обогатить свою ссылку UTM метками </Typography>
</Typography>
{/* Первый белый блок */} {/* Первый белый блок */}
<Box sx={{ <Box sx={{
bgcolor: "#fff", bgcolor: "#fff",
@ -185,8 +183,8 @@ export default function PersonalizationAI() {
alignItems: "center" alignItems: "center"
}} }}
> >
<Typography sx={{ width: "100%" ,textAlign: "center", mb: "25px"}}>Уверены, что хотите удалить ссылку?</Typography> <Typography sx={{ width: "100%", textAlign: "center", mb: "25px" }}>Уверены, что хотите удалить ссылку?</Typography>
<Button sx={{mb: "20px"}} onClick={handleDelete}>Удалить</Button> <Button sx={{ mb: "20px" }} onClick={handleDelete}>Удалить</Button>
<Button variant="contained" onClick={() => setDeleteModal(0)} >Отмена</Button> <Button variant="contained" onClick={() => setDeleteModal(0)} >Отмена</Button>
</Box> </Box>
</Modal> </Modal>

@ -12,6 +12,7 @@ export default function TooltipClickInfo({ title }: { title: string }) {
const handleTooltipOpen = () => { const handleTooltipOpen = () => {
setOpen(true); setOpen(true);
}; };
return ( return (
<> <>
<ClickAwayListener onClickAway={handleTooltipClose}> <ClickAwayListener onClickAway={handleTooltipClose}>
@ -23,14 +24,13 @@ export default function TooltipClickInfo({ title }: { title: string }) {
placement="top" placement="top"
onClose={handleTooltipClose} onClose={handleTooltipClose}
open={open} open={open}
disableFocusListener title={title}
disableHoverListener onMouseEnter={handleTooltipOpen}
disableTouchListener onMouseLeave={handleTooltipClose}
sx={{ sx={{
fontSize: "12px", fontSize: "12px",
p:"10px" p:"10px"
}} }}
title={title}
> >
<IconButton onClick={handleTooltipOpen}> <IconButton onClick={handleTooltipOpen}>
<InfoIcon /> <InfoIcon />