From 45ad08ec32c86d6da5d6f9ea057aaabdcae49b1b Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Tue, 9 Nov 2021 16:00:24 +0800 Subject: [PATCH] Remove use-history-nav.js For electron.js only --- ui/component/app/view.jsx | 8 -------- ui/effects/use-history-nav.js | 25 ------------------------- 2 files changed, 33 deletions(-) delete mode 100644 ui/effects/use-history-nav.js diff --git a/ui/component/app/view.jsx b/ui/component/app/view.jsx index 3c84db9ea..cd6c65c8a 100644 --- a/ui/component/app/view.jsx +++ b/ui/component/app/view.jsx @@ -21,9 +21,6 @@ import usePersistedState from 'effects/use-persisted-state'; import Spinner from 'component/spinner'; import LANGUAGES from 'constants/languages'; -// @if TARGET='app' -import useHistoryNav from 'effects/use-history-nav'; -// @endif // @if TARGET='web' import YoutubeWelcome from 'web/component/youtubeReferralWelcome'; import { @@ -235,11 +232,6 @@ function App(props: Props) { return () => window.removeEventListener('keydown', handleKeyPress); }, []); - // Enable 'Alt + Left/Right' for history navigation on Desktop. - // @if TARGET='app' - useHistoryNav(history); - // @endif - useEffect(() => { if (referredRewardAvailable && sanitizedReferrerParam && isRewardApproved) { setReferrer(sanitizedReferrerParam, true); diff --git a/ui/effects/use-history-nav.js b/ui/effects/use-history-nav.js deleted file mode 100644 index aa82b4077..000000000 --- a/ui/effects/use-history-nav.js +++ /dev/null @@ -1,25 +0,0 @@ -import { useEffect } from 'react'; - -export default function useHistoryNav(history) { - useEffect(() => { - const handleKeyPress = e => { - if ((e.metaKey || e.altKey) && !e.ctrlKey && !e.shiftKey) { - switch (e.code) { - case 'ArrowLeft': - e.preventDefault(); - history.goBack(); - break; - case 'ArrowRight': - e.preventDefault(); - history.goForward(); - break; - default: - // Do nothing - break; - } - } - }; - window.addEventListener('keydown', handleKeyPress); - return () => window.removeEventListener('keydown', handleKeyPress); - }, []); -}