refactor(events): Events are now tied to a common enum typings (#167)

* chore(scripts/twitter): Refactored twitter to use event enums

* chore(scripts/marketplace): Refactored marketplace to use event enums

* chore(scripts/messages): Refactored messages to use event enums

* chore(scripts/contacts): Refactored contacts to use event enums

* chore(scripts/calls): Refactored calls to use event enums

* chore(scripts/notes): Refactored notes to use event enums

* chore(scripts/photos): Refactored photos to use event enums

* chore(scripts/bank): Refactored bank to use event enums

* chore(scripts/phone): Refactored phone to use event enums

* chore(events): Removed old events object

* refactor(phone/nui-events): Attached NUI events to respective enum

* tweak(event-enums): Added npwd prefix to all events

* tweak(phone/serve): Added craco to override CRA without eject

Also bumped react-scripts to 4.0.1, with seemingly no issues

* fix(typings/twitter): Fixed method enums for twitter
This commit is contained in:
Taso authored and GitHub committed 2021-03-22 13:37:07 -04:00
1 parent 53d5bb459d
commit 0f61088999
62 files changed
+4734 -3470

No files matched your search

@@ -3,7 +3,7 @@ import Nui from '../../nui-events/utils/Nui';
export const AppWithStartup = ({ children, id }) => {
useEffect(() => {
Nui.send(`phone:app:${id}`);
Nui.send(`npwd:app:${id}`);
}, [id]);
return children;
};
+4 -3
View File
@@ -2,6 +2,7 @@ import { useRecoilState } from 'recoil';
import { CallProps } from '../../../../../typings/call';
import Nui from '../../nui-events/utils/Nui';
import { callerState } from './state';
import { CallEvents } from '../../../../../typings/call';
interface CallHook {
call: CallProps;
@@ -15,19 +16,19 @@ export const useCall = (): CallHook => {
const [call, setCall] = useRecoilState(callerState.currentCall);
const acceptCall = () => {
Nui.send('phone:acceptCall', {
Nui.send(CallEvents.ACCEPT_CALL, {
transmitterNumber: call.transmitter,
});
};
const rejectCall = () => {
Nui.send('phone:rejectCall', {
Nui.send(CallEvents.REJECTED, {
phoneNumber: call.transmitter,
});
};
const endCall = () => {
Nui.send('phone:endCall', {
Nui.send(CallEvents.END_CALL, {
transmitterNumber: call.transmitter,
});
};
+3 -2
View File
@@ -4,6 +4,7 @@ import ServerConfig from '../../../config.autogen.json';
import { useNotifications } from '../../notifications/hooks/useNotifications';
import Nui from '../../nui-events/utils/Nui';
import { phoneState } from './state';
import { PhoneEvents } from '../../../../../typings/phone';
interface IUsePhone {
config?: IServerConfig;
@@ -21,10 +22,10 @@ export const usePhone = (): IUsePhone => {
const closePhone = () => {
removeAlerts();
Nui.send('phone:close');
Nui.send(PhoneEvents.CLOSE_PHONE);
};
const openPhone = () => {
Nui.send('phone:open');
Nui.send(PhoneEvents.OPEN_PHONE);
};
return { config: ServerConfig as any, closePhone, openPhone, isPhoneOpen, isPhoneReady };