фон стартовой страницы по-умолчанию изображение

This commit is contained in:
Tamara 2024-03-28 00:46:12 +03:00
parent 0831da8403
commit af39e627da
3 changed files with 34 additions and 23 deletions

@ -164,7 +164,7 @@ export const defaultQuizConfig: QuizConfig = {
logo: null, logo: null,
originalLogo: null, originalLogo: null,
background: { background: {
type: null, type: "image",
desktop: null, desktop: null,
originalDesktop: null, originalDesktop: null,
mobile: null, mobile: null,

@ -80,18 +80,19 @@ export default function CsNodeButtons({ csElements, cyRef }: Props) {
cleardragQuestionContentId(); cleardragQuestionContentId();
}} }}
/>, />,
(!csElement.data.isRoot && !isQuestionProhibited(csElement.data.qtype)) && ( !csElement.data.isRoot &&
<CsSettingsButton !isQuestionProhibited(csElement.data.qtype) && (
key={`settings-${csElement.data.id}`} <CsSettingsButton
ref={(r) => { key={`settings-${csElement.data.id}`}
const buttonData = buttonRefsById.current[csElement.data.id]; ref={(r) => {
if (buttonData) buttonData.settings = r; const buttonData = buttonRefsById.current[csElement.data.id];
}} if (buttonData) buttonData.settings = r;
onClick={() => { }}
updateOpenedModalSettingsId(csElement.data.id,); onClick={() => {
}} updateOpenedModalSettingsId(csElement.data.id);
/> }}
), />
),
//оболочка узла //оболочка узла
<CsSelectButton <CsSelectButton
key={`select-${csElement.data.id}`} key={`select-${csElement.data.id}`}
@ -101,8 +102,13 @@ export default function CsNodeButtons({ csElements, cyRef }: Props) {
}} }}
onClick={() => { onClick={() => {
setModalQuestionParentContentId(csElement.data.id); setModalQuestionParentContentId(csElement.data.id);
console.log("csElement ", csElement) console.log("csElement ", csElement);
setOpenedModalQuestions(!(isQuestionProhibited(csElement.data.type) && csElement.data.children > 0)); setOpenedModalQuestions(
!(
isQuestionProhibited(csElement.data.type) &&
csElement.data.children > 0
),
);
}} }}
/>, />,
])} ])}

@ -73,9 +73,12 @@ export const storeToNodes = (questions: AnyTypedQuizQuestion[]) => {
isRoot: question.content.rule.parentId === "root", isRoot: question.content.rule.parentId === "root",
id: question.content.id, id: question.content.id,
label, label,
qtype: question.content.rule.parentId === "root" ? "root" : parentQuestion.type, qtype:
question.content.rule.parentId === "root"
? "root"
: parentQuestion.type,
type: question.type, type: question.type,
children: question.content.rule.children.length children: question.content.rule.children.length,
}, },
classes: "multiline-auto", classes: "multiline-auto",
}); });
@ -344,14 +347,15 @@ export const addNode = ({
const parentQuestion = { const parentQuestion = {
...getQuestionByContentId(parentNodeContentId), ...getQuestionByContentId(parentNodeContentId),
} as AnyTypedQuizQuestion; } as AnyTypedQuizQuestion;
if ((parentQuestion.type !== undefined && isQuestionProhibited(parentQuestion.type)) && if (
parentQuestion.type !== undefined &&
isQuestionProhibited(parentQuestion.type) &&
parentQuestion.content.rule.children.length > 0 parentQuestion.content.rule.children.length > 0
) { ) {
enqueueSnackbar("у вопроса этого типа может быть только 1 потомок"); enqueueSnackbar("у вопроса этого типа может быть только 1 потомок");
return; return;
} }
//если есть инфо о выбранном вопросе из модалки - берём родителя из инфо модалки. Иначе из значения дропа //если есть инфо о выбранном вопросе из модалки - берём родителя из инфо модалки. Иначе из значения дропа
const targetQuestion = { const targetQuestion = {
...getQuestionByContentId( ...getQuestionByContentId(
@ -363,13 +367,14 @@ export const addNode = ({
clearDataAfterAddNode({ parentNodeContentId, targetQuestion }); clearDataAfterAddNode({ parentNodeContentId, targetQuestion });
createResult(useQuizStore.getState().editQuizId, targetQuestion.content.id); createResult(useQuizStore.getState().editQuizId, targetQuestion.content.id);
} else { } else {
enqueueSnackbar("Добавляемый вопрос не найден. Перетащите вопрос из списка"); enqueueSnackbar(
"Добавляемый вопрос не найден. Перетащите вопрос из списка",
);
} }
}; };
export const isQuestionProhibited = (parentQType: string) => ( export const isQuestionProhibited = (parentQType: string) =>
parentQType === "text" || parentQType === "text" ||
parentQType === "date" || parentQType === "date" ||
parentQType === "number" || parentQType === "number" ||
parentQType === "page" parentQType === "page";
)