mirror of
https://github.com/genemecija/learn-morse-code.git
synced 2026-04-06 14:53:54 +00:00
Layout, styling, WPM buttons & functionality, Morse Buttons
This commit is contained in:
parent
5759522aff
commit
a41921c15b
17 changed files with 649 additions and 368 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import React, {useContext} from 'react';
|
||||
import React, {useContext, useEffect} from 'react';
|
||||
import '../css/App.css';
|
||||
import morseCode from '../data/morse-reverse.json'
|
||||
import ChallengeWord from '../components/ChallengeWord'
|
||||
|
|
@ -24,17 +24,20 @@ export default React.memo(function ChallengeMode(props) {
|
|||
let incorrectMorseIndexes = [] // Indexes of incorrect morse characters in morse character buffer
|
||||
|
||||
let offset = 0
|
||||
|
||||
|
||||
|
||||
if (!word) {
|
||||
console.log('FINISHED ALL WORDS!')
|
||||
alert('No more words.')
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
let challengeLetters = word.split('')
|
||||
|
||||
|
||||
// Iterate through the morse character buffer and compare with each letter of challenge word
|
||||
morseArray.forEach((item, index) => {
|
||||
|
||||
if (morseCharBuffer.slice(-1) === '_') { // If end of morse character
|
||||
|
||||
let morseLetter = morseCode[morseArray[index]] || '[?]'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue