@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.
Files changed (225) hide show
  1. package/dist/components/exams/ExamCreator.js +1 -16
  2. package/dist/components/exams/take/ExamTakingPageContainer.js +0 -12
  3. package/dist/components/exams/take/components/QuestionRenderer.js +2 -15
  4. package/dist/components/exams/take/components/question-renderers/index.d.ts +0 -3
  5. package/dist/components/exams/take/components/question-renderers/index.js +0 -3
  6. package/dist/components/exams/take/components/speaking/renderers/SpeakingQuestionRenderer.js +0 -4
  7. package/dist/components/exams/take/types/speaking.types.d.ts +0 -31
  8. package/dist/components/exams/take/types.d.ts +0 -65
  9. package/dist/components/exams/take/utils/answer-transformers.js +6 -60
  10. package/dist/components/exams/take/utils/question-transformers.d.ts +2 -15
  11. package/dist/components/exams/take/utils/question-transformers.js +0 -143
  12. package/dist/components/questions/_shared/components/compact/CompactCreatorHeader.d.ts +23 -0
  13. package/dist/components/questions/_shared/components/compact/CompactCreatorHeader.js +9 -0
  14. package/dist/components/questions/_shared/components/compact/CompactExampleToggle.d.ts +6 -0
  15. package/dist/components/questions/_shared/components/compact/CompactExampleToggle.js +8 -0
  16. package/dist/components/questions/_shared/components/compact/CompactExplanationToggle.d.ts +7 -0
  17. package/dist/components/questions/_shared/components/compact/CompactExplanationToggle.js +14 -0
  18. package/dist/components/questions/_shared/components/compact/CompactFieldCard.d.ts +9 -0
  19. package/dist/components/questions/_shared/components/compact/CompactFieldCard.js +7 -0
  20. package/dist/components/questions/_shared/components/compact/CompactPreviewBanner.d.ts +7 -0
  21. package/dist/components/questions/_shared/components/compact/CompactPreviewBanner.js +7 -0
  22. package/dist/components/questions/_shared/components/compact/CompactPreviewButton.d.ts +6 -0
  23. package/dist/components/questions/_shared/components/compact/CompactPreviewButton.js +7 -0
  24. package/dist/components/questions/_shared/components/compact/index.d.ts +6 -0
  25. package/dist/components/questions/_shared/components/compact/index.js +6 -0
  26. package/dist/components/questions/_shared/config/question-types.config.js +0 -24
  27. package/dist/components/questions/_shared/hooks/useQuestionInitialization.js +0 -9
  28. package/dist/components/questions/_shared/types/index.d.ts +0 -1
  29. package/dist/components/questions/_shared/types/index.js +0 -1
  30. package/dist/components/questions/_shared/types/look-and-choose-answer.type.d.ts +0 -13
  31. package/dist/components/questions/_shared/utils/answer-builder.js +0 -11
  32. package/dist/components/questions/components/ColorRegionCreator.js +66 -63
  33. package/dist/components/questions/components/QuestionSearchDropdown.js +0 -8
  34. package/dist/components/questions/components/QuestionTypeSelector.js +0 -2
  35. package/dist/components/questions/components/index.d.ts +1 -0
  36. package/dist/components/questions/components/index.js +1 -0
  37. package/dist/components/questions/creator/question-type-registry.js +0 -8
  38. package/dist/components/questions/groups/ArticlesGroupCard.js +2 -2
  39. package/dist/components/questions/groups/BasicQuestionGroupCard.js +1 -1
  40. package/dist/components/questions/groups/DocumentGroupCard.js +1 -1
  41. package/dist/components/questions/groups/ImageLabelGroupCard.js +1 -1
  42. package/dist/components/questions/groups/MatchAnswerGroupCard.js +2 -2
  43. package/dist/components/questions/question-bank/QuestionEditorRenderer.d.ts +0 -3
  44. package/dist/components/questions/question-bank/QuestionEditorRenderer.js +1 -10
  45. package/dist/components/questions/question-bank/editor-adapters/choice-adapters.d.ts +0 -2
  46. package/dist/components/questions/question-bank/editor-adapters/choice-adapters.js +0 -41
  47. package/dist/components/questions/question-bank/editor-adapters/index.d.ts +2 -2
  48. package/dist/components/questions/question-bank/editor-adapters/index.js +2 -2
  49. package/dist/components/questions/question-bank/editor-adapters/media-adapters.d.ts +0 -1
  50. package/dist/components/questions/question-bank/editor-adapters/media-adapters.js +0 -28
  51. package/dist/components/questions/question-bank/question-bank-picker.utils.js +0 -7
  52. package/dist/components/questions/types/answer-the-question/AnswerTheQuestionClient.js +16 -16
  53. package/dist/components/questions/types/answer-the-question/AnswerTheQuestionCreator.js +36 -30
  54. package/dist/components/questions/types/answer-the-question-group/AnswerTheQuestionGroupClient.js +1 -1
  55. package/dist/components/questions/types/answer-the-question-group/AnswerTheQuestionGroupCreator.js +7 -6
  56. package/dist/components/questions/types/arrange-letters-into-words/ArrangeLettersIntoWordsClient.js +2 -2
  57. package/dist/components/questions/types/arrange-letters-into-words/ArrangeLettersIntoWordsCreator.js +11 -7
  58. package/dist/components/questions/types/choose-correct-adjective/ChooseCorrectAdjectiveClient.js +1 -1
  59. package/dist/components/questions/types/choose-correct-adjective/ChooseCorrectAdjectiveCreator.js +11 -5
  60. package/dist/components/questions/types/choose-the-correct-answer/ChooseTheCorrectAnswerClient.js +5 -5
  61. package/dist/components/questions/types/choose-the-correct-answer/ChooseTheCorrectAnswerCreator.js +34 -28
  62. package/dist/components/questions/types/choose-the-correct-answer-group/ChooseAnswerGroupImageUpload.js +2 -2
  63. package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupClient.js +1 -1
  64. package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupCreator.js +44 -28
  65. package/dist/components/questions/types/choose-then-answer-group/ChooseThenAnswerGroupClient.js +7 -7
  66. package/dist/components/questions/types/choose-then-answer-group/ChooseThenAnswerGroupCreator.js +8 -5
  67. package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupClient.js +2 -2
  68. package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupCreator.js +20 -16
  69. package/dist/components/questions/types/crossword-puzzle/CrosswordPuzzleClient.js +1 -1
  70. package/dist/components/questions/types/crossword-puzzle/CrosswordPuzzleCreator.js +66 -29
  71. package/dist/components/questions/types/fill-in-blank/FillInBlankClient.js +5 -5
  72. package/dist/components/questions/types/fill-in-blank/FillInBlankCreator.js +45 -37
  73. package/dist/components/questions/types/fill-in-blank-group/FillInBlankGroupCreator.js +24 -20
  74. package/dist/components/questions/types/fill-missing-words-in-grid/FillMissingWordsInGridClient.js +2 -2
  75. package/dist/components/questions/types/fill-missing-words-in-grid/FillMissingWordsInGridCreator.js +68 -65
  76. package/dist/components/questions/types/find-words-in-matrix/FindWordsInMatrixClient.js +1 -1
  77. package/dist/components/questions/types/find-words-in-matrix/FindWordsInMatrixCreator.js +45 -5
  78. package/dist/components/questions/types/label-the-picture/LabelThePictureClient.js +2 -2
  79. package/dist/components/questions/types/label-the-picture/LabelThePictureCreator.js +18 -14
  80. package/dist/components/questions/types/listen-and-choose-from-answer-group/ListenAndChooseFromAnswerGroupClient.js +2 -2
  81. package/dist/components/questions/types/listen-and-choose-from-answer-group/ListenAndChooseFromAnswerGroupCreator.js +30 -30
  82. package/dist/components/questions/types/listen-and-choose-objects-in-scene/ListenAndChooseObjectsInSceneClient.js +2 -2
  83. package/dist/components/questions/types/listen-and-choose-objects-in-scene/ListenAndChooseObjectsInSceneCreator.js +24 -31
  84. package/dist/components/questions/types/listen-and-drag-objects-into-scene/ListenAndDragObjectsIntoSceneClient.js +2 -2
  85. package/dist/components/questions/types/listen-and-drag-objects-into-scene/ListenAndDragObjectsIntoSceneCreator.js +29 -32
  86. package/dist/components/questions/types/listen-and-speak-answer/ListenAndSpeakAnswerClient.js +1 -1
  87. package/dist/components/questions/types/listen-and-speak-answer/ListenAndSpeakAnswerCreator.js +27 -29
  88. package/dist/components/questions/types/listen-and-speak-compare-images/ListenAndSpeakCompareImagesClient.js +1 -1
  89. package/dist/components/questions/types/listen-and-speak-compare-images/ListenAndSpeakCompareImagesCreator.js +11 -15
  90. package/dist/components/questions/types/listen-and-speak-image-group/ListenAndSpeakImageGroupClient.js +1 -1
  91. package/dist/components/questions/types/listen-and-speak-image-group/ListenAndSpeakImageGroupCreator.js +22 -24
  92. package/dist/components/questions/types/listen-and-speak-info-exchange/ListenAndSpeakInfoExchangeClient.js +1 -1
  93. package/dist/components/questions/types/listen-and-speak-info-exchange/ListenAndSpeakInfoExchangeCreator.js +17 -24
  94. package/dist/components/questions/types/listen-and-speak-odd-one-out/ListenAndSpeakOddOneOutClient.js +1 -1
  95. package/dist/components/questions/types/listen-and-speak-odd-one-out/ListenAndSpeakOddOneOutCreator.js +31 -31
  96. package/dist/components/questions/types/listen-and-speak-question-list/ListenAndSpeakQuestionListClient.js +1 -1
  97. package/dist/components/questions/types/listen-and-speak-question-list/ListenAndSpeakQuestionListCreator.js +11 -15
  98. package/dist/components/questions/types/listen-and-speak-with-story-images/ListenAndSpeakWithStoryImagesClient.js +1 -1
  99. package/dist/components/questions/types/listen-and-speak-with-story-images/ListenAndSpeakWithStoryImagesCreator.js +14 -15
  100. package/dist/components/questions/types/match-by-writing-answer/MatchByWritingAnswerClient.js +2 -2
  101. package/dist/components/questions/types/match-by-writing-answer/MatchByWritingAnswerCreator.js +27 -25
  102. package/dist/components/questions/types/match-columns-to-make-sentences/MatchColumnsToMakeSentencesClient.js +12 -12
  103. package/dist/components/questions/types/match-columns-to-make-sentences/MatchColumnsToMakeSentencesCreator.js +8 -5
  104. package/dist/components/questions/types/match-word-to-picture/MatchWordToPictureClient.js +8 -8
  105. package/dist/components/questions/types/match-word-to-picture/MatchWordToPictureCreator.js +25 -20
  106. package/dist/components/questions/types/match-word-to-picture-group/MatchWordToPictureGroupClient.js +1 -1
  107. package/dist/components/questions/types/match-word-to-picture-group/MatchWordToPictureGroupCreator.js +13 -10
  108. package/dist/components/questions/types/matching-with-lines-group/MatchingWithLinesGroupCreator.js +8 -5
  109. package/dist/components/questions/types/read-displayed-content/ReadDisplayedContentCreator.js +7 -11
  110. package/dist/components/questions/types/read-passage-and-answer-questions/ReadPassageAndAnswerQuestionsClient.js +1 -1
  111. package/dist/components/questions/types/read-passage-and-answer-questions/ReadPassageAndAnswerQuestionsCreator.js +15 -12
  112. package/dist/components/questions/types/sort-words-into-categories/SortWordsIntoCategoriesClient.js +1 -1
  113. package/dist/components/questions/types/sort-words-into-categories/SortWordsIntoCategoriesCreator.js +5 -5
  114. package/dist/components/questions/types/speaking-conversation/SpeakingConversationCreator.js +35 -39
  115. package/dist/components/questions/types/speaking-conversation/SpeakingConversationPreviewClient.js +2 -2
  116. package/dist/components/questions/types/speaking-cue-card/SpeakingCueCardClient.js +1 -1
  117. package/dist/components/questions/types/speaking-cue-card/SpeakingCueCardCreator.js +7 -8
  118. package/dist/components/questions/types/speaking-describe-image/SpeakingDescribeImageClient.js +1 -1
  119. package/dist/components/questions/types/speaking-describe-image/SpeakingDescribeImageCreator.js +30 -23
  120. package/dist/components/questions/types/spontaneous-qa/SpontaneousQAClient.js +1 -1
  121. package/dist/components/questions/types/spontaneous-qa/SpontaneousQACreator.js +26 -19
  122. package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupClient.js +1 -1
  123. package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupCreator.js +13 -11
  124. package/dist/components/questions/types/true-false/TrueFalseClient.js +2 -2
  125. package/dist/components/questions/types/true-false/TrueFalseCreator.js +35 -29
  126. package/dist/components/questions/types/true-false-correct-group/TrueFalseCorrectGroupClient.js +1 -1
  127. package/dist/components/questions/types/true-false-correct-group/TrueFalseCorrectGroupCreator.js +11 -7
  128. package/dist/components/questions/types/true-false-group/TrueFalseGroupClient.js +1 -1
  129. package/dist/components/questions/types/true-false-group/TrueFalseGroupCreator.js +11 -7
  130. package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphClient.js +2 -2
  131. package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphCreator.js +21 -56
  132. package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormClient.js +1 -1
  133. package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormCreator.js +30 -24
  134. package/dist/components/questions/types/word-order-and-match-group/WordOrderAndMatchGroupClient.js +3 -3
  135. package/dist/components/questions/types/word-order-and-match-group/WordOrderAndMatchGroupCreator.js +12 -14
  136. package/dist/components/questions/types/word-ordering/WordOrderingClient.js +1 -1
  137. package/dist/components/questions/types/word-ordering/WordOrderingCreator.js +27 -18
  138. package/dist/components/questions/types/word-ordering-group/WordOrderingGroupClient.js +7 -7
  139. package/dist/components/questions/types/word-ordering-group/WordOrderingGroupCreator.js +16 -13
  140. package/dist/components/questions/types/write-a-short-letter/WriteAShortLetterClient.js +2 -2
  141. package/dist/components/questions/types/write-a-short-letter/WriteAShortLetterCreator.js +34 -28
  142. package/dist/components/questions/types/write-correct-verb-form/WriteCorrectVerbFormClient.js +2 -2
  143. package/dist/components/questions/types/write-correct-verb-form/WriteCorrectVerbFormCreator.js +22 -22
  144. package/dist/components/questions/types/write-sentences/WriteSentencesCreator.js +21 -18
  145. package/dist/components/questions/types/write-short-paragraph/WriteShortParagraphClient.js +1 -1
  146. package/dist/components/questions/types/write-short-paragraph/WriteShortParagraphCreator.js +7 -4
  147. package/dist/components/questions/viewer/QuestionViewer.js +0 -98
  148. package/dist/components/results/renderers/review-question-body-movers.js +2 -26
  149. package/dist/components/results/review-data.js +0 -4
  150. package/dist/components/ui/points-input.d.ts +1 -0
  151. package/dist/components/ui/points-input.js +12 -2
  152. package/dist/shared/constants/question-skills.js +0 -11
  153. package/dist/shared/lib/i18n/messages/en/admin.d.ts +0 -3
  154. package/dist/shared/lib/i18n/messages/en/admin.js +0 -3
  155. package/dist/shared/lib/i18n/messages/en.d.ts +0 -3
  156. package/dist/shared/lib/i18n/messages/vi/admin.d.ts +0 -3
  157. package/dist/shared/lib/i18n/messages/vi/admin.js +0 -3
  158. package/dist/shared/lib/i18n/messages/vi.d.ts +0 -3
  159. package/dist/shared/lib/utils/question-reverse-transform.js +0 -19
  160. package/dist/shared/lib/utils/question-transform-types.d.ts +1 -23
  161. package/dist/shared/lib/utils/question-transform-validation.js +0 -40
  162. package/dist/shared/lib/utils/question-transform.js +0 -9
  163. package/dist/shared/types/common.types.d.ts +1 -1
  164. package/dist/shared/types/entities/question.types.d.ts +1 -11
  165. package/dist/shared/types/questions/index.d.ts +0 -3
  166. package/dist/shared/types/questions/index.js +0 -6
  167. package/package.json +1 -1
  168. package/dist/components/exams/take/components/question-renderers/MoversFillWordHintRenderer.d.ts +0 -2
  169. package/dist/components/exams/take/components/question-renderers/MoversFillWordHintRenderer.js +0 -131
  170. package/dist/components/exams/take/components/question-renderers/MoversPictureChooseRenderer.d.ts +0 -2
  171. package/dist/components/exams/take/components/question-renderers/MoversPictureChooseRenderer.js +0 -76
  172. package/dist/components/exams/take/components/question-renderers/MoversPictureFillBlankChooseRenderer.d.ts +0 -2
  173. package/dist/components/exams/take/components/question-renderers/MoversPictureFillBlankChooseRenderer.js +0 -68
  174. package/dist/components/exams/take/components/speaking/renderers/SpeakingGNInterviewRenderer.d.ts +0 -16
  175. package/dist/components/exams/take/components/speaking/renderers/SpeakingGNInterviewRenderer.js +0 -212
  176. package/dist/components/questions/_shared/types/gn-speaking-interview.type.d.ts +0 -32
  177. package/dist/components/questions/_shared/types/gn-speaking-interview.type.js +0 -1
  178. package/dist/components/questions/_shared/types/look-picture-fill-word-hint.type.d.ts +0 -47
  179. package/dist/components/questions/_shared/types/look-picture-fill-word-hint.type.js +0 -1
  180. package/dist/components/questions/types/gn-speaking-interview/GNSpeakingInterviewCreator.d.ts +0 -2
  181. package/dist/components/questions/types/gn-speaking-interview/GNSpeakingInterviewCreator.js +0 -262
  182. package/dist/components/questions/types/gn-speaking-interview/register.d.ts +0 -2
  183. package/dist/components/questions/types/gn-speaking-interview/register.js +0 -121
  184. package/dist/components/questions/types/gn-speaking-interview/transform.d.ts +0 -2
  185. package/dist/components/questions/types/gn-speaking-interview/transform.js +0 -48
  186. package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerClient.d.ts +0 -20
  187. package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerClient.js +0 -72
  188. package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerCreator.d.ts +0 -15
  189. package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerCreator.js +0 -230
  190. package/dist/components/questions/types/look-picture-choose-correct-answer/index.d.ts +0 -1
  191. package/dist/components/questions/types/look-picture-choose-correct-answer/index.js +0 -1
  192. package/dist/components/questions/types/look-picture-choose-correct-answer/register.d.ts +0 -2
  193. package/dist/components/questions/types/look-picture-choose-correct-answer/register.js +0 -66
  194. package/dist/components/questions/types/look-picture-choose-correct-answer/transform.d.ts +0 -2
  195. package/dist/components/questions/types/look-picture-choose-correct-answer/transform.js +0 -42
  196. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerClient.d.ts +0 -6
  197. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerClient.js +0 -96
  198. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerCreator.d.ts +0 -15
  199. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerCreator.js +0 -238
  200. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/index.d.ts +0 -2
  201. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/index.js +0 -2
  202. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/register.d.ts +0 -2
  203. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/register.js +0 -76
  204. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/transform.d.ts +0 -2
  205. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/transform.js +0 -19
  206. package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintClient.d.ts +0 -7
  207. package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintClient.js +0 -134
  208. package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintCreator.d.ts +0 -3
  209. package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintCreator.js +0 -617
  210. package/dist/components/questions/types/look-picture-fill-word-hint/index.d.ts +0 -2
  211. package/dist/components/questions/types/look-picture-fill-word-hint/index.js +0 -2
  212. package/dist/components/questions/types/look-picture-fill-word-hint/register.d.ts +0 -2
  213. package/dist/components/questions/types/look-picture-fill-word-hint/register.js +0 -82
  214. package/dist/components/questions/types/look-picture-fill-word-hint/transform.d.ts +0 -2
  215. package/dist/components/questions/types/look-picture-fill-word-hint/transform.js +0 -29
  216. package/dist/shared/lib/validation/look-picture-choose-correct-answer.validation.d.ts +0 -9
  217. package/dist/shared/lib/validation/look-picture-choose-correct-answer.validation.js +0 -12
  218. package/dist/shared/lib/validation/look-picture-fill-blank-choose-answer.validation.d.ts +0 -17
  219. package/dist/shared/lib/validation/look-picture-fill-blank-choose-answer.validation.js +0 -47
  220. package/dist/shared/types/questions/look-picture-choose-correct-answer.d.ts +0 -38
  221. package/dist/shared/types/questions/look-picture-choose-correct-answer.js +0 -5
  222. package/dist/shared/types/questions/look-picture-fill-blank-choose-answer.d.ts +0 -63
  223. package/dist/shared/types/questions/look-picture-fill-blank-choose-answer.js +0 -9
  224. package/dist/shared/types/questions/look-picture-fill-word-hint.d.ts +0 -57
  225. package/dist/shared/types/questions/look-picture-fill-word-hint.js +0 -7
