66 Icon ,
77 IconButton ,
88 Form ,
9- Spinner ,
109} from '@openedx/paragon' ;
1110import { FeedbackOutline , DeleteOutline } from '@openedx/paragon/icons' ;
1211import { FormattedMessage , useIntl } from '@edx/frontend-platform/i18n' ;
@@ -45,7 +44,7 @@ const AnswerOption = ({
4544 const setSelectedFeedback = hooks . setSelectedFeedback ( { answer, hasSingleAnswer, dispatch } ) ;
4645 const setUnselectedFeedback = hooks . setUnselectedFeedback ( { answer, hasSingleAnswer, dispatch } ) ;
4746 const { isFeedbackVisible, toggleFeedback } = hooks . useFeedback ( answer ) ;
48- const { data = { is_valid : true } , mutate, isPending } = useValidateInputBlock ( ) ;
47+ const { data = { isValid : true } , mutate } = useValidateInputBlock ( ) ;
4948
5049 const staticRootUrl = isLibrary
5150 ? `${ getConfig ( ) . STUDIO_BASE_URL } /library_assets/blocks/${ blockId } /`
@@ -71,9 +70,10 @@ const AnswerOption = ({
7170 />
7271 ) ;
7372 }
73+
7474 if ( problemType !== ProblemTypeKeys . NUMERIC || ! answer . isAnswerRange ) {
7575 return (
76- < Form . Group isInvalid = { ! data ?. is_valid ?? true } >
76+ < Form . Group isInvalid = { ! data ?. isValid ?? true } >
7777 < Form . Control
7878 as = "textarea"
7979 className = "answer-option-textarea text-gray-500 small"
@@ -82,19 +82,18 @@ const AnswerOption = ({
8282 value = { answer . title }
8383 onChange = { ( e ) => {
8484 setAnswerTitle ( e ) ;
85- mutate ( e . target . value ) ;
85+ if ( problemType === ProblemTypeKeys . NUMERIC ) {
86+ mutate ( e . target . value ) ;
87+ }
8688 } }
8789 placeholder = { intl . formatMessage ( messages . answerTextboxPlaceholder ) }
8890
8991 />
90- { ( ! data ?. is_valid ?? true ) && (
92+ { ( ! data ?. isValid ?? true ) && (
9193 < Form . Control . Feedback type = "invalid" >
9294 < FormattedMessage { ...messages . answerNumericErrorText } />
9395 </ Form . Control . Feedback >
9496 ) }
95- { isPending && (
96- < Spinner animation = "border" className = "mie-3 mt-3" screenReaderText = "loading" />
97- ) }
9897 </ Form . Group >
9998 ) ;
10099 }
0 commit comments