import { Badge, HStack, Icon, Stack, Text } from '@chakra-ui/react'; import { __ } from '@wordpress/i18n'; import React from 'react'; import { BiInfoCircle } from 'react-icons/bi'; import { Td, Tr } from 'react-super-responsive-table'; import { H5PQuestionScore } from '../types/h5pQuizAttempt'; interface Props { questionScores: H5PQuestionScore[]; } /** * Per-question result rows (Question / Result / Points) for an H5P attempt. * No "Answer" column — H5P reports only score/success, not answer text. */ const H5PQuestionScores: React.FC = ({ questionScores }) => { // Like the normal quiz overview, list only attempted questions (empty notice when none, not a list of "Not attempted" rows). const attemptedScores = questionScores.filter((q) => q.completed); if (attemptedScores.length === 0) { return ( {__('No questions attempt found.', 'learning-management-system')} ); } return ( <> {attemptedScores.map((q) => ( {q.title || __('Question', 'learning-management-system')} {q.success === true ? ( {__('Correct', 'learning-management-system')} ) : q.success === false ? ( {__('Incorrect', 'learning-management-system')} ) : ( {__('Answered', 'learning-management-system')} )} {q.completed && q.max_score > 0 ? `${q.score}/${q.max_score} ${__('pts', 'learning-management-system')}` : '—'} ))} ); }; export default H5PQuestionScores;