diff --git a/phone/src/apps/contacts/components/ContactsApp.tsx b/phone/src/apps/contacts/components/ContactsApp.tsx index f27a774..8350195 100644 --- a/phone/src/apps/contacts/components/ContactsApp.tsx +++ b/phone/src/apps/contacts/components/ContactsApp.tsx @@ -45,7 +45,7 @@ InjectDebugData([ { id: 3, display: 'Chip', - number: '417-8792', + number: '777-7777', }, ], }, diff --git a/phone/src/apps/dialer/components/DialerApp.tsx b/phone/src/apps/dialer/components/DialerApp.tsx index 3610085..4ce7eb0 100644 --- a/phone/src/apps/dialer/components/DialerApp.tsx +++ b/phone/src/apps/dialer/components/DialerApp.tsx @@ -39,7 +39,7 @@ export const DialerApp = () => { InjectDebugData([ { - app: 'DIALER', + app: 'DAILER', method: 'setHistory', data: [ { diff --git a/phone/src/apps/dialer/components/views/DialerHistory.tsx b/phone/src/apps/dialer/components/views/DialerHistory.tsx index 4269fd8..f0fd47f 100644 --- a/phone/src/apps/dialer/components/views/DialerHistory.tsx +++ b/phone/src/apps/dialer/components/views/DialerHistory.tsx @@ -1,7 +1,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 PhoneIcon from '@material-ui/icons/Phone'; +import PersonAddIcon from '@material-ui/icons/PersonAdd'; import { List } from '../../../../ui/components/List'; import { ListItem } from '../../../../ui/components/ListItem'; import Nui from '../../../../os/nui-events/utils/Nui'; @@ -10,11 +11,27 @@ import { useContacts } from '../../../contacts/hooks/useContacts'; import { ICall } from '../../../../common/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'; + +const useStyles = makeStyles((theme: Theme) => ({ + callForward: { + color: theme.palette.success.main, + }, + callBack: { + color: theme.palette.error.main, + }, +})); export const DialerHistory = ({ calls }) => { const { number } = useSimcard(); const { getDisplayByNumber } = useContacts(); + const classes = useStyles(); + + const history = useHistory(); + const { t } = useTranslation(); const handleCall = (phoneNumber) => { @@ -23,8 +40,17 @@ export const DialerHistory = ({ calls }) => { }); }; - if (!calls) { - return

Things are loading or arent here at all

; + if (!calls?.length) { + return ( + +

You got no friends!😎

+
+ ); } return ( @@ -34,27 +60,59 @@ export const DialerHistory = ({ calls }) => { handleCall(call.receiver)} > + + {} + + - {} + handleCall(call.receiver)}> + {} + + + + history.push( + `/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts` + ) + } + > + {} + ) : ( handleCall(call.transmitter)} > + + {} + + - {} + handleCall(call.receiver)}> + {} + + + {getDisplayByNumber(call.transmitter) === call.transmitter ? ( + + history.push( + `/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts` + ) + } + > + {} + + ) : null} ) )} diff --git a/phone/src/apps/dialer/hooks/state.ts b/phone/src/apps/dialer/hooks/state.ts index e1c5751..2833fce 100644 --- a/phone/src/apps/dialer/hooks/state.ts +++ b/phone/src/apps/dialer/hooks/state.ts @@ -3,6 +3,6 @@ import { atom } from 'recoil'; export const dialState = { history: atom({ key: 'dialHistory', - default: null, + default: [], }), }; diff --git a/phone/src/apps/dialer/hooks/useDialHistory.ts b/phone/src/apps/dialer/hooks/useDialHistory.ts index c4503e3..63bd9f5 100644 --- a/phone/src/apps/dialer/hooks/useDialHistory.ts +++ b/phone/src/apps/dialer/hooks/useDialHistory.ts @@ -5,7 +5,7 @@ interface ICallUI { history: ICall[]; } -export const useDialHistory = (): ICallUI => { +export const useDialHistory = (): ICallUI[] => { const history = useRecoilValue(dialState.history); return history; };