mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
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:
1 parent
4633146d40
commit
f6d7a3dbe1
42 files changed
+869
-679
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import React from 'react';
|
||||
import { Box, makeStyles } from '@material-ui/core';
|
||||
import { useNotifications } from '../hooks/useNotifications';
|
||||
import { Alert, AlertTitle } from '@material-ui/lab';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
snackbar: {
|
||||
marginTop: '-710px',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
alert: {
|
||||
position: 'relative',
|
||||
cursor: 'pointer',
|
||||
width: '370px',
|
||||
height: '120px',
|
||||
zIndex: 50,
|
||||
backgroundColor: theme.palette.background.paper,
|
||||
color: theme.palette.text.primary,
|
||||
'& .MuiAlert-icon': {
|
||||
color: theme.palette.text.primary,
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
export const NotificationAlert = () => {
|
||||
const classes = useStyles();
|
||||
const { currentAlert } = useNotifications();
|
||||
|
||||
return (
|
||||
<div className={classes.snackbar}>
|
||||
{currentAlert ? (
|
||||
<Alert
|
||||
onClick={() => currentAlert.onClick?.(currentAlert)}
|
||||
icon={currentAlert.icon || false}
|
||||
className={classes.alert}
|
||||
elevation={6}
|
||||
>
|
||||
<AlertTitle>{currentAlert.title}</AlertTitle>
|
||||
<Box width='100%'>{currentAlert.content}</Box>
|
||||
</Alert>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user