@@ -1,134 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState, useEffect, useMemo } from 'react';
4
- import { cn } from '../../../../shared/lib/utils';
5
- import { Input } from '../../../../components/ui/input';
6
- import { Check, X, Lightbulb, Pencil } from 'lucide-react';
7
- import { usePresignedFileUrl } from '../../../../shared/lib/hooks';
8
- export function LookPictureFillWordHintClient({ questionData, userAnswer = {}, isReviewMode = false, autoFillCorrectAnswers = false, explanation, onSubmit, }) {
9
- // Build correct answers map
10
- const correctAnswersMap = useMemo(() => {
11
- return questionData.subQuestions.reduce((acc, sq) => {
12
- acc[sq.id] = sq.correctAnswer;
13
- return acc;
14
- }, {});
15
- }, [questionData.subQuestions]);
16
- const initialAnswers = autoFillCorrectAnswers ? correctAnswersMap : (userAnswer || {});
17
- const [answers, setAnswers] = useState(initialAnswers);
18
- useEffect(() => {
19
- if (autoFillCorrectAnswers) {
20
- setAnswers(correctAnswersMap);
21
- }
22
- else if (userAnswer) {
23
- setAnswers(userAnswer);
24
- }
25
- }, [userAnswer, autoFillCorrectAnswers, correctAnswersMap]);
26
- const handleAnswerChange = (subQuestionId, blankIndex, value) => {
27
- if (isReviewMode)
28
- return;
29
- const currentAnswer = answers[subQuestionId] || '';
30
- const currentParts = currentAnswer.split(',').map(a => a.trim());
31
- const subQuestion = questionData.subQuestions.find(sq => sq.id === subQuestionId);
32
- if (!subQuestion)
33
- return;
34
- const matches = subQuestion.word.match(/\{(\d+)\}/g);
35
- const blankCount = matches ? matches.length : 0;
36
- while (currentParts.length < blankCount) {
37
- currentParts.push('');
38
- }
39
- currentParts[blankIndex] = value.replace(/[^a-zA-Z]/g, '');
40
- const newAnswers = { ...answers, [subQuestionId]: currentParts.join(',') };
41
- setAnswers(newAnswers);
42
- onSubmit?.(newAnswers);
43
- };
44
- const hintLetters = questionData.hintLetters || [];
45
- const isSingleQuestion = questionData.subQuestions.length === 1;
46
- // For single question, use the card layout similar to LookPictureFillBlankChooseAnswer
47
- if (isSingleQuestion) {
48
- const subQuestion = questionData.subQuestions[0];
49
- const userAnswerValue = answers[subQuestion.id] || '';
50
- return (_jsx(SingleQuestionLayout, { subQuestion: subQuestion, userAnswerValue: userAnswerValue, isReviewMode: isReviewMode, hintLetters: hintLetters, explanation: explanation, onAnswerChange: (blankIdx, value) => handleAnswerChange(subQuestion.id, blankIdx, value) }));
51
- }
52
- // Multiple questions - grid layout
53
- return (_jsxs("div", { className: "space-y-4", children: [hintLetters.length > 0 && (_jsxs("div", { className: "flex items-center gap-3 rounded-xl border border-amber-200 bg-gradient-to-r from-amber-50 to-orange-50 px-4 py-3", children: [_jsx(Lightbulb, { className: "h-5 w-5 text-amber-500 flex-shrink-0" }), _jsx("span", { className: "text-sm font-medium text-amber-700", children: "G\u1EE3i \u00FD:" }), _jsx("div", { className: "flex flex-wrap gap-1.5", children: hintLetters.map((letter, i) => (_jsx("span", { className: "inline-flex h-7 w-7 items-center justify-center rounded-md border border-amber-300 bg-white text-sm font-bold text-amber-700", children: letter.toUpperCase() }, i))) })] })), _jsx("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: questionData.subQuestions.map((subQuestion, index) => (_jsx(MultiQuestionCard, { subQuestion: subQuestion, index: index, userAnswerValue: answers[subQuestion.id] || '', isReviewMode: isReviewMode, onAnswerChange: (blankIdx, value) => handleAnswerChange(subQuestion.id, blankIdx, value) }, subQuestion.id))) })] }));
54
- }
55
- // Parse word into segments
56
- function parseWord(word, answerParts, correctParts, isReviewMode) {
57
- const segments = [];
58
- let lastIdx = 0;
59
- const regex = /\{(\d+)\}/g;
60
- let match;
61
- while ((match = regex.exec(word)) !== null) {
62
- if (match.index > lastIdx) {
63
- segments.push({ type: 'text', value: word.substring(lastIdx, match.index) });
64
- }
65
- const blankIdx = parseInt(match[1], 10);
66
- const userVal = answerParts[blankIdx] || '';
67
- const correctVal = correctParts[blankIdx] || '';
68
- const isCorrect = userVal.toLowerCase() === correctVal.toLowerCase();
69
- segments.push({
70
- type: 'blank',
71
- value: userVal,
72
- index: blankIdx,
73
- isCorrect: isReviewMode ? isCorrect : undefined,
74
- correctValue: correctVal,
75
- });
76
- lastIdx = match.index + match[0].length;
77
- }
78
- if (lastIdx < word.length) {
79
- segments.push({ type: 'text', value: word.substring(lastIdx) });
80
- }
81
- return segments;
82
- }
83
- // Single question layout - similar to LookPictureFillBlankChooseAnswer
84
- function SingleQuestionLayout({ subQuestion, userAnswerValue, isReviewMode, hintLetters, explanation, onAnswerChange, }) {
85
- const { previewUrl, isLoading } = usePresignedFileUrl(subQuestion.imageUrl);
86
- const correctAnswer = subQuestion.correctAnswer.trim();
87
- const matches = subQuestion.word.match(/\{(\d+)\}/g);
88
- const blankCount = matches ? matches.length : 0;
89
- const userParts = userAnswerValue.split(',').map(a => a.trim());
90
- const correctParts = correctAnswer.split(',').map(a => a.trim());
91
- const isComplete = userParts.filter(p => p.length > 0).length === blankCount;
92
- const isAllCorrect = isReviewMode && isComplete && userAnswerValue.trim().toLowerCase() === correctAnswer.toLowerCase();
93
- const isWrong = isReviewMode && isComplete && !isAllCorrect;
94
- const hasAnswered = userParts.some(p => p.length > 0);
95
- const segments = parseWord(subQuestion.word, userParts, correctParts, isReviewMode);
96
- const imageSrc = previewUrl || (subQuestion.imageUrl?.startsWith('http') ? subQuestion.imageUrl : null);
97
- // Build complete word for preview
98
- const renderWordWithAnswer = (parts) => {
99
- let result = subQuestion.word;
100
- for (let i = 0; i < parts.length; i++) {
101
- result = result.replace(`{${i}}`, parts[i]?.toUpperCase() || '?');
102
- }
103
- return result;
104
- };
105
- return (_jsxs("div", { className: "overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm transition-all hover:shadow-md", 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-teal-500 to-cyan-600 text-white shadow-sm", children: _jsx(Pencil, { className: "h-4 w-4" }) }), _jsx("span", { className: "text-sm font-medium text-gray-700", children: "Nh\u00ECn tranh, \u0111i\u1EC1n ch\u1EEF c\u00E1i c\u00F2n thi\u1EBFu" })] }), isReviewMode && hasAnswered && (_jsxs("div", { className: cn('flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-semibold', isAllCorrect ? 'bg-green-100 text-green-700' : isWrong ? 'bg-red-100 text-red-700' : 'bg-gray-100 text-gray-600'), children: [isAllCorrect && _jsx(Check, { className: "h-3.5 w-3.5" }), isWrong && _jsx(X, { className: "h-3.5 w-3.5" }), isAllCorrect ? 'Đúng' : isWrong ? 'Sai' : 'Chưa hoàn thành'] }))] }), _jsxs("div", { className: "p-5 space-y-5", children: [(imageSrc || 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-teal-500" }) })) : (_jsx("img", { src: imageSrc || subQuestion.imageUrl, alt: "Question", className: "max-h-56 w-auto object-contain rounded-md", onError: (e) => {
106
- e.target.src = '/images/placeholder-image.svg';
107
- } })) })] })), hintLetters.length > 0 && (_jsxs("div", { className: "flex items-center gap-3 rounded-lg border border-amber-200 bg-gradient-to-r from-amber-50 to-orange-50 px-4 py-3", children: [_jsx(Lightbulb, { className: "h-5 w-5 text-amber-500 flex-shrink-0" }), _jsx("span", { className: "text-sm font-medium text-amber-700", children: "G\u1EE3i \u00FD ch\u1EEF c\u00E1i:" }), _jsx("div", { className: "flex flex-wrap gap-1.5", children: hintLetters.map((letter, i) => (_jsx("span", { className: "inline-flex h-8 w-8 items-center justify-center rounded-lg border-2 border-amber-300 bg-white text-sm font-bold text-amber-700 shadow-sm", children: letter.toUpperCase() }, i))) })] })), _jsx("div", { className: "rounded-lg bg-gradient-to-r from-gray-50 to-slate-50 p-4 border border-gray-100", 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-teal-100 text-teal-600", children: _jsx("span", { className: "text-xs font-bold", children: "?" }) }), _jsxs("div", { className: "flex-1", children: [_jsx("span", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider", children: "\u0110i\u1EC1n ch\u1EEF c\u00E1i c\u00F2n thi\u1EBFu" }), _jsx("div", { className: "mt-3 flex flex-wrap items-center gap-1", children: segments.map((seg, i) => {
108
- if (seg.type === 'text') {
109
- return (_jsx("span", { className: "text-2xl font-bold text-gray-800 font-mono tracking-wide", children: seg.value }, i));
110
- }
111
- // Blank input
112
- return (_jsxs("div", { className: "relative inline-flex flex-col items-center mx-0.5", children: [_jsx(Input, { type: "text", value: seg.value.toUpperCase(), onChange: (e) => onAnswerChange(seg.index, e.target.value), disabled: isReviewMode, maxLength: 2, placeholder: "?", className: cn('h-11 w-11 rounded-lg border-2 text-center font-mono font-bold text-xl uppercase transition-all', seg.isCorrect === true && 'border-green-400 bg-green-50 text-green-700', seg.isCorrect === false && 'border-red-400 bg-red-50 text-red-700', seg.isCorrect === undefined && 'border-teal-300 bg-teal-50 text-teal-700 focus:border-teal-500 focus:ring-2 focus:ring-teal-200') }), seg.isCorrect === false && (_jsx("span", { className: "absolute -bottom-5 text-xs font-bold text-green-600", children: seg.correctValue?.toUpperCase() }))] }, i));
113
- }) }), isWrong && _jsx("div", { className: "h-4" })] })] }) }), hasAnswered && !isReviewMode && (_jsxs("div", { className: "rounded-lg bg-gradient-to-r from-teal-50 to-cyan-50 p-4 border border-teal-100", children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-teal-500 text-white", children: _jsx(Check, { className: "h-3 w-3" }) }), _jsx("span", { className: "text-xs font-semibold text-teal-700 uppercase tracking-wider", children: "Preview t\u1EEB ho\u00E0n ch\u1EC9nh" })] }), _jsx("p", { className: "text-lg font-mono font-bold text-gray-800 tracking-wide", children: renderWordWithAnswer(userParts) })] })), isReviewMode && isWrong && (_jsxs("div", { className: "rounded-lg bg-gradient-to-r from-green-50 to-emerald-50 p-4 border border-green-200", children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-green-500 text-white", children: _jsx(Check, { className: "h-3 w-3" }) }), _jsx("span", { className: "text-xs font-semibold text-green-700 uppercase tracking-wider", children: "\u0110\u00E1p \u00E1n \u0111\u00FAng" })] }), _jsx("p", { className: "text-lg font-mono font-bold text-gray-800 tracking-wide", children: renderWordWithAnswer(correctParts) })] })), !isReviewMode && !hasAnswered && (_jsxs("div", { className: "rounded-lg border border-amber-200 bg-gradient-to-r from-amber-50 to-yellow-50 p-3 flex items-center gap-2", children: [_jsx("div", { className: "flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full bg-amber-400 text-white", children: _jsx("span", { className: "text-xs font-bold", children: "!" }) }), _jsx("span", { className: "text-sm text-amber-800", children: "Vui l\u00F2ng \u0111i\u1EC1n ch\u1EEF c\u00E1i v\u00E0o c\u00E1c \u00F4 tr\u1ED1ng" })] })), isReviewMode && explanation && (_jsx("div", { className: "rounded-lg 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 })] })] }) }))] })] }));
114
- }
115
- // Multiple questions - compact card for grid
116
- function MultiQuestionCard({ subQuestion, index, userAnswerValue, isReviewMode, onAnswerChange, }) {
117
- const { previewUrl } = usePresignedFileUrl(subQuestion.imageUrl);
118
- const correctAnswer = subQuestion.correctAnswer.trim();
119
- const matches = subQuestion.word.match(/\{(\d+)\}/g);
120
- const blankCount = matches ? matches.length : 0;
121
- const userParts = userAnswerValue.split(',').map(a => a.trim());
122
- const correctParts = correctAnswer.split(',').map(a => a.trim());
123
- const isComplete = userParts.filter(p => p.length > 0).length === blankCount;
124
- const isAllCorrect = isReviewMode && isComplete && userAnswerValue.trim().toLowerCase() === correctAnswer.toLowerCase();
125
- const isWrong = isReviewMode && isComplete && !isAllCorrect;
126
- const segments = parseWord(subQuestion.word, userParts, correctParts, isReviewMode);
127
- const imageSrc = previewUrl || (subQuestion.imageUrl?.startsWith('http') ? subQuestion.imageUrl : null);
128
- return (_jsxs("div", { className: cn('overflow-hidden rounded-xl border-2 bg-white transition-all', isAllCorrect && 'border-green-400', isWrong && 'border-red-400', !isReviewMode && 'border-gray-200 hover:shadow-md'), children: [_jsxs("div", { className: "relative h-36 bg-gradient-to-br from-slate-50 to-slate-100 flex items-center justify-center", children: [imageSrc ? (_jsx("img", { src: imageSrc, alt: "Question", className: "h-full w-full object-contain p-3" })) : (_jsx("svg", { className: "h-10 w-10 text-gray-300", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) })), _jsx("div", { className: "absolute left-2 top-2 flex h-6 w-6 items-center justify-center rounded-full bg-teal-500 text-xs font-bold text-white", children: index + 1 }), isReviewMode && (isAllCorrect || isWrong) && (_jsx("div", { className: cn('absolute right-2 top-2 rounded-full p-1', isAllCorrect && 'bg-green-500 text-white', isWrong && 'bg-red-500 text-white'), children: isAllCorrect ? _jsx(Check, { className: "h-3 w-3" }) : _jsx(X, { className: "h-3 w-3" }) }))] }), _jsxs("div", { className: "p-3", children: [_jsx("div", { className: "flex flex-wrap items-center justify-center gap-0.5", children: segments.map((seg, i) => {
129
- if (seg.type === 'text') {
130
- return _jsx("span", { className: "text-lg font-bold text-gray-800 font-mono", children: seg.value }, i);
131
- }
132
- return (_jsx(Input, { type: "text", value: seg.value.toUpperCase(), onChange: (e) => onAnswerChange(seg.index, e.target.value), disabled: isReviewMode, maxLength: 2, placeholder: "?", className: cn('h-8 w-8 rounded border-2 text-center font-mono font-bold text-lg uppercase outline-none transition-all', seg.isCorrect === true && 'border-green-400 bg-green-50 text-green-700', seg.isCorrect === false && 'border-red-400 bg-red-50 text-red-700', seg.isCorrect === undefined && 'border-gray-300 focus:border-teal-400') }, i));
133
- }) }), isWrong && (_jsxs("p", { className: "text-center text-xs text-green-600 font-medium mt-2", children: ["\u0110\u00E1p \u00E1n: ", subQuestion.word.replace(/\{(\d+)\}/g, (_, idx) => correctParts[parseInt(idx)]?.toUpperCase() || '')] }))] })] }));
134
- }
@@ -1,3 +0,0 @@
1
- import { LookPictureFillWordHintCreatorProps } from '../../_shared/types/look-picture-fill-word-hint.type';
2
- export declare function LookPictureFillWordHintCreator(props: LookPictureFillWordHintCreatorProps): import("react").JSX.Element;
3
- export declare const LookPictureFillWordHint: typeof LookPictureFillWordHintCreator;