mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Prettified Code!
This commit is contained in:
1 parent
e48864c6dc
commit
566b55b374
5 files changed
+78
-59
No files matched your search
+2
-2
@@ -65,12 +65,12 @@ if (process.env.NODE_ENV === 'development') {
|
||||
{
|
||||
id: 1,
|
||||
transmitter: '636-6496',
|
||||
start: 1612301545782
|
||||
start: 1612301545782,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
transmitter: '777-7777',
|
||||
start: 1612301545782
|
||||
start: 1612301545782,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -4,43 +4,60 @@ 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 Nui from '../../../../os/nui-events/utils/Nui'
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import { useSimcard } from '../../../../os/simcard/hooks/useSimcard';
|
||||
import { useContacts } from '../../../contacts/hooks/useContacts';
|
||||
import { ICall } from '../../../../common/typings/call';
|
||||
import dayjs from 'dayjs'
|
||||
import dayjs from 'dayjs';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
|
||||
export const DialerHistory = ({ calls }) => {
|
||||
const { number } = useSimcard();
|
||||
const { getDisplayByNumber } = useContacts();
|
||||
|
||||
const { t } = useTranslation()
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleCall = (phoneNumber) => {
|
||||
Nui.send('phone:beginCall', {
|
||||
number: phoneNumber
|
||||
})
|
||||
}
|
||||
number: phoneNumber,
|
||||
});
|
||||
};
|
||||
|
||||
if (!calls) {
|
||||
return <p>Things are loading or arent here at all</p>
|
||||
}
|
||||
return <p>Things are loading or arent here at all</p>;
|
||||
}
|
||||
|
||||
return (
|
||||
<List disablePadding>
|
||||
{calls.map((call: ICall) => call.transmitter === number ? (
|
||||
<ListItem key={call.id} divider button onClick={() => handleCall(call.receiver)}>
|
||||
<ListItemText primary={getDisplayByNumber(call.receiver)} secondary={new Date(call.start).getUTCDate()}/>
|
||||
{<PhoneForwardedIcon />}
|
||||
</ListItem>
|
||||
): (
|
||||
<ListItem key={call.id} divider button onClick={() => handleCall(call.transmitter)}>
|
||||
<ListItemText primary={getDisplayByNumber(call.transmitter)} secondary={dayjs.unix(call.start).format(t("DATE_TIME_FORMAT"))} />
|
||||
{<PhoneCallbackIcon />}
|
||||
</ListItem>
|
||||
))}
|
||||
{calls.map((call: ICall) =>
|
||||
call.transmitter === number ? (
|
||||
<ListItem
|
||||
key={call.id}
|
||||
divider
|
||||
button
|
||||
onClick={() => handleCall(call.receiver)}
|
||||
>
|
||||
<ListItemText
|
||||
primary={getDisplayByNumber(call.receiver)}
|
||||
secondary={new Date(call.start).getUTCDate()}
|
||||
/>
|
||||
{<PhoneForwardedIcon />}
|
||||
</ListItem>
|
||||
) : (
|
||||
<ListItem
|
||||
key={call.id}
|
||||
divider
|
||||
button
|
||||
onClick={() => handleCall(call.transmitter)}
|
||||
>
|
||||
<ListItemText
|
||||
primary={getDisplayByNumber(call.transmitter)}
|
||||
secondary={dayjs.unix(call.start).format(t('DATE_TIME_FORMAT'))}
|
||||
/>
|
||||
{<PhoneCallbackIcon />}
|
||||
</ListItem>
|
||||
)
|
||||
)}
|
||||
</List>
|
||||
);
|
||||
};
|
||||
@@ -21,4 +21,4 @@ export interface ICallDuration {
|
||||
s: number;
|
||||
m: number;
|
||||
h: number;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user