2020-01-16 10:18:40 +01:00
|
|
|
import React, {useContext} from 'react';
|
2020-01-09 10:06:38 +01:00
|
|
|
import '../css/App.css';
|
2020-01-17 10:29:24 +01:00
|
|
|
import {KeyTypeContext} from "../contexts/keyTypeContext"
|
|
|
|
|
import StraightKey from '../components/StraightKey'
|
|
|
|
|
import ElectronicKey from '../components/ElectronicKey'
|
2020-01-09 10:06:38 +01:00
|
|
|
import MorseBufferDisplay from '../components/MorseBufferDisplay'
|
|
|
|
|
import MorseDisplay from '../components/MorseDisplay'
|
2020-01-16 10:18:40 +01:00
|
|
|
|
2020-01-09 10:06:38 +01:00
|
|
|
|
2020-01-17 10:29:24 +01:00
|
|
|
export default React.memo(function PracticeMode(props) {
|
|
|
|
|
console.log("COMPONENT LOADED: PracticeMode");
|
|
|
|
|
const {keyType} = useContext(KeyTypeContext)
|
2020-01-16 10:18:40 +01:00
|
|
|
// const [telegraphType, setTelegraphType] = useState('electronic')
|
|
|
|
|
|
|
|
|
|
// useElectronicKey()
|
|
|
|
|
// const {morseCharBuffer, morseWords, clearHistory} = useStraightKey('practice')
|
2020-01-17 10:29:24 +01:00
|
|
|
|
2020-01-16 10:18:40 +01:00
|
|
|
|
2020-01-09 10:06:38 +01:00
|
|
|
return (
|
|
|
|
|
<>
|
2020-01-17 10:29:24 +01:00
|
|
|
{keyType === "straight" ? <StraightKey /> : <ElectronicKey />}
|
|
|
|
|
<MorseBufferDisplay /><br/>
|
|
|
|
|
<MorseDisplay /><br/>
|
|
|
|
|
{/* <MorseBufferDisplay buffer={morseCharBuffer} /><br/>
|
|
|
|
|
<MorseDisplay morseWords={morseWords} /><br/> */}
|
2020-01-09 10:06:38 +01:00
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
|
2020-01-16 10:18:40 +01:00
|
|
|
|
2020-01-17 10:29:24 +01:00
|
|
|
})
|