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

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,
originalLogo: null,
background: {
type: null,
type: "image",
desktop: null,
originalDesktop: null,
mobile: null,

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

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