Files
new-phone-who-dis/phone/src/apps/dialer/components/views/DialPage.tsx
T
Taso f1f6a05981 tweak(dialer): Several fixes and improvements
Time has been changed to a relative format. Locale specifics are pending
merge of #168.

Several typos have been fixed where "DAILER" was referenced instead of
"DIALER"

A translation key was added for when a user has no call history.

The input box has been unlocked so users can use their keyboard directly
rather than using the dial pad.
2021-03-17 10:26:52 -04:00

41 lines
1.1 KiB
TypeScript

import React, { useState } from 'react';
import { makeStyles, Theme } from '@material-ui/core/styles';
import DialGrid from '../DialPadGrid';
import { DialerInput } from '../DialerInput';
import { DialInputCtx } from '../../context/InputContext';
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
const useStyles = makeStyles((theme: Theme) => ({
root: {
width: '100%',
minHeight: '100%',
display: 'flex',
flexDirection: 'column',
},
}));
const DialPage = () => {
const classes = useStyles();
const query = useQueryParams();
const queryNumber = query.number;
const [inputVal, setInputVal] = useState(queryNumber || '');
return (
<div className={classes.root}>
<DialInputCtx.Provider
value={{
inputVal,
add: (val: string) => setInputVal(inputVal + val),
removeOne: () => setInputVal(inputVal.slice(0, -1)),
clear: () => setInputVal(''),
set: (val: string) => setInputVal(val),
}}
>
<DialerInput />
<DialGrid />
</DialInputCtx.Provider>
</div>
);
};
export default DialPage;