Remove use-history-nav.js

For electron.js only
This commit is contained in:
infinite-persistence 2021-11-09 16:00:24 +08:00
parent d7fc5069be
commit 45ad08ec32
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 0 additions and 33 deletions

View file

@ -21,9 +21,6 @@ import usePersistedState from 'effects/use-persisted-state';
import Spinner from 'component/spinner'; import Spinner from 'component/spinner';
import LANGUAGES from 'constants/languages'; import LANGUAGES from 'constants/languages';
// @if TARGET='app'
import useHistoryNav from 'effects/use-history-nav';
// @endif
// @if TARGET='web' // @if TARGET='web'
import YoutubeWelcome from 'web/component/youtubeReferralWelcome'; import YoutubeWelcome from 'web/component/youtubeReferralWelcome';
import { import {
@ -235,11 +232,6 @@ function App(props: Props) {
return () => window.removeEventListener('keydown', handleKeyPress); return () => window.removeEventListener('keydown', handleKeyPress);
}, []); }, []);
// Enable 'Alt + Left/Right' for history navigation on Desktop.
// @if TARGET='app'
useHistoryNav(history);
// @endif
useEffect(() => { useEffect(() => {
if (referredRewardAvailable && sanitizedReferrerParam && isRewardApproved) { if (referredRewardAvailable && sanitizedReferrerParam && isRewardApproved) {
setReferrer(sanitizedReferrerParam, true); setReferrer(sanitizedReferrerParam, true);

View file

@ -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);
}, []);
}