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,16 +1,16 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Snackbar } from "@material-ui/core";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Snackbar } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
|
||||
import useAlerts from "../hooks/useAlerts";
|
||||
import Alert from "../../../ui/components/Alert";
|
||||
import useAlerts from '../hooks/useAlerts';
|
||||
import Alert from '../../../ui/components/Alert';
|
||||
|
||||
const useStyles = makeStyles(() => ({
|
||||
root: {
|
||||
width: "100%",
|
||||
bottom: "60px",
|
||||
position: "absolute",
|
||||
width: '100%',
|
||||
bottom: '60px',
|
||||
position: 'absolute',
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -37,22 +37,22 @@ export default function AlertBar() {
|
||||
|
||||
const { error, phoneNumber, duplicate, mine } = createMessageGroupResult;
|
||||
if (error && phoneNumber) {
|
||||
const error = `${t("APPS_MESSAGES_INVALID_PHONE_NUMBER")}${phoneNumber}`;
|
||||
const error = `${t('APPS_MESSAGES_INVALID_PHONE_NUMBER')}${phoneNumber}`;
|
||||
setOpen(true);
|
||||
setSeverity("error");
|
||||
setSeverity('error');
|
||||
setMessage(error);
|
||||
} else if (error && duplicate) {
|
||||
setOpen(true);
|
||||
setSeverity("error");
|
||||
setMessage(t("APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE"));
|
||||
setSeverity('error');
|
||||
setMessage(t('APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE'));
|
||||
} else if (error && mine) {
|
||||
setOpen(true);
|
||||
setSeverity("error");
|
||||
setMessage(t("APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE"));
|
||||
setSeverity('error');
|
||||
setMessage(t('APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE'));
|
||||
} else if (error) {
|
||||
setOpen(true);
|
||||
setSeverity("error");
|
||||
setMessage(t("APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED"));
|
||||
setSeverity('error');
|
||||
setMessage(t('APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED'));
|
||||
}
|
||||
}, [createMessageGroupResult, t]);
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import React from "react";
|
||||
import { AppWrapper } from "../../../ui/components";
|
||||
import { AppTitle } from "../../../ui/components/AppTitle";
|
||||
import { AppContent } from "../../../ui/components/AppContent";
|
||||
import { useApp } from "../../../os/apps/hooks/useApps";
|
||||
import AlertBar from "./AlertBar";
|
||||
import { MessageModal } from "./modal/MessageModal";
|
||||
import MessageGroupModal from "./modal/MessageGroupModal";
|
||||
import NewMessageGroupButton from "./buttons/NewMessageGroupButton";
|
||||
import MessagesList from "./list/MessagesList";
|
||||
import "./messages.css";
|
||||
import React from 'react';
|
||||
import { AppWrapper } from '../../../ui/components';
|
||||
import { AppTitle } from '../../../ui/components/AppTitle';
|
||||
import { AppContent } from '../../../ui/components/AppContent';
|
||||
import { useApp } from '../../../os/apps/hooks/useApps';
|
||||
import AlertBar from './AlertBar';
|
||||
import { MessageModal } from './modal/MessageModal';
|
||||
import MessageGroupModal from './modal/MessageGroupModal';
|
||||
import NewMessageGroupButton from './buttons/NewMessageGroupButton';
|
||||
import MessagesList from './list/MessagesList';
|
||||
import './messages.css';
|
||||
|
||||
export const MessagesApp = () => {
|
||||
const messages = useApp("MESSAGES");
|
||||
const messages = useApp('MESSAGES');
|
||||
return (
|
||||
<AppWrapper id="messages-app">
|
||||
<AppWrapper id='messages-app'>
|
||||
<AppTitle app={messages} />
|
||||
<MessageModal />
|
||||
<MessageGroupModal />
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import React from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { Fab } from "@material-ui/core";
|
||||
import AddIcon from "@material-ui/icons/Add";
|
||||
import useModals from "../../hooks/useModals";
|
||||
import React from 'react';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { Fab } from '@material-ui/core';
|
||||
import AddIcon from '@material-ui/icons/Add';
|
||||
import useModals from '../../hooks/useModals';
|
||||
|
||||
const useStyles = makeStyles(() => ({
|
||||
root: {
|
||||
position: "absolute",
|
||||
bottom: "25px",
|
||||
right: "15px",
|
||||
position: 'absolute',
|
||||
bottom: '25px',
|
||||
right: '15px',
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -20,7 +20,7 @@ export function NewMessageGroupButton() {
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<Fab color="primary" onClick={handleClick}>
|
||||
<Fab color='primary' onClick={handleClick}>
|
||||
<AddIcon />
|
||||
</Fab>
|
||||
</div>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { InputBase, Paper } from "@material-ui/core";
|
||||
import SearchIcon from "@material-ui/icons/Search";
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { InputBase, Paper } from '@material-ui/core';
|
||||
import SearchIcon from '@material-ui/icons/Search';
|
||||
|
||||
import useStyles from "./list.styles";
|
||||
import useStyles from './list.styles';
|
||||
|
||||
interface IProps {
|
||||
value: string;
|
||||
@@ -16,7 +16,7 @@ const MessageSearch = ({ value, handleChange }: IProps) => {
|
||||
const { t } = useTranslation();
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<Paper elevation={24} variant="outlined" className={classes.bg}>
|
||||
<Paper elevation={24} variant='outlined' className={classes.bg}>
|
||||
<div className={classes.search}>
|
||||
<div className={classes.searchIcon}>
|
||||
<SearchIcon />
|
||||
@@ -24,12 +24,12 @@ const MessageSearch = ({ value, handleChange }: IProps) => {
|
||||
<InputBase
|
||||
value={value}
|
||||
onChange={handleChange}
|
||||
placeholder={t("APPS_MESSAGES_SEARCH_PLACEHOLDER")}
|
||||
placeholder={t('APPS_MESSAGES_SEARCH_PLACEHOLDER')}
|
||||
classes={{
|
||||
root: classes.inputRoot,
|
||||
input: classes.inputInput,
|
||||
}}
|
||||
inputProps={{ "aria-label": "search" }}
|
||||
inputProps={{ 'aria-label': 'search' }}
|
||||
/>
|
||||
</div>
|
||||
</Paper>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { makeStyles, fade } from "@material-ui/core";
|
||||
import { makeStyles, fade } from '@material-ui/core';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
height: "100%",
|
||||
overflowY: "auto",
|
||||
height: '100%',
|
||||
overflowY: 'auto',
|
||||
},
|
||||
bg: {
|
||||
display: "flex",
|
||||
display: 'flex',
|
||||
height: 60,
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
textFieldInput: {
|
||||
fontSize: 20,
|
||||
@@ -21,38 +21,38 @@ const useStyles = makeStyles((theme) => ({
|
||||
inputInput: {
|
||||
padding: theme.spacing(1, 4, 1, 4),
|
||||
// vertical padding + font size from searchIcon
|
||||
transition: theme.transitions.create("width"),
|
||||
width: "100%",
|
||||
transition: theme.transitions.create('width'),
|
||||
width: '100%',
|
||||
|
||||
[theme.breakpoints.up("sm")]: {
|
||||
width: "13ch",
|
||||
"&:focus": {
|
||||
width: "20ch",
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
width: '13ch',
|
||||
'&:focus': {
|
||||
width: '20ch',
|
||||
},
|
||||
},
|
||||
},
|
||||
search: {
|
||||
position: "relative",
|
||||
position: 'relative',
|
||||
borderRadius: theme.shape.borderRadius,
|
||||
backgroundColor: fade(theme.palette.common.white, 0.25),
|
||||
"&:hover": {
|
||||
'&:hover': {
|
||||
backgroundColor: fade(theme.palette.common.white, 0.25),
|
||||
},
|
||||
marginLeft: 0,
|
||||
width: "100%",
|
||||
[theme.breakpoints.up("sm")]: {
|
||||
width: '100%',
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
marginLeft: theme.spacing(1),
|
||||
width: "auto",
|
||||
width: 'auto',
|
||||
},
|
||||
},
|
||||
searchIcon: {
|
||||
padding: theme.spacing(0, 0.5),
|
||||
height: "100%",
|
||||
position: "absolute",
|
||||
pointerEvents: "none",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
height: '100%',
|
||||
position: 'absolute',
|
||||
pointerEvents: 'none',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { makeStyles } from "@material-ui/core";
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
addMessageFab: {
|
||||
position: "sticky",
|
||||
position: 'sticky',
|
||||
bottom: theme.spacing(2),
|
||||
left: theme.spacing(3),
|
||||
},
|
||||
|
||||
@@ -31,7 +31,11 @@ const Conversation = ({ activeMessageGroup, messages }: IProps) => {
|
||||
variant='outlined'
|
||||
>
|
||||
{isImage(message.message) ? (
|
||||
<img src={message.message} className={classes.imageMessage} alt="image" />
|
||||
<img
|
||||
src={message.message}
|
||||
className={classes.imageMessage}
|
||||
alt='image'
|
||||
/>
|
||||
) : (
|
||||
<div>{message.message}</div>
|
||||
)}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import React from "react";
|
||||
import { Slide, Paper, Button } from "@material-ui/core";
|
||||
import ArrowBackIcon from "@material-ui/icons/ArrowBack";
|
||||
import useStyles from "./modal.styles";
|
||||
import React from 'react';
|
||||
import { Slide, Paper, Button } from '@material-ui/core';
|
||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||
import useStyles from './modal.styles';
|
||||
|
||||
import useModals from "../../hooks/useModals";
|
||||
import NewMessageGroupForm from "../form/NewMessageGroupForm";
|
||||
import useModals from '../../hooks/useModals';
|
||||
import NewMessageGroupForm from '../form/NewMessageGroupForm';
|
||||
|
||||
const MessageGroupModal = () => {
|
||||
const classes = useStyles();
|
||||
@@ -13,12 +13,12 @@ const MessageGroupModal = () => {
|
||||
const handleClose = () => setShowNewMessageGroup(false);
|
||||
|
||||
return (
|
||||
<Slide direction="left" in={showNewMessageGroup}>
|
||||
<Slide direction='left' in={showNewMessageGroup}>
|
||||
<Paper
|
||||
className={showNewMessageGroup ? classes.modalRoot : classes.modalHide}
|
||||
>
|
||||
<Button onClick={handleClose}>
|
||||
<ArrowBackIcon fontSize="large" />
|
||||
<ArrowBackIcon fontSize='large' />
|
||||
</Button>
|
||||
<NewMessageGroupForm />
|
||||
</Paper>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { TextField, Button } from '@material-ui/core';
|
||||
import React, { useState } from 'react'
|
||||
import React, { useState } from 'react';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import Modal from '../../../../ui/components/Modal'
|
||||
import { useImageModal } from '../../hooks/useImageModal'
|
||||
import Modal from '../../../../ui/components/Modal';
|
||||
import { useImageModal } from '../../hooks/useImageModal';
|
||||
import CloseIcon from '@material-ui/icons/Close';
|
||||
import useStyles from './modal.styles';
|
||||
|
||||
@@ -13,30 +13,34 @@ interface IProps {
|
||||
export const MessageImageModal = ({ messageGroupId }: IProps) => {
|
||||
const classes = useStyles();
|
||||
const { imageModal, setImageModal } = useImageModal();
|
||||
const [ message, setMessage ] = useState("");
|
||||
const [message, setMessage] = useState('');
|
||||
|
||||
const _handleClose = () => {
|
||||
setImageModal(false)
|
||||
}
|
||||
setImageModal(false);
|
||||
};
|
||||
|
||||
const sendImageMessage = (event) => {
|
||||
if (event.key ==="Enter") {
|
||||
if (event.key === 'Enter') {
|
||||
Nui.send('phone:sendMessage', {
|
||||
groupId: messageGroupId,
|
||||
message
|
||||
})
|
||||
message,
|
||||
});
|
||||
setImageModal(false);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal visible={imageModal} handleClose={_handleClose}>
|
||||
<div>
|
||||
<Button onClick={_handleClose} className={classes.imageModalCloseButton} ><CloseIcon /></Button>
|
||||
<TextField
|
||||
placeholder="A link to your image or gif"
|
||||
onChange={e => setMessage(e.target.value)}
|
||||
<Button
|
||||
onClick={_handleClose}
|
||||
className={classes.imageModalCloseButton}
|
||||
>
|
||||
<CloseIcon />
|
||||
</Button>
|
||||
<TextField
|
||||
placeholder='A link to your image or gif'
|
||||
onChange={(e) => setMessage(e.target.value)}
|
||||
value={message}
|
||||
className={classes.input}
|
||||
inputProps={{
|
||||
@@ -47,5 +51,5 @@ export const MessageImageModal = ({ messageGroupId }: IProps) => {
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -1,13 +1,13 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Slide, Paper, Button, Typography } from "@material-ui/core";
|
||||
import ArrowBackIcon from "@material-ui/icons/ArrowBack";
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Slide, Paper, Button, Typography } from '@material-ui/core';
|
||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||
|
||||
import useStyles from "./modal.styles";
|
||||
import useMessages from "../../hooks/useMessages";
|
||||
import useModals from "../../hooks/useModals";
|
||||
import Conversation, { CONVERSATION_ELEMENT_ID } from "./Conversation";
|
||||
import MessageSkeletonList from "./MessageSkeletonList";
|
||||
import Nui from "../../../../os/nui-events/utils/Nui";
|
||||
import useStyles from './modal.styles';
|
||||
import useMessages from '../../hooks/useMessages';
|
||||
import useModals from '../../hooks/useModals';
|
||||
import Conversation, { CONVERSATION_ELEMENT_ID } from './Conversation';
|
||||
import MessageSkeletonList from './MessageSkeletonList';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
|
||||
const LARGE_HEADER_CHARS = 30;
|
||||
const MAX_HEADER_CHARS = 80;
|
||||
@@ -35,7 +35,7 @@ export const MessageModal = () => {
|
||||
|
||||
const interval = window.setInterval(() => {
|
||||
if (!activeMessageGroup) return;
|
||||
Nui.send("phone:fetchMessages", {
|
||||
Nui.send('phone:fetchMessages', {
|
||||
groupId: activeMessageGroup.groupId,
|
||||
});
|
||||
}, MESSAGES_REFRESH_RATE);
|
||||
@@ -64,7 +64,7 @@ export const MessageModal = () => {
|
||||
const isOpen = activeMessageGroup !== null;
|
||||
|
||||
// don't allow too many characters, it takes too much room
|
||||
let header = activeMessageGroup ? activeMessageGroup.groupDisplay : "";
|
||||
let header = activeMessageGroup ? activeMessageGroup.groupDisplay : '';
|
||||
const truncatedHeader = `${header.slice(0, MAX_HEADER_CHARS).trim()}...`;
|
||||
header =
|
||||
header.length > MAX_HEADER_CHARS
|
||||
@@ -77,13 +77,13 @@ export const MessageModal = () => {
|
||||
: classes.groupdisplay;
|
||||
|
||||
return (
|
||||
<Slide direction="left" in={isOpen}>
|
||||
<Slide direction='left' in={isOpen}>
|
||||
<Paper className={isOpen ? classes.modalRoot : classes.modalHide}>
|
||||
<Paper className={classes.topContainer}>
|
||||
<Button onClick={closeModal}>
|
||||
<ArrowBackIcon fontSize="large" />
|
||||
<ArrowBackIcon fontSize='large' />
|
||||
</Button>
|
||||
<Typography variant="h5" className={headerClass}>
|
||||
<Typography variant='h5' className={headerClass}>
|
||||
{header}
|
||||
</Typography>
|
||||
</Paper>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import React from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Skeleton from "@material-ui/lab/Skeleton";
|
||||
import React from 'react';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import Skeleton from '@material-ui/lab/Skeleton';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
root: {
|
||||
margin: "0px 0px 12px 8px",
|
||||
margin: '0px 0px 12px 8px',
|
||||
},
|
||||
});
|
||||
|
||||
export default function MessageSkeleton({ height, isMine = false }) {
|
||||
const classes = useStyles();
|
||||
|
||||
const marginLeft = isMine ? "60px" : "8px";
|
||||
const marginLeft = isMine ? '60px' : '8px';
|
||||
return (
|
||||
<div className={classes.root} style={{ marginLeft, height: `${height}px` }}>
|
||||
<Skeleton variant="text" width={325} height={height} />
|
||||
<Skeleton variant='text' width={325} height={height} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import React from 'react';
|
||||
|
||||
import { List } from "../../../../ui/components/List";
|
||||
import MessageSkeleton from "./MessageSkeleton";
|
||||
import { List } from '../../../../ui/components/List';
|
||||
import MessageSkeleton from './MessageSkeleton';
|
||||
|
||||
export function MessageSkeletonList() {
|
||||
return (
|
||||
|
||||
@@ -1,81 +1,81 @@
|
||||
import { makeStyles } from "@material-ui/core";
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
modalRoot: {
|
||||
zIndex: 10,
|
||||
position: "absolute",
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
position: 'absolute',
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
},
|
||||
modalHide: {
|
||||
display: "none",
|
||||
display: 'none',
|
||||
},
|
||||
topContainer: {
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
padding: "3px 0px",
|
||||
display: 'flex',
|
||||
flexFlow: 'row nowrap',
|
||||
padding: '3px 0px',
|
||||
},
|
||||
groupdisplay: {
|
||||
width: "300px",
|
||||
paddingTop: "8px",
|
||||
fontSize: "24px",
|
||||
whiteSpace: "nowrap",
|
||||
overflowX: "hidden",
|
||||
textOverflow: "ellipsis",
|
||||
width: '300px',
|
||||
paddingTop: '8px',
|
||||
fontSize: '24px',
|
||||
whiteSpace: 'nowrap',
|
||||
overflowX: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
},
|
||||
largeGroupDisplay: {
|
||||
width: "300px",
|
||||
paddingTop: "8px",
|
||||
fontSize: "20px",
|
||||
width: '300px',
|
||||
paddingTop: '8px',
|
||||
fontSize: '20px',
|
||||
},
|
||||
messageList: {
|
||||
height: "90%",
|
||||
overflowY: "auto",
|
||||
paddingBottom: "40px",
|
||||
height: '90%',
|
||||
overflowY: 'auto',
|
||||
paddingBottom: '40px',
|
||||
},
|
||||
messageContainer: {
|
||||
marginTop: 25,
|
||||
width: "100%",
|
||||
width: '100%',
|
||||
},
|
||||
sourceSms: {
|
||||
float: "right",
|
||||
float: 'right',
|
||||
margin: 10,
|
||||
padding: "6px 12px",
|
||||
padding: '6px 12px',
|
||||
height: 'auto',
|
||||
width: "80%",
|
||||
background: "#0288d1",
|
||||
borderRadius: "20px",
|
||||
textOverflow: 'ellipsis'
|
||||
width: '80%',
|
||||
background: '#0288d1',
|
||||
borderRadius: '20px',
|
||||
textOverflow: 'ellipsis',
|
||||
},
|
||||
sms: {
|
||||
float: "left",
|
||||
float: 'left',
|
||||
margin: 10,
|
||||
padding: "6px 12px",
|
||||
width: "80%",
|
||||
padding: '6px 12px',
|
||||
width: '80%',
|
||||
height: 'auto',
|
||||
background: "#ddd",
|
||||
color: "#232323",
|
||||
borderRadius: "15px",
|
||||
textOverflow: 'ellipsis'
|
||||
background: '#ddd',
|
||||
color: '#232323',
|
||||
borderRadius: '15px',
|
||||
textOverflow: 'ellipsis',
|
||||
},
|
||||
messagesInput: {
|
||||
fontSize: 20,
|
||||
},
|
||||
input: {
|
||||
width: "100%",
|
||||
width: '100%',
|
||||
margin: 10,
|
||||
},
|
||||
imageMessage: {
|
||||
width: '80%',
|
||||
maxWidth: '80%',
|
||||
height: '80%',
|
||||
maxHeight: '80%'
|
||||
maxHeight: '80%',
|
||||
},
|
||||
imageModalCloseButton: {
|
||||
position: 'absolute',
|
||||
right: 0,
|
||||
width: '10%'
|
||||
}
|
||||
width: '10%',
|
||||
},
|
||||
}));
|
||||
|
||||
export default useStyles;
|
||||
Reference in new issue
Block a user