mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Add dialer app theme | Add new contact button from dialer after you type number
This commit is contained in:
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>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user