@tinyweb_dev/oe-exam-sdk 0.1.28 → 0.1.30
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/README.md +4 -4
- package/dist/api/contest-rooms.js +54 -1
- package/dist/api/contest-rooms.types.js +1 -1
- package/dist/api/exam-create.js +179 -1
- package/dist/api/exam-create.types.js +1 -1
- package/dist/api/exam-entry.js +68 -1
- package/dist/api/exam-entry.types.js +1 -1
- package/dist/api/exam-questions.js +149 -1
- package/dist/api/exam-questions.types.js +1 -1
- package/dist/api/exam-taking.js +84 -1
- package/dist/api/exam-taking.types.d.ts +7 -0
- package/dist/api/exam-taking.types.js +1 -1
- package/dist/api/index.js +8 -1
- package/dist/api/result-review.js +62 -1
- package/dist/api/result-review.types.js +16 -1
- package/dist/components/CueCardEditor.js +58 -1
- package/dist/components/common/ResolvedImage.js +15 -1
- package/dist/components/exams/CompletionDialog.js +8 -1
- package/dist/components/exams/CreateExamInfoForm.js +84 -1
- package/dist/components/exams/CreateExamPageContainer.js +110 -1
- package/dist/components/exams/ExamCreator.js +287 -1
- package/dist/components/exams/ExamPartTabs.js +138 -1
- package/dist/components/exams/ExamPreviewDialog.d.ts +6 -7
- package/dist/components/exams/ExamPreviewDialog.js +121 -1
- package/dist/components/exams/ExamPreviewPartContent.d.ts +18 -0
- package/dist/components/exams/ExamPreviewPartContent.js +27 -0
- package/dist/components/exams/ExamPreviewSidebar.d.ts +17 -0
- package/dist/components/exams/ExamPreviewSidebar.js +37 -0
- package/dist/components/exams/ExamQuestionGrid.js +37 -1
- package/dist/components/exams/ExamQuestionsPageContainer.js +112 -1
- package/dist/components/exams/ExamViewDialog.js +61 -1
- package/dist/components/exams/PartAudioUploader.js +9 -1
- package/dist/components/exams/TemplateSelector.js +76 -1
- package/dist/components/exams/UnsavedChangesDialog.js +7 -1
- package/dist/components/exams/api.js +3 -1
- package/dist/components/exams/create-exam.texts.js +1 -1
- package/dist/components/exams/create-exam.validation.js +18 -1
- package/dist/components/exams/entry/EntryRestartDialog.js +11 -1
- package/dist/components/exams/entry/StudentExamEntryPageContainer.js +358 -1
- package/dist/components/exams/entry/exam-entry.states.js +26 -1
- package/dist/components/exams/entry/exam-entry.utils.js +55 -1
- package/dist/components/exams/entry/fullscreen-loading.js +18 -1
- package/dist/components/exams/entry/index.js +4 -1
- package/dist/components/exams/exam-preview.types.d.ts +30 -0
- package/dist/components/exams/exam-preview.types.js +62 -0
- package/dist/components/exams/exam-question-status.js +45 -1
- package/dist/components/exams/exam-template.utils.js +18 -1
- package/dist/components/exams/index.d.ts +1 -0
- package/dist/components/exams/index.js +19 -1
- package/dist/components/exams/rooms/StudentContestRoomsPageContainer.js +183 -1
- package/dist/components/exams/rooms/contest-rooms.utils.js +93 -1
- package/dist/components/exams/rooms/index.js +2 -1
- package/dist/components/exams/take/ExamTakingApiContext.js +25 -1
- package/dist/components/exams/take/ExamTakingPageContainer.js +955 -1
- package/dist/components/exams/take/GenericQuestionRenderer.js +14 -1
- package/dist/components/exams/take/components/QuestionRenderer.js +207 -1
- package/dist/components/exams/take/components/index.js +11 -1
- package/dist/components/exams/take/components/question-renderers/ArticlesViewer.js +8 -1
- package/dist/components/exams/take/components/question-renderers/MoversAnswerTheQuestionRenderer.js +30 -1
- package/dist/components/exams/take/components/question-renderers/MoversChooseAdjectiveRenderer.js +63 -1
- package/dist/components/exams/take/components/question-renderers/MoversChooseBestAnswerRenderer.js +136 -1
- package/dist/components/exams/take/components/question-renderers/MoversColoringRenderer.js +379 -1
- package/dist/components/exams/take/components/question-renderers/MoversCrossOutWordGroupRenderer.d.ts +20 -0
- package/dist/components/exams/take/components/question-renderers/MoversCrossOutWordGroupRenderer.js +141 -0
- package/dist/components/exams/take/components/question-renderers/MoversFillWordHintRenderer.js +131 -1
- package/dist/components/exams/take/components/question-renderers/MoversGridFillRenderer.js +76 -1
- package/dist/components/exams/take/components/question-renderers/MoversLabelThePictureRenderer.js +68 -1
- package/dist/components/exams/take/components/question-renderers/MoversListenAndWriteRenderer.js +42 -1
- package/dist/components/exams/take/components/question-renderers/MoversMatchByWritingAnswerRenderer.js +131 -1
- package/dist/components/exams/take/components/question-renderers/MoversPictureChooseRenderer.js +76 -1
- package/dist/components/exams/take/components/question-renderers/MoversPictureFillBlankChooseRenderer.js +68 -1
- package/dist/components/exams/take/components/question-renderers/MoversReadingPassageRenderer.js +62 -1
- package/dist/components/exams/take/components/question-renderers/MoversTrueFalseRenderer.d.ts +1 -1
- package/dist/components/exams/take/components/question-renderers/MoversTrueFalseRenderer.js +51 -1
- package/dist/components/exams/take/components/question-renderers/MoversWordFillParagraphRenderer.js +171 -1
- package/dist/components/exams/take/components/question-renderers/MoversWordFillStructuredFormRenderer.js +198 -1
- package/dist/components/exams/take/components/question-renderers/MoversWordOrderAndMatchGroupRenderer.d.ts +15 -0
- package/dist/components/exams/take/components/question-renderers/MoversWordOrderAndMatchGroupRenderer.js +36 -0
- package/dist/components/exams/take/components/question-renderers/MoversWordOrderingRenderer.js +92 -1
- package/dist/components/exams/take/components/question-renderers/MoversWriteSentencesRenderer.js +11 -1
- package/dist/components/exams/take/components/question-renderers/MoversWritingRenderer.js +56 -1
- package/dist/components/exams/take/components/question-renderers/index.d.ts +2 -0
- package/dist/components/exams/take/components/question-renderers/index.js +25 -1
- package/dist/components/exams/take/components/speaking/SpeakingAudioPlayer.js +85 -1
- package/dist/components/exams/take/components/speaking/SpeakingContentFrame.js +10 -1
- package/dist/components/exams/take/components/speaking/SpeakingExamLayout.js +15 -1
- package/dist/components/exams/take/components/speaking/SpeakingHeader.js +6 -1
- package/dist/components/exams/take/components/speaking/SpeakingInstructionBar.js +8 -1
- package/dist/components/exams/take/components/speaking/SpeakingMicButton.js +59 -1
- package/dist/components/exams/take/components/speaking/SpeakingNavButton.js +7 -1
- package/dist/components/exams/take/components/speaking/SpeakingPartBadge.js +5 -1
- package/dist/components/exams/take/components/speaking/SpeakingReadDisplayedContent.module.css +120 -0
- package/dist/components/exams/take/components/speaking/SpeakingRecordingPreview.js +73 -1
- package/dist/components/exams/take/components/speaking/SpeakingReportErrorButton.js +8 -1
- package/dist/components/exams/take/components/speaking/SpeakingSpontaneousQA.module.css +344 -0
- package/dist/components/exams/take/components/speaking/SpeakingVideoIntro.js +32 -1
- package/dist/components/exams/take/components/speaking/index.js +1 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingChooseAnswerGroupRenderer.js +63 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingChooseObjectsRenderer.js +95 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingCompareImagesRenderer.js +35 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingConversationRenderer.js +147 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingCueCardRenderer.js +232 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingDescribeImageRenderer.js +193 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingDragObjectsRenderer.js +155 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingGNInterviewRenderer.js +212 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingInfoExchangeRenderer.js +77 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingListenAndSpeakAnswerRenderer.js +64 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingOddOneOutRenderer.js +69 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingQuestionListRenderer.js +64 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingQuestionRenderer.js +92 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingReadDisplayedContentRenderer.js +202 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingSpontaneousQARenderer.js +339 -1
- package/dist/components/exams/take/components/speaking/renderers/SpeakingSpontaneousQaGroupRenderer.d.ts +19 -0
- package/dist/components/exams/take/components/speaking/renderers/SpeakingSpontaneousQaGroupRenderer.js +76 -0
- package/dist/components/exams/take/components/speaking/renderers/SpeakingStoryImagesRenderer.js +56 -1
- package/dist/components/exams/take/components/speaking/renderers/SpontaneousQACambridgeLayout.d.ts +24 -0
- package/dist/components/exams/take/components/speaking/renderers/SpontaneousQACambridgeLayout.js +120 -0
- package/dist/components/exams/take/components/speaking/renderers/SpontaneousQAInlineAudioPlayer.d.ts +8 -0
- package/dist/components/exams/take/components/speaking/renderers/SpontaneousQAInlineAudioPlayer.js +94 -0
- package/dist/components/exams/take/components/speaking/renderers/SpontaneousQASummerSkyAudioPlayer.d.ts +8 -0
- package/dist/components/exams/take/components/speaking/renderers/SpontaneousQASummerSkyAudioPlayer.js +101 -0
- package/dist/components/exams/take/components/speaking/renderers/index.d.ts +1 -0
- package/dist/components/exams/take/components/speaking/renderers/index.js +14 -1
- package/dist/components/exams/take/exam-taking.utils.d.ts +13 -0
- package/dist/components/exams/take/exam-taking.utils.js +203 -1
- package/dist/components/exams/take/hooks/index.js +2 -1
- package/dist/components/exams/take/hooks/useAnswerAutosave.js +71 -1
- package/dist/components/exams/take/hooks/useAttemptSubmit.js +38 -1
- package/dist/components/exams/take/hooks/useAutoSave.js +83 -1
- package/dist/components/exams/take/hooks/useExamCountdown.js +35 -1
- package/dist/components/exams/take/hooks/useExamTimer.js +97 -1
- package/dist/components/exams/take/hooks/useProctoringCamera.js +118 -1
- package/dist/components/exams/take/hooks/useProctoringSnapshot.js +76 -1
- package/dist/components/exams/take/hooks/useSpeakingConversationAudio.js +178 -1
- package/dist/components/exams/take/hooks/useSpeakingNavigation.js +51 -1
- package/dist/components/exams/take/hooks/useSpeakingRecorder.js +406 -1
- package/dist/components/exams/take/hooks/useSpeakingRendererSetup.js +136 -1
- package/dist/components/exams/take/hooks/useSpontaneousQaGroupRecorder.d.ts +11 -0
- package/dist/components/exams/take/hooks/useSpontaneousQaGroupRecorder.js +352 -0
- package/dist/components/exams/take/hooks/useSpontaneousQaGroupRendererSetup.d.ts +42 -0
- package/dist/components/exams/take/hooks/useSpontaneousQaGroupRendererSetup.js +166 -0
- package/dist/components/exams/take/hooks/useToeicAudio.js +35 -1
- package/dist/components/exams/take/index.js +6 -1
- package/dist/components/exams/take/types/speaking-cue-card.types.js +1 -1
- package/dist/components/exams/take/types/speaking.types.js +7 -1
- package/dist/components/exams/take/types.js +4 -1
- package/dist/components/exams/take/utils/answer-transformers.js +452 -1
- package/dist/components/exams/take/utils/cambridge-yle-inline-speaking.d.ts +21 -0
- package/dist/components/exams/take/utils/cambridge-yle-inline-speaking.js +44 -0
- package/dist/components/exams/take/utils/coloring-assignments.js +40 -1
- package/dist/components/exams/take/utils/cross-out-word-group.transformer.d.ts +21 -0
- package/dist/components/exams/take/utils/cross-out-word-group.transformer.js +83 -0
- package/dist/components/exams/take/utils/question-transformers.d.ts +43 -2
- package/dist/components/exams/take/utils/question-transformers.js +1137 -1
- package/dist/components/features/exam-entry/entry-state-cards.js +19 -1
- package/dist/components/features/exam-entry/index.js +2 -1
- package/dist/components/features/exam-entry/themed/CambridgeYleWaitingRoom.js +121 -1
- package/dist/components/features/exam-entry/themed/ThemedWaitingRoom.js +37 -1
- package/dist/components/features/exam-entry/themed/ToeicWaitingRoom.js +15 -1
- package/dist/components/features/exam-entry/themed/cambridge-yle-waiting-parts.js +80 -1
- package/dist/components/features/exam-entry/themed/components/CloseButton.js +6 -1
- package/dist/components/features/exam-entry/themed/components/ExamInfoPanel.js +17 -1
- package/dist/components/features/exam-entry/themed/components/ModeSelector.js +6 -1
- package/dist/components/features/exam-entry/themed/components/StartButton.js +12 -1
- package/dist/components/features/exam-entry/themed/components/index.js +4 -1
- package/dist/components/features/exam-entry/themed/index.js +3 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +43 -1
- package/dist/components/questions/_shared/config/question-types.config.js +362 -1
- package/dist/components/questions/_shared/constants/color-palette.js +21 -1
- package/dist/components/questions/_shared/hooks/useAnswerGroupQuestionGroup.js +105 -1
- package/dist/components/questions/_shared/hooks/useBasicQuestionGroup.js +222 -1
- package/dist/components/questions/_shared/hooks/useCompareImagesGroup.js +140 -1
- package/dist/components/questions/_shared/hooks/useImageQuestionGroup.js +123 -1
- package/dist/components/questions/_shared/hooks/useInfoExchangeGroup.js +50 -1
- package/dist/components/questions/_shared/hooks/useQuestionFormState.js +54 -1
- package/dist/components/questions/_shared/hooks/useQuestionInitialization.js +123 -1
- package/dist/components/questions/_shared/hooks/useQuestionListGroup.js +121 -1
- package/dist/components/questions/_shared/hooks/useQuestionOnChange.js +70 -1
- package/dist/components/questions/_shared/hooks/useSceneQuestionGroup.js +194 -1
- package/dist/components/questions/_shared/index.js +7 -1
- package/dist/components/questions/_shared/types/answer-the-question.type.js +1 -1
- package/dist/components/questions/_shared/types/arrange-letters-into-words.type.js +1 -1
- package/dist/components/questions/_shared/types/choose-correct-adjective.type.js +3 -1
- package/dist/components/questions/_shared/types/choose-the-correct-answer-group.type.d.ts +1 -0
- package/dist/components/questions/_shared/types/choose-the-correct-answer-group.type.js +1 -1
- package/dist/components/questions/_shared/types/color-region.config.js +1 -1
- package/dist/components/questions/_shared/types/cross-out-word-group.type.d.ts +2 -0
- package/dist/components/questions/_shared/types/cross-out-word-group.type.js +1 -1
- package/dist/components/questions/_shared/types/fill-in-blank.type.js +1 -1
- package/dist/components/questions/_shared/types/fill-missing-words-in-grid.type.js +1 -1
- package/dist/components/questions/_shared/types/gn-speaking-interview.type.js +1 -1
- package/dist/components/questions/_shared/types/index.d.ts +1 -0
- package/dist/components/questions/_shared/types/index.js +14 -1
- package/dist/components/questions/_shared/types/label-the-picture.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-choose-from-answer-group.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-choose-objects-in-scene.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-drag-objects-into-scene.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-speak-answer.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-speak-compare-images.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-speak-image-group.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-speak-info-exchange.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-speak-odd-one-out.type.js +3 -1
- package/dist/components/questions/_shared/types/listen-and-speak-question-list.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-speak-with-story-images.type.js +3 -1
- package/dist/components/questions/_shared/types/listen-and-tick-answer.type.js +1 -1
- package/dist/components/questions/_shared/types/listening-drawline.type.js +1 -1
- package/dist/components/questions/_shared/types/look-and-choose-answer.type.js +1 -1
- package/dist/components/questions/_shared/types/look-picture-fill-word-hint.type.js +1 -1
- package/dist/components/questions/_shared/types/match-by-writing-answer.type.js +1 -1
- package/dist/components/questions/_shared/types/multiple-choice.type.d.ts +5 -0
- package/dist/components/questions/_shared/types/multiple-choice.type.js +1 -1
- package/dist/components/questions/_shared/types/question-group.type.js +11 -1
- package/dist/components/questions/_shared/types/read-and-color-objects.type.js +1 -1
- package/dist/components/questions/_shared/types/read-displayed-content.type.js +1 -1
- package/dist/components/questions/_shared/types/read-passage-and-answer-questions.type.js +1 -1
- package/dist/components/questions/_shared/types/speaking-describe-image.type.js +1 -1
- package/dist/components/questions/_shared/types/spontaneous-qa-group.type.d.ts +37 -0
- package/dist/components/questions/_shared/types/spontaneous-qa-group.type.js +1 -0
- package/dist/components/questions/_shared/types/spontaneous-qa.type.js +1 -1
- package/dist/components/questions/_shared/types/true-false-group.type.js +1 -1
- package/dist/components/questions/_shared/types/word-fill-paragraph-with-options.type.js +1 -1
- package/dist/components/questions/_shared/types/word-fill-paragraph.type.js +1 -1
- package/dist/components/questions/_shared/types/word-fill-structured-form.type.d.ts +20 -11
- package/dist/components/questions/_shared/types/word-fill-structured-form.type.js +1 -1
- package/dist/components/questions/_shared/types/word-order-and-match-group.type.d.ts +38 -0
- package/dist/components/questions/_shared/types/word-order-and-match-group.type.js +1 -0
- package/dist/components/questions/_shared/types/word-ordering.type.js +1 -1
- package/dist/components/questions/_shared/types/write-a-short-letter.type.js +1 -1
- package/dist/components/questions/_shared/types/write-correct-verb-form.type.js +3 -1
- package/dist/components/questions/_shared/types/write-sentences.type.js +1 -1
- package/dist/components/questions/_shared/types/write-short-paragraph.type.js +1 -1
- package/dist/components/questions/_shared/utils/answer-builder.js +79 -1
- package/dist/components/questions/_shared/utils/createColorRegionRegistration.js +39 -1
- package/dist/components/questions/_shared/utils/id-generator.js +3 -1
- package/dist/components/questions/_shared/utils/parseFillBlankStem.d.ts +30 -0
- package/dist/components/questions/_shared/utils/parseFillBlankStem.js +69 -0
- package/dist/components/questions/_shared/utils/question-validation.js +21 -1
- package/dist/components/questions/components/ColorNode.js +85 -1
- package/dist/components/questions/components/ColorRegionClient.js +545 -1
- package/dist/components/questions/components/ColorRegionCreator.js +420 -1
- package/dist/components/questions/components/ColorRegionNode.js +59 -1
- package/dist/components/questions/components/CreatorGuide.js +103 -1
- package/dist/components/questions/components/NameNode.js +26 -1
- package/dist/components/questions/components/QuestionBankOption.js +46 -1
- package/dist/components/questions/components/QuestionBasicInfoForm.js +9 -1
- package/dist/components/questions/components/QuestionCommonFields.js +33 -1
- package/dist/components/questions/components/QuestionSearchDropdown.js +258 -1
- package/dist/components/questions/components/QuestionTypeSelector.js +32 -1
- package/dist/components/questions/components/QuestionTypeSpecificForms.js +6 -1
- package/dist/components/questions/components/RegionNode.js +94 -1
- package/dist/components/questions/components/index.js +14 -1
- package/dist/components/questions/creator/QuestionCreator.js +90 -1
- package/dist/components/questions/creator/QuestionGroupCreator.js +119 -1
- package/dist/components/questions/creator/dedicated-component-router.js +79 -1
- package/dist/components/questions/creator/index.js +3 -1
- package/dist/components/questions/creator/question-type-registry.js +90 -1
- package/dist/components/questions/groups/ArticlesGroupCard.js +121 -1
- package/dist/components/questions/groups/BasicQuestionGroupCard.js +50 -1
- package/dist/components/questions/groups/DocumentGroupCard.js +114 -1
- package/dist/components/questions/groups/MatchAnswerGroupCard.js +25 -1
- package/dist/components/questions/index.d.ts +1 -0
- package/dist/components/questions/index.js +11 -1
- package/dist/components/questions/question-bank/EditQuestionBankDialog.d.ts +2 -0
- package/dist/components/questions/question-bank/EditQuestionBankDialog.js +114 -0
- package/dist/components/questions/question-bank/QuestionEditorRenderer.d.ts +23 -0
- package/dist/components/questions/question-bank/QuestionEditorRenderer.js +75 -0
- package/dist/components/questions/question-bank/difficulty.d.ts +15 -0
- package/dist/components/questions/question-bank/difficulty.js +33 -0
- package/dist/components/questions/question-bank/editor-adapters/choice-adapters.d.ts +5 -0
- package/dist/components/questions/question-bank/editor-adapters/choice-adapters.js +101 -0
- package/dist/components/questions/question-bank/editor-adapters/index.d.ts +5 -0
- package/dist/components/questions/question-bank/editor-adapters/index.js +4 -0
- package/dist/components/questions/question-bank/editor-adapters/media-adapters.d.ts +6 -0
- package/dist/components/questions/question-bank/editor-adapters/media-adapters.js +140 -0
- package/dist/components/questions/question-bank/editor-adapters/types.d.ts +1 -0
- package/dist/components/questions/question-bank/editor-adapters/types.js +1 -0
- package/dist/components/questions/question-bank/editor-adapters/unsupported-fallback.d.ts +8 -0
- package/dist/components/questions/question-bank/editor-adapters/unsupported-fallback.js +6 -0
- package/dist/components/questions/question-bank/editor-adapters/writing-adapters.d.ts +5 -0
- package/dist/components/questions/question-bank/editor-adapters/writing-adapters.js +114 -0
- package/dist/components/questions/question-bank/index.d.ts +4 -0
- package/dist/components/questions/question-bank/index.js +3 -0
- package/dist/components/questions/question-bank/types.d.ts +59 -0
- package/dist/components/questions/question-bank/types.js +1 -0
- package/dist/components/questions/types/answer-the-question/AnswerTheQuestionClient.js +37 -1
- package/dist/components/questions/types/answer-the-question/AnswerTheQuestionCreator.js +351 -1
- package/dist/components/questions/types/answer-the-question/register.js +67 -1
- package/dist/components/questions/types/answer-the-question/transform.js +36 -1
- package/dist/components/questions/types/arrange-letters-into-words/ArrangeLettersIntoWordsClient.js +141 -1
- package/dist/components/questions/types/arrange-letters-into-words/ArrangeLettersIntoWordsCreator.js +118 -1
- package/dist/components/questions/types/arrange-letters-into-words/index.js +2 -1
- package/dist/components/questions/types/arrange-letters-into-words/register.js +4 -1
- package/dist/components/questions/types/arrange-letters-into-words/transform.js +24 -1
- package/dist/components/questions/types/choose-correct-adjective/ChooseCorrectAdjectiveClient.js +74 -1
- package/dist/components/questions/types/choose-correct-adjective/ChooseCorrectAdjectiveCreator.js +169 -1
- package/dist/components/questions/types/choose-correct-adjective/index.js +2 -1
- package/dist/components/questions/types/choose-correct-adjective/register.js +55 -1
- package/dist/components/questions/types/choose-correct-adjective/transform.js +16 -1
- package/dist/components/questions/types/choose-the-correct-answer/ChooseTheCorrectAnswerClient.js +149 -1
- package/dist/components/questions/types/choose-the-correct-answer/ChooseTheCorrectAnswerCreator.js +568 -1
- package/dist/components/questions/types/choose-the-correct-answer/index.js +3 -1
- package/dist/components/questions/types/choose-the-correct-answer/normalize.d.ts +9 -0
- package/dist/components/questions/types/choose-the-correct-answer/normalize.js +88 -1
- package/dist/components/questions/types/choose-the-correct-answer/register.js +99 -1
- package/dist/components/questions/types/choose-the-correct-answer/transform.js +70 -1
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupClient.js +22 -1
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupCreator.js +163 -1
- package/dist/components/questions/types/choose-the-correct-answer-group/index.js +3 -1
- package/dist/components/questions/types/choose-the-correct-answer-group/map-choose-the-correct-answer-group-data.js +94 -1
- package/dist/components/questions/types/choose-the-correct-answer-group/register.js +36 -1
- package/dist/components/questions/types/choose-the-correct-answer-group/transform.js +55 -1
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupClient.js +27 -1
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupCreator.js +231 -1
- package/dist/components/questions/types/cross-out-word-group/index.js +5 -1
- package/dist/components/questions/types/cross-out-word-group/map-cross-out-word-group-data.d.ts +1 -1
- package/dist/components/questions/types/cross-out-word-group/map-cross-out-word-group-data.js +110 -1
- package/dist/components/questions/types/cross-out-word-group/register.js +36 -1
- package/dist/components/questions/types/cross-out-word-group/transform.js +67 -1
- package/dist/components/questions/types/fill-in-blank/FillInBlankClient.js +275 -1
- package/dist/components/questions/types/fill-in-blank/FillInBlankCreator.js +464 -1
- package/dist/components/questions/types/fill-in-blank/index.js +2 -1
- package/dist/components/questions/types/fill-in-blank/register.js +148 -1
- package/dist/components/questions/types/fill-in-blank/transform.js +88 -1
- package/dist/components/questions/types/fill-missing-words-in-grid/FillMissingWordsInGridClient.js +117 -1
- package/dist/components/questions/types/fill-missing-words-in-grid/FillMissingWordsInGridCreator.js +671 -1
- package/dist/components/questions/types/fill-missing-words-in-grid/index.js +2 -1
- package/dist/components/questions/types/fill-missing-words-in-grid/register.js +37 -1
- package/dist/components/questions/types/fill-missing-words-in-grid/transform.js +15 -1
- package/dist/components/questions/types/gn-speaking-interview/GNSpeakingInterviewCreator.js +262 -1
- package/dist/components/questions/types/gn-speaking-interview/register.js +121 -1
- package/dist/components/questions/types/gn-speaking-interview/transform.js +48 -1
- package/dist/components/questions/types/image-object-matching/ImageObjectMatchingClient.js +16 -1
- package/dist/components/questions/types/image-object-matching/ImageObjectMatchingCreator.js +27 -1
- package/dist/components/questions/types/image-object-matching/index.js +2 -1
- package/dist/components/questions/types/image-object-matching/register.js +3 -1
- package/dist/components/questions/types/image-object-matching/transform.js +2 -1
- package/dist/components/questions/types/label-the-picture/LabelThePictureClient.js +102 -1
- package/dist/components/questions/types/label-the-picture/LabelThePictureCreator.js +344 -1
- package/dist/components/questions/types/label-the-picture/index.js +2 -1
- package/dist/components/questions/types/label-the-picture/register.js +54 -1
- package/dist/components/questions/types/label-the-picture/transform.js +28 -1
- package/dist/components/questions/types/listen-and-choose-from-answer-group/ListenAndChooseFromAnswerGroupClient.js +78 -1
- package/dist/components/questions/types/listen-and-choose-from-answer-group/ListenAndChooseFromAnswerGroupCreator.js +232 -1
- package/dist/components/questions/types/listen-and-choose-from-answer-group/index.js +2 -1
- package/dist/components/questions/types/listen-and-choose-from-answer-group/register.js +82 -1
- package/dist/components/questions/types/listen-and-choose-from-answer-group/transform.js +27 -1
- package/dist/components/questions/types/listen-and-choose-objects-in-scene/ListenAndChooseObjectsInSceneClient.js +70 -1
- package/dist/components/questions/types/listen-and-choose-objects-in-scene/ListenAndChooseObjectsInSceneCreator.js +386 -1
- package/dist/components/questions/types/listen-and-choose-objects-in-scene/index.js +2 -1
- package/dist/components/questions/types/listen-and-choose-objects-in-scene/register.js +100 -1
- package/dist/components/questions/types/listen-and-choose-objects-in-scene/transform.js +33 -1
- package/dist/components/questions/types/listen-and-drag-objects-into-scene/ListenAndDragObjectsIntoSceneClient.js +106 -1
- package/dist/components/questions/types/listen-and-drag-objects-into-scene/ListenAndDragObjectsIntoSceneCreator.js +457 -1
- package/dist/components/questions/types/listen-and-drag-objects-into-scene/index.js +2 -1
- package/dist/components/questions/types/listen-and-drag-objects-into-scene/register.js +110 -1
- package/dist/components/questions/types/listen-and-drag-objects-into-scene/transform.js +35 -1
- package/dist/components/questions/types/listen-and-speak-answer/ArrowIndicator.js +8 -1
- package/dist/components/questions/types/listen-and-speak-answer/ListenAndSpeakAnswerClient.js +22 -1
- package/dist/components/questions/types/listen-and-speak-answer/ListenAndSpeakAnswerCreator.js +291 -1
- package/dist/components/questions/types/listen-and-speak-answer/index.js +2 -1
- package/dist/components/questions/types/listen-and-speak-answer/register.js +84 -1
- package/dist/components/questions/types/listen-and-speak-answer/transform.js +27 -1
- package/dist/components/questions/types/listen-and-speak-compare-images/ListenAndSpeakCompareImagesClient.js +32 -1
- package/dist/components/questions/types/listen-and-speak-compare-images/ListenAndSpeakCompareImagesCreator.js +295 -1
- package/dist/components/questions/types/listen-and-speak-compare-images/register.js +79 -1
- package/dist/components/questions/types/listen-and-speak-compare-images/transform.js +27 -1
- package/dist/components/questions/types/listen-and-speak-image-group/ListenAndSpeakImageGroupClient.js +34 -1
- package/dist/components/questions/types/listen-and-speak-image-group/ListenAndSpeakImageGroupCreator.js +285 -1
- package/dist/components/questions/types/listen-and-speak-image-group/register.js +81 -1
- package/dist/components/questions/types/listen-and-speak-image-group/transform.js +26 -1
- package/dist/components/questions/types/listen-and-speak-info-exchange/ListenAndSpeakInfoExchangeClient.js +38 -1
- package/dist/components/questions/types/listen-and-speak-info-exchange/ListenAndSpeakInfoExchangeCreator.js +385 -1
- package/dist/components/questions/types/listen-and-speak-info-exchange/register.js +87 -1
- package/dist/components/questions/types/listen-and-speak-info-exchange/transform.js +32 -1
- package/dist/components/questions/types/listen-and-speak-odd-one-out/ListenAndSpeakOddOneOutClient.js +26 -1
- package/dist/components/questions/types/listen-and-speak-odd-one-out/ListenAndSpeakOddOneOutCreator.js +247 -1
- package/dist/components/questions/types/listen-and-speak-odd-one-out/register.js +59 -1
- package/dist/components/questions/types/listen-and-speak-odd-one-out/transform.js +18 -1
- package/dist/components/questions/types/listen-and-speak-question-list/ListenAndSpeakQuestionListClient.js +26 -1
- package/dist/components/questions/types/listen-and-speak-question-list/ListenAndSpeakQuestionListCreator.js +256 -1
- package/dist/components/questions/types/listen-and-speak-question-list/register.js +81 -1
- package/dist/components/questions/types/listen-and-speak-question-list/transform.js +26 -1
- package/dist/components/questions/types/listen-and-speak-with-story-images/ListenAndSpeakWithStoryImagesClient.js +26 -1
- package/dist/components/questions/types/listen-and-speak-with-story-images/ListenAndSpeakWithStoryImagesCreator.js +230 -1
- package/dist/components/questions/types/listen-and-speak-with-story-images/register.js +56 -1
- package/dist/components/questions/types/listen-and-speak-with-story-images/transform.js +16 -1
- package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerClient.js +72 -1
- package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerCreator.js +230 -1
- package/dist/components/questions/types/look-picture-choose-correct-answer/index.js +1 -1
- package/dist/components/questions/types/look-picture-choose-correct-answer/register.js +66 -1
- package/dist/components/questions/types/look-picture-choose-correct-answer/transform.js +42 -1
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerClient.js +96 -1
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerCreator.js +238 -1
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/index.js +2 -1
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/register.js +76 -1
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/transform.js +19 -1
- package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintClient.js +134 -1
- package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintCreator.js +617 -1
- package/dist/components/questions/types/look-picture-fill-word-hint/index.js +2 -1
- package/dist/components/questions/types/look-picture-fill-word-hint/register.js +82 -1
- package/dist/components/questions/types/look-picture-fill-word-hint/transform.js +29 -1
- package/dist/components/questions/types/match-by-writing-answer/MatchByWritingAnswerClient.js +38 -1
- package/dist/components/questions/types/match-by-writing-answer/MatchByWritingAnswerCreator.js +359 -1
- package/dist/components/questions/types/match-by-writing-answer/index.js +3 -1
- package/dist/components/questions/types/match-by-writing-answer/register.js +58 -1
- package/dist/components/questions/types/match-by-writing-answer/transform.js +61 -1
- package/dist/components/questions/types/read-and-color-objects/ReadAndColorObjectsClient.js +16 -1
- package/dist/components/questions/types/read-and-color-objects/ReadAndColorObjectsCreator.js +23 -1
- package/dist/components/questions/types/read-and-color-objects/index.js +2 -1
- package/dist/components/questions/types/read-and-color-objects/register.js +3 -1
- package/dist/components/questions/types/read-and-color-objects/transform.js +36 -1
- package/dist/components/questions/types/read-displayed-content/ReadDisplayedContentCreator.js +125 -1
- package/dist/components/questions/types/read-displayed-content/register.js +64 -1
- package/dist/components/questions/types/read-displayed-content/transform.js +12 -1
- package/dist/components/questions/types/read-passage-and-answer-questions/ReadPassageAndAnswerQuestionsClient.js +65 -1
- package/dist/components/questions/types/read-passage-and-answer-questions/ReadPassageAndAnswerQuestionsCreator.js +511 -1
- package/dist/components/questions/types/read-passage-and-answer-questions/index.js +2 -1
- package/dist/components/questions/types/read-passage-and-answer-questions/register.js +58 -1
- package/dist/components/questions/types/read-passage-and-answer-questions/transform.js +28 -1
- package/dist/components/questions/types/speaking-conversation/SpeakingConversationCreator.js +373 -1
- package/dist/components/questions/types/speaking-conversation/SpeakingConversationPreviewClient.js +41 -1
- package/dist/components/questions/types/speaking-conversation/register.js +110 -1
- package/dist/components/questions/types/speaking-conversation/transform.js +34 -1
- package/dist/components/questions/types/speaking-cue-card/SpeakingCueCardCreator.js +74 -1
- package/dist/components/questions/types/speaking-cue-card/register.js +52 -1
- package/dist/components/questions/types/speaking-cue-card/transform.js +12 -1
- package/dist/components/questions/types/speaking-describe-image/SpeakingDescribeImageClient.js +10 -1
- package/dist/components/questions/types/speaking-describe-image/SpeakingDescribeImageCreator.js +161 -1
- package/dist/components/questions/types/speaking-describe-image/index.js +2 -1
- package/dist/components/questions/types/speaking-describe-image/register.js +69 -1
- package/dist/components/questions/types/speaking-describe-image/transform.js +16 -1
- package/dist/components/questions/types/spontaneous-qa/SpontaneousQACreator.js +234 -1
- package/dist/components/questions/types/spontaneous-qa/register.js +93 -1
- package/dist/components/questions/types/spontaneous-qa/transform.js +34 -1
- package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupClient.d.ts +2 -0
- package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupClient.js +9 -0
- package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupCreator.d.ts +2 -0
- package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupCreator.js +179 -0
- package/dist/components/questions/types/spontaneous-qa-group/creator-helpers.d.ts +5 -0
- package/dist/components/questions/types/spontaneous-qa-group/creator-helpers.js +43 -0
- package/dist/components/questions/types/spontaneous-qa-group/flatten.d.ts +14 -0
- package/dist/components/questions/types/spontaneous-qa-group/flatten.js +69 -0
- package/dist/components/questions/types/spontaneous-qa-group/index.d.ts +2 -0
- package/dist/components/questions/types/spontaneous-qa-group/index.js +2 -0
- package/dist/components/questions/types/spontaneous-qa-group/register.d.ts +2 -0
- package/dist/components/questions/types/spontaneous-qa-group/register.js +139 -0
- package/dist/components/questions/types/spontaneous-qa-group/transform.d.ts +2 -0
- package/dist/components/questions/types/spontaneous-qa-group/transform.js +52 -0
- package/dist/components/questions/types/true-false/TrueFalseClient.js +75 -1
- package/dist/components/questions/types/true-false/TrueFalseCreator.js +244 -1
- package/dist/components/questions/types/true-false/index.js +2 -1
- package/dist/components/questions/types/true-false/register.js +77 -1
- package/dist/components/questions/types/true-false/transform.js +32 -1
- package/dist/components/questions/types/true-false-group/TrueFalseGroupClient.js +25 -1
- package/dist/components/questions/types/true-false-group/TrueFalseGroupCreator.js +129 -1
- package/dist/components/questions/types/true-false-group/index.js +5 -1
- package/dist/components/questions/types/true-false-group/map-true-false-group-data.js +69 -1
- package/dist/components/questions/types/true-false-group/register.js +36 -1
- package/dist/components/questions/types/true-false-group/transform.js +43 -1
- package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphClient.js +233 -1
- package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphCreator.js +631 -1
- package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphWrapper.js +28 -1
- package/dist/components/questions/types/word-fill-paragraph/index.js +2 -1
- package/dist/components/questions/types/word-fill-paragraph/register.js +136 -1
- package/dist/components/questions/types/word-fill-paragraph/transform.js +56 -1
- package/dist/components/questions/types/word-fill-structured-form/WfsfWordBankEditor.js +86 -1
- package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormClient.js +246 -1
- package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormCreator.d.ts +2 -0
- package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormCreator.js +484 -1
- package/dist/components/questions/types/word-fill-structured-form/index.js +3 -1
- package/dist/components/questions/types/word-fill-structured-form/map-wfsf-question-data.js +113 -1
- package/dist/components/questions/types/word-fill-structured-form/register.js +36 -1
- package/dist/components/questions/types/word-fill-structured-form/transform.js +77 -1
- package/dist/components/questions/types/word-fill-structured-form/wfsf-word-bank.utils.js +110 -1
- package/dist/components/questions/types/word-order-and-match-group/WordOrderAndMatchGroupClient.d.ts +3 -0
- package/dist/components/questions/types/word-order-and-match-group/WordOrderAndMatchGroupClient.js +190 -0
- package/dist/components/questions/types/word-order-and-match-group/WordOrderAndMatchGroupCreator.d.ts +3 -0
- package/dist/components/questions/types/word-order-and-match-group/WordOrderAndMatchGroupCreator.js +182 -0
- package/dist/components/questions/types/word-order-and-match-group/index.d.ts +4 -0
- package/dist/components/questions/types/word-order-and-match-group/index.js +4 -0
- package/dist/components/questions/types/word-order-and-match-group/register.d.ts +2 -0
- package/dist/components/questions/types/word-order-and-match-group/register.js +121 -0
- package/dist/components/questions/types/word-order-and-match-group/transform.d.ts +2 -0
- package/dist/components/questions/types/word-order-and-match-group/transform.js +70 -0
- package/dist/components/questions/types/word-ordering/WordOrderingClient.js +84 -1
- package/dist/components/questions/types/word-ordering/WordOrderingCreator.js +192 -1
- package/dist/components/questions/types/word-ordering/index.js +2 -1
- package/dist/components/questions/types/word-ordering/register.js +46 -1
- package/dist/components/questions/types/word-ordering/transform.js +24 -1
- package/dist/components/questions/types/write-a-short-letter/WriteAShortLetterClient.js +99 -1
- package/dist/components/questions/types/write-a-short-letter/WriteAShortLetterCreator.js +320 -1
- package/dist/components/questions/types/write-a-short-letter/index.js +2 -1
- package/dist/components/questions/types/write-a-short-letter/register.js +68 -1
- package/dist/components/questions/types/write-a-short-letter/transform.js +25 -1
- package/dist/components/questions/types/write-correct-verb-form/WriteCorrectVerbFormClient.js +61 -1
- package/dist/components/questions/types/write-correct-verb-form/WriteCorrectVerbFormCreator.js +196 -1
- package/dist/components/questions/types/write-correct-verb-form/index.js +2 -1
- package/dist/components/questions/types/write-correct-verb-form/register.js +62 -1
- package/dist/components/questions/types/write-correct-verb-form/transform.js +17 -1
- package/dist/components/questions/types/write-sentences/WriteSentencesClient.js +22 -1
- package/dist/components/questions/types/write-sentences/WriteSentencesCreator.js +174 -1
- package/dist/components/questions/types/write-sentences/index.js +2 -1
- package/dist/components/questions/types/write-sentences/register.js +58 -1
- package/dist/components/questions/types/write-sentences/transform.js +28 -1
- package/dist/components/questions/types/write-short-paragraph/WriteShortParagraphClient.js +96 -1
- package/dist/components/questions/types/write-short-paragraph/WriteShortParagraphCreator.js +161 -1
- package/dist/components/questions/types/write-short-paragraph/index.js +2 -1
- package/dist/components/questions/types/write-short-paragraph/register.js +4 -1
- package/dist/components/questions/types/write-short-paragraph/transform.js +21 -1
- package/dist/components/questions/viewer/ChooseTheCorrectAnswerGroupViewer.js +11 -1
- package/dist/components/questions/viewer/CrossOutWordGroupViewer.js +8 -1
- package/dist/components/questions/viewer/QuestionGroupViewer.js +36 -1
- package/dist/components/questions/viewer/QuestionViewer.js +692 -1
- package/dist/components/questions/viewer/SpontaneousQaGroupViewer.d.ts +2 -1
- package/dist/components/questions/viewer/SpontaneousQaGroupViewer.js +82 -1
- package/dist/components/questions/viewer/TrueFalseGroupViewer.js +11 -1
- package/dist/components/questions/viewer/WordFillStructuredFormViewer.js +14 -1
- package/dist/components/questions/viewer/WordOrderAndMatchGroupViewer.d.ts +3 -1
- package/dist/components/questions/viewer/WordOrderAndMatchGroupViewer.js +95 -1
- package/dist/components/questions/viewer/index.js +8 -1
- package/dist/components/results/ResultReviewPageContainer.js +220 -1
- package/dist/components/results/ReviewQuestionRenderer.js +55 -1
- package/dist/components/results/hooks/useResultReviewPolling.js +76 -1
- package/dist/components/results/index.js +22 -1
- package/dist/components/results/renderers/QuestionExplanations.js +19 -1
- package/dist/components/results/renderers/ReviewChooseAdjectiveRenderer.js +94 -1
- package/dist/components/results/renderers/ReviewChooseBestAnswerRenderer.js +75 -1
- package/dist/components/results/renderers/ReviewColoringRenderer.js +110 -1
- package/dist/components/results/renderers/ReviewListenAndWriteRenderer.js +48 -1
- package/dist/components/results/renderers/ReviewListenChooseAnswerGroupRenderer.js +87 -1
- package/dist/components/results/renderers/ReviewListenChooseObjectsRenderer.js +104 -1
- package/dist/components/results/renderers/ReviewListenDragObjectsRenderer.js +123 -1
- package/dist/components/results/renderers/ReviewListeningHeader.js +104 -1
- package/dist/components/results/renderers/ReviewSpeakingAIPanel.js +116 -1
- package/dist/components/results/renderers/ReviewSpeakingMedia.js +48 -1
- package/dist/components/results/renderers/ReviewSpeakingQuestionItem.js +42 -1
- package/dist/components/results/renderers/ReviewSpeakingRenderer.js +12 -1
- package/dist/components/results/renderers/ReviewSpeakingRenderer.types.js +85 -1
- package/dist/components/results/renderers/review-question-body-dedicated.js +104 -1
- package/dist/components/results/renderers/review-question-body-movers.js +148 -1
- package/dist/components/results/renderers/review-speaking-map.js +226 -1
- package/dist/components/results/renderers/review-spontaneous-qa-group.d.ts +4 -0
- package/dist/components/results/renderers/review-spontaneous-qa-group.js +74 -0
- package/dist/components/results/report/BadgeTitle.js +5 -1
- package/dist/components/results/report/ExamSkillRow.js +20 -1
- package/dist/components/results/report/OceanEduExamReport.js +58 -1
- package/dist/components/results/report/OceanEduSpeakingReport.js +62 -1
- package/dist/components/results/report/OverallAssessmentSection.js +17 -1
- package/dist/components/results/report/ResultErrorState.js +18 -1
- package/dist/components/results/report/ResultLoadingState.js +10 -1
- package/dist/components/results/report/ResultNotPublicState.js +27 -1
- package/dist/components/results/report/SpeakingReportParts.js +14 -1
- package/dist/components/results/report/SpeakingReportShared.js +86 -1
- package/dist/components/results/report/SpeakingRubricSection.js +171 -1
- package/dist/components/results/report/speaking-report.utils.js +198 -1
- package/dist/components/results/result-review.utils.js +6 -1
- package/dist/components/results/review-data.js +222 -1
- package/dist/components/results/review-renderer.utils.js +97 -1
- package/dist/components/results/review-status.utils.js +36 -1
- package/dist/components/results/review-types.js +1 -1
- package/dist/components/results/speaking/SpeakingResultAudioPlayer.js +77 -1
- package/dist/components/results/speaking/SpeakingReviewResult.js +48 -1
- package/dist/components/results/utils/review-score.utils.js +72 -1
- package/dist/components/results/utils/speaking-summary.js +224 -1
- package/dist/components/results/utils/transform-speaking-review.js +183 -1
- package/dist/components/shared/RichTextEditor.d.ts +9 -0
- package/dist/components/shared/RichTextEditor.js +47 -0
- package/dist/components/shared/audio/SpeakingAudioPlayer.js +100 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleAudioPlayer.js +140 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleBottomNav.js +10 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleExamLayout.d.ts +1 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleExamLayout.js +18 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleExampleText.js +11 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleHeader.js +11 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleInstructionBanner.d.ts +2 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleInstructionBanner.js +19 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleNavButton.js +13 -1
- package/dist/components/themes/cambridge-yle/CambridgeYlePartBanner.d.ts +1 -1
- package/dist/components/themes/cambridge-yle/CambridgeYlePartBanner.js +3 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleProgressBar.js +6 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleQuestionCard.js +5 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleQuestionCardFullWidth.js +9 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleSidebar.d.ts +2 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleSidebar.js +61 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleTimer.d.ts +1 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleTimer.js +25 -1
- package/dist/components/themes/cambridge-yle/index.js +13 -1
- package/dist/components/themes/english-certification/EcAnswerTheQuestion.js +25 -1
- package/dist/components/themes/english-certification/EcMatchByWritingAnswer.js +89 -1
- package/dist/components/themes/english-certification/EcWordFillParagraph.js +56 -1
- package/dist/components/themes/english-certification/EcWordFillStructuredForm.js +192 -1
- package/dist/components/themes/english-certification/EcWritingTask.js +60 -1
- package/dist/components/themes/english-certification/EnglishCertificationAudioPlayer.js +108 -1
- package/dist/components/themes/english-certification/EnglishCertificationBrand.js +11 -1
- package/dist/components/themes/english-certification/EnglishCertificationExamLayout.js +34 -1
- package/dist/components/themes/english-certification/EnglishCertificationFlagButton.js +15 -1
- package/dist/components/themes/english-certification/EnglishCertificationFooterBar.js +19 -1
- package/dist/components/themes/english-certification/EnglishCertificationGroupedQuestion.js +166 -1
- package/dist/components/themes/english-certification/EnglishCertificationHeader.js +31 -1
- package/dist/components/themes/english-certification/EnglishCertificationInstructionBanner.js +79 -1
- package/dist/components/themes/english-certification/EnglishCertificationNavigationPanel.js +71 -1
- package/dist/components/themes/english-certification/EnglishCertificationOptionSelector.js +79 -1
- package/dist/components/themes/english-certification/EnglishCertificationPartHeader.js +47 -1
- package/dist/components/themes/english-certification/EnglishCertificationPassagePanel.js +77 -1
- package/dist/components/themes/english-certification/EnglishCertificationQuestionCard.js +25 -1
- package/dist/components/themes/english-certification/EnglishCertificationQuestionItem.js +36 -1
- package/dist/components/themes/english-certification/EnglishCertificationQuestionRenderer.js +81 -1
- package/dist/components/themes/english-certification/EnglishCertificationReadingSection.js +95 -1
- package/dist/components/themes/english-certification/EnglishCertificationSingleQuestion.js +18 -1
- package/dist/components/themes/english-certification/EnglishCertificationSingleQuestionList.js +32 -1
- package/dist/components/themes/english-certification/english-cert-scroll.js +163 -1
- package/dist/components/themes/english-certification/english-certification-theme.js +58 -1
- package/dist/components/themes/english-certification/grouped-question-utils.js +243 -1
- package/dist/components/themes/english-certification/index.js +24 -1
- package/dist/components/themes/index.js +25 -1
- package/dist/components/themes/summer-sky/SummerSkyAudioPlayer.js +170 -1
- package/dist/components/themes/summer-sky/SummerSkyExitModal.js +21 -1
- package/dist/components/themes/summer-sky/SummerSkyLayout.js +221 -1
- package/dist/components/themes/summer-sky/SummerSkySubmitModal.js +18 -1
- package/dist/components/themes/summer-sky/SummerSkyWaitingRoom.js +193 -1
- package/dist/components/themes/types.js +1 -1
- package/dist/components/ui/alert-dialog.js +26 -1
- package/dist/components/ui/alert.js +22 -1
- package/dist/components/ui/avatar.js +12 -1
- package/dist/components/ui/badge.js +38 -1
- package/dist/components/ui/button.js +35 -1
- package/dist/components/ui/calendar.js +76 -1
- package/dist/components/ui/card.js +16 -1
- package/dist/components/ui/carousel.js +91 -1
- package/dist/components/ui/checkbox.js +9 -1
- package/dist/components/ui/collapsible.js +13 -1
- package/dist/components/ui/command.js +34 -1
- package/dist/components/ui/confirm-dialog.js +49 -1
- package/dist/components/ui/dialog.js +23 -1
- package/dist/components/ui/drawer.js +35 -1
- package/dist/components/ui/dropdown-menu.js +33 -1
- package/dist/components/ui/file-upload.js +155 -1
- package/dist/components/ui/form.js +62 -1
- package/dist/components/ui/hover-card.js +10 -1
- package/dist/components/ui/image-preview.js +29 -1
- package/dist/components/ui/input.js +8 -1
- package/dist/components/ui/label.js +9 -1
- package/dist/components/ui/language-switcher.js +15 -1
- package/dist/components/ui/multi-select.js +90 -1
- package/dist/components/ui/points-input.js +33 -1
- package/dist/components/ui/popover.js +26 -1
- package/dist/components/ui/progress.js +16 -1
- package/dist/components/ui/radio-group.js +12 -1
- package/dist/components/ui/scroll-area.js +11 -1
- package/dist/components/ui/select.js +38 -1
- package/dist/components/ui/separator.js +8 -1
- package/dist/components/ui/sheet.js +40 -1
- package/dist/components/ui/single-select.js +76 -1
- package/dist/components/ui/skeleton.js +6 -1
- package/dist/components/ui/switch.js +8 -1
- package/dist/components/ui/table.js +20 -1
- package/dist/components/ui/tabs.js +17 -1
- package/dist/components/ui/textarea.js +8 -1
- package/dist/components/ui/tooltip.js +11 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +24 -1
- package/dist/shared/constants/ApiConstant.d.ts +1 -0
- package/dist/shared/constants/ApiConstant.js +278 -1
- package/dist/shared/constants/QueryKeyConstant.js +112 -1
- package/dist/shared/constants/exam-level.enum.js +41 -1
- package/dist/shared/constants/landings/placement-test.constants.js +431 -1
- package/dist/shared/constants/question-skills.js +277 -1
- package/dist/shared/constants/routes.js +81 -1
- package/dist/shared/index.js +10 -1
- package/dist/shared/lib/hooks/index.js +10 -1
- package/dist/shared/lib/hooks/useAlertDialog.js +57 -1
- package/dist/shared/lib/hooks/useAudioPlayCounter.js +30 -1
- package/dist/shared/lib/hooks/useAudioPreview.js +81 -1
- package/dist/shared/lib/hooks/useAudioUpload.js +24 -1
- package/dist/shared/lib/hooks/useConfirmDialog.js +89 -1
- package/dist/shared/lib/hooks/useDebouncedCallback.js +32 -1
- package/dist/shared/lib/hooks/useDelayedAutoPlay.js +12 -1
- package/dist/shared/lib/hooks/useFileUpload.js +24 -1
- package/dist/shared/lib/hooks/useImageUrl.js +5 -1
- package/dist/shared/lib/hooks/usePresignedFileUrl.js +108 -1
- package/dist/shared/lib/hooks/useReactHookForm.js +31 -1
- package/dist/shared/lib/hooks/useToast.js +62 -1
- package/dist/shared/lib/html-content.js +22 -1
- package/dist/shared/lib/i18n/index.js +54 -1
- package/dist/shared/lib/i18n/messages/en/admin.d.ts +11 -4
- package/dist/shared/lib/i18n/messages/en/admin.js +2111 -1
- package/dist/shared/lib/i18n/messages/en/auth.js +86 -1
- package/dist/shared/lib/i18n/messages/en/common.js +140 -1
- package/dist/shared/lib/i18n/messages/en/file-upload.js +18 -1
- package/dist/shared/lib/i18n/messages/en/student.js +133 -1
- package/dist/shared/lib/i18n/messages/en/terms.js +37 -1
- package/dist/shared/lib/i18n/messages/en.d.ts +11 -4
- package/dist/shared/lib/i18n/messages/en.js +15 -1
- package/dist/shared/lib/i18n/messages/vi/admin.d.ts +11 -4
- package/dist/shared/lib/i18n/messages/vi/admin.js +2111 -1
- package/dist/shared/lib/i18n/messages/vi/auth.js +86 -1
- package/dist/shared/lib/i18n/messages/vi/common.js +140 -1
- package/dist/shared/lib/i18n/messages/vi/file-upload.js +18 -1
- package/dist/shared/lib/i18n/messages/vi/student.js +133 -1
- package/dist/shared/lib/i18n/messages/vi/terms.js +37 -1
- package/dist/shared/lib/i18n/messages/vi.d.ts +11 -4
- package/dist/shared/lib/i18n/messages/vi.js +15 -1
- package/dist/shared/lib/i18n/types.js +1 -1
- package/dist/shared/lib/stores/examQuestionStore.js +212 -1
- package/dist/shared/lib/stores/examTakingStore.js +240 -1
- package/dist/shared/lib/stores/gradingTransientStore.js +39 -1
- package/dist/shared/lib/stores/localeStore.js +10 -1
- package/dist/shared/lib/themes/config/starters.config.js +71 -1
- package/dist/shared/lib/themes/index.js +49 -1
- package/dist/shared/lib/themes/types.js +2 -1
- package/dist/shared/lib/toast.js +43 -1
- package/dist/shared/lib/utils/public-page.js +44 -1
- package/dist/shared/lib/utils/question-reverse-transform.js +438 -1
- package/dist/shared/lib/utils/question-transform-types.js +1 -1
- package/dist/shared/lib/utils/question-transform-validation.js +194 -1
- package/dist/shared/lib/utils/question-transform.js +199 -1
- package/dist/shared/lib/utils.js +168 -1
- package/dist/shared/lib/validation/choose-correct-answer.validation.js +111 -1
- package/dist/shared/lib/validation/label-the-picture.validation.js +19 -1
- package/dist/shared/lib/validation/listen-and-choose-from-answer-group.validation.js +46 -1
- package/dist/shared/lib/validation/listen-and-choose-objects-in-scene.validation.js +21 -1
- package/dist/shared/lib/validation/listen-and-drag-objects-into-scene.validation.js +34 -1
- package/dist/shared/lib/validation/listen-and-speak-answer.validation.js +40 -1
- package/dist/shared/lib/validation/listen-and-speak-compare-images.validation.js +45 -1
- package/dist/shared/lib/validation/listen-and-speak-image-group.validation.js +19 -1
- package/dist/shared/lib/validation/listen-and-speak-info-exchange.validation.js +39 -1
- package/dist/shared/lib/validation/listen-and-speak-odd-one-out.validation.js +32 -1
- package/dist/shared/lib/validation/listen-and-speak-question-list.validation.js +19 -1
- package/dist/shared/lib/validation/listen-and-speak-with-story-images.validation.js +28 -1
- package/dist/shared/lib/validation/look-picture-choose-correct-answer.validation.js +12 -1
- package/dist/shared/lib/validation/look-picture-fill-blank-choose-answer.validation.js +47 -1
- package/dist/shared/lib/validation/read-and-color-objects.validation.js +29 -1
- package/dist/shared/lib/validation/read-displayed-content.validation.js +28 -1
- package/dist/shared/lib/validation/speaking-conversation.validation.js +75 -1
- package/dist/shared/lib/validation/speaking-describe-image.validation.js +31 -1
- package/dist/shared/lib/validation/spontaneous-qa.validation.js +48 -1
- package/dist/shared/lib/validation/word-fill-paragraph-default.validation.js +38 -1
- package/dist/shared/lib/validation/word-fill-paragraph-with-options.validation.js +39 -1
- package/dist/shared/lib/validation/word-fill-paragraph.validation.js +43 -1
- package/dist/shared/lib/validation/word-ordering.validation.js +33 -1
- package/dist/shared/types/branch.types.js +6 -1
- package/dist/shared/types/common.types.js +49 -1
- package/dist/shared/types/entities/exam-schedule.types.js +5 -1
- package/dist/shared/types/entities/exam.types.js +1 -1
- package/dist/shared/types/entities/question.types.js +4 -1
- package/dist/shared/types/entities/result.types.js +4 -1
- package/dist/shared/types/entities/user.types.js +4 -1
- package/dist/shared/types/exam-taking.types.js +2 -1
- package/dist/shared/types/history.types.js +34 -1
- package/dist/shared/types/index.js +1 -1
- package/dist/shared/types/questions/choose-correct-adjective.js +4 -1
- package/dist/shared/types/questions/choose-the-correct-answer-group.d.ts +1 -0
- package/dist/shared/types/questions/choose-the-correct-answer-group.js +1 -1
- package/dist/shared/types/questions/choose-the-correct-answer.js +9 -1
- package/dist/shared/types/questions/cross-out-word-group.d.ts +2 -0
- package/dist/shared/types/questions/cross-out-word-group.js +1 -1
- package/dist/shared/types/questions/fill-missing-words-in-grid.js +11 -1
- package/dist/shared/types/questions/index.d.ts +1 -0
- package/dist/shared/types/questions/index.js +46 -1
- package/dist/shared/types/questions/listen-and-speak-answer.js +1 -1
- package/dist/shared/types/questions/listen-and-speak-compare-images.js +1 -1
- package/dist/shared/types/questions/listen-and-speak-image-group.js +1 -1
- package/dist/shared/types/questions/listen-and-speak-info-exchange.js +3 -1
- package/dist/shared/types/questions/listen-and-speak-odd-one-out.js +3 -1
- package/dist/shared/types/questions/listen-and-speak-question-list.js +1 -1
- package/dist/shared/types/questions/listen-and-speak-with-story-images.js +3 -1
- package/dist/shared/types/questions/look-picture-choose-correct-answer.js +5 -1
- package/dist/shared/types/questions/look-picture-fill-blank-choose-answer.js +9 -1
- package/dist/shared/types/questions/look-picture-fill-word-hint.js +7 -1
- package/dist/shared/types/questions/read-displayed-content.js +1 -1
- package/dist/shared/types/questions/speaking-conversation.js +7 -1
- package/dist/shared/types/questions/speaking-describe-image.js +1 -1
- package/dist/shared/types/questions/spontaneous-qa.js +1 -1
- package/dist/shared/types/questions/word-order-and-match-group.d.ts +33 -0
- package/dist/shared/types/questions/word-order-and-match-group.js +1 -0
- package/dist/shared/types/questions/write-correct-verb-form.js +12 -1
- package/dist/shared/types/role.types.js +1 -1
- package/dist/shared/types/structure-management.js +28 -1
- package/dist/shared/types/student.types.js +57 -1
- package/dist/shared/types/teacher-dashboard-rooms.js +2 -1
- package/package.json +184 -166
- package/dist/mcp/config.d.ts +0 -12
- package/dist/mcp/config.js +0 -1
- package/dist/mcp/http-client.d.ts +0 -6
- package/dist/mcp/http-client.js +0 -1
- package/dist/mcp/index.d.ts +0 -6
- package/dist/mcp/index.js +0 -2
- package/dist/mcp/tools/_helpers.d.ts +0 -4
- package/dist/mcp/tools/_helpers.js +0 -1
- package/dist/mcp/tools/exams.d.ts +0 -2
- package/dist/mcp/tools/exams.js +0 -1
- package/dist/mcp/tools/index.d.ts +0 -2
- package/dist/mcp/tools/index.js +0 -1
- package/dist/mcp/tools/results.d.ts +0 -2
- package/dist/mcp/tools/results.js +0 -1
|
@@ -1 +1,121 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useEffect as a,useMemo as n,useRef as i,useState as s}from"react";import{ArrowLeft as r,ArrowRight as l,Eye as d,Loader2 as m}from"lucide-react";import{Badge as c}from"../../components/ui/badge";import{Button as o}from"../../components/ui/button";import{Card as p,CardContent as x,CardHeader as u,CardTitle as h}from"../../components/ui/card";import{Dialog as g,DialogContent as f,DialogHeader as N,DialogTitle as v}from"../../components/ui/dialog";import{Progress as b}from"../../components/ui/progress";import{useT as y}from"../../shared/lib/i18n";import{QuestionViewer as w}from"../questions/viewer/QuestionViewer";function j(e){return e&&"object"==typeof e&&"data"in e?e.data:e}function I(e){switch(e?.toUpperCase()){case"EASY":return"bg-green-100 text-green-800";case"MEDIUM":return"bg-orange-100 text-orange-800";case"HARD":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}}export function ExamPreviewDialog({open:q,onOpenChange:S,examId:C,api:Q,title:k}){const E=y(),[P,z]=s(null),[A,M]=s([]),[$,D]=s(0),[T,O]=s("all"),[R,U]=s(!1),[H,V]=s(!1),[Y,B]=s(null),[F,G]=s(0),J=i(null);a(()=>{if(!q||!C)return;let e=!1;return V(!0),B(null),D(0),O("all"),(async()=>{try{const t=j(await Q.getExam(C)),a=Q.getQuestions?j(await Q.getQuestions(C)):[];if(e)return;const n=[...a].sort((e,t)=>(e.questionNumber??0)-(t.questionNumber??0));z(t),M(n)}catch{e||B(E("admin.exams.preview.loadError"))}finally{e||V(!1)}})(),()=>{e=!0}},[q,C,F,Q,E]),a(()=>{q||(z(null),M([]),D(0),O("all"),U(!1),B(null))},[q]);const K=n(()=>{const e=(P?.template?.parts??[]).map(e=>({id:e.id,name:e.name||e.title})),t=new Set(e.map(e=>e.id));for(const a of A){const n=a.partId??"";n&&!t.has(n)&&(t.add(n),e.push({id:n}))}return e},[P,A]),L=e=>{const t=K.findIndex(t=>t.id===(e??""));return t>=0?t+1:1},W=n(()=>{const e=new Map;for(const t of A){const a=t.partId??"";if(!e.has(a)){const t=K.findIndex(e=>e.id===a),n=t>=0?t+1:1;e.set(a,{partId:a,partNo:n,partName:K[t]?.name||`Part ${n}`,questions:[]})}e.get(a).questions.push(t)}return Array.from(e.values()).sort((e,t)=>e.partNo-t.partNo)},[A,K]),X=P?.name??k??"",Z=P?.template?.totalTime??P?.duration??0,_=function(e){return e.reduce((e,t)=>e+(Number(t.points)||0),0)}(A),ee=A[$],te=A.length>0?($+1)/A.length*100:0,ae=e=>{D(e),J.current?.scrollTo({top:0,behavior:"smooth"})},ne="all"===T?A:A.filter(e=>L(e.partId)===T);return e(g,{open:q,onOpenChange:S,children:t(f,{className:"max-h-[95vh] max-w-7xl overflow-y-auto",children:[e(N,{children:t(v,{className:"flex items-center gap-2",children:[e(d,{className:"h-5 w-5 text-blue-600"}),E("admin.exams.preview.title",{name:X})]})}),t("div",{className:"flex h-[80vh] flex-col gap-4 sm:flex-row",children:[e("div",{className:"w-full overflow-y-auto border-b border-gray-200 sm:w-80 sm:border-b-0 sm:border-r",children:t("div",{className:"space-y-4 p-4",children:[t(p,{children:[e(u,{className:"pb-3",children:e(h,{className:"text-base",children:E("admin.exams.preview.examInfo")})}),t(x,{className:"space-y-3",children:[t("div",{className:"flex items-center justify-between",children:[e("span",{className:"text-sm text-gray-600",children:E("admin.exams.preview.duration")}),e("span",{className:"text-sm font-medium",children:E("admin.exams.view.minutes",{count:String(Z)})})]}),t("div",{className:"flex items-center justify-between",children:[e("span",{className:"text-sm text-gray-600",children:E("admin.exams.preview.questionCount")}),e("span",{className:"text-sm font-medium",children:H?"...":E("admin.exams.preview.questions",{count:String(A.length)})})]}),t("div",{className:"flex items-center justify-between",children:[e("span",{className:"text-sm text-gray-600",children:E("admin.exams.preview.totalPoints")}),e("span",{className:"text-sm font-medium",children:E("admin.exams.preview.points",{count:String(_)})})]})]})]}),!H&&A.length>0&&e(p,{children:e(x,{className:"p-4",children:t("div",{className:"space-y-2",children:[t("div",{className:"flex justify-between text-sm",children:[e("span",{children:E("admin.exams.preview.progress")}),t("span",{className:"font-medium",children:[$+1,"/",A.length]})]}),e(b,{value:te,className:"h-2"})]})})}),H?e("div",{className:"flex items-center justify-center py-4",children:t("div",{className:"flex items-center gap-2 text-gray-500",children:[e(m,{className:"h-4 w-4 animate-spin"}),e("span",{className:"text-sm",children:E("admin.exams.preview.loading")})]})}):A.length>0&&t("div",{className:"space-y-3",children:[e("h4",{className:"text-sm font-medium text-gray-700",children:E("admin.exams.preview.questionNavigation")}),t("div",{className:"flex flex-wrap gap-2",children:[e(o,{variant:"all"===T?"default":"outline",size:"sm",onClick:()=>O("all"),className:"h-8 px-3 text-xs font-medium",children:E("admin.exams.preview.all")}),W.map(e=>t(o,{variant:T===e.partNo?"default":"outline",size:"sm",onClick:()=>{O(e.partNo);const t=e.questions[0];if(t){const e=A.findIndex(e=>e.id===t.id);-1!==e&&ae(e)}},className:"h-8 px-3 text-xs font-medium",children:["P",e.partNo]},e.partId||`part-${e.partNo}`))]}),e("div",{className:"rounded bg-gray-50 p-2 text-xs",children:e("span",{className:"font-medium",children:"all"===T?E("admin.exams.preview.allQuestions",{count:String(A.length)}):E("admin.exams.preview.partQuestions",{part:String(T),count:String(W.find(e=>e.partNo===T)?.questions.length??0)})})}),e("div",{className:"rounded-lg bg-gray-50 p-3",children:e("div",{className:"grid max-h-64 grid-cols-6 gap-2 overflow-y-auto pr-2",children:ne.map(t=>{const a=A.findIndex(e=>e.id===t.id);return e(o,{variant:"ghost",size:"sm",onClick:()=>ae(a),className:"h-8 w-full p-0 text-xs font-medium transition-all duration-200 "+(a===$?"border-2 border-blue-500 bg-blue-500 text-white hover:bg-blue-600":"border border-gray-300 bg-white hover:bg-gray-100"),children:t.questionNumber},t.id)})})})]}),!H&&A.length>0&&t("div",{children:[t("div",{className:"mb-2 flex items-center justify-between",children:[e("h4",{className:"text-sm font-medium text-gray-700",children:X}),e(o,{variant:"ghost",size:"sm",onClick:()=>U(e=>!e),className:"h-6 px-2 text-xs text-gray-600 hover:text-gray-900",children:E(R?"admin.exams.preview.collapse":"admin.exams.preview.detail")})]}),e("div",{className:"rounded-lg bg-gray-50 p-3",children:t("div",{className:"flex items-center justify-between",children:[t("div",{children:[t("span",{className:"text-sm font-medium text-gray-900",children:["Total: ",E("admin.exams.preview.questions",{count:String(A.length)})]}),e("div",{className:"mt-1 flex gap-3",children:t("span",{className:"text-xs text-gray-600",children:[W.length," part(s)"]})})]}),e("div",{className:"text-xs text-gray-500",children:E("admin.exams.view.minutes",{count:String(Z)})})]})}),R&&e("div",{className:"mt-3 space-y-2",children:W.map(a=>{const n=L(ee?.partId)===a.partNo;return e("div",{className:"cursor-pointer rounded-lg border-2 p-3 transition-all duration-200 "+(n?"border-blue-400 bg-blue-50 shadow-md":"border-gray-200 bg-white hover:border-gray-300"),onClick:()=>{const e=a.questions[0];if(e){const t=A.findIndex(t=>t.id===e.id);-1!==t&&(ae(t),O(a.partNo))}},children:t("div",{className:"flex items-center justify-between",children:[e("span",{className:"text-sm font-medium "+(n?"text-blue-900":"text-gray-900"),children:a.partName}),e(c,{variant:"secondary",className:"text-xs "+(n?"bg-blue-200 text-blue-800":"bg-gray-100 text-gray-700"),children:E("admin.exams.preview.questions",{count:String(a.questions.length)})})]})},a.partId||`part-${a.partNo}`)})})]})]})}),e("div",{className:"flex-1 overflow-y-auto",children:t("div",{className:"flex h-full flex-col",children:[t("div",{className:"flex items-center justify-between border-b pb-4",children:[t("div",{children:[e("h3",{className:"text-lg font-semibold",children:H?e("span",{className:"text-gray-400",children:E("admin.exams.preview.loading")}):A.length>0?E("admin.exams.preview.questionIndex",{index:String($+1),total:String(A.length)}):E("admin.exams.preview.noQuestions")}),ee&&e("div",{className:"mt-1 inline-flex items-center gap-2 rounded-lg border border-blue-200 bg-blue-50 px-3 py-1.5",children:e("span",{className:"text-sm font-semibold text-blue-700",children:(e=>{const t=K.findIndex(t=>t.id===(e??""));return K[t]?.name||`Part ${t>=0?t+1:1}`})(ee.partId)})})]}),ee&&t("div",{className:"flex items-center gap-2",children:[e(c,{variant:"outline",children:E("admin.exams.preview.points",{count:String(Number(ee.points)||1)})}),e(c,{className:I(ee.difficulty),children:ee.difficulty??"N/A"})]})]}),e("div",{ref:J,className:"flex-1 overflow-y-auto py-4",children:H?t("div",{className:"flex flex-col items-center justify-center space-y-4 py-12",children:[e(m,{className:"h-8 w-8 animate-spin text-blue-500"}),e("p",{className:"text-gray-600",children:E("admin.exams.preview.loadingQuestions")})]}):Y?e("div",{className:"flex flex-col items-center justify-center space-y-4 py-12",children:t("div",{className:"rounded-lg border border-red-200 bg-red-50 p-6 text-center",children:[e("p",{className:"font-medium text-red-800",children:Y}),e(o,{variant:"outline",onClick:()=>G(e=>e+1),className:"mt-4",children:E("admin.exams.preview.retry")})]})}):0===A.length?e("div",{className:"flex flex-col items-center justify-center space-y-4 py-12",children:e("div",{className:"rounded-lg border border-yellow-200 bg-yellow-50 p-6 text-center",children:e("p",{className:"font-medium text-yellow-800",children:E("admin.exams.preview.examNoQuestions")})})}):ee?e(w,{question:ee,isReviewMode:!0}):null}),!H&&A.length>0&&t("div",{className:"mt-auto flex items-center justify-between border-t border-gray-200 bg-gray-50 px-4 py-3",children:[t(o,{variant:"outline",onClick:()=>{$>0&&ae($-1)},disabled:0===$,className:"flex h-9 items-center gap-2 px-3 text-sm",children:[e(r,{className:"h-4 w-4"}),e("span",{className:"hidden sm:inline",children:E("admin.exams.preview.prevQuestion")}),e("span",{className:"sm:hidden",children:E("admin.exams.preview.prev")})]}),t("div",{className:"text-sm text-gray-600",children:[$+1," / ",A.length]}),t(o,{variant:"outline",onClick:()=>{$<A.length-1&&ae($+1)},disabled:$===A.length-1,className:"flex h-9 items-center gap-2 px-3 text-sm",children:[e("span",{className:"hidden sm:inline",children:E("admin.exams.preview.nextQuestion")}),e("span",{className:"sm:hidden",children:E("admin.exams.preview.next")}),e(l,{className:"h-4 w-4"})]})]})]})})]}),e("div",{className:"border-t pt-4",children:t("div",{className:"flex items-center justify-between",children:[e("div",{className:"text-sm text-gray-600",children:E("admin.exams.preview.footerNote")}),e(o,{variant:"outline",onClick:()=>S(!1),className:"border-gray-300",children:E("admin.exams.preview.close")})]})})]})})}
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { Eye } from 'lucide-react';
|
|
5
|
+
import { Button } from '../../components/ui/button';
|
|
6
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../../components/ui/dialog';
|
|
7
|
+
import { useT } from '../../shared/lib/i18n';
|
|
8
|
+
import { ExamPreviewPartContent } from './ExamPreviewPartContent';
|
|
9
|
+
import { ExamPreviewSidebar } from './ExamPreviewSidebar';
|
|
10
|
+
import { getQuestionNumber, getQuestionPoints, groupQuestionsByPart, sumQuestionPoints, unwrapApiData, } from './exam-preview.types';
|
|
11
|
+
/**
|
|
12
|
+
* Read-only popup that previews an exam by id.
|
|
13
|
+
*
|
|
14
|
+
* UI mirrors the host app: one Part per screen (all questions of that part),
|
|
15
|
+
* Next/Prev navigates between parts. No attempt is created — data comes from
|
|
16
|
+
* {@link ExamQuestionsSdkApi}. Questions render via QuestionViewer in review mode.
|
|
17
|
+
*/
|
|
18
|
+
export function ExamPreviewDialog({ open, onOpenChange, examId, api, title, }) {
|
|
19
|
+
const t = useT();
|
|
20
|
+
const [exam, setExam] = useState(null);
|
|
21
|
+
const [questions, setQuestions] = useState([]);
|
|
22
|
+
const [currentPartIndex, setCurrentPartIndex] = useState(0);
|
|
23
|
+
const [showPartsDetail, setShowPartsDetail] = useState(false);
|
|
24
|
+
const [loading, setLoading] = useState(false);
|
|
25
|
+
const [error, setError] = useState(null);
|
|
26
|
+
const [reloadKey, setReloadKey] = useState(0);
|
|
27
|
+
const contentRef = useRef(null);
|
|
28
|
+
// Fetch exam + questions whenever the dialog opens for an exam.
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (!open || !examId) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
let cancelled = false;
|
|
34
|
+
setLoading(true);
|
|
35
|
+
setError(null);
|
|
36
|
+
setCurrentPartIndex(0);
|
|
37
|
+
void (async () => {
|
|
38
|
+
try {
|
|
39
|
+
const examData = unwrapApiData((await api.getExam(examId)));
|
|
40
|
+
const rawQuestions = api.getQuestions
|
|
41
|
+
? unwrapApiData((await api.getQuestions(examId)))
|
|
42
|
+
: [];
|
|
43
|
+
if (cancelled) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const sorted = [...rawQuestions].sort((a, b) => getQuestionNumber(a) - getQuestionNumber(b));
|
|
47
|
+
setExam(examData);
|
|
48
|
+
setQuestions(sorted);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
if (!cancelled) {
|
|
52
|
+
setError(t('admin.exams.preview.loadError'));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
if (!cancelled) {
|
|
57
|
+
setLoading(false);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
})();
|
|
61
|
+
return () => {
|
|
62
|
+
cancelled = true;
|
|
63
|
+
};
|
|
64
|
+
}, [open, examId, reloadKey, api, t]);
|
|
65
|
+
// Reset everything when the dialog closes.
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!open) {
|
|
68
|
+
setExam(null);
|
|
69
|
+
setQuestions([]);
|
|
70
|
+
setCurrentPartIndex(0);
|
|
71
|
+
setShowPartsDetail(false);
|
|
72
|
+
setError(null);
|
|
73
|
+
}
|
|
74
|
+
}, [open]);
|
|
75
|
+
const templateParts = (exam?.template?.parts ?? []);
|
|
76
|
+
const questionsByPart = useMemo(() => groupQuestionsByPart(questions, templateParts), [questions, templateParts]);
|
|
77
|
+
// Keep current part index in range when parts change
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (questionsByPart.length === 0) {
|
|
80
|
+
if (currentPartIndex !== 0) {
|
|
81
|
+
setCurrentPartIndex(0);
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (currentPartIndex > questionsByPart.length - 1) {
|
|
86
|
+
setCurrentPartIndex(questionsByPart.length - 1);
|
|
87
|
+
}
|
|
88
|
+
}, [currentPartIndex, questionsByPart.length]);
|
|
89
|
+
const heading = exam?.name ?? title ?? '';
|
|
90
|
+
// Duration lives on the exam (duration) or template (totalTime).
|
|
91
|
+
const duration = exam?.duration ?? exam?.template?.totalTime ?? 0;
|
|
92
|
+
const totalPoints = sumQuestionPoints(questions);
|
|
93
|
+
const currentPart = questionsByPart[currentPartIndex] ?? null;
|
|
94
|
+
const currentPartQuestions = currentPart?.questions ?? [];
|
|
95
|
+
const totalParts = questionsByPart.length;
|
|
96
|
+
const progress = totalParts > 0 ? ((currentPartIndex + 1) / totalParts) * 100 : 0;
|
|
97
|
+
const partDisplayName = currentPart?.partName ?? '';
|
|
98
|
+
const partTotalPoints = currentPartQuestions.reduce((sum, question) => sum + getQuestionPoints(question), 0);
|
|
99
|
+
const scrollToTop = () => {
|
|
100
|
+
contentRef.current?.scrollTo({ top: 0, behavior: 'smooth' });
|
|
101
|
+
};
|
|
102
|
+
const goToPart = (index) => {
|
|
103
|
+
if (index < 0 || index >= totalParts)
|
|
104
|
+
return;
|
|
105
|
+
setCurrentPartIndex(index);
|
|
106
|
+
scrollToTop();
|
|
107
|
+
};
|
|
108
|
+
const goToPreviousPart = () => {
|
|
109
|
+
if (currentPartIndex > 0) {
|
|
110
|
+
setCurrentPartIndex(currentPartIndex - 1);
|
|
111
|
+
scrollToTop();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const goToNextPart = () => {
|
|
115
|
+
if (currentPartIndex < totalParts - 1) {
|
|
116
|
+
setCurrentPartIndex(currentPartIndex + 1);
|
|
117
|
+
scrollToTop();
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "max-h-[95vh] max-w-7xl overflow-y-auto", children: [_jsx(DialogHeader, { children: _jsxs(DialogTitle, { className: "flex items-center gap-2", children: [_jsx(Eye, { className: "h-5 w-5 text-blue-600" }), t('admin.exams.preview.title', { name: heading })] }) }), _jsxs("div", { className: "flex h-[80vh] flex-col gap-4 sm:flex-row", children: [_jsx(ExamPreviewSidebar, { examName: heading, duration: duration, totalPoints: totalPoints, questions: questions, questionsByPart: questionsByPart, currentPart: currentPart, currentPartIndex: currentPartIndex, totalParts: totalParts, progress: progress, loading: loading, showPartsDetail: showPartsDetail, onTogglePartsDetail: () => setShowPartsDetail((value) => !value), onGoToPart: goToPart }), _jsx(ExamPreviewPartContent, { loading: loading, error: error, questions: questions, currentPart: currentPart, currentPartQuestions: currentPartQuestions, currentPartIndex: currentPartIndex, totalParts: totalParts, partDisplayName: partDisplayName, partTotalPoints: partTotalPoints, contentRef: contentRef, onRetry: () => setReloadKey((key) => key + 1), onPreviousPart: goToPreviousPart, onNextPart: goToNextPart })] }), _jsx("div", { className: "border-t pt-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-sm text-gray-600", children: t('admin.exams.preview.footerNote') }), _jsx(Button, { variant: "outline", onClick: () => onOpenChange(false), className: "border-gray-300", children: t('admin.exams.preview.close') })] }) })] }) }));
|
|
121
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import { type PreviewQuestion, type QuestionsByPart } from './exam-preview.types';
|
|
3
|
+
export interface ExamPreviewPartContentProps {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error: string | null;
|
|
6
|
+
questions: PreviewQuestion[];
|
|
7
|
+
currentPart: QuestionsByPart | null;
|
|
8
|
+
currentPartQuestions: PreviewQuestion[];
|
|
9
|
+
currentPartIndex: number;
|
|
10
|
+
totalParts: number;
|
|
11
|
+
partDisplayName: string;
|
|
12
|
+
partTotalPoints: number;
|
|
13
|
+
contentRef: RefObject<HTMLDivElement | null>;
|
|
14
|
+
onRetry: () => void;
|
|
15
|
+
onPreviousPart: () => void;
|
|
16
|
+
onNextPart: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function ExamPreviewPartContent({ loading, error, questions, currentPart, currentPartQuestions, currentPartIndex, totalParts, partDisplayName, partTotalPoints, contentRef, onRetry, onPreviousPart, onNextPart, }: ExamPreviewPartContentProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ArrowLeft, ArrowRight, Loader2 } from 'lucide-react';
|
|
4
|
+
import { Badge } from '../../components/ui/badge';
|
|
5
|
+
import { Button } from '../../components/ui/button';
|
|
6
|
+
import { QuestionViewer } from '../questions/viewer/QuestionViewer';
|
|
7
|
+
import { useT } from '../../shared/lib/i18n';
|
|
8
|
+
import { difficultyBadgeClass, getQuestionDifficulty, getQuestionNumber, getQuestionPoints, } from './exam-preview.types';
|
|
9
|
+
export function ExamPreviewPartContent({ loading, error, questions, currentPart, currentPartQuestions, currentPartIndex, totalParts, partDisplayName, partTotalPoints, contentRef, onRetry, onPreviousPart, onNextPart, }) {
|
|
10
|
+
const t = useT();
|
|
11
|
+
return (_jsx("div", { className: "flex-1 overflow-y-auto", children: _jsxs("div", { className: "flex h-full flex-col", children: [_jsxs("div", { className: "flex items-center justify-between border-b pb-4", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold", children: loading ? (_jsx("span", { className: "text-gray-400", children: t('admin.exams.preview.loading') })) : totalParts > 0 ? (t('admin.exams.preview.partIndex', {
|
|
12
|
+
index: String(currentPartIndex + 1),
|
|
13
|
+
total: String(totalParts),
|
|
14
|
+
})) : (t('admin.exams.preview.noQuestions')) }), currentPart && (_jsxs("div", { className: "mt-1 inline-flex items-center gap-2 rounded-lg border border-blue-200 bg-blue-50 px-3 py-1.5", children: [_jsx("span", { className: "text-sm font-semibold text-blue-700", children: partDisplayName }), _jsx("span", { className: "text-xs text-blue-600", children: t('admin.exams.preview.questions', {
|
|
15
|
+
count: String(currentPartQuestions.length),
|
|
16
|
+
}) })] }))] }), currentPart && (_jsx("div", { className: "flex items-center gap-2", children: _jsx(Badge, { variant: "outline", children: t('admin.exams.preview.points', {
|
|
17
|
+
count: String(partTotalPoints),
|
|
18
|
+
}) }) }))] }), _jsx("div", { ref: contentRef, className: "flex-1 overflow-y-auto py-4", children: loading ? (_jsxs("div", { className: "flex flex-col items-center justify-center space-y-4 py-12", children: [_jsx(Loader2, { className: "h-8 w-8 animate-spin text-blue-500" }), _jsx("p", { className: "text-gray-600", children: t('admin.exams.preview.loadingQuestions') })] })) : error ? (_jsx("div", { className: "flex flex-col items-center justify-center space-y-4 py-12", children: _jsxs("div", { className: "rounded-lg border border-red-200 bg-red-50 p-6 text-center", children: [_jsx("p", { className: "font-medium text-red-800", children: error }), _jsx(Button, { variant: "outline", onClick: onRetry, className: "mt-4", children: t('admin.exams.preview.retry') })] }) })) : questions.length === 0 ? (_jsx("div", { className: "flex flex-col items-center justify-center space-y-4 py-12", children: _jsx("div", { className: "rounded-lg border border-yellow-200 bg-yellow-50 p-6 text-center", children: _jsx("p", { className: "font-medium text-yellow-800", children: t('admin.exams.preview.examNoQuestions') }) }) })) : currentPartQuestions.length > 0 ? (_jsx("div", { className: "space-y-6", children: currentPartQuestions.map((question) => {
|
|
19
|
+
const qNumber = getQuestionNumber(question);
|
|
20
|
+
const difficulty = getQuestionDifficulty(question);
|
|
21
|
+
return (_jsxs("div", { id: `preview-q-${question.id}`, className: "rounded-xl border border-gray-200 bg-white p-4 shadow-sm", children: [_jsxs("div", { className: "mb-3 flex items-center justify-between gap-2 border-b border-gray-100 pb-3", children: [_jsx("span", { className: "inline-flex h-7 min-w-7 items-center justify-center rounded-md bg-blue-100 px-2 text-xs font-bold text-blue-700", children: t('admin.exams.preview.questionLabel', {
|
|
22
|
+
number: String(qNumber),
|
|
23
|
+
}) }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Badge, { variant: "outline", children: t('admin.exams.preview.points', {
|
|
24
|
+
count: String(getQuestionPoints(question)),
|
|
25
|
+
}) }), _jsx(Badge, { className: difficultyBadgeClass(difficulty), children: difficulty })] })] }), _jsx(QuestionViewer, { question: question, isReviewMode: true })] }, question.id));
|
|
26
|
+
}) })) : null }), !loading && totalParts > 0 && (_jsxs("div", { className: "mt-auto flex items-center justify-between border-t border-gray-200 bg-gray-50 px-4 py-3", children: [_jsxs(Button, { variant: "outline", onClick: onPreviousPart, disabled: currentPartIndex === 0, className: "flex h-9 items-center gap-2 px-3 text-sm", children: [_jsx(ArrowLeft, { className: "h-4 w-4" }), _jsx("span", { className: "hidden sm:inline", children: t('admin.exams.preview.prevPart') }), _jsx("span", { className: "sm:hidden", children: t('admin.exams.preview.prev') })] }), _jsxs("div", { className: "text-sm text-gray-600", children: [currentPartIndex + 1, " / ", totalParts] }), _jsxs(Button, { variant: "outline", onClick: onNextPart, disabled: currentPartIndex === totalParts - 1, className: "flex h-9 items-center gap-2 px-3 text-sm", children: [_jsx("span", { className: "hidden sm:inline", children: t('admin.exams.preview.nextPart') }), _jsx("span", { className: "sm:hidden", children: t('admin.exams.preview.next') }), _jsx(ArrowRight, { className: "h-4 w-4" })] })] }))] }) }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type PreviewQuestion, type QuestionsByPart } from './exam-preview.types';
|
|
2
|
+
export interface ExamPreviewSidebarProps {
|
|
3
|
+
examName: string;
|
|
4
|
+
duration: number;
|
|
5
|
+
totalPoints: number;
|
|
6
|
+
questions: PreviewQuestion[];
|
|
7
|
+
questionsByPart: QuestionsByPart[];
|
|
8
|
+
currentPart: QuestionsByPart | null;
|
|
9
|
+
currentPartIndex: number;
|
|
10
|
+
totalParts: number;
|
|
11
|
+
progress: number;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
showPartsDetail: boolean;
|
|
14
|
+
onTogglePartsDetail: () => void;
|
|
15
|
+
onGoToPart: (index: number) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function ExamPreviewSidebar({ examName, duration, totalPoints, questions, questionsByPart, currentPart, currentPartIndex, totalParts, progress, loading, showPartsDetail, onTogglePartsDetail, onGoToPart, }: ExamPreviewSidebarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Badge } from '../../components/ui/badge';
|
|
4
|
+
import { Button } from '../../components/ui/button';
|
|
5
|
+
import { Card, CardContent, CardHeader, CardTitle } from '../../components/ui/card';
|
|
6
|
+
import { Progress } from '../../components/ui/progress';
|
|
7
|
+
import { Loader2 } from 'lucide-react';
|
|
8
|
+
import { useT } from '../../shared/lib/i18n';
|
|
9
|
+
import { getQuestionNumber, } from './exam-preview.types';
|
|
10
|
+
export function ExamPreviewSidebar({ examName, duration, totalPoints, questions, questionsByPart, currentPart, currentPartIndex, totalParts, progress, loading, showPartsDetail, onTogglePartsDetail, onGoToPart, }) {
|
|
11
|
+
const t = useT();
|
|
12
|
+
return (_jsx("div", { className: "w-full overflow-y-auto border-b border-gray-200 sm:w-80 sm:border-b-0 sm:border-r", children: _jsxs("div", { className: "space-y-4 p-4", children: [_jsxs(Card, { children: [_jsx(CardHeader, { className: "pb-3", children: _jsx(CardTitle, { className: "text-base", children: t('admin.exams.preview.examInfo') }) }), _jsxs(CardContent, { className: "space-y-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-sm text-gray-600", children: t('admin.exams.preview.duration') }), _jsx("span", { className: "text-sm font-medium", children: t('admin.exams.view.minutes', { count: String(duration) }) })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-sm text-gray-600", children: t('admin.exams.preview.questionCount') }), _jsx("span", { className: "text-sm font-medium", children: loading
|
|
13
|
+
? '...'
|
|
14
|
+
: t('admin.exams.preview.questions', { count: String(questions.length) }) })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-sm text-gray-600", children: t('admin.exams.preview.totalPoints') }), _jsx("span", { className: "text-sm font-medium", children: t('admin.exams.preview.points', { count: String(totalPoints) }) })] })] })] }), !loading && totalParts > 0 && (_jsx(Card, { children: _jsx(CardContent, { className: "p-4", children: _jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "flex justify-between text-sm", children: [_jsx("span", { children: t('admin.exams.preview.progress') }), _jsxs("span", { className: "font-medium", children: [currentPartIndex + 1, "/", totalParts] })] }), _jsx(Progress, { value: progress, className: "h-2" })] }) }) })), loading ? (_jsx("div", { className: "flex items-center justify-center py-4", children: _jsxs("div", { className: "flex items-center gap-2 text-gray-500", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), _jsx("span", { className: "text-sm", children: t('admin.exams.preview.loading') })] }) })) : (totalParts > 0 && (_jsxs("div", { className: "space-y-3", children: [_jsx("h4", { className: "text-sm font-medium text-gray-700", children: t('admin.exams.preview.questionNavigation') }), _jsx("div", { className: "flex flex-wrap gap-2", children: questionsByPart.map((part, index) => {
|
|
15
|
+
const isCurrent = index === currentPartIndex;
|
|
16
|
+
return (_jsxs(Button, { variant: isCurrent ? 'default' : 'outline', size: "sm", onClick: () => onGoToPart(index), className: "h-8 px-3 text-xs font-medium", children: ["P", part.partNo] }, part.partId || `part-${part.partNo}`));
|
|
17
|
+
}) }), currentPart && (_jsx("div", { className: "rounded bg-gray-50 p-2 text-xs", children: _jsx("span", { className: "font-medium", children: t('admin.exams.preview.partQuestions', {
|
|
18
|
+
part: String(currentPart.partNo),
|
|
19
|
+
count: String(currentPart.questions.length),
|
|
20
|
+
}) }) })), currentPart && (_jsx("div", { className: "rounded-lg bg-gray-50 p-3", children: _jsx("div", { className: "grid max-h-64 grid-cols-6 gap-2 overflow-y-auto pr-2", children: currentPart.questions.map((question) => (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => {
|
|
21
|
+
const el = document.getElementById(`preview-q-${question.id}`);
|
|
22
|
+
el?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
23
|
+
}, className: "h-8 w-full border border-gray-300 bg-white p-0 text-xs font-medium transition-all duration-200 hover:bg-gray-100", children: getQuestionNumber(question) }, question.id))) }) }))] }))), !loading && questions.length > 0 && (_jsxs("div", { children: [_jsxs("div", { className: "mb-2 flex items-center justify-between", children: [_jsx("h4", { className: "text-sm font-medium text-gray-700", children: examName }), _jsx(Button, { variant: "ghost", size: "sm", onClick: onTogglePartsDetail, className: "h-6 px-2 text-xs text-gray-600 hover:text-gray-900", children: showPartsDetail
|
|
24
|
+
? t('admin.exams.preview.collapse')
|
|
25
|
+
: t('admin.exams.preview.detail') })] }), _jsx("div", { className: "rounded-lg bg-gray-50 p-3", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsxs("span", { className: "text-sm font-medium text-gray-900", children: ["Total:", ' ', t('admin.exams.preview.questions', {
|
|
26
|
+
count: String(questions.length),
|
|
27
|
+
})] }), _jsx("div", { className: "mt-1 flex gap-3", children: _jsxs("span", { className: "text-xs text-gray-600", children: [questionsByPart.length, " part(s)"] }) })] }), _jsx("div", { className: "text-xs text-gray-500", children: t('admin.exams.view.minutes', { count: String(duration) }) })] }) }), showPartsDetail && (_jsx("div", { className: "mt-3 space-y-2", children: questionsByPart.map((part, index) => {
|
|
28
|
+
const isCurrentPart = index === currentPartIndex;
|
|
29
|
+
return (_jsx("div", { className: `cursor-pointer rounded-lg border-2 p-3 transition-all duration-200 ${isCurrentPart
|
|
30
|
+
? 'border-blue-400 bg-blue-50 shadow-md'
|
|
31
|
+
: 'border-gray-200 bg-white hover:border-gray-300'}`, onClick: () => onGoToPart(index), children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: `text-sm font-medium ${isCurrentPart ? 'text-blue-900' : 'text-gray-900'}`, children: part.partName }), _jsx(Badge, { variant: "secondary", className: `text-xs ${isCurrentPart
|
|
32
|
+
? 'bg-blue-200 text-blue-800'
|
|
33
|
+
: 'bg-gray-100 text-gray-700'}`, children: t('admin.exams.preview.questions', {
|
|
34
|
+
count: String(part.questions.length),
|
|
35
|
+
}) })] }) }, part.partId || `part-detail-${part.partNo}`));
|
|
36
|
+
}) }))] }))] }) }));
|
|
37
|
+
}
|
|
@@ -1 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CheckCircle2, Circle, ListOrdered, Zap } from 'lucide-react';
|
|
4
|
+
import { cn } from '../../shared/lib/utils';
|
|
5
|
+
import { getPartByQuestionIndex, getSectionForQuestionIndex } from './exam-template.utils';
|
|
6
|
+
export function ExamQuestionGrid({ template, currentQuestionIndex, completedQuestions, onQuestionChange, }) {
|
|
7
|
+
const getQuestionStatus = (questionIndex) => {
|
|
8
|
+
if (questionIndex === currentQuestionIndex)
|
|
9
|
+
return 'current';
|
|
10
|
+
if (completedQuestions.has(questionIndex))
|
|
11
|
+
return 'completed';
|
|
12
|
+
return 'not-started';
|
|
13
|
+
};
|
|
14
|
+
const getQuestionButtonClass = (questionIndex) => {
|
|
15
|
+
const status = getQuestionStatus(questionIndex);
|
|
16
|
+
return cn('h-8 w-8 rounded-lg text-xs font-semibold transition-all duration-200', 'hover:scale-105 focus:outline-none focus:ring-2 focus:ring-offset-1', 'border-2 cursor-pointer shadow-sm', {
|
|
17
|
+
// Current question - gradient blue with glow
|
|
18
|
+
'bg-gradient-to-br from-blue-500 to-indigo-600 text-white border-transparent shadow-lg shadow-blue-300/50 ring-2 ring-blue-400 ring-offset-1': status === 'current',
|
|
19
|
+
// Completed questions - gradient green
|
|
20
|
+
'bg-gradient-to-br from-green-400 to-emerald-500 text-white border-transparent hover:shadow-md hover:shadow-green-200': status === 'completed',
|
|
21
|
+
// Not started questions - subtle gray
|
|
22
|
+
'bg-white text-gray-500 border-gray-200 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700': status === 'not-started',
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
// Generate array of question numbers (1-200)
|
|
26
|
+
const questionNumbers = Array.from({ length: template.totalQuestions }, (_, i) => i);
|
|
27
|
+
return (_jsxs("div", { className: "space-y-5", 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-blue-600 shadow-sm", children: _jsx(ListOrdered, { className: "h-4 w-4 text-white" }) }), _jsxs("div", { children: [_jsx("h3", { className: "text-sm font-bold text-gray-900", children: "Danh s\u00E1ch c\u00E2u h\u1ECFi" }), _jsx("p", { className: "text-xs text-gray-500", children: "Click \u0111\u1EC3 chuy\u1EC3n c\u00E2u" })] })] }), _jsx("div", { className: "rounded-xl border border-gray-200 bg-gradient-to-b from-gray-50 to-white p-4 shadow-inner", children: _jsx("div", { className: "grid max-h-[320px] grid-cols-6 gap-3 overflow-y-auto px-3 py-2 justify-center", children: questionNumbers.map((questionIndex) => {
|
|
28
|
+
const questionNumber = questionIndex + 1;
|
|
29
|
+
const part = getPartByQuestionIndex(template, questionIndex);
|
|
30
|
+
const section = part ? getSectionForQuestionIndex(part, questionIndex) : undefined;
|
|
31
|
+
const tooltipParts = [`Câu ${questionNumber}`, part?.name || 'Unknown Part'];
|
|
32
|
+
if (section) {
|
|
33
|
+
tooltipParts.push(section.name);
|
|
34
|
+
}
|
|
35
|
+
return (_jsx("button", { onClick: () => onQuestionChange(questionIndex), className: getQuestionButtonClass(questionIndex), title: tooltipParts.join(' - '), children: questionNumber }, questionIndex));
|
|
36
|
+
}) }) }), _jsxs("div", { className: "rounded-xl border border-gray-100 bg-white p-3 shadow-sm", children: [_jsx("div", { className: "mb-2 text-xs font-bold uppercase tracking-wide text-gray-400", children: "Ch\u00FA th\u00EDch" }), _jsxs("div", { className: "grid grid-cols-1 gap-2", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-blue-500 to-indigo-600 shadow-md", children: _jsx(Zap, { className: "h-3.5 w-3.5 text-white" }) }), _jsx("span", { className: "text-xs font-medium text-gray-700", children: "C\u00E2u \u0111ang l\u00E0m" })] }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-green-400 to-emerald-500 shadow-sm", children: _jsx(CheckCircle2, { className: "h-3.5 w-3.5 text-white" }) }), _jsx("span", { className: "text-xs font-medium text-gray-700", children: "\u0110\u00E3 ho\u00E0n th\u00E0nh" })] }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex h-7 w-7 items-center justify-center rounded-lg border-2 border-gray-200 bg-white", children: _jsx(Circle, { className: "h-3.5 w-3.5 text-gray-400" }) }), _jsx("span", { className: "text-xs font-medium text-gray-700", children: "Ch\u01B0a t\u1EA1o" })] })] })] })] }));
|
|
37
|
+
}
|
|
@@ -1 +1,112 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Suspense, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { ArrowLeft, Hash, Loader2, Save } from 'lucide-react';
|
|
5
|
+
import { Badge } from '../../components/ui/badge';
|
|
6
|
+
import { Button } from '../../components/ui/button';
|
|
7
|
+
import { useToast } from '../../shared/lib/hooks/useToast';
|
|
8
|
+
import { useT } from '../../shared/lib/i18n';
|
|
9
|
+
import { transformApiQuestionsToFrontend } from '../../shared/lib/utils/question-reverse-transform';
|
|
10
|
+
import { ExamCreator } from './ExamCreator';
|
|
11
|
+
import { initializeQuestionStatusesFromAPI } from './exam-question-status';
|
|
12
|
+
function ExamQuestionsContent({ api, examId, listPath = '/manage/exams', onNavigate, texts }) {
|
|
13
|
+
const t = useT();
|
|
14
|
+
const { error: errorToast, success } = useToast();
|
|
15
|
+
const saveExamRef = useRef(null);
|
|
16
|
+
const [exam, setExam] = useState(null);
|
|
17
|
+
const [questions, setQuestions] = useState([]);
|
|
18
|
+
const [partAudioOverrides, setPartAudioOverrides] = useState({});
|
|
19
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
20
|
+
const navigate = (href) => {
|
|
21
|
+
if (onNavigate)
|
|
22
|
+
onNavigate(href);
|
|
23
|
+
else if (typeof window !== 'undefined')
|
|
24
|
+
window.location.href = href;
|
|
25
|
+
};
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
let ignore = false;
|
|
28
|
+
setIsLoading(true);
|
|
29
|
+
Promise.all([api.getExam(examId), api.getQuestions?.(examId)])
|
|
30
|
+
.then(([examResult, questionResult]) => {
|
|
31
|
+
if (ignore)
|
|
32
|
+
return;
|
|
33
|
+
const loadedExam = unwrap(examResult);
|
|
34
|
+
const loadedQuestions = normalizeQuestions(unwrapOptional(questionResult) ?? []);
|
|
35
|
+
setExam(loadedExam);
|
|
36
|
+
setQuestions(loadedQuestions);
|
|
37
|
+
const totalQuestions = getTemplateTotalQuestions(loadedExam.template);
|
|
38
|
+
if (totalQuestions > 0) {
|
|
39
|
+
initializeQuestionStatusesFromAPI(examId, loadedQuestions.map((question) => question.questionNumber ?? 0), totalQuestions);
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
.catch((err) => errorToast({
|
|
43
|
+
message: t('admin.exams.questions.error'),
|
|
44
|
+
description: err instanceof Error ? err.message : t('admin.exams.questions.loadError'),
|
|
45
|
+
}))
|
|
46
|
+
.finally(() => !ignore && setIsLoading(false));
|
|
47
|
+
return () => { ignore = true; };
|
|
48
|
+
}, [api, examId, errorToast, t]);
|
|
49
|
+
const template = useMemo(() => exam?.template ? normalizeTemplate(exam.template) : null, [exam?.template]);
|
|
50
|
+
const handleSaveExam = async (examData) => {
|
|
51
|
+
if (!template)
|
|
52
|
+
return;
|
|
53
|
+
await api.saveExam?.({ examId, questions: examData.questions, template, examData });
|
|
54
|
+
navigate(listPath);
|
|
55
|
+
};
|
|
56
|
+
const handlePartAudioChange = async (partId, audioUrl) => {
|
|
57
|
+
if (!template)
|
|
58
|
+
return;
|
|
59
|
+
const previous = partAudioOverrides[partId];
|
|
60
|
+
setPartAudioOverrides((prev) => ({ ...prev, [partId]: audioUrl }));
|
|
61
|
+
try {
|
|
62
|
+
await api.updatePartAudio?.({ examId, partId, audioUrl, template });
|
|
63
|
+
success({ message: t('admin.exams.partEditor.audioFile'), description: 'Đã lưu file âm thanh cho part.' });
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
setPartAudioOverrides((prev) => {
|
|
67
|
+
const next = { ...prev };
|
|
68
|
+
if (previous === undefined)
|
|
69
|
+
delete next[partId];
|
|
70
|
+
else
|
|
71
|
+
next[partId] = previous;
|
|
72
|
+
return next;
|
|
73
|
+
});
|
|
74
|
+
errorToast({ message: t('admin.exams.questions.error'), description: err instanceof Error ? err.message : undefined });
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
if (isLoading)
|
|
78
|
+
return _jsx(Loading, { label: texts?.questionsLoadingLabel ?? t('admin.exams.questions.loading') });
|
|
79
|
+
if (!exam || !template)
|
|
80
|
+
return _jsx(Empty, { onBack: () => navigate(listPath), label: texts?.questionsNoTemplateLabel ?? t('admin.exams.questions.noTemplate') });
|
|
81
|
+
return (_jsxs("div", { className: "-m-4 flex h-[calc(100vh-4rem)] flex-col overflow-hidden md:-m-6 md:-mb-10", children: [_jsxs("div", { className: "flex flex-shrink-0 items-center gap-4 border-b border-gray-200/60 bg-white px-4 py-3", children: [_jsx(Button, { variant: "ghost", size: "icon", onClick: () => navigate(listPath), className: "h-8 w-8", children: _jsx(ArrowLeft, { className: "h-4 w-4" }) }), _jsx("div", { className: "min-w-0 flex-1", children: _jsxs("h1", { className: "truncate text-lg font-semibold tracking-tight text-gray-900", children: [exam.name, exam.code && _jsxs(Badge, { variant: "outline", className: "ml-2 align-middle border-blue-200 bg-blue-50 text-blue-700 text-xs font-normal", children: [_jsx(Hash, { className: "mr-0.5 h-3 w-3" }), exam.code] })] }) }), _jsxs(Button, { onClick: () => saveExamRef.current?.(), className: "gap-2 bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 shadow-sm", size: "sm", children: [_jsx(Save, { className: "h-4 w-4" }), texts?.saveQuestionsLabel ?? 'Lưu đề thi'] })] }), _jsx(ExamCreator, { template: template, examId: examId, examDifficulty: exam.difficulty, examLevel: exam.examLevel ?? undefined, subjectId: exam.subject?.id, initialQuestions: questions, onSaveQuestion: api.saveQuestion, onSave: handleSaveExam, onCancel: () => navigate(listPath), onPartAudioChange: api.updatePartAudio ? handlePartAudioChange : undefined, partAudioOverrides: partAudioOverrides, searchQuestions: api.searchQuestions, saveExamRef: saveExamRef })] }));
|
|
82
|
+
}
|
|
83
|
+
export function ExamQuestionsPageContainer(props) {
|
|
84
|
+
return _jsx(Suspense, { fallback: _jsx(Loading, { label: "Loading..." }), children: _jsx(ExamQuestionsContent, { ...props }) });
|
|
85
|
+
}
|
|
86
|
+
function Loading({ label }) {
|
|
87
|
+
return _jsx("div", { className: "flex h-screen items-center justify-center", children: _jsxs("div", { className: "flex flex-col items-center gap-3", children: [_jsx(Loader2, { className: "h-8 w-8 animate-spin text-blue-600" }), _jsx("p", { className: "text-sm text-gray-600", children: label })] }) });
|
|
88
|
+
}
|
|
89
|
+
function Empty({ label, onBack }) {
|
|
90
|
+
return _jsx("div", { className: "flex h-screen items-center justify-center", children: _jsxs("div", { className: "text-center", children: [_jsx("p", { className: "text-lg text-gray-900", children: label }), _jsx(Button, { onClick: onBack, className: "mt-4", children: "Quay l\u1EA1i" })] }) });
|
|
91
|
+
}
|
|
92
|
+
function unwrap(value) {
|
|
93
|
+
return typeof value === 'object' && value !== null && 'data' in value ? value.data : value;
|
|
94
|
+
}
|
|
95
|
+
function unwrapOptional(value) {
|
|
96
|
+
return value === undefined ? undefined : unwrap(value);
|
|
97
|
+
}
|
|
98
|
+
function normalizeTemplate(template) {
|
|
99
|
+
if ('name' in template)
|
|
100
|
+
return template;
|
|
101
|
+
return { ...template, name: template.title, description: template.description || template.subTitle || '', level: template.examLevel, parts: template.parts.map((part) => ({ ...part, name: part.name || part.title || '' })) };
|
|
102
|
+
}
|
|
103
|
+
function getTemplateTotalQuestions(template) {
|
|
104
|
+
return template?.totalQuestions ?? 0;
|
|
105
|
+
}
|
|
106
|
+
function normalizeQuestions(questions) {
|
|
107
|
+
if (questions.length === 0)
|
|
108
|
+
return [];
|
|
109
|
+
return questions.some((question) => 'question_type' in question || 'questionType' in question)
|
|
110
|
+
? transformApiQuestionsToFrontend(questions)
|
|
111
|
+
: questions;
|
|
112
|
+
}
|
|
@@ -1 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '../../components/ui/dialog';
|
|
4
|
+
import { Button } from '../../components/ui/button';
|
|
5
|
+
import { Badge } from '../../components/ui/badge';
|
|
6
|
+
import { BookOpen, Clock, FileText, GraduationCap, Hash, Star, Target, X, } from 'lucide-react';
|
|
7
|
+
import { useT } from '../../shared/lib/i18n';
|
|
8
|
+
export const EXAM_DIFFICULTY = {
|
|
9
|
+
EASY: 'EASY',
|
|
10
|
+
MEDIUM: 'MEDIUM',
|
|
11
|
+
HARD: 'HARD',
|
|
12
|
+
};
|
|
13
|
+
function getDifficultyConfig(difficulty, t) {
|
|
14
|
+
const configs = {
|
|
15
|
+
[EXAM_DIFFICULTY.EASY]: {
|
|
16
|
+
label: t('admin.exams.difficulty.easy'),
|
|
17
|
+
badgeClassName: 'bg-green-50 text-green-700 border-green-200',
|
|
18
|
+
iconContainerClassName: 'bg-green-100',
|
|
19
|
+
iconClassName: 'text-green-600',
|
|
20
|
+
icon: Star,
|
|
21
|
+
},
|
|
22
|
+
[EXAM_DIFFICULTY.MEDIUM]: {
|
|
23
|
+
label: t('admin.exams.difficulty.medium'),
|
|
24
|
+
badgeClassName: 'bg-yellow-50 text-yellow-700 border-yellow-200',
|
|
25
|
+
iconContainerClassName: 'bg-yellow-100',
|
|
26
|
+
iconClassName: 'text-yellow-600',
|
|
27
|
+
icon: Star,
|
|
28
|
+
},
|
|
29
|
+
[EXAM_DIFFICULTY.HARD]: {
|
|
30
|
+
label: t('admin.exams.difficulty.hard'),
|
|
31
|
+
badgeClassName: 'bg-red-50 text-red-700 border-red-200',
|
|
32
|
+
iconContainerClassName: 'bg-red-100',
|
|
33
|
+
iconClassName: 'text-red-600',
|
|
34
|
+
icon: Star,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
return configs[difficulty];
|
|
38
|
+
}
|
|
39
|
+
function ExamHeader({ exam }) {
|
|
40
|
+
return (_jsx("div", { className: "bg-gradient-to-r from-blue-600 to-indigo-600 px-6 py-5 text-white", children: _jsx(DialogHeader, { className: "space-y-2", children: _jsx("div", { className: "flex items-start justify-between", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex h-12 w-12 items-center justify-center rounded-xl bg-white/20 backdrop-blur-sm", children: _jsx(FileText, { className: "h-6 w-6 text-white" }) }), _jsxs("div", { children: [_jsx(DialogTitle, { className: "text-xl font-bold text-white", children: exam.name }), _jsx(DialogDescription, { className: "text-blue-100 mt-1", children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(Hash, { className: "h-3.5 w-3.5" }), exam.code || exam.id] }) })] })] }) }) }) }));
|
|
41
|
+
}
|
|
42
|
+
function ExamStatCard({ label, value, icon: Icon, iconContainerClassName, iconClassName, hoverClassName, }) {
|
|
43
|
+
return (_jsx("div", { className: `rounded-xl border border-gray-200 bg-gray-50/50 p-4 transition-all ${hoverClassName}`, children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: `flex h-10 w-10 items-center justify-center rounded-lg ${iconContainerClassName}`, children: _jsx(Icon, { className: `h-5 w-5 ${iconClassName}` }) }), _jsxs("div", { children: [_jsx("p", { className: "text-xs font-medium text-gray-500 uppercase tracking-wide", children: label }), _jsx("p", { className: "text-sm font-semibold text-gray-900 mt-0.5", children: value })] })] }) }));
|
|
44
|
+
}
|
|
45
|
+
function DifficultyStatCard({ label, config }) {
|
|
46
|
+
const DifficultyIcon = config.icon;
|
|
47
|
+
return (_jsx("div", { className: "rounded-xl border border-gray-200 bg-gray-50/50 p-4 transition-all hover:border-gray-300", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: `flex h-10 w-10 items-center justify-center rounded-lg ${config.iconContainerClassName}`, children: _jsx(DifficultyIcon, { className: `h-5 w-5 ${config.iconClassName}` }) }), _jsxs("div", { children: [_jsx("p", { className: "text-xs font-medium text-gray-500 uppercase tracking-wide", children: label }), _jsx(Badge, { className: `mt-1 ${config.badgeClassName} border`, children: config.label })] })] }) }));
|
|
48
|
+
}
|
|
49
|
+
function ExamDescription({ description, title }) {
|
|
50
|
+
return (_jsxs("div", { className: "rounded-xl border border-gray-200 bg-gray-50/50 p-4", children: [_jsxs("h4", { className: "text-sm font-semibold text-gray-900 mb-2 flex items-center gap-2", children: [_jsx(FileText, { className: "h-4 w-4 text-gray-500" }), title] }), _jsx("p", { className: "text-sm text-gray-600 leading-relaxed", children: description })] }));
|
|
51
|
+
}
|
|
52
|
+
function ExamDialogFooter({ closeLabel, onClose }) {
|
|
53
|
+
return (_jsx(DialogFooter, { className: "border-t border-gray-200 bg-gray-50/50 px-6 py-4", children: _jsxs(Button, { variant: "outline", onClick: onClose, className: "gap-2", children: [_jsx(X, { className: "h-4 w-4" }), closeLabel] }) }));
|
|
54
|
+
}
|
|
55
|
+
export function ExamViewDialog({ open, onOpenChange, exam }) {
|
|
56
|
+
const t = useT();
|
|
57
|
+
if (!exam)
|
|
58
|
+
return null;
|
|
59
|
+
const difficultyConfig = getDifficultyConfig(exam.difficulty, t);
|
|
60
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "max-w-2xl p-0 overflow-hidden", children: [_jsx(ExamHeader, { exam: exam }), _jsxs("div", { className: "px-6 py-5 space-y-6", children: [_jsxs("div", { className: "grid grid-cols-2 md:grid-cols-3 gap-4", children: [_jsx(ExamStatCard, { label: t('admin.exams.view.subject'), value: exam.subject, icon: BookOpen, iconContainerClassName: "bg-blue-100", iconClassName: "text-blue-600", hoverClassName: "hover:border-blue-200 hover:bg-blue-50/30" }), _jsx(ExamStatCard, { label: t('admin.exams.view.level'), value: exam.level, icon: GraduationCap, iconContainerClassName: "bg-purple-100", iconClassName: "text-purple-600", hoverClassName: "hover:border-purple-200 hover:bg-purple-50/30" }), _jsx(ExamStatCard, { label: t('admin.exams.view.duration'), value: t('admin.exams.view.minutes', { count: String(exam.duration) }), icon: Clock, iconContainerClassName: "bg-orange-100", iconClassName: "text-orange-600", hoverClassName: "hover:border-orange-200 hover:bg-orange-50/30" }), _jsx(ExamStatCard, { label: t('admin.exams.view.questionCount'), value: t('admin.exams.view.questions', { count: String(exam.questionCount) }), icon: FileText, iconContainerClassName: "bg-cyan-100", iconClassName: "text-cyan-600", hoverClassName: "hover:border-cyan-200 hover:bg-cyan-50/30" }), _jsx(ExamStatCard, { label: t('admin.exams.view.totalPoints'), value: t('admin.exams.view.points', { count: String(exam.totalPoints) }), icon: Target, iconContainerClassName: "bg-green-100", iconClassName: "text-green-600", hoverClassName: "hover:border-green-200 hover:bg-green-50/30" }), _jsx(DifficultyStatCard, { label: t('admin.exams.view.difficulty'), config: difficultyConfig })] }), exam.description && _jsx(ExamDescription, { title: t('admin.exams.view.description'), description: exam.description })] }), _jsx(ExamDialogFooter, { closeLabel: t('admin.exams.view.close'), onClose: () => onOpenChange(false) })] }) }));
|
|
61
|
+
}
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Headphones, Music } from 'lucide-react';
|
|
4
|
+
import { Card, CardContent } from '../../components/ui/card';
|
|
5
|
+
import { FileUpload } from '../../components/ui/file-upload';
|
|
6
|
+
import { Label } from '../../components/ui/label';
|
|
7
|
+
export function PartAudioUploader({ partId, partName, audioUrl, onAudioChange, examId, isReadOnly = false }) {
|
|
8
|
+
return (_jsxs(Card, { className: "mb-4 overflow-hidden border-0 bg-white shadow-lg shadow-sky-100/50", children: [_jsx("div", { className: "h-1.5 bg-gradient-to-r from-sky-500 via-cyan-500 to-teal-500" }), _jsx(CardContent, { className: "px-4 py-4", children: _jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-sky-500 to-cyan-600 shadow-md", children: _jsx(Headphones, { className: "h-5 w-5 text-white" }) }), _jsxs("div", { children: [_jsxs(Label, { className: "text-sm font-bold text-gray-900", children: ["File \u00E2m thanh cho ", partName] }), _jsx("p", { className: "text-xs text-gray-500", children: "Audio d\u00F9ng chung cho t\u1EA5t c\u1EA3 c\u00E2u h\u1ECFi trong ph\u1EA7n n\u00E0y." })] })] }), _jsx("div", { className: "flex-1", children: _jsx(FileUpload, { id: `part-audio-${partId}`, label: "", accept: "audio/*", value: audioUrl || '', onChange: (url) => !isReadOnly && onAudioChange(url), placeholder: "Ch\u1ECDn file audio cho part n\u00E0y...", icon: _jsx(Music, { className: "h-4 w-4" }), maxSize: 100, autoUpload: true, examId: examId, partId: partId, showPlayButton: true, disabled: isReadOnly }) })] }) })] }));
|
|
9
|
+
}
|