minor fix

This commit is contained in:
nflnkr 2023-12-12 22:04:36 +03:00
parent dfe85edc67
commit 60632625ba
7 changed files with 66 additions and 66 deletions

@ -18,74 +18,74 @@ import type {
type ButtonTypeQuestion = { type ButtonTypeQuestion = {
icon: JSX.Element; icon: JSX.Element;
title: string; title: string;
value: QuestionType; value: QuestionType;
}; };
const BUTTON_TYPE_SHORT_QUESTIONS: ButtonTypeQuestion[] = [ const BUTTON_TYPE_SHORT_QUESTIONS: ButtonTypeQuestion[] = [
{ {
icon: <Answer color="#9A9AAF" />, icon: <Answer color="#9A9AAF" />,
title: "Варианты ответов", title: "Варианты ответов",
value: "variant", value: "variant",
}, },
{ {
icon: <Input color="#9A9AAF" />, icon: <Input color="#9A9AAF" />,
title: "Своё поле для ввода", title: "Своё поле для ввода",
value: "text", value: "text",
}, },
{ {
icon: <DropDown color="#9A9AAF" />, icon: <DropDown color="#9A9AAF" />,
title: "Выпадающий список", title: "Выпадающий список",
value: "select", value: "select",
}, },
{ {
icon: <Date color="#9A9AAF" />, icon: <Date color="#9A9AAF" />,
title: "Дата", title: "Дата",
value: "date", value: "date",
}, },
{ {
icon: <Slider color="#9A9AAF" />, icon: <Slider color="#9A9AAF" />,
title: "Ползунок", title: "Ползунок",
value: "number", value: "number",
}, },
{ {
icon: <Download color="#9A9AAF" />, icon: <Download color="#9A9AAF" />,
title: "Загрузка файла", title: "Загрузка файла",
value: "file", value: "file",
}, },
]; ];
interface Props { interface Props {
question: UntypedQuizQuestion; question: UntypedQuizQuestion;
} }
export default function FormTypeQuestions({ question }: Props) { export default function FormTypeQuestions({ question }: Props) {
return ( return (
<Box> <Box>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
flexWrap: "wrap", flexWrap: "wrap",
gap: "20px", gap: "20px",
margin: "20px", margin: "20px",
}} }}
> >
{(true /* TODO только первый вопрос */ {(("page" in question) && question.page === 0
? BUTTON_TYPE_QUESTIONS ? BUTTON_TYPE_QUESTIONS
: BUTTON_TYPE_SHORT_QUESTIONS : BUTTON_TYPE_SHORT_QUESTIONS
).map(({ icon, title, value: questionType }) => ( ).map(({ icon, title, value: questionType }) => (
<QuestionsMiniButton <QuestionsMiniButton
key={title} key={title}
onClick={() => { onClick={() => {
createTypedQuestion(question.id, questionType); createTypedQuestion(question.id, questionType);
}} }}
icon={icon} icon={icon}
text={title} text={title}
/> />
))} ))}
</Box> </Box>
</Box> </Box>
); );
} }

@ -9,7 +9,7 @@ export default function ImageAndVideoButtons() {
return ( return (
<Box sx={{ display: "flex", alignItems: "center", gap: "12px", mt: "20px", mb: "20px" }}> <Box sx={{ display: "flex", alignItems: "center", gap: "12px", mt: "20px", mb: "20px" }}>
<AddImage onClick={undefined/* TODO () => openCropModal("", "") */} /> <AddImage onClick={undefined} />
<Typography <Typography
sx={{ sx={{
fontWeight: 400, fontWeight: 400,

@ -21,7 +21,7 @@ export default function FaviconDropZone({ imageUrl, onImageUploadClick, onDelete
const [isDropReady, setIsDropReady] = useState<boolean>(false); const [isDropReady, setIsDropReady] = useState<boolean>(false);
const [isImageUploadOpen, openImageUploadModal, closeImageUploadModal] = useDisclosure(); const [isImageUploadOpen, openImageUploadModal, closeImageUploadModal] = useDisclosure();
if (!quiz) return null; // TODO throw and catch with error boundary if (!quiz) return null;
async function handleImageUpload(file: File) { async function handleImageUpload(file: File) {
if (file.size > 5 * 2 ** 20) return enqueueSnackbar("Размер картинки слишком велик"); if (file.size > 5 * 2 ** 20) return enqueueSnackbar("Размер картинки слишком велик");

@ -63,7 +63,7 @@ export default function StartPageSettings() {
const [formState, setFormState] = useState<"design" | "content">("design"); const [formState, setFormState] = useState<"design" | "content">("design");
const [mobileVersion, setMobileVersion] = useState(false); const [mobileVersion, setMobileVersion] = useState(false);
if (!quiz) return null; // TODO throw and catch with error boundary if (!quiz) return null;
const MobileVersionHC = (bool: boolean) => { const MobileVersionHC = (bool: boolean) => {
setMobileVersion(bool); setMobileVersion(bool);

@ -44,7 +44,7 @@ export const DropZone = ({ text, sx, deleteIconSx, imageUrl, originalImageUrl, o
setCropModalImageBlob, setCropModalImageBlob,
} = useCropModalState(); } = useCropModalState();
if (!quiz) return null; // TODO throw and catch with error boundary if (!quiz) return null;
async function handleImageUpload(file: File) { async function handleImageUpload(file: File) {
if (file.size > 5 * 2 ** 20) return enqueueSnackbar("Размер картинки слишком велик"); if (file.size > 5 * 2 ** 20) return enqueueSnackbar("Размер картинки слишком велик");

@ -10,7 +10,7 @@ export default function StepOne() {
const quiz = useCurrentQuiz(); const quiz = useCurrentQuiz();
const config = quiz?.config; const config = quiz?.config;
if (!config) return null; // TODO throw and catch with error boundary if (!config) return null;
return ( return (
<Box <Box

@ -20,7 +20,7 @@ export default function Steptwo() {
const config = quiz?.config; const config = quiz?.config;
if (!config) return null; // TODO throw and catch with error boundary if (!config) return null;
return ( return (
<Box sx={{ mt: "60px" }}> <Box sx={{ mt: "60px" }}>