From 4b4030a88d3f9ef2fd2ae6cc7825853841750956 Mon Sep 17 00:00:00 2001 From: Gene Mecija Date: Sat, 25 Jan 2020 12:23:47 -0800 Subject: [PATCH] Combinging straight/electronic keys --- src/App.js | 79 ++++++----- src/app-modes/PracticeMode.js | 10 +- src/components/ElectronicKey.js | 11 +- src/components/StraightKey.js | 10 +- src/components/WordsPerMinute.js | 3 +- src/hooks/useElectronicKey.js | 32 +---- src/hooks/useStraightKey.js | 80 +++++------ src/hooks/useTelegraphKey.js | 229 +++++++++++++++++++++++++++++++ src/index.js | 9 +- 9 files changed, 345 insertions(+), 118 deletions(-) create mode 100644 src/hooks/useTelegraphKey.js diff --git a/src/App.js b/src/App.js index dff5c5e..c22859d 100644 --- a/src/App.js +++ b/src/App.js @@ -26,12 +26,13 @@ import MorseHistory from './components/MorseHistory' import StraightKey from './components/StraightKey'; import ElectronicKey from './components/ElectronicKey'; import Footer from './components/Footer'; -import { WPMContextProvider } from './contexts/wpmContext'; +import { WPMContext } from './contexts/wpmContext'; export default React.memo(function App() { console.log('App.js rendered') const {gameMode} = useContext(GameModeContext) + const {wpm} = useContext(WPMContext) const {keyType} = useContext(KeyTypeContext) console.log('gameMode', gameMode); @@ -41,45 +42,43 @@ export default React.memo(function App() { <>
- - - - - - - {gameMode === 'practice' && - <> - {keyType === "straight" ? - : } -
-
-
- - } - {gameMode === 'timed' && - <> - {keyType === "straight" ? - : } -
-
-
- - } - {gameMode === 'challenge' && - <> - - - - {keyType === "straight" ? - : } - - - - - } - -
-
+ + + + + + {gameMode === 'practice' && + <> + {/* {keyType === "straight" ? + : } */} +
+ {/*
+
*/} + + } + {/* {gameMode === 'timed' && + <> + {keyType === "straight" ? + : } +
+
+
+ + } + {gameMode === 'challenge' && + <> + + + + {keyType === "straight" ? + : } + + + + + } */} + +