mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +00:00
Feat: Dial section
Still WIP
This commit is contained in:
1 parent
5a9707ae3c
commit
d6e9a85b40
8 files changed
+221
-4
No files matched your search
@@ -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 <Box flexGrow={1} className={classes.root}></Box>;
|
||||
};
|
||||
|
||||
export default ContactsSearch;
|
||||
@@ -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 (
|
||||
<Grid key={label} item xs={4}>
|
||||
<Button fullWidth className={classes.gridItem} onClick={onClick}>
|
||||
{label}
|
||||
</Button>
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
|
||||
export const DialGrid = () => {
|
||||
return (
|
||||
<Box>
|
||||
<Grid container justify='space-around'>
|
||||
<ButtonItem label={1} />
|
||||
<ButtonItem label={2} />
|
||||
<ButtonItem label={3} />
|
||||
<ButtonItem label={4} />
|
||||
<ButtonItem label={5} />
|
||||
<ButtonItem label={6} />
|
||||
<ButtonItem label={7} />
|
||||
<ButtonItem label={8} />
|
||||
<ButtonItem label={9} />
|
||||
<ButtonItem label='*' />
|
||||
<ButtonItem label={0} />
|
||||
<ButtonItem label='#' />
|
||||
</Grid>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default DialGrid;
|
||||
@@ -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 = () => {
|
||||
<AppWrapper>
|
||||
<AppTitle app={dialer} />
|
||||
<AppContent>
|
||||
<DialerHistory calls={history} />
|
||||
<Switch>
|
||||
<Route path='/phone/dial'>
|
||||
<DialPage />
|
||||
</Route>
|
||||
<Route path='/phone'>
|
||||
<DialerHistory calls={history} />
|
||||
</Route>
|
||||
{/*<Route path='/phone/contacts'></Route>*/}
|
||||
</Switch>
|
||||
</AppContent>
|
||||
<DialerNavBar />
|
||||
</AppWrapper>
|
||||
);
|
||||
};
|
||||
@@ -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 (
|
||||
<Box component={Paper} className={classes.root}>
|
||||
<InputBase placeholder='Enter a number' className={classes.input} />
|
||||
<IconButton className={classes.iconBtn}>
|
||||
<PhoneIcon />
|
||||
</IconButton>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -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 (
|
||||
<BottomNavigation
|
||||
value={page}
|
||||
onChange={handleChange}
|
||||
showLabels
|
||||
className={classes.root}
|
||||
>
|
||||
<BottomNavigationAction
|
||||
label='History'
|
||||
component={Link}
|
||||
icon={<History />}
|
||||
to='/phone'
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<PhoneIcon />}
|
||||
to='/phone/dial'
|
||||
label='Call'
|
||||
/>
|
||||
</BottomNavigation>
|
||||
);
|
||||
};
|
||||
|
||||
export default DialerNavBar;
|
||||
@@ -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 (
|
||||
<div className={classes.root}>
|
||||
<DialInputCtx.Provider
|
||||
value={{
|
||||
inputVal,
|
||||
add: (val: string) => setInputVal(inputVal + val),
|
||||
removeOne: () => setInputVal(inputVal.slice(0, -1)),
|
||||
clear: () => setInputVal(''),
|
||||
}}
|
||||
>
|
||||
<ContactSearch />
|
||||
<DialerInput />
|
||||
<DialGrid />
|
||||
</DialInputCtx.Provider>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default DialPage;
|
||||
+2
-2
@@ -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: <PhoneCallbackIcon />,
|
||||
@@ -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);
|
||||
Reference in new issue
Block a user