Feature/floating notifications calling and twitter (#112)

* Add floating notifications :O

* Add phone notifications and refactor calling ui

* This is unsafe

* Fix controls null check

* Remove go to alert

* Fix phone stuck after call

* Remove lazy mount for Phone

* Fix open/close cl_main

* Use effect for notification visibility

* Remove all alerts when phone closes

* Avoid re-render useNuiEvent

* It works now :c
This commit is contained in:
J Francisco Rader authored and GitHub committed 2021-02-23 13:19:10 -05:00
1 parent 4633146d40
commit f6d7a3dbe1
42 files changed
+869 -679

No files matched your search

@@ -0,0 +1,58 @@
import React from 'react';
import CloseIcon from '@material-ui/icons/Close';
import {
IconButton,
ListItem,
ListItemAvatar,
ListItemText,
makeStyles,
} from '@material-ui/core';
import { INotification } from '../providers/NotificationsProvider';
const useStyles = makeStyles((theme) => ({
closeNotifBtn: {
position: 'absolute',
right: '8px',
top: '8px',
},
notificationItem: {
position: 'relative',
},
}));
export const NotificationItem = ({
onClose,
onClickClose,
...notification
}: INotification & {
onClose: (e: any) => void;
onClickClose: (e: any) => void;
}) => {
const { title, icon, content, cantClose, onClick } = notification;
const classes = useStyles();
return (
<ListItem
divider
button
onClick={(e) => {
if (onClick) {
onClick(notification);
onClickClose(e);
}
}}
className={classes.notificationItem}
>
{icon && <ListItemAvatar>{icon}</ListItemAvatar>}
<ListItemText secondary={content}>{title}</ListItemText>
{!cantClose && (
<IconButton
className={classes.closeNotifBtn}
size='small'
onClick={onClose}
>
<CloseIcon color='primary' />
</IconButton>
)}
</ListItem>
);
};