fixes
Some checks are pending
Deploy Admin Panel / Deploy Admin Panel (push) Waiting to run
Deploy Admin Panel / Admin Panel Verification (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
Some checks are pending
Deploy Admin Panel / Deploy Admin Panel (push) Waiting to run
Deploy Admin Panel / Admin Panel Verification (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
This commit is contained in:
parent
162cb84244
commit
0b14a7458e
2 changed files with 20 additions and 6 deletions
|
|
@ -32,6 +32,18 @@ export function SimpleQuestionForm({
|
|||
const [buttons, setButtons] = useState<TestButton[]>(question.options || [])
|
||||
const [answer, setAnswer] = useState(question.answer || '')
|
||||
|
||||
useEffect(() => {
|
||||
onChange({
|
||||
questionType: QuestionType.SIMPLE,
|
||||
word,
|
||||
text: text || undefined,
|
||||
image: image || undefined,
|
||||
audio: audio || undefined,
|
||||
options: buttons,
|
||||
answer,
|
||||
})
|
||||
}, [word, text, image, audio, buttons, answer, onChange])
|
||||
|
||||
const addButton = () => {
|
||||
const newButton: TestButton = {
|
||||
id: `btn_${Date.now()}`,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
export const enum QuestionType {
|
||||
SIMPLE = 'simple',
|
||||
INPUT_BUTTONS = 'input_buttons',
|
||||
}
|
||||
export const QuestionType = {
|
||||
SIMPLE: 'simple',
|
||||
INPUT_BUTTONS: 'input_buttons',
|
||||
} as const
|
||||
|
||||
export type QuestionType = typeof QuestionType[keyof typeof QuestionType]
|
||||
|
||||
// Соответствует полю options в БД
|
||||
export interface TestButton {
|
||||
|
|
@ -28,11 +30,11 @@ export interface BaseQuestion {
|
|||
}
|
||||
|
||||
export interface SimpleQuestion extends BaseQuestion {
|
||||
questionType: QuestionType.SIMPLE
|
||||
questionType: 'simple'
|
||||
}
|
||||
|
||||
export interface InputButtonsQuestion extends BaseQuestion {
|
||||
questionType: QuestionType.INPUT_BUTTONS
|
||||
questionType: 'input_buttons'
|
||||
template: string // Хранится в uiData
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue