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,66 @@
|
||||
import React from 'react';
|
||||
import CallIcon from '@material-ui/icons/Call';
|
||||
import CallEndIcon from '@material-ui/icons/CallEnd';
|
||||
import { Fab } from '@material-ui/core';
|
||||
import { useCall } from '../hooks/useCall';
|
||||
import useStyles from './modal.styles';
|
||||
import { useModal } from '../hooks/useModal';
|
||||
|
||||
export const CallControls = ({
|
||||
size,
|
||||
}: {
|
||||
size?: 'small' | 'medium' | 'large';
|
||||
}) => {
|
||||
const classes = useStyles();
|
||||
const { setModal } = useModal();
|
||||
const { call, endCall, acceptCall, rejectCall } = useCall();
|
||||
|
||||
if (!call) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const handleRejectCall = () => {
|
||||
setModal(false);
|
||||
rejectCall();
|
||||
};
|
||||
|
||||
const handleEndCall = () => {
|
||||
setModal(false);
|
||||
endCall();
|
||||
};
|
||||
|
||||
const { accepted, isTransmitter } = call;
|
||||
|
||||
if (accepted || isTransmitter) {
|
||||
return (
|
||||
<Fab
|
||||
size={size}
|
||||
onClick={handleEndCall}
|
||||
style={{ backgroundColor: '#e74c3c', color: '#fff' }}
|
||||
className={classes.actionButton}
|
||||
>
|
||||
<CallEndIcon />
|
||||
</Fab>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Fab
|
||||
size={size}
|
||||
onClick={handleRejectCall}
|
||||
style={{ backgroundColor: '#e74c3c', color: '#fff' }}
|
||||
className={classes.actionButton}
|
||||
>
|
||||
<CallEndIcon />
|
||||
</Fab>
|
||||
<Fab
|
||||
size={size}
|
||||
onClick={acceptCall}
|
||||
style={{ backgroundColor: '#27ae60', color: '#fff' }}
|
||||
className={classes.actionButton}
|
||||
>
|
||||
<CallIcon />
|
||||
</Fab>
|
||||
</>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user