From d6e9a85b402ed47eb83f6500beb2919b696cf73b Mon Sep 17 00:00:00 2001 From: Taso Date: Mon, 18 Jan 2021 14:30:32 -0500 Subject: [PATCH] Feat: Dial section Still WIP --- .../apps/dialer/components/ContactSearch.tsx | 17 ++++++ .../apps/dialer/components/DialPadGrid.tsx | 49 +++++++++++++++++ .../src/apps/dialer/components/DialerApp.tsx | 16 +++++- .../apps/dialer/components/DialerInput.tsx | 36 +++++++++++++ .../apps/dialer/components/DialerNavBar.tsx | 54 +++++++++++++++++++ .../apps/dialer/components/views/DialPage.tsx | 39 ++++++++++++++ .../components/{ => views}/DialerHistory.tsx | 4 +- .../src/apps/dialer/context/InputContext.tsx | 10 ++++ 8 files changed, 221 insertions(+), 4 deletions(-) create mode 100644 phone/src/apps/dialer/components/ContactSearch.tsx create mode 100644 phone/src/apps/dialer/components/DialPadGrid.tsx create mode 100644 phone/src/apps/dialer/components/DialerInput.tsx create mode 100644 phone/src/apps/dialer/components/DialerNavBar.tsx create mode 100644 phone/src/apps/dialer/components/views/DialPage.tsx rename phone/src/apps/dialer/components/{ => views}/DialerHistory.tsx (84%) create mode 100644 phone/src/apps/dialer/context/InputContext.tsx diff --git a/phone/src/apps/dialer/components/ContactSearch.tsx b/phone/src/apps/dialer/components/ContactSearch.tsx new file mode 100644 index 0000000..f5e1f02 --- /dev/null +++ b/phone/src/apps/dialer/components/ContactSearch.tsx @@ -0,0 +1,17 @@ +import React from 'react'; +import { Box } from '@material-ui/core'; +import { makeStyles, Theme } from '@material-ui/core/styles'; + +const useStyles = makeStyles((theme: Theme) => ({ + root: { + backgroundColor: '#e9e9e9', + }, +})); + +const ContactsSearch = () => { + const classes = useStyles(); + + return ; +}; + +export default ContactsSearch; diff --git a/phone/src/apps/dialer/components/DialPadGrid.tsx b/phone/src/apps/dialer/components/DialPadGrid.tsx new file mode 100644 index 0000000..aa61232 --- /dev/null +++ b/phone/src/apps/dialer/components/DialPadGrid.tsx @@ -0,0 +1,49 @@ +import React from 'react'; +import { Box, Button, Grid } from '@material-ui/core'; +import { makeStyles, Theme } from '@material-ui/core/styles'; + +const useStyles = makeStyles((theme: Theme) => ({ + gridItem: { + fontSize: theme.typography.h5.fontSize, + padding: theme.spacing(2), + }, +})); + +interface IBtnItem { + onClick?: (...args: any) => void; + label: string | number; +} + +const ButtonItem = ({ label, onClick }: IBtnItem) => { + const classes = useStyles(); + return ( + + + + ); +}; + +export const DialGrid = () => { + return ( + + + + + + + + + + + + + + + + + ); +}; + +export default DialGrid; diff --git a/phone/src/apps/dialer/components/DialerApp.tsx b/phone/src/apps/dialer/components/DialerApp.tsx index 4aacf55..cf81025 100644 --- a/phone/src/apps/dialer/components/DialerApp.tsx +++ b/phone/src/apps/dialer/components/DialerApp.tsx @@ -2,9 +2,12 @@ import React from 'react'; import { AppWrapper } from '../../../ui/components'; import { AppTitle } from '../../../ui/components/AppTitle'; import { AppContent } from '../../../ui/components/AppContent'; -import { DialerHistory } from './DialerHistory'; +import { DialerHistory } from './views/DialerHistory'; import { useDialerHistory } from '../hooks/useDialerHistory'; import { useApp } from '../../../os/apps/hooks/useApps'; +import { Switch, Route } from 'react-router-dom'; +import DialPage from './views/DialPage'; +import DialerNavBar from './DialerNavBar'; export const DialerApp = () => { const { history } = useDialerHistory(); @@ -13,8 +16,17 @@ export const DialerApp = () => { - + + + + + + + + {/**/} + + ); }; diff --git a/phone/src/apps/dialer/components/DialerInput.tsx b/phone/src/apps/dialer/components/DialerInput.tsx new file mode 100644 index 0000000..7c2dee8 --- /dev/null +++ b/phone/src/apps/dialer/components/DialerInput.tsx @@ -0,0 +1,36 @@ +import React 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'; + +const useStyles = makeStyles((theme: Theme) => ({ + root: { + textAlign: 'right', + paddingTop: theme.spacing(3), + paddingBottom: theme.spacing(3), + paddingLeft: theme.spacing(5), + paddingRight: theme.spacing(5), + display: 'flex', + height: 100, + }, + input: { + flex: 1, + fontSize: theme.typography.h6.fontSize, + }, + iconBtn: { + padding: 10, + }, +})); + +export const DialerInput = () => { + const classes = useStyles(); + + return ( + + + + + + + ); +}; diff --git a/phone/src/apps/dialer/components/DialerNavBar.tsx b/phone/src/apps/dialer/components/DialerNavBar.tsx new file mode 100644 index 0000000..3da86d9 --- /dev/null +++ b/phone/src/apps/dialer/components/DialerNavBar.tsx @@ -0,0 +1,54 @@ +import React, { ChangeEvent, useState } from 'react'; +import { BottomNavigation, BottomNavigationAction } from '@material-ui/core'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faHome } from '@fortawesome/free-solid-svg-icons'; +import AddCircleIcon from '@material-ui/icons/AddCircle'; +import { Link } from 'react-router-dom'; +import { makeStyles, Theme } from '@material-ui/core/styles'; +import PhoneCallbackIcon from '@material-ui/icons/PhoneCallback'; +import PhoneIcon from '@material-ui/icons/Phone'; +import { History } from '@material-ui/icons'; + +const useStyles = makeStyles((theme: Theme) => ({ + root: { + width: '100%', + backgroundColor: theme.palette.background.default, + }, + icon: { + color: '#43a047', + }, +})); + +const DialerNavBar = () => { + const classes = useStyles(); + + const [page, setPage] = useState(0); + + const handleChange = (event: ChangeEvent<{}>, newPage) => { + setPage(newPage); + }; + + return ( + + } + to='/phone' + /> + } + to='/phone/dial' + label='Call' + /> + + ); +}; + +export default DialerNavBar; diff --git a/phone/src/apps/dialer/components/views/DialPage.tsx b/phone/src/apps/dialer/components/views/DialPage.tsx new file mode 100644 index 0000000..619a79c --- /dev/null +++ b/phone/src/apps/dialer/components/views/DialPage.tsx @@ -0,0 +1,39 @@ +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'; + +const useStyles = makeStyles((theme: Theme) => ({ + root: { + width: '100%', + minHeight: '100%', + display: 'flex', + flexDirection: 'column', + }, +})); + +const DialPage = () => { + const classes = useStyles(); + + const [inputVal, setInputVal] = useState(''); + + return ( +
+ setInputVal(inputVal + val), + removeOne: () => setInputVal(inputVal.slice(0, -1)), + clear: () => setInputVal(''), + }} + > + + + + +
+ ); +}; +export default DialPage; diff --git a/phone/src/apps/dialer/components/DialerHistory.tsx b/phone/src/apps/dialer/components/views/DialerHistory.tsx similarity index 84% rename from phone/src/apps/dialer/components/DialerHistory.tsx rename to phone/src/apps/dialer/components/views/DialerHistory.tsx index 5b2f34a..6d418f1 100644 --- a/phone/src/apps/dialer/components/DialerHistory.tsx +++ b/phone/src/apps/dialer/components/views/DialerHistory.tsx @@ -2,8 +2,8 @@ import React from 'react'; import ListItemText from '@material-ui/core/ListItemText'; import PhoneCallbackIcon from '@material-ui/icons/PhoneCallback'; import PhoneForwardedIcon from '@material-ui/icons/PhoneForwarded'; -import { List } from '../../../ui/components/List'; -import { ListItem } from '../../../ui/components/ListItem'; +import { List } from '../../../../ui/components/List'; +import { ListItem } from '../../../../ui/components/ListItem'; const CallTypeIcon = { incoming: , diff --git a/phone/src/apps/dialer/context/InputContext.tsx b/phone/src/apps/dialer/context/InputContext.tsx new file mode 100644 index 0000000..1f3462c --- /dev/null +++ b/phone/src/apps/dialer/context/InputContext.tsx @@ -0,0 +1,10 @@ +import { createContext } from 'react'; + +export interface IDialInputCtx { + inputVal: string; + add: (char: string | number) => void; + removeOne: () => void; + clear: () => void; +} + +export const DialInputCtx = createContext(null);