mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Merge branch 'modal' of https://github.com/AvarianKnight/new-phone-who-dis
This commit is contained in:
commit
c48b7333e2
7 files changed
+11
-38
No files matched your search
@@ -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';
|
||||
@@ -76,23 +76,10 @@ export const AddTweetModal = () => {
|
||||
setModalVisible(false);
|
||||
};
|
||||
|
||||
// when the user presses escape we should close the modal
|
||||
const _handleEscape = (e) => {
|
||||
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('keydown', _handleEscape, true);
|
||||
return () => window.removeEventListener('keydown', _handleEscape);
|
||||
});
|
||||
if (!ResourceConfig) return null;
|
||||
|
||||
const isValidMessage = (message) => {
|
||||
|
||||
@@ -14,7 +14,7 @@ export function TweetList({ tweets }) {
|
||||
setMimimumLoadPassed(true);
|
||||
}, MINIMUM_LOAD_TIME);
|
||||
return () => window.clearTimeout(timeout);
|
||||
});
|
||||
}, []);
|
||||
|
||||
// we add a minimum (but short) load time here so that
|
||||
// there isn't a quick flash of loading and immediately
|
||||
|
||||
@@ -20,7 +20,6 @@ const useStyles = makeStyles({
|
||||
});
|
||||
|
||||
export const TweetMessage = ({ modalVisible, message, handleChange }) => {
|
||||
const textFieldRef = useRef(null);
|
||||
const textFieldInputRef = useRef(null);
|
||||
const classes = useStyles();
|
||||
const { ResourceConfig } = usePhone();
|
||||
@@ -40,7 +39,7 @@ export const TweetMessage = ({ modalVisible, message, handleChange }) => {
|
||||
// so that we always have the latest line and error message
|
||||
// in view
|
||||
e.preventDefault();
|
||||
textFieldRef.current.scrollTop = textFieldRef.current.scrollHeight;
|
||||
textFieldInputRef.current.scrollTop = textFieldInputRef.current.scrollHeight;
|
||||
handleChange(e.target.value);
|
||||
},
|
||||
[handleChange],
|
||||
@@ -77,7 +76,7 @@ export const TweetMessage = ({ modalVisible, message, handleChange }) => {
|
||||
inputRef={textFieldInputRef}
|
||||
error={errorMessage !== null}
|
||||
helperText={errorMessage || null}
|
||||
ref={textFieldRef}
|
||||
// ref={textFieldRef}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user