Add dialer app theme | Add new contact button from dialer after you type number

This commit is contained in:
J Francisco Rader committed 2021-02-21 19:24:38 -05:00
1 parent 2c6358e4c3
commit ada49700e5
7 files changed
+76 -29

No files matched your search

@@ -2,8 +2,10 @@ import React, { useContext } from 'react';
import { Box, IconButton, InputBase, Paper } from '@material-ui/core';
import { makeStyles, Theme } from '@material-ui/core/styles';
import PhoneIcon from '@material-ui/icons/Phone';
import PersonAddIcon from '@material-ui/icons/PersonAdd';
import { DialInputCtx } from '../context/InputContext';
import Nui from '../../../os/nui-events/utils/Nui';
import { useHistory } from 'react-router-dom';
const useStyles = makeStyles((theme: Theme) => ({
root: {
@@ -26,8 +28,9 @@ const useStyles = makeStyles((theme: Theme) => ({
export const DialerInput = () => {
const classes = useStyles();
const history = useHistory();
const { inputVal } = useContext(DialInputCtx)
const { inputVal } = useContext(DialInputCtx);
const handleCall = (number: string) => {
Nui.send('phone:beginCall', {
@@ -35,6 +38,10 @@ export const DialerInput = () => {
});
};
const handleNewContact = (number: string) => {
history.push(`/contacts/-1/?addNumber=${number}`)
}
return (
<Box component={Paper} className={classes.root}>
<InputBase
@@ -42,8 +49,11 @@ export const DialerInput = () => {
className={classes.input}
value={inputVal}
/>
<IconButton color='primary' className={classes.iconBtn}>
<PhoneIcon fontSize="large" onClick={() => handleCall(inputVal)} />
</IconButton>
<IconButton className={classes.iconBtn}>
<PhoneIcon onClick={() => handleCall(inputVal)} />
<PersonAddIcon fontSize="large" onClick={() => handleNewContact(inputVal)} />
</IconButton>
</Box>
);