diff --git a/phone/src/os/apps/components/AppRoute.tsx b/phone/src/os/apps/components/AppRoute.tsx index 4049a14..a85fcc8 100644 --- a/phone/src/os/apps/components/AppRoute.tsx +++ b/phone/src/os/apps/components/AppRoute.tsx @@ -2,12 +2,12 @@ import React from 'react'; import { Route } from 'react-router-dom'; import { AppWithStartup } from './AppWithStartup'; -export const AppRoute = ({ id, component: Component, ...rest }) => { +export const AppRoute = ({ id, emitOnOpen, component: Component, ...rest }) => { return ( ( - + )} diff --git a/phone/src/os/apps/components/AppWithStartup.tsx b/phone/src/os/apps/components/AppWithStartup.tsx index 43de431..7dc7129 100644 --- a/phone/src/os/apps/components/AppWithStartup.tsx +++ b/phone/src/os/apps/components/AppWithStartup.tsx @@ -1,11 +1,11 @@ import { memo, useEffect } from 'react'; import { useNuiRequest } from 'fivem-nui-react-lib'; -const Component = ({ children, id }) => { +const Component = ({ children, id, emitOnOpen }) => { const Nui = useNuiRequest(); useEffect(() => { - Nui.send(`npwd:app:${id}`); - }, [Nui, id]); + if (emitOnOpen) Nui.send(`npwd:app:${id}`); + }, [Nui, id, emitOnOpen]); return children; }; diff --git a/phone/src/os/apps/config/apps.tsx b/phone/src/os/apps/config/apps.tsx index 4f15e03..bda8970 100644 --- a/phone/src/os/apps/config/apps.tsx +++ b/phone/src/os/apps/config/apps.tsx @@ -59,7 +59,7 @@ export const APPS: IAppConfig[] = [ backgroundColor: DIALER_APP_PRIMARY_COLOR, color: DIALER_APP_TEXT_COLOR, path: '/phone', - Route: () => , + Route: () => , }, { id: 'MESSAGES', @@ -67,7 +67,9 @@ export const APPS: IAppConfig[] = [ backgroundColor: MESSAGES_APP_PRIMARY_COLOR, color: MESSAGES_APP_TEXT_COLOR, path: '/messages', - Route: () => , + Route: () => ( + + ), }, { id: 'CONTACTS', @@ -75,7 +77,9 @@ export const APPS: IAppConfig[] = [ backgroundColor: CONTACTS_APP_PRIMARY_COLOR, color: CONTACTS_APP_TEXT_COLOR, path: '/contacts', - Route: () => , + Route: () => ( + + ), }, { id: 'CALCULATOR', @@ -83,7 +87,9 @@ export const APPS: IAppConfig[] = [ backgroundColor: purple[500], color: grey[50], path: '/calculator', - Route: () => , + Route: () => ( + + ), }, { id: 'SETTINGS', @@ -91,7 +97,9 @@ export const APPS: IAppConfig[] = [ backgroundColor: '#383838', color: grey[50], path: '/settings', - Route: () => , + Route: () => ( + + ), }, /* Hiding the bank app while the bank resource gets done */ /*{ @@ -108,7 +116,7 @@ export const APPS: IAppConfig[] = [ backgroundColor: MATCH_APP_PRIMARY_COLOR, color: MATCH_APP_TEXT_COLOR, path: '/match', - Route: () => , + Route: () => , }, { id: 'TWITTER', @@ -116,7 +124,7 @@ export const APPS: IAppConfig[] = [ backgroundColor: TWITTER_APP_PRIMARY_COLOR, color: TWITTER_APP_TEXT_COLOR, path: '/twitter', - Route: () => , + Route: () => , }, { id: 'SELLOUT', @@ -124,7 +132,9 @@ export const APPS: IAppConfig[] = [ backgroundColor: SELLOUT_APP_PRIMARY_COLOR, color: SELLOUT_APP_ICON_COLOR, path: '/marketplace', - Route: () => , + Route: () => ( + + ), }, { id: 'NOTES', @@ -132,7 +142,7 @@ export const APPS: IAppConfig[] = [ backgroundColor: NOTES_APP_PRIMARY_COLOR, color: NOTES_APP_ICON_COLOR, path: '/notes', - Route: () => , + Route: () => , }, { id: 'CAMERA', @@ -140,7 +150,7 @@ export const APPS: IAppConfig[] = [ backgroundColor: grey['A400'], color: common.white, path: '/camera', - Route: () => , + Route: () => , }, ]; @@ -152,6 +162,8 @@ if (process.env.NODE_ENV === 'development') { backgroundColor: blue[500], color: blue[50], path: '/example', - Route: () => , + Route: () => ( + + ), }); }