This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const setDifficulty = (value: number) => { | |
setDifficultyLevel(value); | |
setDisplayVal(paragraphs[value]); /*----THIS LINE SETS THE DISPLAY VALUE (STRING) ----*/ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [displayVal, setDisplayVal] = useState<string>(''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const computeResult = () => { | |
const result = (inputVal.length / 5) / minutes; | |
const percentage = (((inputVal.length - incorrectEntry) / inputVal.length) * 100).toFixed(2); | |
setWordsPerMin(result); | |
setAccuracy(parseFloat(percentage)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const displayResult = () => { | |
return( | |
<div> | |
<p>The words per minute written: {wordsPerMin}</p> | |
<p>Percentage Accuracy: {accuracy}%</p> | |
</div> | |
) | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{endTimer && displayResult()} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const resetTest = () => { | |
setEndTimer(false); | |
setInputVal(''); | |
setInpBoxSplit([]); | |
setWordsPerMin(undefined); | |
setAccuracy(0); | |
setDifficultyLevel(undefined); | |
setIncorrectEntry(0); | |
setTimeInSeconds(0); | |
setElegibleToStart(false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{inputVal.length > 0 && <button onClick={() => resetTest()}>Reset</button>} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{!endTimer && eligibleToStart && <InputBox value={inputVal} onChange={(e) => setInputVal(e.target.value)}/>} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{paragraphArr.length > 0 && <Paragraph value={paragraphArr.length > 0 ? paragraphArr : [] }/>} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const setDifficulty = (value: number) => { | |
setDifficultyLevel(value); | |
setDisplayVal(paragraphs[value]); | |
} |