Skip to content

Commit

Permalink
remove(components/tweet): don't use escape at all
Browse files Browse the repository at this point in the history
- readds useKeyboardService module
  • Loading branch information
AvarianKnight committed May 24, 2021
1 parent d95062d commit f10369a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
1 change: 1 addition & 0 deletions phone/src/Phone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import WindowSnackbar from './ui/components/WindowSnackbar';
import { useTranslation } from 'react-i18next';
import { useSnackbar } from './ui/hooks/useSnackbar';
import { PhoneEvents } from '../../typings/phone';
import { useKeyboardService } from './os/keyboard/hooks/useKeyboardService';
import PhoneWrapper from './PhoneWrapper';

import dayjs from 'dayjs';
Expand Down
16 changes: 1 addition & 15 deletions phone/src/apps/twitter/components/AddTweetModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useState, useEffect } from 'react';
import React, { useCallback, useState } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { v4 as uuidv4 } from 'uuid';
import { useNuiRequest } from 'fivem-nui-react-lib';
Expand Down Expand Up @@ -76,24 +76,10 @@ export const AddTweetModal = () => {
setModalVisible(false);
};

// when the user presses escape we should close the modal
const _handleEscape = (e) => {
e.stopPropagation();
const isEscapeKey = e.key === 'Escape' || e.key === 'Esc';
if (isEscapeKey) {
e.preventDefault();
_handleClose();
}
};

const handleimageChange = useCallback((link) => setLink(link), []);

const handleMessageChange = useCallback((message) => setMessage(message), [setMessage]);

useEffect(() => {
window.addEventListener('keyup', _handleEscape, true);
return () => window.removeEventListener('keyup', _handleEscape, true);
}, []);
if (!ResourceConfig) return null;

const isValidMessage = (message) => {
Expand Down

0 comments on commit f10369a

Please sign in to comment.