Fix: Dialer Routing, added contacts and styling. (#77)

* Fix dialer routing and add contacts to it

* Fix styling

* Delete unused component
This commit is contained in:
J Francisco Rader authored and GitHub committed 2021-02-07 23:55:24 -05:00
1 parent 84d9b08bff
commit 2bb32c453b
8 files changed
+95 -84

No files matched your search

@@ -19,7 +19,7 @@ const ButtonItem = ({ label, onClick }: IBtnItem) => {
const classes = useStyles();
return (
<Grid key={label} item xs={4}>
<Button fullWidth className={classes.gridItem} onClick={onClick}>
<Button fullWidth size="large" className={classes.gridItem} onClick={onClick}>
{label}
</Button>
</Grid>
@@ -30,7 +30,7 @@ export const DialGrid = () => {
const { add, removeOne, clear} = useContext(DialInputCtx)
return (
<Box>
<Box height="100%">
<Grid container justify='space-around'>
<ButtonItem label={1} onClick={() => add(1)} />
<ButtonItem label={2} onClick={() => add(2)} />
@@ -9,6 +9,7 @@ import DialPage from './views/DialPage';
import DialerNavBar from './DialerNavBar';
import { useDialHistory } from '../hooks/useDialHistory';
import InjectDebugData from '../../../os/debug/InjectDebugData';
import { ContactList } from '../../contacts/components/List/ContactList';
InjectDebugData([
{
@@ -41,10 +42,10 @@ export const DialerApp = () => {
<Route path='/phone/dial'>
<DialPage />
</Route>
<Route path='/phone'>
<Route exact path='/phone'>
<DialerHistory calls={history} />
</Route>
{/*<Route path='/phone/contacts'></Route>*/}
<Route path='/phone/contacts' component={ContactList}></Route>
</Switch>
</AppContent>
<DialerNavBar />
@@ -1,9 +1,10 @@
import React, { ChangeEvent, useState } from 'react';
import React, { useState } from 'react';
import { BottomNavigation, BottomNavigationAction } from '@material-ui/core';
import { Link } from 'react-router-dom';
import { NavLink, useLocation } from 'react-router-dom';
import { makeStyles, Theme } from '@material-ui/core/styles';
import PhoneIcon from '@material-ui/icons/Phone';
import { History } from '@material-ui/icons';
import PersonIcon from '@material-ui/icons/Person';
import HistoryIcon from '@material-ui/icons/History';
const useStyles = makeStyles((theme: Theme) => ({
root: {
@@ -17,10 +18,10 @@ const useStyles = makeStyles((theme: Theme) => ({
const DialerNavBar = () => {
const classes = useStyles();
const { pathname } = useLocation();
const [page, setPage] = useState(pathname);
const [page, setPage] = useState(0);
const handleChange = (event: ChangeEvent<{}>, newPage) => {
const handleChange = (_e, newPage) => {
setPage(newPage);
};
@@ -33,15 +34,26 @@ const DialerNavBar = () => {
>
<BottomNavigationAction
label='History'
component={Link}
icon={<History />}
value='/phone'
component={NavLink}
icon={<HistoryIcon />}
to='/phone'
/>
<BottomNavigationAction
component={Link}
label='Dial'
value='/phone/dial'
color="secondary"
component={NavLink}
icon={<PhoneIcon />}
to='/phone/dial'
label='Call'
/>
<BottomNavigationAction
label='Contacts'
value='/phone/contacts'
color="secondary"
component={NavLink}
icon={<PersonIcon />}
to='/phone/contacts'
/>
</BottomNavigation>
);
@@ -2,8 +2,8 @@ import React, { useState } from 'react';
import { makeStyles, Theme } from '@material-ui/core/styles';
import DialGrid from '../DialPadGrid';
import { DialerInput } from '../DialerInput';
import ContactSearch from '../ContactSearch';
import { DialInputCtx } from '../../context/InputContext';
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
const useStyles = makeStyles((theme: Theme) => ({
root: {
@@ -16,8 +16,9 @@ const useStyles = makeStyles((theme: Theme) => ({
const DialPage = () => {
const classes = useStyles();
const [inputVal, setInputVal] = useState('');
const query = useQueryParams();
const queryNumber = query.number;
const [inputVal, setInputVal] = useState(queryNumber || '');
return (
<div className={classes.root}>
@@ -29,7 +30,6 @@ const DialPage = () => {
clear: () => setInputVal(''),
}}
>
<ContactSearch />
<DialerInput />
<DialGrid />
</DialInputCtx.Provider>