@tinyweb_dev/oe-exam-sdk 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/exams/ExamCreator.js +1 -16
- package/dist/components/exams/take/ExamTakingPageContainer.js +0 -12
- package/dist/components/exams/take/components/QuestionRenderer.js +2 -15
- package/dist/components/exams/take/components/question-renderers/index.d.ts +0 -3
- package/dist/components/exams/take/components/question-renderers/index.js +0 -3
- package/dist/components/exams/take/components/speaking/renderers/SpeakingQuestionRenderer.js +0 -4
- package/dist/components/exams/take/types/speaking.types.d.ts +0 -31
- package/dist/components/exams/take/types.d.ts +0 -65
- package/dist/components/exams/take/utils/answer-transformers.js +6 -60
- package/dist/components/exams/take/utils/question-transformers.d.ts +2 -15
- package/dist/components/exams/take/utils/question-transformers.js +0 -143
- package/dist/components/questions/_shared/components/compact/CompactCreatorHeader.d.ts +23 -0
- package/dist/components/questions/_shared/components/compact/CompactCreatorHeader.js +9 -0
- package/dist/components/questions/_shared/components/compact/CompactExampleToggle.d.ts +6 -0
- package/dist/components/questions/_shared/components/compact/CompactExampleToggle.js +8 -0
- package/dist/components/questions/_shared/components/compact/CompactExplanationToggle.d.ts +7 -0
- package/dist/components/questions/_shared/components/compact/CompactExplanationToggle.js +14 -0
- package/dist/components/questions/_shared/components/compact/CompactFieldCard.d.ts +9 -0
- package/dist/components/questions/_shared/components/compact/CompactFieldCard.js +7 -0
- package/dist/components/questions/_shared/components/compact/CompactPreviewBanner.d.ts +7 -0
- package/dist/components/questions/_shared/components/compact/CompactPreviewBanner.js +7 -0
- package/dist/components/questions/_shared/components/compact/CompactPreviewButton.d.ts +6 -0
- package/dist/components/questions/_shared/components/compact/CompactPreviewButton.js +7 -0
- package/dist/components/questions/_shared/components/compact/index.d.ts +6 -0
- package/dist/components/questions/_shared/components/compact/index.js +6 -0
- package/dist/components/questions/_shared/config/question-types.config.js +0 -24
- package/dist/components/questions/_shared/hooks/useQuestionInitialization.js +0 -9
- package/dist/components/questions/_shared/types/index.d.ts +0 -1
- package/dist/components/questions/_shared/types/index.js +0 -1
- package/dist/components/questions/_shared/types/look-and-choose-answer.type.d.ts +0 -13
- package/dist/components/questions/_shared/utils/answer-builder.js +0 -11
- package/dist/components/questions/components/ColorRegionCreator.js +66 -63
- package/dist/components/questions/components/QuestionSearchDropdown.js +0 -8
- package/dist/components/questions/components/QuestionTypeSelector.js +0 -2
- package/dist/components/questions/components/index.d.ts +1 -0
- package/dist/components/questions/components/index.js +1 -0
- package/dist/components/questions/creator/question-type-registry.js +0 -8
- package/dist/components/questions/groups/ArticlesGroupCard.js +2 -2
- package/dist/components/questions/groups/BasicQuestionGroupCard.js +1 -1
- package/dist/components/questions/groups/DocumentGroupCard.js +1 -1
- package/dist/components/questions/groups/ImageLabelGroupCard.js +1 -1
- package/dist/components/questions/groups/MatchAnswerGroupCard.js +2 -2
- package/dist/components/questions/question-bank/QuestionEditorRenderer.d.ts +0 -3
- package/dist/components/questions/question-bank/QuestionEditorRenderer.js +1 -10
- package/dist/components/questions/question-bank/editor-adapters/choice-adapters.d.ts +0 -2
- package/dist/components/questions/question-bank/editor-adapters/choice-adapters.js +0 -41
- package/dist/components/questions/question-bank/editor-adapters/index.d.ts +2 -2
- package/dist/components/questions/question-bank/editor-adapters/index.js +2 -2
- package/dist/components/questions/question-bank/editor-adapters/media-adapters.d.ts +0 -1
- package/dist/components/questions/question-bank/editor-adapters/media-adapters.js +0 -28
- package/dist/components/questions/question-bank/question-bank-picker.utils.js +0 -7
- package/dist/components/questions/types/answer-the-question/AnswerTheQuestionClient.js +16 -16
- package/dist/components/questions/types/answer-the-question/AnswerTheQuestionCreator.js +36 -30
- package/dist/components/questions/types/answer-the-question-group/AnswerTheQuestionGroupClient.js +1 -1
- package/dist/components/questions/types/answer-the-question-group/AnswerTheQuestionGroupCreator.js +7 -6
- package/dist/components/questions/types/arrange-letters-into-words/ArrangeLettersIntoWordsClient.js +2 -2
- package/dist/components/questions/types/arrange-letters-into-words/ArrangeLettersIntoWordsCreator.js +11 -7
- package/dist/components/questions/types/choose-correct-adjective/ChooseCorrectAdjectiveClient.js +1 -1
- package/dist/components/questions/types/choose-correct-adjective/ChooseCorrectAdjectiveCreator.js +11 -5
- package/dist/components/questions/types/choose-the-correct-answer/ChooseTheCorrectAnswerClient.js +5 -5
- package/dist/components/questions/types/choose-the-correct-answer/ChooseTheCorrectAnswerCreator.js +34 -28
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseAnswerGroupImageUpload.js +2 -2
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupClient.js +1 -1
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupCreator.js +44 -28
- package/dist/components/questions/types/choose-then-answer-group/ChooseThenAnswerGroupClient.js +7 -7
- package/dist/components/questions/types/choose-then-answer-group/ChooseThenAnswerGroupCreator.js +8 -5
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupClient.js +2 -2
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupCreator.js +20 -16
- package/dist/components/questions/types/crossword-puzzle/CrosswordPuzzleClient.js +1 -1
- package/dist/components/questions/types/crossword-puzzle/CrosswordPuzzleCreator.js +66 -29
- package/dist/components/questions/types/fill-in-blank/FillInBlankClient.js +5 -5
- package/dist/components/questions/types/fill-in-blank/FillInBlankCreator.js +45 -37
- package/dist/components/questions/types/fill-in-blank-group/FillInBlankGroupCreator.js +24 -20
- package/dist/components/questions/types/fill-missing-words-in-grid/FillMissingWordsInGridClient.js +2 -2
- package/dist/components/questions/types/fill-missing-words-in-grid/FillMissingWordsInGridCreator.js +68 -65
- package/dist/components/questions/types/find-words-in-matrix/FindWordsInMatrixClient.js +1 -1
- package/dist/components/questions/types/find-words-in-matrix/FindWordsInMatrixCreator.js +45 -5
- package/dist/components/questions/types/label-the-picture/LabelThePictureClient.js +2 -2
- package/dist/components/questions/types/label-the-picture/LabelThePictureCreator.js +18 -14
- package/dist/components/questions/types/listen-and-choose-from-answer-group/ListenAndChooseFromAnswerGroupClient.js +2 -2
- package/dist/components/questions/types/listen-and-choose-from-answer-group/ListenAndChooseFromAnswerGroupCreator.js +30 -30
- package/dist/components/questions/types/listen-and-choose-objects-in-scene/ListenAndChooseObjectsInSceneClient.js +2 -2
- package/dist/components/questions/types/listen-and-choose-objects-in-scene/ListenAndChooseObjectsInSceneCreator.js +24 -31
- package/dist/components/questions/types/listen-and-drag-objects-into-scene/ListenAndDragObjectsIntoSceneClient.js +2 -2
- package/dist/components/questions/types/listen-and-drag-objects-into-scene/ListenAndDragObjectsIntoSceneCreator.js +29 -32
- package/dist/components/questions/types/listen-and-speak-answer/ListenAndSpeakAnswerClient.js +1 -1
- package/dist/components/questions/types/listen-and-speak-answer/ListenAndSpeakAnswerCreator.js +27 -29
- package/dist/components/questions/types/listen-and-speak-compare-images/ListenAndSpeakCompareImagesClient.js +1 -1
- package/dist/components/questions/types/listen-and-speak-compare-images/ListenAndSpeakCompareImagesCreator.js +11 -15
- package/dist/components/questions/types/listen-and-speak-image-group/ListenAndSpeakImageGroupClient.js +1 -1
- package/dist/components/questions/types/listen-and-speak-image-group/ListenAndSpeakImageGroupCreator.js +22 -24
- package/dist/components/questions/types/listen-and-speak-info-exchange/ListenAndSpeakInfoExchangeClient.js +1 -1
- package/dist/components/questions/types/listen-and-speak-info-exchange/ListenAndSpeakInfoExchangeCreator.js +17 -24
- package/dist/components/questions/types/listen-and-speak-odd-one-out/ListenAndSpeakOddOneOutClient.js +1 -1
- package/dist/components/questions/types/listen-and-speak-odd-one-out/ListenAndSpeakOddOneOutCreator.js +31 -31
- package/dist/components/questions/types/listen-and-speak-question-list/ListenAndSpeakQuestionListClient.js +1 -1
- package/dist/components/questions/types/listen-and-speak-question-list/ListenAndSpeakQuestionListCreator.js +11 -15
- package/dist/components/questions/types/listen-and-speak-with-story-images/ListenAndSpeakWithStoryImagesClient.js +1 -1
- package/dist/components/questions/types/listen-and-speak-with-story-images/ListenAndSpeakWithStoryImagesCreator.js +14 -15
- package/dist/components/questions/types/match-by-writing-answer/MatchByWritingAnswerClient.js +2 -2
- package/dist/components/questions/types/match-by-writing-answer/MatchByWritingAnswerCreator.js +27 -25
- package/dist/components/questions/types/match-columns-to-make-sentences/MatchColumnsToMakeSentencesClient.js +12 -12
- package/dist/components/questions/types/match-columns-to-make-sentences/MatchColumnsToMakeSentencesCreator.js +8 -5
- package/dist/components/questions/types/match-word-to-picture/MatchWordToPictureClient.js +8 -8
- package/dist/components/questions/types/match-word-to-picture/MatchWordToPictureCreator.js +25 -20
- package/dist/components/questions/types/match-word-to-picture-group/MatchWordToPictureGroupClient.js +1 -1
- package/dist/components/questions/types/match-word-to-picture-group/MatchWordToPictureGroupCreator.js +13 -10
- package/dist/components/questions/types/matching-with-lines-group/MatchingWithLinesGroupCreator.js +8 -5
- package/dist/components/questions/types/read-displayed-content/ReadDisplayedContentCreator.js +7 -11
- package/dist/components/questions/types/read-passage-and-answer-questions/ReadPassageAndAnswerQuestionsClient.js +1 -1
- package/dist/components/questions/types/read-passage-and-answer-questions/ReadPassageAndAnswerQuestionsCreator.js +15 -12
- package/dist/components/questions/types/sort-words-into-categories/SortWordsIntoCategoriesClient.js +1 -1
- package/dist/components/questions/types/sort-words-into-categories/SortWordsIntoCategoriesCreator.js +5 -5
- package/dist/components/questions/types/speaking-conversation/SpeakingConversationCreator.js +35 -39
- package/dist/components/questions/types/speaking-conversation/SpeakingConversationPreviewClient.js +2 -2
- package/dist/components/questions/types/speaking-cue-card/SpeakingCueCardClient.js +1 -1
- package/dist/components/questions/types/speaking-cue-card/SpeakingCueCardCreator.js +7 -8
- package/dist/components/questions/types/speaking-describe-image/SpeakingDescribeImageClient.js +1 -1
- package/dist/components/questions/types/speaking-describe-image/SpeakingDescribeImageCreator.js +30 -23
- package/dist/components/questions/types/spontaneous-qa/SpontaneousQAClient.js +1 -1
- package/dist/components/questions/types/spontaneous-qa/SpontaneousQACreator.js +26 -19
- package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupClient.js +1 -1
- package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupCreator.js +13 -11
- package/dist/components/questions/types/true-false/TrueFalseClient.js +2 -2
- package/dist/components/questions/types/true-false/TrueFalseCreator.js +35 -29
- package/dist/components/questions/types/true-false-correct-group/TrueFalseCorrectGroupClient.js +1 -1
- package/dist/components/questions/types/true-false-correct-group/TrueFalseCorrectGroupCreator.js +11 -7
- package/dist/components/questions/types/true-false-group/TrueFalseGroupClient.js +1 -1
- package/dist/components/questions/types/true-false-group/TrueFalseGroupCreator.js +11 -7
- package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphClient.js +2 -2
- package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphCreator.js +21 -56
- package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormClient.js +1 -1
- package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormCreator.js +30 -24
- package/dist/components/questions/types/word-order-and-match-group/WordOrderAndMatchGroupClient.js +3 -3
- package/dist/components/questions/types/word-order-and-match-group/WordOrderAndMatchGroupCreator.js +12 -14
- package/dist/components/questions/types/word-ordering/WordOrderingClient.js +1 -1
- package/dist/components/questions/types/word-ordering/WordOrderingCreator.js +27 -18
- package/dist/components/questions/types/word-ordering-group/WordOrderingGroupClient.js +7 -7
- package/dist/components/questions/types/word-ordering-group/WordOrderingGroupCreator.js +16 -13
- package/dist/components/questions/types/write-a-short-letter/WriteAShortLetterClient.js +2 -2
- package/dist/components/questions/types/write-a-short-letter/WriteAShortLetterCreator.js +34 -28
- package/dist/components/questions/types/write-correct-verb-form/WriteCorrectVerbFormClient.js +2 -2
- package/dist/components/questions/types/write-correct-verb-form/WriteCorrectVerbFormCreator.js +22 -22
- package/dist/components/questions/types/write-sentences/WriteSentencesCreator.js +21 -18
- package/dist/components/questions/types/write-short-paragraph/WriteShortParagraphClient.js +1 -1
- package/dist/components/questions/types/write-short-paragraph/WriteShortParagraphCreator.js +7 -4
- package/dist/components/questions/viewer/QuestionViewer.js +0 -98
- package/dist/components/results/renderers/review-question-body-movers.js +2 -26
- package/dist/components/results/review-data.js +0 -4
- package/dist/components/ui/points-input.d.ts +1 -0
- package/dist/components/ui/points-input.js +12 -2
- package/dist/shared/constants/question-skills.js +0 -11
- package/dist/shared/lib/i18n/messages/en/admin.d.ts +0 -3
- package/dist/shared/lib/i18n/messages/en/admin.js +0 -3
- package/dist/shared/lib/i18n/messages/en.d.ts +0 -3
- package/dist/shared/lib/i18n/messages/vi/admin.d.ts +0 -3
- package/dist/shared/lib/i18n/messages/vi/admin.js +0 -3
- package/dist/shared/lib/i18n/messages/vi.d.ts +0 -3
- package/dist/shared/lib/utils/question-reverse-transform.js +0 -19
- package/dist/shared/lib/utils/question-transform-types.d.ts +1 -23
- package/dist/shared/lib/utils/question-transform-validation.js +0 -40
- package/dist/shared/lib/utils/question-transform.js +0 -9
- package/dist/shared/types/common.types.d.ts +1 -1
- package/dist/shared/types/entities/question.types.d.ts +1 -11
- package/dist/shared/types/questions/index.d.ts +0 -3
- package/dist/shared/types/questions/index.js +0 -6
- package/package.json +1 -1
- package/dist/components/exams/take/components/question-renderers/MoversFillWordHintRenderer.d.ts +0 -2
- package/dist/components/exams/take/components/question-renderers/MoversFillWordHintRenderer.js +0 -131
- package/dist/components/exams/take/components/question-renderers/MoversPictureChooseRenderer.d.ts +0 -2
- package/dist/components/exams/take/components/question-renderers/MoversPictureChooseRenderer.js +0 -76
- package/dist/components/exams/take/components/question-renderers/MoversPictureFillBlankChooseRenderer.d.ts +0 -2
- package/dist/components/exams/take/components/question-renderers/MoversPictureFillBlankChooseRenderer.js +0 -68
- package/dist/components/exams/take/components/speaking/renderers/SpeakingGNInterviewRenderer.d.ts +0 -16
- package/dist/components/exams/take/components/speaking/renderers/SpeakingGNInterviewRenderer.js +0 -212
- package/dist/components/questions/_shared/types/gn-speaking-interview.type.d.ts +0 -32
- package/dist/components/questions/_shared/types/gn-speaking-interview.type.js +0 -1
- package/dist/components/questions/_shared/types/look-picture-fill-word-hint.type.d.ts +0 -47
- package/dist/components/questions/_shared/types/look-picture-fill-word-hint.type.js +0 -1
- package/dist/components/questions/types/gn-speaking-interview/GNSpeakingInterviewCreator.d.ts +0 -2
- package/dist/components/questions/types/gn-speaking-interview/GNSpeakingInterviewCreator.js +0 -262
- package/dist/components/questions/types/gn-speaking-interview/register.d.ts +0 -2
- package/dist/components/questions/types/gn-speaking-interview/register.js +0 -121
- package/dist/components/questions/types/gn-speaking-interview/transform.d.ts +0 -2
- package/dist/components/questions/types/gn-speaking-interview/transform.js +0 -48
- package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerClient.d.ts +0 -20
- package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerClient.js +0 -72
- package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerCreator.d.ts +0 -15
- package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerCreator.js +0 -230
- package/dist/components/questions/types/look-picture-choose-correct-answer/index.d.ts +0 -1
- package/dist/components/questions/types/look-picture-choose-correct-answer/index.js +0 -1
- package/dist/components/questions/types/look-picture-choose-correct-answer/register.d.ts +0 -2
- package/dist/components/questions/types/look-picture-choose-correct-answer/register.js +0 -66
- package/dist/components/questions/types/look-picture-choose-correct-answer/transform.d.ts +0 -2
- package/dist/components/questions/types/look-picture-choose-correct-answer/transform.js +0 -42
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerClient.d.ts +0 -6
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerClient.js +0 -96
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerCreator.d.ts +0 -15
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerCreator.js +0 -238
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/index.d.ts +0 -2
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/index.js +0 -2
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/register.d.ts +0 -2
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/register.js +0 -76
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/transform.d.ts +0 -2
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/transform.js +0 -19
- package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintClient.d.ts +0 -7
- package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintClient.js +0 -134
- package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintCreator.d.ts +0 -3
- package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintCreator.js +0 -617
- package/dist/components/questions/types/look-picture-fill-word-hint/index.d.ts +0 -2
- package/dist/components/questions/types/look-picture-fill-word-hint/index.js +0 -2
- package/dist/components/questions/types/look-picture-fill-word-hint/register.d.ts +0 -2
- package/dist/components/questions/types/look-picture-fill-word-hint/register.js +0 -82
- package/dist/components/questions/types/look-picture-fill-word-hint/transform.d.ts +0 -2
- package/dist/components/questions/types/look-picture-fill-word-hint/transform.js +0 -29
- package/dist/shared/lib/validation/look-picture-choose-correct-answer.validation.d.ts +0 -9
- package/dist/shared/lib/validation/look-picture-choose-correct-answer.validation.js +0 -12
- package/dist/shared/lib/validation/look-picture-fill-blank-choose-answer.validation.d.ts +0 -17
- package/dist/shared/lib/validation/look-picture-fill-blank-choose-answer.validation.js +0 -47
- package/dist/shared/types/questions/look-picture-choose-correct-answer.d.ts +0 -38
- package/dist/shared/types/questions/look-picture-choose-correct-answer.js +0 -5
- package/dist/shared/types/questions/look-picture-fill-blank-choose-answer.d.ts +0 -63
- package/dist/shared/types/questions/look-picture-fill-blank-choose-answer.js +0 -9
- package/dist/shared/types/questions/look-picture-fill-word-hint.d.ts +0 -57
- package/dist/shared/types/questions/look-picture-fill-word-hint.js +0 -7
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { GNSpeakingInterviewCreator } from './GNSpeakingInterviewCreator';
|
|
2
|
-
export const gnSpeakingInterviewRegistration = {
|
|
3
|
-
component: GNSpeakingInterviewCreator,
|
|
4
|
-
transformInitialData: (initialData) => {
|
|
5
|
-
const content = initialData?.content;
|
|
6
|
-
const answer = initialData?.answer || initialData?.correctAnswer || initialData?.correct_answer;
|
|
7
|
-
const points = initialData?.total_points !== undefined && initialData?.total_points !== null
|
|
8
|
-
? parseFloat(initialData.total_points)
|
|
9
|
-
: (initialData?.points ?? content?.points ?? answer?.points ?? 1);
|
|
10
|
-
const explanation = initialData?.explanation || content?.explanation || answer?.explanation || '';
|
|
11
|
-
// Normalize expected answers
|
|
12
|
-
const normalizeSampleAnswers = () => {
|
|
13
|
-
const newArr = answer?.expectedAnswers;
|
|
14
|
-
if (Array.isArray(newArr) && newArr.length > 0)
|
|
15
|
-
return newArr;
|
|
16
|
-
const arr = answer?.sampleAnswers;
|
|
17
|
-
if (Array.isArray(arr) && arr.length > 0)
|
|
18
|
-
return arr;
|
|
19
|
-
const single = answer?.sampleAnswer;
|
|
20
|
-
if (single)
|
|
21
|
-
return [single];
|
|
22
|
-
return [''];
|
|
23
|
-
};
|
|
24
|
-
if (content && typeof content === 'object' && content.targetCandidate !== undefined) {
|
|
25
|
-
return {
|
|
26
|
-
inputType: content.inputType || 'TEXT',
|
|
27
|
-
audioUrl: content.audioUrl || '',
|
|
28
|
-
imageUrl: content.imageUrl || '',
|
|
29
|
-
questionText: content.questionText || '',
|
|
30
|
-
targetCandidate: content.targetCandidate || 'REAL',
|
|
31
|
-
virtualAnswerText: content.virtualAnswer?.answerText || '',
|
|
32
|
-
virtualAnswerAudioUrl: content.virtualAnswer?.audioUrl || '',
|
|
33
|
-
isExtendedResponse: content.isExtendedResponse || false,
|
|
34
|
-
sampleAnswers: normalizeSampleAnswers(),
|
|
35
|
-
explanation,
|
|
36
|
-
points,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
inputType: answer?.inputType || content?.inputType || 'TEXT',
|
|
41
|
-
audioUrl: answer?.audioUrl || content?.audioUrl || '',
|
|
42
|
-
imageUrl: answer?.imageUrl || content?.imageUrl || '',
|
|
43
|
-
questionText: answer?.questionText || content?.questionText || '',
|
|
44
|
-
targetCandidate: answer?.targetCandidate || content?.targetCandidate || 'REAL',
|
|
45
|
-
virtualAnswerText: answer?.virtualAnswerText || content?.virtualAnswer?.answerText || '',
|
|
46
|
-
virtualAnswerAudioUrl: answer?.virtualAnswerAudioUrl || content?.virtualAnswer?.audioUrl || '',
|
|
47
|
-
isExtendedResponse: answer?.isExtendedResponse || content?.isExtendedResponse || false,
|
|
48
|
-
sampleAnswers: normalizeSampleAnswers(),
|
|
49
|
-
explanation,
|
|
50
|
-
points,
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
getExtraProps: (ctx) => ({
|
|
54
|
-
onUnsavedChangesChange: ctx.onUnsavedChangesChange,
|
|
55
|
-
validationRef: ctx.validationRef,
|
|
56
|
-
}),
|
|
57
|
-
wrapOnSave: (data, ctx) => {
|
|
58
|
-
const expectedAnswers = (data.sampleAnswers || []).filter((s) => s && s.trim() !== '');
|
|
59
|
-
const isVirtual = data.targetCandidate === 'VIRTUAL'; // VIRTUAL = virtual by default
|
|
60
|
-
return {
|
|
61
|
-
type: ctx.questionType,
|
|
62
|
-
content: {
|
|
63
|
-
...(typeof ctx.state.content === 'object' && ctx.state.content !== null
|
|
64
|
-
? ctx.state.content
|
|
65
|
-
: {}),
|
|
66
|
-
inputType: data.inputType,
|
|
67
|
-
audioUrl: data.audioUrl || '',
|
|
68
|
-
imageUrl: data.imageUrl || '',
|
|
69
|
-
questionText: data.inputType === 'TEXT' ? data.questionText : undefined,
|
|
70
|
-
targetCandidate: data.targetCandidate || 'REAL',
|
|
71
|
-
virtualAnswer: isVirtual
|
|
72
|
-
? {
|
|
73
|
-
answerText: data.virtualAnswerText || '',
|
|
74
|
-
audioUrl: data.virtualAnswerAudioUrl || '',
|
|
75
|
-
}
|
|
76
|
-
: undefined,
|
|
77
|
-
isExtendedResponse: data.isExtendedResponse || false,
|
|
78
|
-
},
|
|
79
|
-
points: isVirtual ? 0 : (data?.points ?? ctx.state.points ?? 1),
|
|
80
|
-
level: ctx.state.level,
|
|
81
|
-
difficulty: ctx.state.difficulty,
|
|
82
|
-
skill: ctx.state.skill,
|
|
83
|
-
answer: {
|
|
84
|
-
expectedAnswers: isVirtual ? [] : expectedAnswers,
|
|
85
|
-
},
|
|
86
|
-
explanation: data?.explanation || '',
|
|
87
|
-
};
|
|
88
|
-
},
|
|
89
|
-
wrapOnChange: (data, ctx) => {
|
|
90
|
-
const expectedAnswers = data.sampleAnswers || [''];
|
|
91
|
-
const isVirtual = data.targetCandidate === 'VIRTUAL';
|
|
92
|
-
return {
|
|
93
|
-
type: ctx.questionType,
|
|
94
|
-
content: {
|
|
95
|
-
...(typeof ctx.state.content === 'object' && ctx.state.content !== null
|
|
96
|
-
? ctx.state.content
|
|
97
|
-
: {}),
|
|
98
|
-
inputType: data.inputType,
|
|
99
|
-
audioUrl: data.audioUrl || '',
|
|
100
|
-
imageUrl: data.imageUrl || '',
|
|
101
|
-
questionText: data.inputType === 'TEXT' ? data.questionText : undefined,
|
|
102
|
-
targetCandidate: data.targetCandidate || 'REAL',
|
|
103
|
-
virtualAnswer: isVirtual
|
|
104
|
-
? {
|
|
105
|
-
answerText: data.virtualAnswerText || '',
|
|
106
|
-
audioUrl: data.virtualAnswerAudioUrl || '',
|
|
107
|
-
}
|
|
108
|
-
: undefined,
|
|
109
|
-
isExtendedResponse: data.isExtendedResponse || false,
|
|
110
|
-
},
|
|
111
|
-
points: isVirtual ? 0 : (data?.points ?? ctx.state.points ?? 1),
|
|
112
|
-
level: ctx.state.level,
|
|
113
|
-
difficulty: ctx.state.difficulty,
|
|
114
|
-
skill: ctx.state.skill,
|
|
115
|
-
answer: {
|
|
116
|
-
expectedAnswers: isVirtual ? [] : expectedAnswers,
|
|
117
|
-
},
|
|
118
|
-
explanation: data?.explanation || '',
|
|
119
|
-
};
|
|
120
|
-
},
|
|
121
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export const transformGNSpeakingInterview = (question) => {
|
|
2
|
-
const contentData = question.content;
|
|
3
|
-
const answerData = question.answer;
|
|
4
|
-
const inputType = contentData?.inputType || 'TEXT';
|
|
5
|
-
const targetCandidate = contentData?.targetCandidate || 'REAL'; // VIRTUAL=Virtual, REAL=Real
|
|
6
|
-
const apiContent = {
|
|
7
|
-
inputType,
|
|
8
|
-
// Always include audioUrl — populated when AUDIO, empty string when TEXT
|
|
9
|
-
audioUrl: contentData?.audioUrl || '',
|
|
10
|
-
imageUrl: contentData?.imageUrl || '',
|
|
11
|
-
targetCandidate,
|
|
12
|
-
isExtendedResponse: contentData?.isExtendedResponse || false,
|
|
13
|
-
};
|
|
14
|
-
// Include questionText when inputType is TEXT
|
|
15
|
-
if (inputType === 'TEXT' && contentData?.questionText) {
|
|
16
|
-
apiContent.questionText = contentData.questionText;
|
|
17
|
-
}
|
|
18
|
-
// Include virtualAnswer when targetCandidate is 'VIRTUAL'
|
|
19
|
-
if (targetCandidate === 'VIRTUAL' && contentData?.virtualAnswer) {
|
|
20
|
-
apiContent.virtualAnswer = {
|
|
21
|
-
answerText: contentData.virtualAnswer.answerText || '',
|
|
22
|
-
audioUrl: contentData.virtualAnswer.audioUrl || '',
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
// Normalize: support expectedAnswers, sampleAnswers (array) and legacy sampleAnswer
|
|
26
|
-
const expectedAnswers = (() => {
|
|
27
|
-
// Virtual candidates do not have expected answers
|
|
28
|
-
if (targetCandidate === 'VIRTUAL')
|
|
29
|
-
return [];
|
|
30
|
-
const newArr = answerData?.expectedAnswers;
|
|
31
|
-
if (Array.isArray(newArr))
|
|
32
|
-
return newArr.filter((s) => s && s.trim() !== '');
|
|
33
|
-
const arr = answerData?.sampleAnswers;
|
|
34
|
-
if (Array.isArray(arr))
|
|
35
|
-
return arr.filter((s) => s && s.trim() !== '');
|
|
36
|
-
const single = answerData?.sampleAnswer;
|
|
37
|
-
if (single && single.trim() !== '')
|
|
38
|
-
return [single];
|
|
39
|
-
return [];
|
|
40
|
-
})();
|
|
41
|
-
const apiCorrectAnswer = {
|
|
42
|
-
expectedAnswers,
|
|
43
|
-
};
|
|
44
|
-
return {
|
|
45
|
-
apiContent,
|
|
46
|
-
apiCorrectAnswer,
|
|
47
|
-
};
|
|
48
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
interface LookPictureChooseCorrectAnswerClientProps {
|
|
2
|
-
questionData: {
|
|
3
|
-
subQuestions: Array<{
|
|
4
|
-
id: string;
|
|
5
|
-
imageUrl: string;
|
|
6
|
-
question?: string;
|
|
7
|
-
options: Array<{
|
|
8
|
-
id: string;
|
|
9
|
-
text: string;
|
|
10
|
-
isCorrect: boolean;
|
|
11
|
-
}>;
|
|
12
|
-
}>;
|
|
13
|
-
};
|
|
14
|
-
onSubmit?: (answers: Record<string, string>) => void;
|
|
15
|
-
isReviewMode?: boolean;
|
|
16
|
-
userAnswer?: Record<string, string>;
|
|
17
|
-
explanation?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare function LookPictureChooseCorrectAnswerClient({ questionData, onSubmit, isReviewMode, userAnswer, explanation, }: LookPictureChooseCorrectAnswerClientProps): import("react").JSX.Element;
|
|
20
|
-
export {};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect } from 'react';
|
|
4
|
-
import { Check, X, Lightbulb } from 'lucide-react';
|
|
5
|
-
import { usePresignedFileUrl } from '../../../../shared/lib/hooks';
|
|
6
|
-
function SubQuestionClient({ subQuestion, index, userAnswerValue, isReviewMode, onAnswerChange, }) {
|
|
7
|
-
// Use hook at component level
|
|
8
|
-
const { previewUrl: imagePreviewUrl, isLoading } = usePresignedFileUrl(subQuestion.imageUrl || '');
|
|
9
|
-
// Find correct answer
|
|
10
|
-
const correctOption = subQuestion.options.find((opt) => opt.isCorrect);
|
|
11
|
-
const correctOptionId = correctOption?.id || '';
|
|
12
|
-
// Check if answer is correct
|
|
13
|
-
const isAnswerCorrect = userAnswerValue === correctOptionId;
|
|
14
|
-
const hasAnswered = userAnswerValue !== '';
|
|
15
|
-
return (_jsxs("div", { className: "overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white px-5 py-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-lg bg-gradient-to-br from-blue-500 to-indigo-600 text-sm font-bold text-white shadow-sm", children: index + 1 }), _jsx("span", { className: "text-sm font-medium text-gray-700", children: "Nh\u00ECn tranh, ch\u1ECDn \u0111\u00E1p \u00E1n \u0111\u00FAng" })] }), isReviewMode && hasAnswered && (_jsxs("div", { className: `flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-semibold ${isAnswerCorrect
|
|
16
|
-
? 'bg-green-100 text-green-700'
|
|
17
|
-
: 'bg-red-100 text-red-700'}`, children: [isAnswerCorrect ? _jsx(Check, { className: "h-3.5 w-3.5" }) : _jsx(X, { className: "h-3.5 w-3.5" }), isAnswerCorrect ? 'Đúng' : 'Sai'] }))] }), _jsxs("div", { className: "p-5 space-y-4", children: [(imagePreviewUrl || subQuestion.imageUrl) && (_jsxs("div", { className: "overflow-hidden rounded-lg border border-gray-200 bg-gradient-to-br from-slate-50 to-gray-100", children: [_jsx("div", { className: "border-b border-gray-100 px-3 py-1.5", children: _jsxs("div", { className: "flex items-center gap-1.5", children: [_jsx("div", { className: "h-2 w-2 rounded-full bg-red-400" }), _jsx("div", { className: "h-2 w-2 rounded-full bg-yellow-400" }), _jsx("div", { className: "h-2 w-2 rounded-full bg-green-400" }), _jsx("span", { className: "ml-2 text-xs font-medium text-gray-500", children: "H\u00ECnh \u1EA3nh" })] }) }), _jsx("div", { className: "flex items-center justify-center p-4", children: isLoading ? (_jsx("div", { className: "flex h-48 items-center justify-center", children: _jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-gray-200 border-t-blue-500" }) })) : (
|
|
18
|
-
/* eslint-disable-next-line @next/next/no-img-element */
|
|
19
|
-
_jsx("img", { src: imagePreviewUrl || subQuestion.imageUrl, alt: "Question illustration", className: "max-h-56 w-auto object-contain", onError: (e) => {
|
|
20
|
-
const target = e.target;
|
|
21
|
-
target.onerror = null;
|
|
22
|
-
target.src = '/images/placeholder-image.svg';
|
|
23
|
-
} })) })] })), _jsx("div", { className: "space-y-2", children: subQuestion.options.map((option, optIndex) => {
|
|
24
|
-
const isSelected = userAnswerValue === option.id;
|
|
25
|
-
const isCorrectAnswer = option.isCorrect;
|
|
26
|
-
const letter = String.fromCharCode(65 + optIndex);
|
|
27
|
-
return _jsxs("button", { type: "button", onClick: () => !isReviewMode && onAnswerChange(option.id), disabled: isReviewMode, className: `group flex w-full items-center gap-3 rounded-lg border-2 p-3 text-left transition-all ${isReviewMode
|
|
28
|
-
? isCorrectAnswer
|
|
29
|
-
? 'border-green-400 bg-green-50'
|
|
30
|
-
: isSelected
|
|
31
|
-
? 'border-red-400 bg-red-50'
|
|
32
|
-
: 'border-gray-200 bg-gray-50'
|
|
33
|
-
: isSelected
|
|
34
|
-
? 'border-blue-500 bg-blue-50 shadow-sm'
|
|
35
|
-
: 'border-gray-200 bg-white hover:border-gray-300 hover:bg-gray-50 hover:shadow-sm'}`, children: [_jsx("div", { className: `flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg text-sm font-bold transition-all ${isReviewMode
|
|
36
|
-
? isCorrectAnswer
|
|
37
|
-
? 'bg-green-500 text-white'
|
|
38
|
-
: isSelected
|
|
39
|
-
? 'bg-red-500 text-white'
|
|
40
|
-
: 'bg-gray-200 text-gray-600'
|
|
41
|
-
: isSelected
|
|
42
|
-
? 'bg-blue-500 text-white'
|
|
43
|
-
: 'bg-gray-100 text-gray-600 group-hover:bg-gray-200'}`, children: letter }), _jsx("span", { className: `flex-1 text-sm font-medium ${isReviewMode && isCorrectAnswer
|
|
44
|
-
? 'text-green-800'
|
|
45
|
-
: isReviewMode && isSelected && !isCorrectAnswer
|
|
46
|
-
? 'text-red-800'
|
|
47
|
-
: 'text-gray-700'}`, children: option.text }), isReviewMode && (isCorrectAnswer || isSelected) && (_jsx("div", { className: `flex h-6 w-6 items-center justify-center rounded-full ${isCorrectAnswer ? 'bg-green-500' : 'bg-red-500'}`, children: isCorrectAnswer
|
|
48
|
-
? _jsx(Check, { className: "h-4 w-4 text-white" })
|
|
49
|
-
: _jsx(X, { className: "h-4 w-4 text-white" }) }))] }, option.id);
|
|
50
|
-
}) }), isReviewMode && hasAnswered && !isAnswerCorrect && (_jsxs("div", { className: "flex items-center gap-2 rounded-lg bg-green-50 p-3 border border-green-200", children: [_jsx(Check, { className: "h-4 w-4 text-green-600" }), _jsxs("span", { className: "text-sm text-green-700", children: ["\u0110\u00E1p \u00E1n \u0111\u00FAng: ", _jsx("strong", { children: correctOption?.text })] })] }))] })] }));
|
|
51
|
-
}
|
|
52
|
-
export function LookPictureChooseCorrectAnswerClient({ questionData, onSubmit, isReviewMode = false, userAnswer = {}, explanation, }) {
|
|
53
|
-
// State for answers: { subQuestionId: selectedOptionId }
|
|
54
|
-
const [answers, setAnswers] = useState(userAnswer);
|
|
55
|
-
// Sync userAnswer when it changes
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
setAnswers(userAnswer);
|
|
58
|
-
}, [userAnswer]);
|
|
59
|
-
// Handle answer change for a sub-question
|
|
60
|
-
const handleAnswerChange = (subQuestionId, optionId) => {
|
|
61
|
-
if (isReviewMode)
|
|
62
|
-
return;
|
|
63
|
-
const newAnswers = {
|
|
64
|
-
...answers,
|
|
65
|
-
[subQuestionId]: optionId,
|
|
66
|
-
};
|
|
67
|
-
setAnswers(newAnswers);
|
|
68
|
-
// Auto submit if callback provided
|
|
69
|
-
onSubmit?.(newAnswers);
|
|
70
|
-
};
|
|
71
|
-
return (_jsxs("div", { className: "space-y-6", children: [questionData.subQuestions.map((subQuestion, index) => (_jsx(SubQuestionClient, { subQuestion: subQuestion, index: index, userAnswerValue: answers[subQuestion.id] || '', isReviewMode: isReviewMode, onAnswerChange: (value) => handleAnswerChange(subQuestion.id, value) }, subQuestion.id))), isReviewMode && explanation && (_jsx("div", { className: "rounded-xl bg-gradient-to-r from-blue-50 to-indigo-50 p-4 border border-blue-200", children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full bg-blue-500 text-white", children: _jsx(Lightbulb, { className: "h-3.5 w-3.5" }) }), _jsxs("div", { className: "flex-1", children: [_jsx("span", { className: "text-xs font-semibold text-blue-700 uppercase tracking-wider", children: "Gi\u1EA3i th\u00EDch" }), _jsx("p", { className: "mt-1 text-sm text-gray-700 leading-relaxed", children: explanation })] })] }) }))] }));
|
|
72
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
interface LookPictureChooseCorrectAnswerCreatorProps {
|
|
2
|
-
initialData?: any;
|
|
3
|
-
onSave?: (data: any) => void;
|
|
4
|
-
onCancel?: () => void;
|
|
5
|
-
onChange?: (data: any) => void;
|
|
6
|
-
onUnsavedChangesChange?: (hasUnsavedChanges: boolean) => void;
|
|
7
|
-
optionCount?: number;
|
|
8
|
-
validationRef?: React.MutableRefObject<{
|
|
9
|
-
triggerValidation: () => Promise<boolean>;
|
|
10
|
-
getFormData?: () => any;
|
|
11
|
-
} | null>;
|
|
12
|
-
}
|
|
13
|
-
export declare function LookPictureChooseCorrectAnswerCreator(props: LookPictureChooseCorrectAnswerCreatorProps): import("react").JSX.Element;
|
|
14
|
-
export declare const LookPictureChooseCorrectAnswer: typeof LookPictureChooseCorrectAnswerCreator;
|
|
15
|
-
export {};
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useRef, useEffect } from 'react';
|
|
4
|
-
import { Button } from '../../../../components/ui/button';
|
|
5
|
-
import { Input } from '../../../../components/ui/input';
|
|
6
|
-
import { Textarea } from '../../../../components/ui/textarea';
|
|
7
|
-
import { Card, CardContent, CardHeader, CardTitle } from '../../../../components/ui/card';
|
|
8
|
-
import { PointsInput } from '../../../../components/ui/points-input';
|
|
9
|
-
import { RadioGroup } from '../../../../components/ui/radio-group';
|
|
10
|
-
import { Pencil, Eye, Plus, Trash2, Image, CheckCircle2, Lightbulb, BookOpen } from 'lucide-react';
|
|
11
|
-
import { FileUpload } from '../../../../components/ui/file-upload';
|
|
12
|
-
import { ImagePreview } from '../../../../components/ui/image-preview';
|
|
13
|
-
import { usePresignedFileUrl, useDebouncedCallback } from '../../../../shared/lib/hooks';
|
|
14
|
-
import { LookPictureChooseCorrectAnswerClient } from './LookPictureChooseCorrectAnswerClient';
|
|
15
|
-
import { useReactHookForm } from '../../../../shared/lib/hooks/useReactHookForm';
|
|
16
|
-
import { lookPictureChooseCorrectAnswerFormSchema, } from '../../../../shared/lib/validation/look-picture-choose-correct-answer.validation';
|
|
17
|
-
function LookPictureChooseCorrectAnswerContent({ initialData, onSave, onCancel, onChange, onUnsavedChangesChange, optionCount = 2, validationRef, }) {
|
|
18
|
-
// Helper to normalize options - ensure they are always string[]
|
|
19
|
-
const normalizeOptions = (opts, defaultCount) => {
|
|
20
|
-
if (!opts || opts.length === 0) {
|
|
21
|
-
return Array.from({ length: defaultCount }, () => '');
|
|
22
|
-
}
|
|
23
|
-
// Options should always be string[] - convert each to string for safety
|
|
24
|
-
return opts.map((opt) => String(opt || ''));
|
|
25
|
-
};
|
|
26
|
-
// Use react-hook-form with Zod validation
|
|
27
|
-
// initialData can be in API format (content.imageUrl, correctAnswer.answer) or flat format
|
|
28
|
-
const apiData = initialData;
|
|
29
|
-
const rawOptions = apiData?.content?.options || apiData?.options || [];
|
|
30
|
-
const form = useReactHookForm({
|
|
31
|
-
defaultValues: {
|
|
32
|
-
// Support both API format (content.imageUrl) and flat format (imageUrl)
|
|
33
|
-
imageUrl: apiData?.content?.imageUrl || apiData?.imageUrl || '',
|
|
34
|
-
// Use normalizeOptions to ensure options are always string[]
|
|
35
|
-
options: normalizeOptions(rawOptions, optionCount),
|
|
36
|
-
// Support both API format (correctAnswer.answer) and flat format (correctAnswer as number)
|
|
37
|
-
correctAnswer: typeof apiData?.correctAnswer === 'object'
|
|
38
|
-
? (apiData?.correctAnswer?.answer ?? -1)
|
|
39
|
-
: (apiData?.correctAnswer ?? -1),
|
|
40
|
-
explanation: apiData?.explanation || '',
|
|
41
|
-
points: apiData?.points ?? 1,
|
|
42
|
-
},
|
|
43
|
-
zodSchema: lookPictureChooseCorrectAnswerFormSchema,
|
|
44
|
-
mode: 'onBlur',
|
|
45
|
-
});
|
|
46
|
-
// UI State
|
|
47
|
-
const [isClientMode, setIsClientMode] = useState(false);
|
|
48
|
-
const [imagePreviewUrl, setImagePreviewUrl] = useState('');
|
|
49
|
-
// Track previous initialData to detect changes
|
|
50
|
-
const previousInitialDataRef = useRef(initialData);
|
|
51
|
-
const isInitializingRef = useRef(false);
|
|
52
|
-
const onChangeRef = useRef(onChange);
|
|
53
|
-
const previousPayloadRef = useRef('');
|
|
54
|
-
// Update onChange ref when it changes
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
onChangeRef.current = onChange;
|
|
57
|
-
}, [onChange]);
|
|
58
|
-
// Debounced onChange callback to prevent excessive re-renders
|
|
59
|
-
const debouncedOnChange = useDebouncedCallback((data) => {
|
|
60
|
-
onChangeRef.current?.(data);
|
|
61
|
-
}, 300);
|
|
62
|
-
// Watch form values - MUST be declared before useEffects that use them
|
|
63
|
-
const watchedImageUrl = form.watch('imageUrl');
|
|
64
|
-
const watchedOptions = form.watch('options');
|
|
65
|
-
const watchedCorrectAnswer = form.watch('correctAnswer');
|
|
66
|
-
const watchedExplanation = form.watch('explanation');
|
|
67
|
-
const watchedPoints = form.watch('points');
|
|
68
|
-
// Custom hooks for presigned URL
|
|
69
|
-
const { previewUrl: generatedPreviewUrl } = usePresignedFileUrl(watchedImageUrl);
|
|
70
|
-
const displayPreviewUrl = imagePreviewUrl || generatedPreviewUrl || '';
|
|
71
|
-
// Expose validation function and getFormData via ref
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
if (validationRef) {
|
|
74
|
-
validationRef.current = {
|
|
75
|
-
triggerValidation: async () => {
|
|
76
|
-
const result = await form.trigger();
|
|
77
|
-
// Also check correctAnswer
|
|
78
|
-
if (watchedCorrectAnswer === -1) {
|
|
79
|
-
form.setError('correctAnswer', { message: 'Vui lòng chọn đáp án đúng!' });
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
return result;
|
|
83
|
-
},
|
|
84
|
-
// Return current form data immediately (not debounced)
|
|
85
|
-
getFormData: () => ({
|
|
86
|
-
imageUrl: watchedImageUrl,
|
|
87
|
-
options: watchedOptions,
|
|
88
|
-
correctAnswer: watchedCorrectAnswer,
|
|
89
|
-
explanation: watchedExplanation,
|
|
90
|
-
points: watchedPoints,
|
|
91
|
-
}),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}, [validationRef, form, watchedCorrectAnswer, watchedImageUrl, watchedOptions, watchedExplanation, watchedPoints]);
|
|
95
|
-
// Sync state from initialData when it changes from EXTERNAL sources only
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
const apiData = initialData;
|
|
98
|
-
const normalizedInitialData = {
|
|
99
|
-
imageUrl: apiData?.content?.imageUrl || apiData?.imageUrl || '',
|
|
100
|
-
options: normalizeOptions(apiData?.content?.options || apiData?.options || [], optionCount),
|
|
101
|
-
correctAnswer: typeof apiData?.correctAnswer === 'object'
|
|
102
|
-
? (apiData?.correctAnswer?.answer ?? -1)
|
|
103
|
-
: (apiData?.correctAnswer ?? -1),
|
|
104
|
-
explanation: apiData?.explanation || '',
|
|
105
|
-
points: apiData?.points ?? 1,
|
|
106
|
-
};
|
|
107
|
-
const initialDataChanged = JSON.stringify(previousInitialDataRef.current) !== JSON.stringify(initialData);
|
|
108
|
-
if (!initialDataChanged) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
previousInitialDataRef.current = initialData;
|
|
112
|
-
const currentFormData = {
|
|
113
|
-
imageUrl: watchedImageUrl,
|
|
114
|
-
options: watchedOptions,
|
|
115
|
-
correctAnswer: watchedCorrectAnswer,
|
|
116
|
-
explanation: watchedExplanation,
|
|
117
|
-
points: watchedPoints,
|
|
118
|
-
};
|
|
119
|
-
const isEchoFromOnChange = currentFormData.imageUrl === normalizedInitialData.imageUrl &&
|
|
120
|
-
currentFormData.correctAnswer === normalizedInitialData.correctAnswer &&
|
|
121
|
-
currentFormData.points === normalizedInitialData.points &&
|
|
122
|
-
currentFormData.explanation === normalizedInitialData.explanation &&
|
|
123
|
-
JSON.stringify(currentFormData.options) === JSON.stringify(normalizedInitialData.options);
|
|
124
|
-
const wasJustSaved = initialData?.isCompleted === true;
|
|
125
|
-
if (isEchoFromOnChange && wasJustSaved) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const shouldReset = !isEchoFromOnChange &&
|
|
129
|
-
normalizedInitialData.correctAnswer !== currentFormData.correctAnswer;
|
|
130
|
-
if (shouldReset && normalizedInitialData.correctAnswer !== -1) {
|
|
131
|
-
isInitializingRef.current = true;
|
|
132
|
-
form.reset(normalizedInitialData);
|
|
133
|
-
setTimeout(() => {
|
|
134
|
-
isInitializingRef.current = false;
|
|
135
|
-
}, 150);
|
|
136
|
-
}
|
|
137
|
-
}, [initialData, optionCount, form, watchedImageUrl, watchedOptions, watchedCorrectAnswer, watchedExplanation, watchedPoints]);
|
|
138
|
-
// Convert to payload format and call onChange
|
|
139
|
-
const watchedOptionsString = JSON.stringify(watchedOptions);
|
|
140
|
-
useEffect(() => {
|
|
141
|
-
if (isInitializingRef.current) {
|
|
142
|
-
const currentPayload = JSON.stringify({
|
|
143
|
-
imageUrl: watchedImageUrl,
|
|
144
|
-
options: watchedOptions,
|
|
145
|
-
correctAnswer: watchedCorrectAnswer,
|
|
146
|
-
explanation: watchedExplanation,
|
|
147
|
-
points: watchedPoints,
|
|
148
|
-
});
|
|
149
|
-
previousPayloadRef.current = currentPayload;
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
const payload = {
|
|
153
|
-
imageUrl: watchedImageUrl,
|
|
154
|
-
options: watchedOptions,
|
|
155
|
-
correctAnswer: watchedCorrectAnswer,
|
|
156
|
-
explanation: watchedExplanation,
|
|
157
|
-
points: watchedPoints,
|
|
158
|
-
};
|
|
159
|
-
const payloadString = JSON.stringify(payload);
|
|
160
|
-
if (previousPayloadRef.current !== payloadString) {
|
|
161
|
-
previousPayloadRef.current = payloadString;
|
|
162
|
-
debouncedOnChange(payload);
|
|
163
|
-
}
|
|
164
|
-
}, [
|
|
165
|
-
watchedImageUrl,
|
|
166
|
-
watchedOptionsString,
|
|
167
|
-
watchedCorrectAnswer,
|
|
168
|
-
watchedExplanation,
|
|
169
|
-
watchedPoints,
|
|
170
|
-
]);
|
|
171
|
-
// Handle save with validation
|
|
172
|
-
const handleSave = form.handleSubmit((data) => {
|
|
173
|
-
if (data.correctAnswer === -1 || data.correctAnswer >= data.options.length) {
|
|
174
|
-
form.setError('correctAnswer', { message: 'Vui lòng chọn đáp án đúng!' });
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
onSave?.(data);
|
|
178
|
-
});
|
|
179
|
-
// Client mode preview
|
|
180
|
-
if (isClientMode) {
|
|
181
|
-
const questionData = {
|
|
182
|
-
subQuestions: [{
|
|
183
|
-
id: 'preview-sq',
|
|
184
|
-
imageUrl: displayPreviewUrl || watchedImageUrl,
|
|
185
|
-
question: '',
|
|
186
|
-
options: watchedOptions.map((text, index) => ({
|
|
187
|
-
id: `opt-${index}`,
|
|
188
|
-
text,
|
|
189
|
-
isCorrect: index === watchedCorrectAnswer,
|
|
190
|
-
})),
|
|
191
|
-
}],
|
|
192
|
-
};
|
|
193
|
-
const correctAnswers = watchedCorrectAnswer !== -1
|
|
194
|
-
? { 'preview-sq': `opt-${watchedCorrectAnswer}` }
|
|
195
|
-
: {};
|
|
196
|
-
return (_jsx("div", { className: "space-y-6", children: _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsx(CardTitle, { children: "Nh\u00ECn tranh, ch\u1ECDn \u0111\u00E1p \u00E1n \u0111\u00FAng (Preview)" }), _jsx("p", { className: "mt-1 text-sm text-gray-500", children: "Ch\u1EBF \u0111\u1ED9 xem tr\u01B0\u1EDBc - Hi\u1EC3n th\u1ECB \u0111\u00E1p \u00E1n \u0111\u00FAng" })] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setIsClientMode(false), children: [_jsx(Pencil, { className: "mr-2 h-4 w-4" }), "Quay l\u1EA1i Edit Mode"] })] }) }), _jsx(CardContent, { children: _jsx(LookPictureChooseCorrectAnswerClient, { questionData: questionData, isReviewMode: true, userAnswer: correctAnswers, explanation: watchedExplanation }) })] }) }));
|
|
197
|
-
}
|
|
198
|
-
return (_jsxs("div", { className: "space-y-6", children: [_jsxs(Card, { className: "overflow-hidden border-0 bg-white shadow-lg shadow-cyan-100/50", children: [_jsx("div", { className: "h-1.5 bg-gradient-to-r from-cyan-500 via-teal-500 to-emerald-500" }), _jsx(CardHeader, { className: "pb-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-cyan-500 to-teal-600 shadow-md", children: _jsx(Image, { className: "h-5 w-5 text-white" }) }), _jsxs("div", { children: [_jsx(CardTitle, { className: "text-xl font-bold text-gray-900", children: "Nh\u00ECn tranh, ch\u1ECDn \u0111\u00E1p \u00E1n \u0111\u00FAng" }), _jsx("p", { className: "text-sm text-gray-500", children: "T\u1EA1o c\u00E2u h\u1ECFi v\u1EDBi h\u00ECnh \u1EA3nh v\u00E0 c\u00E1c l\u1EF1a ch\u1ECDn \u0111\u00E1p \u00E1n" })] })] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setIsClientMode(true), className: "gap-2 border-teal-200 text-teal-600 hover:bg-teal-50 hover:text-teal-700", children: [_jsx(Eye, { className: "h-4 w-4" }), "Xem tr\u01B0\u1EDBc"] })] }) }), _jsxs(CardContent, { className: "space-y-6", children: [_jsx("div", { className: "rounded-xl border border-gray-200 bg-gradient-to-r from-gray-50 to-slate-50 p-4", children: _jsx(PointsInput, { defaultValue: watchedPoints, onChange: (e) => form.setValue('points', Number(e.target.value) || 1) }) }), _jsxs("div", { className: "rounded-xl border-2 border-teal-100 bg-gradient-to-r from-teal-50/30 to-cyan-50/30 p-5", children: [_jsxs("div", { className: "mb-4 flex items-center gap-2", children: [_jsx("div", { className: "flex h-6 w-6 items-center justify-center rounded-md bg-teal-100", children: _jsx(Image, { className: "h-3.5 w-3.5 text-teal-600" }) }), _jsx("span", { className: "text-sm font-semibold text-teal-800", children: "H\u00ECnh \u1EA3nh c\u00E2u h\u1ECFi" })] }), _jsx(FileUpload, { id: "image-upload", label: "H\u00ECnh \u1EA3nh", accept: "image/*", value: watchedImageUrl, onChange: (url) => form.setValue('imageUrl', url, { shouldValidate: true }), onPresignedUrlChange: (presignedUrl) => setImagePreviewUrl(presignedUrl), maxSize: 5, placeholder: "Upload \u1EA3nh ho\u1EB7c paste URL", required: true, autoUpload: true, prefix: "questions" }), form.hasError('imageUrl') && (_jsx("p", { className: "mt-1 text-sm text-red-600", children: form.formState.errors.imageUrl?.message })), displayPreviewUrl && (_jsx(ImagePreview, { src: displayPreviewUrl, alt: "Preview for question", className: "mt-2 h-48 w-full max-w-md rounded-lg border border-gray-200" }))] })] })] }), _jsxs(Card, { className: "overflow-hidden border-0 bg-white shadow-lg shadow-indigo-100/50", children: [_jsx("div", { className: "h-1 bg-gradient-to-r from-indigo-400 to-purple-400" }), _jsx(CardHeader, { className: "pb-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "flex h-6 w-6 items-center justify-center rounded-md bg-indigo-100", children: _jsx(Lightbulb, { className: "h-3.5 w-3.5 text-indigo-600" }) }), _jsxs(CardTitle, { className: "text-lg font-semibold text-gray-800", children: ["C\u00E1c l\u1EF1a ch\u1ECDn ", _jsxs("span", { className: "text-sm font-normal text-gray-500", children: ["(", watchedOptions.length, " \u0111\u00E1p \u00E1n)"] })] })] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => {
|
|
199
|
-
const currentOptions = form.getValues('options');
|
|
200
|
-
form.setValue('options', [...currentOptions, '']);
|
|
201
|
-
}, className: "gap-2 border-green-200 text-green-600 hover:bg-green-50 hover:text-green-700", children: [_jsx(Plus, { className: "h-4 w-4" }), "Th\u00EAm \u0111\u00E1p \u00E1n"] })] }) }), _jsxs(CardContent, { className: "space-y-4", children: [_jsx(RadioGroup, { value: watchedCorrectAnswer.toString(), onValueChange: (value) => {
|
|
202
|
-
form.setValue('correctAnswer', Number(value), { shouldValidate: true });
|
|
203
|
-
}, children: watchedOptions.map((option, index) => {
|
|
204
|
-
const optionError = form.formState.errors.options?.[index];
|
|
205
|
-
const isCorrect = watchedCorrectAnswer === index;
|
|
206
|
-
const optionLetter = String.fromCharCode(65 + index);
|
|
207
|
-
return (_jsx("div", { className: `group relative rounded-xl border-2 p-4 transition-all duration-200 ${isCorrect
|
|
208
|
-
? 'border-green-300 bg-gradient-to-r from-green-50 to-emerald-50 shadow-md shadow-green-100'
|
|
209
|
-
: 'border-gray-200 bg-white hover:border-gray-300 hover:shadow-sm'}`, children: _jsxs("div", { className: "flex items-start gap-4", children: [_jsx("div", { className: `flex h-10 w-10 flex-shrink-0 cursor-pointer items-center justify-center rounded-xl font-bold transition-all ${isCorrect
|
|
210
|
-
? 'bg-gradient-to-br from-green-500 to-emerald-600 text-white shadow-md'
|
|
211
|
-
: 'bg-gray-100 text-gray-600 hover:bg-indigo-100 hover:text-indigo-600'}`, onClick: () => form.setValue('correctAnswer', index, { shouldValidate: true }), children: optionLetter }), _jsxs("div", { className: "flex-1 space-y-2", children: [_jsx(Input, { id: `option-input-${index}`, ...form.register(`options.${index}`), placeholder: `Nhập đáp án ${optionLetter}...`, className: `border-gray-200 bg-white transition-all focus:border-indigo-300 focus:ring-indigo-200 ${optionError ? 'border-red-400 focus:border-red-500 focus:ring-red-200' : ''}` }), optionError && (_jsx("p", { className: "text-sm text-red-600", children: optionError.message })), isCorrect && (_jsxs("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-green-100 px-3 py-1 text-xs font-semibold text-green-700", children: [_jsx(CheckCircle2, { className: "h-3.5 w-3.5" }), "\u0110\u00E1p \u00E1n \u0111\u00FAng"] }))] }), _jsxs("div", { className: "flex items-center gap-2", children: [!isCorrect && (_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => form.setValue('correctAnswer', index, { shouldValidate: true }), className: "text-gray-400 hover:text-green-600", title: "Ch\u1ECDn l\u00E0m \u0111\u00E1p \u00E1n \u0111\u00FAng", children: _jsx(CheckCircle2, { className: "h-4 w-4" }) })), watchedOptions.length > 2 && (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => {
|
|
212
|
-
const currentOptions = form.getValues('options');
|
|
213
|
-
const newOptions = currentOptions.filter((_, i) => i !== index);
|
|
214
|
-
form.setValue('options', newOptions);
|
|
215
|
-
// Adjust correctAnswer if needed
|
|
216
|
-
const currentCorrect = form.getValues('correctAnswer');
|
|
217
|
-
if (currentCorrect === index) {
|
|
218
|
-
form.setValue('correctAnswer', -1);
|
|
219
|
-
}
|
|
220
|
-
else if (currentCorrect > index) {
|
|
221
|
-
form.setValue('correctAnswer', currentCorrect - 1);
|
|
222
|
-
}
|
|
223
|
-
}, className: "text-red-500 hover:bg-red-50 hover:text-red-600", children: _jsx(Trash2, { className: "h-4 w-4" }) }))] })] }) }, index));
|
|
224
|
-
}) }), watchedCorrectAnswer === -1 && (_jsxs("div", { className: "flex items-start gap-3 rounded-xl border border-amber-200 bg-gradient-to-r from-amber-50 to-yellow-50 p-4", children: [_jsx("div", { className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-amber-100", children: _jsx("span", { className: "text-lg", children: "\u26A0\uFE0F" }) }), _jsxs("div", { className: "text-sm text-amber-800", children: [_jsx("p", { className: "font-semibold", children: "Ch\u01B0a ch\u1ECDn \u0111\u00E1p \u00E1n \u0111\u00FAng" }), _jsx("p", { className: "mt-0.5 text-amber-700", children: "Click v\u00E0o \u00F4 ch\u1EEF c\u00E1i ho\u1EB7c icon \u2713 \u0111\u1EC3 ch\u1ECDn \u0111\u00E1p \u00E1n \u0111\u00FAng" })] })] })), form.hasError('correctAnswer') && (_jsxs("div", { className: "flex items-start gap-3 rounded-xl border border-red-200 bg-gradient-to-r from-red-50 to-rose-50 p-4", children: [_jsx("div", { className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-red-100", children: _jsx("span", { className: "text-lg", children: "\u274C" }) }), _jsx("div", { className: "text-sm text-red-600", children: form.formState.errors.correctAnswer?.message })] }))] })] }), _jsxs(Card, { className: "overflow-hidden border-0 bg-white shadow-lg shadow-amber-100/50", children: [_jsx("div", { className: "h-1 bg-gradient-to-r from-amber-400 to-orange-400" }), _jsx(CardHeader, { className: "pb-4", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex h-9 w-9 items-center justify-center rounded-lg bg-gradient-to-br from-amber-500 to-orange-500 shadow-sm", children: _jsx(BookOpen, { className: "h-4 w-4 text-white" }) }), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CardTitle, { className: "text-lg font-semibold text-gray-800", children: "Gi\u1EA3i th\u00EDch" }), _jsx("span", { className: "inline-flex items-center rounded-full border border-amber-200 bg-amber-50 px-2.5 py-0.5 text-xs font-medium text-amber-600", children: "Kh\u00F4ng b\u1EAFt bu\u1ED9c" })] }), _jsx("p", { className: "text-sm text-gray-500 mt-0.5", children: "Gi\u1EA3i th\u00EDch cho \u0111\u00E1p \u00E1n \u0111\u00FAng \u2014 hi\u1EC3n th\u1ECB sau khi h\u1ECDc sinh ho\u00E0n th\u00E0nh c\u00E2u h\u1ECFi" })] })] }) }), _jsx(CardContent, { children: _jsx(Textarea, { id: "explanation", ...form.register('explanation'), placeholder: "VD: C\u00E2u tr\u1EA3 l\u1EDDi \u0111\u00FAng l\u00E0... v\u00EC...", rows: 3, className: "min-h-[80px] border-gray-200 bg-white transition-all focus:border-amber-300 focus:ring-amber-200 resize-none" }) })] })] }));
|
|
225
|
-
}
|
|
226
|
-
export function LookPictureChooseCorrectAnswerCreator(props) {
|
|
227
|
-
return _jsx(LookPictureChooseCorrectAnswerContent, { ...props });
|
|
228
|
-
}
|
|
229
|
-
// Legacy export for backward compatibility
|
|
230
|
-
export const LookPictureChooseCorrectAnswer = LookPictureChooseCorrectAnswerCreator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './LookPictureChooseCorrectAnswerCreator';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './LookPictureChooseCorrectAnswerCreator';
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { LookPictureChooseCorrectAnswer } from './LookPictureChooseCorrectAnswerCreator';
|
|
2
|
-
export const lookPictureChooseCorrectAnswerRegistration = {
|
|
3
|
-
component: LookPictureChooseCorrectAnswer,
|
|
4
|
-
transformInitialData: (initialData) => {
|
|
5
|
-
let creatorData = undefined;
|
|
6
|
-
const content = initialData?.content;
|
|
7
|
-
const answer = initialData?.answer;
|
|
8
|
-
const apiPoints = initialData?.total_points
|
|
9
|
-
? parseFloat(initialData.total_points)
|
|
10
|
-
: (initialData?.points || answer?.points || 1);
|
|
11
|
-
const normalizeOptions = (opts) => {
|
|
12
|
-
if (!Array.isArray(opts) || opts.length === 0)
|
|
13
|
-
return [];
|
|
14
|
-
return opts.map((opt) => String(opt || ''));
|
|
15
|
-
};
|
|
16
|
-
// Priority 1: Data from reverse transform or store
|
|
17
|
-
if (answer?.imageUrl !== undefined || answer?.options) {
|
|
18
|
-
creatorData = {
|
|
19
|
-
imageUrl: answer.imageUrl || '',
|
|
20
|
-
options: normalizeOptions(answer.options || []),
|
|
21
|
-
correctAnswer: typeof answer.correctAnswer === 'number' ? answer.correctAnswer : -1,
|
|
22
|
-
explanation: answer.explanation || initialData?.explanation || '',
|
|
23
|
-
points: answer.points || apiPoints,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
// Priority 2: Raw API content format
|
|
27
|
-
else if (content && (content.imageUrl !== undefined || content.options)) {
|
|
28
|
-
let correctAnswer = -1;
|
|
29
|
-
if (typeof answer?.answer === 'number')
|
|
30
|
-
correctAnswer = answer.answer;
|
|
31
|
-
else if (typeof initialData?.correct_answer?.answer === 'number')
|
|
32
|
-
correctAnswer = initialData.correct_answer.answer;
|
|
33
|
-
creatorData = {
|
|
34
|
-
imageUrl: content.imageUrl || '',
|
|
35
|
-
options: normalizeOptions(content.options || []),
|
|
36
|
-
correctAnswer,
|
|
37
|
-
explanation: initialData?.explanation || '',
|
|
38
|
-
points: apiPoints,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
return creatorData;
|
|
42
|
-
},
|
|
43
|
-
getExtraProps: (ctx) => ({
|
|
44
|
-
optionCount: ctx.optionCount ?? undefined,
|
|
45
|
-
onUnsavedChangesChange: ctx.onUnsavedChangesChange,
|
|
46
|
-
validationRef: ctx.validationRef,
|
|
47
|
-
}),
|
|
48
|
-
wrapOnSave: (data, ctx) => ({
|
|
49
|
-
type: ctx.questionType,
|
|
50
|
-
content: ctx.state.content,
|
|
51
|
-
points: data?.points ?? ctx.state.points ?? 1,
|
|
52
|
-
level: ctx.state.level,
|
|
53
|
-
difficulty: ctx.state.difficulty,
|
|
54
|
-
skill: ctx.state.skill,
|
|
55
|
-
answer: data,
|
|
56
|
-
}),
|
|
57
|
-
wrapOnChange: (data, ctx) => ({
|
|
58
|
-
type: ctx.questionType,
|
|
59
|
-
content: ctx.state.content,
|
|
60
|
-
points: data?.points ?? ctx.state.points ?? 1,
|
|
61
|
-
level: ctx.state.level,
|
|
62
|
-
difficulty: ctx.state.difficulty,
|
|
63
|
-
skill: ctx.state.skill,
|
|
64
|
-
answer: data,
|
|
65
|
-
}),
|
|
66
|
-
};
|