diff --git a/phone/src/os/apps/hooks/useApps.tsx b/phone/src/os/apps/hooks/useApps.tsx index 76da56c..43d702d 100644 --- a/phone/src/os/apps/hooks/useApps.tsx +++ b/phone/src/os/apps/hooks/useApps.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useEffect} from 'react'; import { useConfig } from '../../../config/hooks/useConfig'; import { blue, @@ -38,6 +38,23 @@ import { ExampleApp } from '../../../apps/example/components/ExampleApp'; import { SelloutApp } from '../../../apps/sellout/components/SelloutApp'; import { NotesApp } from '../../../apps/notes/NotesApp'; import CameraApp from '../../../apps/camera/components/CameraApp'; +import Nui from "../../nui-events/utils/Nui"; + +const AppWithStartup = ({ children, id }) => { + useEffect(() => { + Nui.send(`phone:app:${id}`); + }, []); + return children; +}; + +const AppRoute = ({ id, component: Component, ...rest }) => { + return ( + } + /> + ); +}; const appsState = atom({ key: 'apps', @@ -50,7 +67,7 @@ const appsState = atom({ backgroundColor: green[600], color: common.white, path: '/phone', - Route: () => , + Route: () => , }, { id: 'MESSAGES', @@ -60,7 +77,7 @@ const appsState = atom({ color: common.white, path: '/messages', sharePath: '/messages/new', - Route: () => , + Route: () => , }, { id: 'CONTACTS', @@ -69,7 +86,7 @@ const appsState = atom({ backgroundColor: blue[500], color: common.white, path: '/contacts', - Route: () => , + Route: () => , }, { id: 'CALCULATOR', @@ -78,7 +95,7 @@ const appsState = atom({ backgroundColor: purple[500], color: grey[50], path: '/calculator', - Route: () => , + Route: () => , }, { id: 'SETTINGS', @@ -87,7 +104,7 @@ const appsState = atom({ backgroundColor: '#383838', color: grey[50], path: '/settings', - Route: () => , + Route: () => , }, { id: 'BANK', @@ -96,7 +113,7 @@ const appsState = atom({ backgroundColor: blue[900], color: common.white, path: '/bank', - Route: () => , + Route: () => , }, { id: 'TWITTER', @@ -105,7 +122,7 @@ const appsState = atom({ backgroundColor: blue[600], color: common.white, path: '/twitter', - Route: () => , + Route: () => , }, { id: 'SELLOUT', @@ -114,7 +131,7 @@ const appsState = atom({ backgroundColor: red[500], color: common.white, path: '/sellout', - Route: () => , + Route: () => , }, { id: 'NOTES', @@ -123,7 +140,7 @@ const appsState = atom({ backgroundColor: yellow[800], color: common.white, path: '/notes', - Route: () => , + Route: () => , }, { id: 'CAMERA', @@ -132,7 +149,7 @@ const appsState = atom({ backgroundColor: grey['A400'], color: common.white, path: '/camera', - Route: () => , + Route: () => , }, { id: 'EXAMPLE', @@ -141,7 +158,7 @@ const appsState = atom({ backgroundColor: blue[500], color: blue[50], path: '/example', - Route: () => , + Route: () => , }, ], }, @@ -158,5 +175,6 @@ export const useApps = () => { export const useApp = (id) => { const { getApp } = useApps(); + return getApp(id); }; diff --git a/phone/src/ui/components/AppIcon.tsx b/phone/src/ui/components/AppIcon.tsx index 0b3c10a..5bc7fae 100644 --- a/phone/src/ui/components/AppIcon.tsx +++ b/phone/src/ui/components/AppIcon.tsx @@ -35,12 +35,8 @@ export const AppIcon = ({ id, name, icon, backgroundColor, color }) => { color: color || green[400], }); - const openAppCallback = () => { - Nui.send(`phone:app:${id}`); - }; - return ( -