diff --git a/src/components/RunCode.tsx b/src/components/RunCode.tsx index af976bf1..d2630787 100644 --- a/src/components/RunCode.tsx +++ b/src/components/RunCode.tsx @@ -28,6 +28,7 @@ const RunCode: React.FC = ({ const [selections, setSelections] = useState([]); const [answers, setAnswers] = useState>([]); const [alert, setAlert] = useState(false); + const unanswered = 'Please select an answer'; const alertFunction = () => { setAlert(true); @@ -40,8 +41,8 @@ const RunCode: React.FC = ({ if (selections.length == 0) { const tempArr: string[] = []; const ansArr: Array = []; - questions.forEach((question) => { - tempArr.push(question.options[0]); + questions.forEach(() => { + tempArr.push(''); ansArr.push(null); }); setSelections(tempArr); @@ -123,7 +124,9 @@ const RunCode: React.FC = ({ />

- {question.answerText.get(selections[index])} + {selections[index] == '' + ? unanswered + : question.answerText.get(selections[index])}

= ({ choices, handleClick }) => { - const [display, setDisplay] = useState(choices[0] || ''); + const [display, setDisplay] = useState(''); const handleChange = (e: SelectChangeEvent) => { setDisplay(e.target.value); @@ -29,6 +29,11 @@ const SelectCode: React.FC = ({ choices, handleClick }) => { inputProps={{ 'aria-label': 'Without label' }} className="select-input" > + +
+              Select
+            
+
{choices.map((choice, index) => ( {
Exercise 2 Diagram
-

How do we create a pointer to the basketball string?

+

+ How do we create a pointer to the basketball string? (Hint: there + are 2 answers here!) +