mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
working groups & messages
This commit is contained in:
1 parent
ccbc2d3b87
commit
681ce16912
25 files changed
+476
-162
No files matched your search
@@ -1,14 +1,21 @@
|
||||
import React, { useState } from 'react'
|
||||
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';
|
||||
|
||||
export const MessageInput = ({ messageGroupId }) => {
|
||||
interface IProps {
|
||||
messageGroupId: string | undefined;
|
||||
}
|
||||
|
||||
const MessageInput = ({ messageGroupId }: IProps) => {
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
const [ message, setMessage ] = useState('')
|
||||
|
||||
const handleSubmit = () => {
|
||||
const handleSubmit = (event: FormEvent) => {
|
||||
event.preventDefault();
|
||||
Nui.send('phone:sendMessage', {
|
||||
groupId: messageGroupId,
|
||||
message
|
||||
@@ -16,21 +23,26 @@ export const MessageInput = ({ messageGroupId }) => {
|
||||
setMessage('');
|
||||
}
|
||||
|
||||
if (!messageGroupId) return null;
|
||||
|
||||
return (
|
||||
<Paper
|
||||
className={classes.form}
|
||||
variant="outlined"
|
||||
>
|
||||
<TextField
|
||||
value={message}
|
||||
onChange={e => setMessage(e.target.value)}
|
||||
placeholder="Message..."
|
||||
className={classes.input}
|
||||
inputProps={{
|
||||
className: classes.messagesInput
|
||||
}}
|
||||
/>
|
||||
<Button className={classes.sendButton} onClick={handleSubmit}><SendIcon /></Button>
|
||||
<Paper className={classes.paper} variant="outlined" >
|
||||
<form className={classes.form} onSubmit={handleSubmit}>
|
||||
<TextField
|
||||
value={message}
|
||||
onChange={e => setMessage(e.target.value)}
|
||||
placeholder={t("APPS_MESSAGES_NEW_MESSAGE")}
|
||||
className={classes.input}
|
||||
inputProps={{
|
||||
className: classes.messagesInput
|
||||
}}
|
||||
/>
|
||||
<Button className={classes.sendButton} type="submit" >
|
||||
<SendIcon />
|
||||
</Button>
|
||||
</form>
|
||||
</Paper>
|
||||
)
|
||||
}
|
||||
|
||||
export default MessageInput;
|
||||
Reference in new issue
Block a user