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.
This commit is contained in:
Taso authored and Taso committed 2021-03-17 10:26:52 -04:00
1 parent a6e8c769c0
commit f1f6a05981
10 files changed
+76 -39

No files matched your search

@@ -9,11 +9,11 @@ import Nui from '../../../../os/nui-events/utils/Nui';
import { useSimcard } from '../../../../os/simcard/hooks/useSimcard';
import { useContacts } from '../../../contacts/hooks/useContacts';
import { ICall } from '../../../../../../typings/call';
import dayjs from 'dayjs';
import { useTranslation } from 'react-i18next';
import { Box, IconButton, ListItemIcon, ListItemText } from '@material-ui/core';
import { useHistory } from 'react-router-dom';
import { makeStyles, Theme } from '@material-ui/core/styles';
import dayjs from 'dayjs';
const useStyles = makeStyles((theme: Theme) => ({
callForward: {
@@ -25,7 +25,7 @@ const useStyles = makeStyles((theme: Theme) => ({
}));
export const DialerHistory = ({ calls }) => {
const { number } = useSimcard();
const { number: myNumber } = useSimcard();
const { getDisplayByNumber } = useContacts();
const classes = useStyles();
@@ -44,9 +44,9 @@ export const DialerHistory = ({ calls }) => {
return (
<Box display="flex" justifyContent="center" alignItems="center" paddingTop={35}>
<p>
You got no friends!
<span role="img" aria-label="deal with it">
😎
{t('APPS_DIALER_NO_HISTORY')}
<span role="img" aria-label="sad">
😞
</span>
</p>
</Box>
@@ -56,45 +56,57 @@ export const DialerHistory = ({ calls }) => {
return (
<List disablePadding>
{calls.map((call: ICall) =>
call.transmitter === number ? (
call.transmitter === myNumber ? (
<ListItem key={call.id} divider>
<ListItemIcon>{<PhoneForwardedIcon className={classes.callForward} />}</ListItemIcon>
<ListItemIcon>
<PhoneForwardedIcon className={classes.callForward} />
</ListItemIcon>
<ListItemText
primary={getDisplayByNumber(call.receiver)}
secondary={dayjs.unix(call.start).format(t('DATE_TIME_FORMAT'))}
secondary={
// TODO: Locale changes are pending #168 merge
dayjs().to(dayjs.unix(call.start))
}
/>
<IconButton onClick={() => handleCall(call.receiver)}>{<PhoneIcon />}</IconButton>
{getDisplayByNumber(call.transmitter) === call.transmitter ? (
{getDisplayByNumber(call.transmitter) === call.transmitter && (
<IconButton
onClick={() =>
history.push(`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`)
}
>
{<PersonAddIcon />}
<PersonAddIcon />
</IconButton>
) : null}
)}
</ListItem>
) : (
<ListItem key={call.id} divider>
<ListItemIcon>{<PhoneCallbackIcon className={classes.callBack} />}</ListItemIcon>
<ListItemIcon>
<PhoneCallbackIcon className={classes.callBack} />
</ListItemIcon>
<ListItemText
primary={getDisplayByNumber(call.transmitter)}
secondary={dayjs.unix(call.start).format(t('DATE_TIME_FORMAT'))}
secondary={
// TODO: Locale changes are pending #168 merge
dayjs().to(dayjs.unix(call.start))
}
/>
<IconButton onClick={() => handleCall(call.transmitter)}>{<PhoneIcon />}</IconButton>
<IconButton onClick={() => handleCall(call.transmitter)}>
<PhoneIcon />
</IconButton>
{getDisplayByNumber(call.transmitter) === call.transmitter ? (
{getDisplayByNumber(call.transmitter) === call.transmitter && (
<IconButton
onClick={() =>
history.push(`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`)
}
>
{<PersonAddIcon />}
<PersonAddIcon />
</IconButton>
) : null}
)}
</ListItem>
),
)}