mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
styling: Enforced styling across all files (#55)
This commit is contained in:
165 files changed
+1879
-1725
No files matched your search
@@ -1,11 +1,11 @@
|
||||
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 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 ImageIcon from '@material-ui/icons/Image';
|
||||
import Nui from "../../../../os/nui-events/utils/Nui";
|
||||
import { useImageModal } from "../../hooks/useImageModal";
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import { useImageModal } from '../../hooks/useImageModal';
|
||||
|
||||
interface IProps {
|
||||
messageGroupId: string | undefined;
|
||||
@@ -15,33 +15,33 @@ const MessageInput = ({ messageGroupId }: IProps) => {
|
||||
const { setImageModal } = useImageModal();
|
||||
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", {
|
||||
Nui.send('phone:sendMessage', {
|
||||
groupId: messageGroupId,
|
||||
message,
|
||||
});
|
||||
setMessage("");
|
||||
setMessage('');
|
||||
}
|
||||
};
|
||||
|
||||
const openImageModal = () => {
|
||||
setImageModal(true);
|
||||
}
|
||||
};
|
||||
|
||||
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)}
|
||||
placeholder={t("APPS_MESSAGES_NEW_MESSAGE")}
|
||||
placeholder={t('APPS_MESSAGES_NEW_MESSAGE')}
|
||||
className={classes.input}
|
||||
inputRef={(input) => input && input.focus()}
|
||||
inputProps={{
|
||||
@@ -51,7 +51,7 @@ const MessageInput = ({ messageGroupId }: IProps) => {
|
||||
<Button className={classes.sendButton} onClick={openImageModal}>
|
||||
<ImageIcon />
|
||||
</Button>
|
||||
<Button className={classes.sendButton} type="submit">
|
||||
<Button className={classes.sendButton} type='submit'>
|
||||
<SendIcon />
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import React, { FormEvent, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { TextField, Button } from "@material-ui/core";
|
||||
import React, { FormEvent, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { TextField, Button } from '@material-ui/core';
|
||||
|
||||
import useStyles from "./form.styles";
|
||||
import useModals from "../../hooks/useModals";
|
||||
import Nui from "../../../../os/nui-events/utils/Nui";
|
||||
import useStyles from './form.styles';
|
||||
import useModals from '../../hooks/useModals';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
|
||||
const NewMessageGroupForm = () => {
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
const { setShowNewMessageGroup } = useModals();
|
||||
const [participants, setParticipants] = useState("");
|
||||
const [label, setLabel] = useState("");
|
||||
const [participants, setParticipants] = useState('');
|
||||
const [label, setLabel] = useState('');
|
||||
|
||||
// handles phone numbers in a csv format and strips all spaces and
|
||||
// external characters out of them:
|
||||
// 123-4567, 987-6543, 333-4444
|
||||
const parts = participants
|
||||
.split(",")
|
||||
.map((part) => part.replace(/[^0-9]/g, ""));
|
||||
.split(',')
|
||||
.map((part) => part.replace(/[^0-9]/g, ''));
|
||||
const isGroupChat = parts.length > 1;
|
||||
|
||||
const handleSubmit = (event: FormEvent) => {
|
||||
@@ -26,11 +26,11 @@ const NewMessageGroupForm = () => {
|
||||
if (parts.length > 0) {
|
||||
const labelValue = label.trim();
|
||||
|
||||
Nui.send("phone:createMessageGroup", {
|
||||
Nui.send('phone:createMessageGroup', {
|
||||
phoneNumbers: parts,
|
||||
label: isGroupChat && labelValue ? labelValue : null,
|
||||
});
|
||||
setParticipants("");
|
||||
setParticipants('');
|
||||
setShowNewMessageGroup(false); // close modal after submission
|
||||
}
|
||||
};
|
||||
@@ -40,7 +40,7 @@ const NewMessageGroupForm = () => {
|
||||
<TextField
|
||||
value={participants}
|
||||
onChange={(e) => setParticipants(e.target.value)}
|
||||
placeholder={t("APPS_MESSAGES_NEW_MESSAGE_GROUP")}
|
||||
placeholder={t('APPS_MESSAGES_NEW_MESSAGE_GROUP')}
|
||||
className={classes.newGroupinput}
|
||||
autoFocus
|
||||
inputProps={{
|
||||
@@ -52,7 +52,7 @@ const NewMessageGroupForm = () => {
|
||||
<TextField
|
||||
value={label}
|
||||
onChange={(e) => setLabel(e.target.value)}
|
||||
placeholder={t("APPS_MESSAGES_GROUP_CHAT_LABEL")}
|
||||
placeholder={t('APPS_MESSAGES_GROUP_CHAT_LABEL')}
|
||||
className={classes.newGroupinput}
|
||||
inputProps={{
|
||||
className: classes.messagesInput,
|
||||
@@ -60,12 +60,12 @@ const NewMessageGroupForm = () => {
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
variant="contained"
|
||||
variant='contained'
|
||||
className={classes.newGroupSubmitButton}
|
||||
color="primary"
|
||||
type="submit"
|
||||
color='primary'
|
||||
type='submit'
|
||||
>
|
||||
{t("APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT")}
|
||||
{t('APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT')}
|
||||
</Button>
|
||||
</form>
|
||||
);
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
import { makeStyles } from "@material-ui/core";
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
sendButton: {
|
||||
float: "right",
|
||||
float: 'right',
|
||||
},
|
||||
paper: {
|
||||
position: "absolute",
|
||||
position: 'absolute',
|
||||
bottom: 0,
|
||||
width: "100%",
|
||||
width: '100%',
|
||||
},
|
||||
form: {
|
||||
display: "flex",
|
||||
display: 'flex',
|
||||
},
|
||||
input: {
|
||||
width: "100%",
|
||||
width: '100%',
|
||||
margin: 10,
|
||||
},
|
||||
newGroupForm: {
|
||||
position: "absolute",
|
||||
position: 'absolute',
|
||||
top: 65,
|
||||
display: "flex",
|
||||
flexFlow: "column nowrap",
|
||||
justifyContent: "flex-start",
|
||||
width: "100%",
|
||||
display: 'flex',
|
||||
flexFlow: 'column nowrap',
|
||||
justifyContent: 'flex-start',
|
||||
width: '100%',
|
||||
},
|
||||
newGroupSubmitButton: {
|
||||
margin: "15px 8px 0px 8px",
|
||||
margin: '15px 8px 0px 8px',
|
||||
},
|
||||
newGroupinput: {
|
||||
margin: "0px 8px 15px 8px",
|
||||
margin: '0px 8px 15px 8px',
|
||||
},
|
||||
messagesInput: {
|
||||
fontSize: 20,
|
||||
|
||||
Reference in new issue
Block a user