mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
prettier formatting
This commit is contained in:
1 parent
9363032c42
commit
be5c038128
19 files changed
+294
-238
No files matched your search
@@ -1,9 +1,9 @@
|
||||
import React, { FormEvent, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Paper, TextField, Button } from '@material-ui/core'
|
||||
import useStyles from './form.styles';
|
||||
import SendIcon from '@material-ui/icons/Send';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import React, { FormEvent, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Paper, TextField, Button } from "@material-ui/core";
|
||||
import useStyles from "./form.styles";
|
||||
import SendIcon from "@material-ui/icons/Send";
|
||||
import Nui from "../../../../os/nui-events/utils/Nui";
|
||||
|
||||
interface IProps {
|
||||
messageGroupId: string | undefined;
|
||||
@@ -12,40 +12,41 @@ interface IProps {
|
||||
const MessageInput = ({ messageGroupId }: IProps) => {
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
const [ message, setMessage ] = useState('')
|
||||
const [message, setMessage] = useState("");
|
||||
|
||||
const handleSubmit = (event: FormEvent) => {
|
||||
event.preventDefault();
|
||||
if (message.trim()) { // don't allow the user to submit white space
|
||||
Nui.send('phone:sendMessage', {
|
||||
groupId: messageGroupId,
|
||||
message
|
||||
if (message.trim()) {
|
||||
// don't allow the user to submit white space
|
||||
Nui.send("phone:sendMessage", {
|
||||
groupId: messageGroupId,
|
||||
message,
|
||||
});
|
||||
setMessage('');
|
||||
setMessage("");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (!messageGroupId) return null;
|
||||
|
||||
return (
|
||||
<Paper className={classes.paper} variant="outlined" >
|
||||
<Paper className={classes.paper} variant="outlined">
|
||||
<form className={classes.form} onSubmit={handleSubmit}>
|
||||
<TextField
|
||||
value={message}
|
||||
onChange={e => setMessage(e.target.value)}
|
||||
onChange={(e) => setMessage(e.target.value)}
|
||||
placeholder={t("APPS_MESSAGES_NEW_MESSAGE")}
|
||||
className={classes.input}
|
||||
inputRef={(input) => input && input.focus()}
|
||||
inputProps={{
|
||||
className: classes.messagesInput
|
||||
className: classes.messagesInput,
|
||||
}}
|
||||
/>
|
||||
<Button className={classes.sendButton} type="submit" >
|
||||
<Button className={classes.sendButton} type="submit">
|
||||
<SendIcon />
|
||||
</Button>
|
||||
</form>
|
||||
</Paper>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export default MessageInput;
|
||||
export default MessageInput;
|
||||
Reference in new issue
Block a user