feats(contacts/nui): cleanup | esx.js | translation for contacts

This commit is contained in:
Christopher committed 2020-12-11 22:13:31 +01:00
1 parent 4d6bc53eea
commit 74f43efddb
12 files changed
+265 -196

No files matched your search

@@ -1,5 +1,5 @@
import React from "react";
import ListItemText from "@material-ui/core/ListItemText";
import React from 'react';
import ListItemText from '@material-ui/core/ListItemText';
import {
Button,
ListItemAvatar,
@@ -9,41 +9,41 @@ import {
TextField,
Collapse,
makeStyles,
} from "@material-ui/core";
} from '@material-ui/core';
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faPen } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faPen } from '@fortawesome/free-solid-svg-icons';
import { useFilteredContacts } from "../../hooks/useFilteredContacts";
import { useFilteredContacts } from '../../hooks/useFilteredContacts';
import PhoneIcon from "@material-ui/icons/Phone";
import ChatIcon from "@material-ui/icons/Chat";
import MoreVertIcon from "@material-ui/icons/MoreVert";
import { useContacts } from "../../hooks/useContacts";
import { useContactModal } from "../../hooks/useContactModal";
import { useContactDetail } from "../../hooks/useContactDetail";
import PhoneIcon from '@material-ui/icons/Phone';
import ChatIcon from '@material-ui/icons/Chat';
import MoreVertIcon from '@material-ui/icons/MoreVert';
import { useContacts } from '../../hooks/useContacts';
import { useContactModal } from '../../hooks/useContactModal';
import { useContactDetail } from '../../hooks/useContactDetail';
import Nui from "../../../../os/nui-events/utils/Nui";
import Nui from '../../../../os/nui-events/utils/Nui';
import "../Contact.css";
import '../Contact.css';
import { ContactAlert } from '../alert/ContactAlert';
const useStyles = makeStyles((theme) => ({
updateButton: {
margin: "auto",
margin: 'auto',
fontSize: 14,
width: 150,
background: "#2196f3",
background: '#2196f3',
marginBottom: 10,
padding: 8,
},
collapseItem: {
margin: "auto",
width: "50%",
margin: 'auto',
width: '50%',
},
}));
export const ContactList = () => {
const classes = useStyles();
const { filteredContacts } = useFilteredContacts();
const { setShowContactModal } = useContactModal();
const { contactDetail, setContactDetail } = useContactDetail();
@@ -53,11 +53,11 @@ export const ContactList = () => {
const openContactInfo = (contact) => {
setShowContactModal(true);
setContactDetail(contact);
console.log("CONTACT", contactDetail);
console.log('CONTACT', contactDetail);
};
const startCall = (number) => {
console.log(number);
Nui.send("phone:startCall", {
Nui.send('phone:startCall', {
number,
});
};
@@ -67,8 +67,8 @@ export const ContactList = () => {
{contacts.contacts
.filter(
(contact) =>
contact.display.includes(filteredContacts) ||
contact.number.includes(filteredContacts)
contact.display.includes(filteredContacts.toLowerCase()) ||
contact.number.includes(filteredContacts.toLowerCase())
)
.map((contact) => (
<>
@@ -91,7 +91,7 @@ export const ContactList = () => {
</Button>
<Button
onClick={() =>
console.log("Message: " + contact.display, contact.number)
console.log('Message: ' + contact.display, contact.number)
}
>
<ChatIcon />
@@ -1,66 +1,65 @@
import React, { useState } from "react";
import { InputBase } from "@material-ui/core";
import SearchIcon from "@material-ui/icons/Search";
import React from 'react';
import { InputBase } from '@material-ui/core';
import SearchIcon from '@material-ui/icons/Search';
import {
createStyles,
fade,
Theme,
makeStyles,
} from "@material-ui/core/styles";
} from '@material-ui/core/styles';
import { useFilteredContacts } from "../../hooks/useFilteredContacts";
import { useFilteredContacts } from '../../hooks/useFilteredContacts';
const useStyles = makeStyles((theme: Theme) =>
createStyles({
bg: {
backgroundColor: "#232323",
display: "flex",
backgroundColor: '#232323',
display: 'flex',
height: 60,
justifyContent: "center",
alignItems: "center",
justifyContent: 'center',
alignItems: 'center',
},
textFieldInput: {
fontSize: 20,
},
inputRoot: {
color: "#fff",
color: '#fff',
fontSize: 18,
},
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.15),
"&: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',
},
})
);
@@ -69,10 +68,8 @@ export const SearchContacts = () => {
const { setFilteredContacts } = useFilteredContacts();
const classes = useStyles();
const [searchValue, setSearchValue] = useState("");
const handleChange = (e) => {
setSearchValue(e.target.value);
setFilteredContacts(e.target.value);
};
@@ -80,16 +77,16 @@ export const SearchContacts = () => {
<div className={classes.bg}>
<div className={classes.search}>
<div className={classes.searchIcon}>
<SearchIcon style={{ color: "#fff" }} />
<SearchIcon style={{ color: '#fff' }} />
</div>
<InputBase
onChange={handleChange}
placeholder="Search contacts..."
placeholder='Search contacts...'
classes={{
root: classes.inputRoot,
input: classes.inputInput,
}}
inputProps={{ "aria-label": "search" }}
inputProps={{ 'aria-label': 'search' }}
/>
</div>
</div>