mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
feat(modals/call/nui): inital commit for calling modal
This commit is contained in:
1 parent
59ad36c7fd
commit
c35b5f2b84
6 files changed
+109
-26
No files matched your search
@@ -1,8 +1,12 @@
|
||||
import { atom } from 'recoil';
|
||||
|
||||
export const callerState = {
|
||||
caller: atom({
|
||||
key: 'callerList',
|
||||
default: [],
|
||||
currentCall: atom({
|
||||
key: 'currentCall',
|
||||
default: null
|
||||
}),
|
||||
callModal: atom({
|
||||
key: 'callingModal',
|
||||
default: false
|
||||
})
|
||||
};
|
||||
@@ -1,7 +1,13 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { CallProps } from '../../common/typings/call';
|
||||
import { callerState } from './state';
|
||||
|
||||
export const useCall = () => {
|
||||
const caller = useRecoilState(callerState.caller);
|
||||
return { caller };
|
||||
interface CallHook {
|
||||
call: CallProps;
|
||||
setCall: (details: any) => void;
|
||||
}
|
||||
|
||||
export const useCall = (): CallHook => {
|
||||
const [call, setCall] = useRecoilState(callerState.currentCall);
|
||||
return { call, setCall };
|
||||
};
|
||||
@@ -2,9 +2,13 @@ import { useNuiEvent } from '../../os/nui-events/hooks/useNuiEvent';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { callerState } from './state';
|
||||
import { useCall } from './useCall';
|
||||
import { useModal } from './useModal';
|
||||
|
||||
export const useCallService = () => {
|
||||
const setCaller = useSetRecoilState(callerState.caller);
|
||||
const setCaller = useSetRecoilState(callerState.currentCall);
|
||||
const setModal= useSetRecoilState(callerState.callModal);
|
||||
|
||||
useNuiEvent('CALL', 'setCaller', setCaller);
|
||||
return useCall();
|
||||
useNuiEvent('CALL', 'callModal', setModal);
|
||||
return { useCall, useModal };
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { callerState } from './state';
|
||||
|
||||
interface ModalProps {
|
||||
modal: boolean;
|
||||
setModal: (show: boolean) => void;
|
||||
}
|
||||
|
||||
export const useModal = (): ModalProps => {
|
||||
const [modal, setModal] = useRecoilState(callerState.callModal);
|
||||
return { modal, setModal }
|
||||
}
|
||||
Reference in new issue
Block a user