diff --git a/phone/src/apps/contacts/components/Contact.css b/phone/src/apps/contacts/components/Contact.css new file mode 100644 index 0000000..21164f2 --- /dev/null +++ b/phone/src/apps/contacts/components/Contact.css @@ -0,0 +1,10 @@ +.display-block { + /*Sets modal to center*/ + display: flex; + justify-content: center; + align-items: center; +} + +.display-none { + display: none; +} diff --git a/phone/src/apps/contacts/components/ContactList.js b/phone/src/apps/contacts/components/ContactList.js index c412ce0..7edd44c 100644 --- a/phone/src/apps/contacts/components/ContactList.js +++ b/phone/src/apps/contacts/components/ContactList.js @@ -1,25 +1,33 @@ -import React from "react"; +import React, { useState } from "react"; import ListItemText from "@material-ui/core/ListItemText"; import { Button } from "@material-ui/core"; import PhoneIcon from "@material-ui/icons/Phone"; import ChatIcon from "@material-ui/icons/Chat"; +import DeleteIcon from "@material-ui/icons/Delete"; import { List } from "../../../ui/components/List"; import { ListItem } from "../../../ui/components/ListItem"; import { useContacts } from "../hooks/useContacts"; +import Nui from "../../../os/nui-events/utils/Nui"; + export const ContactList = () => { const contacts = useContacts(); + const [call, setCall] = useState(""); + + const startCall = (number) => { + console.log(number); + Nui.send("phone:startCall", { + number, + }); + }; + return ( {contacts.contacts.map((contact) => ( - + ))} diff --git a/phone/src/apps/contacts/components/ContactModal.js b/phone/src/apps/contacts/components/ContactModal.js index 21bc05a..c6950d5 100644 --- a/phone/src/apps/contacts/components/ContactModal.js +++ b/phone/src/apps/contacts/components/ContactModal.js @@ -1,103 +1,79 @@ import React, { useState } from "react"; import { makeStyles } from "@material-ui/core/styles"; -import AddCircleIcon from "@material-ui/icons/AddCircle"; -import { AppContent } from "../../../ui/components/AppContent"; -import { Container, Button } from "@material-ui/core"; +import { Button, TextField, Paper } from "@material-ui/core"; import Nui from "../../../os/nui-events/utils/Nui"; -import { TextInput } from "../../../ui/components/Input"; +import List from "@material-ui/core/List"; +import ListItem from "@material-ui/core/ListItem"; const useStyles = makeStyles((theme) => ({ - modal: { - display: "flex", - alignItems: "center", - justifyContent: "center", - }, - paper: { - backgroundColor: theme.palette.background.paper, - boxShadow: theme.shadows[5], - padding: theme.spacing(2, 4, 3), - }, - modalContainer: { - backgroundColor: "#232323", - width: "80%", - height: "30vh", - }, button: { margin: 5, marginTop: 20, }, + root: { + position: "fixed", + bottom: 380, + zIndex: 2, + background: "#232323", + marginLeft: "-4em", + height: "20%", + }, + + displayBlock: { + /*Sets modal to center*/ + display: "flex", + justifyContent: "center", + alignItems: "center", + }, + displayNone: { + display: "none", + }, })); -export const AddContactModal = () => { - const [modal, setModal] = useState(false); +export const AddContactModal = ({ handleClose, show, children }) => { + const [name, setName] = useState(""); + const [number, setNumber] = useState(""); + const classes = useStyles(); + const showHideClassName = show ? classes.displayBlock : classes.displayNone; - const Modal = (props) => { - const [name, setName] = useState(""); - const [number, setNumber] = useState(""); - - const addContact = () => { - if (name === "" || number === "") { - console.log("You need to pass in values"); - } else { - Nui.send("contacts:add", { - name, - number, - }); - console.log(name, number); - } - }; - const classes = useStyles(); - return ( - -

New contact:

- setName(e.target.value)} - /> - setNumber(e.target.value)} - id="number-basic" - type="number" - label="Phone Number" - color="primary" - /> - - -
- ); + const addContact = () => { + if (name === "" || number === "") { + console.log("You need to pass in values"); + } else { + Nui.send("contacts:add", { + name, + number, + }); + console.log(name, number); + } }; return ( - - - - +
+ + + + setName(e.target.value)} + style={{ fontSize: "18px" }} + fullWidth + placeholder="Name" + /> + + + setNumber(e.target.value)} + fullWidth + placeholder="Number" + type="number" + /> + + + + + +
); }; diff --git a/phone/src/apps/contacts/components/ContactsApp.js b/phone/src/apps/contacts/components/ContactsApp.js index c5484b1..de98f0d 100644 --- a/phone/src/apps/contacts/components/ContactsApp.js +++ b/phone/src/apps/contacts/components/ContactsApp.js @@ -1,19 +1,51 @@ -import React from "react"; +import React, { useState } from "react"; +import { makeStyles } from "@material-ui/core/styles"; import { AppWrapper } from "../../../ui/components"; import { AppTitle } from "../../../ui/components/AppTitle"; import { AppContent } from "../../../ui/components/AppContent"; import { ContactList } from "./ContactList"; import { useApp } from "../../../os/apps/hooks/useApps"; +import AddCircleIcon from "@material-ui/icons/AddCircle"; import { AddContactModal } from "./ContactModal"; +import { Button } from "@material-ui/core"; + +const useStyles = makeStyles((theme) => ({ + modalOpener: { + backgroundColor: "red", + height: 50, + position: "fixed", + display: "flex", + justifyContent: "center", + alignItems: "center", + }, +})); export const ContactsApp = () => { + const [modal, setModal] = useState(false); + const classes = useStyles(); const contacts = useApp("CONTACTS"); + + const openModal = () => { + setModal(true); + }; + + const closeModal = () => { + setModal(false); + }; + return ( - + + + - );