From 51d31ee122b5258640517bdaee9c727277a5281b Mon Sep 17 00:00:00 2001 From: J Francisco Rader Date: Fri, 5 Feb 2021 15:08:25 -0500 Subject: [PATCH 01/11] Fix warnings + Improve CallTimer --- phone/src/apps/contacts/hooks/useContacts.ts | 1 - .../apps/dialer/components/DialerNavBar.tsx | 4 -- phone/src/modal/components/CallModal.tsx | 5 +- phone/src/modal/components/CallTimer.tsx | 49 ++++++++----------- phone/src/modal/hooks/useCall.ts | 2 +- phone/src/os/nui-events/hooks/useNuiEvent.ts | 2 +- 6 files changed, 24 insertions(+), 39 deletions(-) diff --git a/phone/src/apps/contacts/hooks/useContacts.ts b/phone/src/apps/contacts/hooks/useContacts.ts index 15df383..780e993 100644 --- a/phone/src/apps/contacts/hooks/useContacts.ts +++ b/phone/src/apps/contacts/hooks/useContacts.ts @@ -2,7 +2,6 @@ import { useRecoilValue } from 'recoil'; import { contactsState } from './state'; import { ContactProps } from '../../../common/typings/contact'; -import { useCall } from '../../../modal/hooks/useCall'; import { useCallback } from 'react'; interface IUseContacts { diff --git a/phone/src/apps/dialer/components/DialerNavBar.tsx b/phone/src/apps/dialer/components/DialerNavBar.tsx index 3da86d9..6951e4f 100644 --- a/phone/src/apps/dialer/components/DialerNavBar.tsx +++ b/phone/src/apps/dialer/components/DialerNavBar.tsx @@ -1,11 +1,7 @@ import React, { ChangeEvent, useState } from 'react'; import { BottomNavigation, BottomNavigationAction } from '@material-ui/core'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faHome } from '@fortawesome/free-solid-svg-icons'; -import AddCircleIcon from '@material-ui/icons/AddCircle'; import { Link } from 'react-router-dom'; import { makeStyles, Theme } from '@material-ui/core/styles'; -import PhoneCallbackIcon from '@material-ui/icons/PhoneCallback'; import PhoneIcon from '@material-ui/icons/Phone'; import { History } from '@material-ui/icons'; diff --git a/phone/src/modal/components/CallModal.tsx b/phone/src/modal/components/CallModal.tsx index ff33f4e..6603f33 100644 --- a/phone/src/modal/components/CallModal.tsx +++ b/phone/src/modal/components/CallModal.tsx @@ -1,7 +1,6 @@ -import React, { useState } from 'react'; -import { Button, Fab } from '@material-ui/core'; +import React from 'react'; +import { Fab } from '@material-ui/core'; import { AppWrapper } from '../../ui/components/AppWrapper'; -import { AppTitle } from '../../ui/components/AppTitle'; import { AppContent } from '../../ui/components/AppContent'; import { useCall } from '../hooks/useCall'; import CallIcon from '@material-ui/icons/Call'; diff --git a/phone/src/modal/components/CallTimer.tsx b/phone/src/modal/components/CallTimer.tsx index ceea576..724dca8 100644 --- a/phone/src/modal/components/CallTimer.tsx +++ b/phone/src/modal/components/CallTimer.tsx @@ -1,8 +1,26 @@ -import React, { useState, useCallback, useEffect } from 'react'; +import React, { useCallback, useEffect, useRef } from 'react'; import { useDuration } from '../hooks/useDuration'; function CallTimer({ isAccepted }) { const { duration, setDuration } = useDuration(); + const updatedTime = useRef({ ms: 0, s: 0, m: 0, h: 0 }); + + const run = useCallback(() => { + let newTime = { ...updatedTime.current }; + if (newTime.m >= 60) { + newTime = { ...newTime, h: newTime.h + 1, m: 0 }; + } + if (newTime.s >= 60) { + newTime = { ...newTime, m: newTime.m + 1, s: 0 }; + } + if (newTime.ms >= 100) { + newTime = { ...newTime, s: newTime.s + 1, ms: 0 }; + } + + newTime = { ...newTime, ms: newTime.ms + 1 }; + updatedTime.current = newTime; + setDuration(newTime); + }, [setDuration]); useEffect(() => { let timer; @@ -12,37 +30,10 @@ function CallTimer({ isAccepted }) { } else { clearInterval(timer); } - }, []); - - let updatedMs = duration.ms, - updatedS = duration.s, - updatedM = duration.m, - updatedH = duration.h; + }, [isAccepted, run]); if (!duration) return null; - const run = () => { - if (updatedM === 60) { - updatedH++; - updatedM = 0; - } - if (updatedS === 60) { - updatedM++; - updatedS = 0; - } - if (updatedMs === 100) { - updatedS++; - updatedMs = 0; - } - updatedMs++; - return setDuration({ - ms: updatedMs, - s: updatedS, - m: updatedM, - h: updatedH, - }); - }; - return (
window.removeEventListener(eventName, eventListener, opts); - }, [app, method, capture, passive, once]); + }, [app, method, capture, passive, once, currentState]); }; From 892acd2f595b417d6bf63563b9f47c6b0064bd63 Mon Sep 17 00:00:00 2001 From: J Francisco Rader Date: Fri, 5 Feb 2021 15:08:25 -0500 Subject: [PATCH 02/11] Fix warnings + Improve CallTimer --- phone/src/apps/contacts/hooks/useContacts.ts | 1 - .../apps/dialer/components/DialerNavBar.tsx | 4 -- phone/src/modal/components/CallModal.tsx | 5 +- phone/src/modal/components/CallTimer.tsx | 49 ++++++++----------- phone/src/modal/hooks/useCall.ts | 2 +- phone/src/os/nui-events/hooks/useNuiEvent.ts | 2 +- 6 files changed, 24 insertions(+), 39 deletions(-) diff --git a/phone/src/apps/contacts/hooks/useContacts.ts b/phone/src/apps/contacts/hooks/useContacts.ts index 15df383..780e993 100644 --- a/phone/src/apps/contacts/hooks/useContacts.ts +++ b/phone/src/apps/contacts/hooks/useContacts.ts @@ -2,7 +2,6 @@ import { useRecoilValue } from 'recoil'; import { contactsState } from './state'; import { ContactProps } from '../../../common/typings/contact'; -import { useCall } from '../../../modal/hooks/useCall'; import { useCallback } from 'react'; interface IUseContacts { diff --git a/phone/src/apps/dialer/components/DialerNavBar.tsx b/phone/src/apps/dialer/components/DialerNavBar.tsx index 3da86d9..6951e4f 100644 --- a/phone/src/apps/dialer/components/DialerNavBar.tsx +++ b/phone/src/apps/dialer/components/DialerNavBar.tsx @@ -1,11 +1,7 @@ import React, { ChangeEvent, useState } from 'react'; import { BottomNavigation, BottomNavigationAction } from '@material-ui/core'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faHome } from '@fortawesome/free-solid-svg-icons'; -import AddCircleIcon from '@material-ui/icons/AddCircle'; import { Link } from 'react-router-dom'; import { makeStyles, Theme } from '@material-ui/core/styles'; -import PhoneCallbackIcon from '@material-ui/icons/PhoneCallback'; import PhoneIcon from '@material-ui/icons/Phone'; import { History } from '@material-ui/icons'; diff --git a/phone/src/modal/components/CallModal.tsx b/phone/src/modal/components/CallModal.tsx index ff33f4e..6603f33 100644 --- a/phone/src/modal/components/CallModal.tsx +++ b/phone/src/modal/components/CallModal.tsx @@ -1,7 +1,6 @@ -import React, { useState } from 'react'; -import { Button, Fab } from '@material-ui/core'; +import React from 'react'; +import { Fab } from '@material-ui/core'; import { AppWrapper } from '../../ui/components/AppWrapper'; -import { AppTitle } from '../../ui/components/AppTitle'; import { AppContent } from '../../ui/components/AppContent'; import { useCall } from '../hooks/useCall'; import CallIcon from '@material-ui/icons/Call'; diff --git a/phone/src/modal/components/CallTimer.tsx b/phone/src/modal/components/CallTimer.tsx index ceea576..724dca8 100644 --- a/phone/src/modal/components/CallTimer.tsx +++ b/phone/src/modal/components/CallTimer.tsx @@ -1,8 +1,26 @@ -import React, { useState, useCallback, useEffect } from 'react'; +import React, { useCallback, useEffect, useRef } from 'react'; import { useDuration } from '../hooks/useDuration'; function CallTimer({ isAccepted }) { const { duration, setDuration } = useDuration(); + const updatedTime = useRef({ ms: 0, s: 0, m: 0, h: 0 }); + + const run = useCallback(() => { + let newTime = { ...updatedTime.current }; + if (newTime.m >= 60) { + newTime = { ...newTime, h: newTime.h + 1, m: 0 }; + } + if (newTime.s >= 60) { + newTime = { ...newTime, m: newTime.m + 1, s: 0 }; + } + if (newTime.ms >= 100) { + newTime = { ...newTime, s: newTime.s + 1, ms: 0 }; + } + + newTime = { ...newTime, ms: newTime.ms + 1 }; + updatedTime.current = newTime; + setDuration(newTime); + }, [setDuration]); useEffect(() => { let timer; @@ -12,37 +30,10 @@ function CallTimer({ isAccepted }) { } else { clearInterval(timer); } - }, []); - - let updatedMs = duration.ms, - updatedS = duration.s, - updatedM = duration.m, - updatedH = duration.h; + }, [isAccepted, run]); if (!duration) return null; - const run = () => { - if (updatedM === 60) { - updatedH++; - updatedM = 0; - } - if (updatedS === 60) { - updatedM++; - updatedS = 0; - } - if (updatedMs === 100) { - updatedS++; - updatedMs = 0; - } - updatedMs++; - return setDuration({ - ms: updatedMs, - s: updatedS, - m: updatedM, - h: updatedH, - }); - }; - return (
window.removeEventListener(eventName, eventListener, opts); - }, [app, method, capture, passive, once]); + }, [app, method, capture, passive, once, currentState]); }; From f626d1b0cefe742d10d9679e5ea5cbc552544655 Mon Sep 17 00:00:00 2001 From: Taso Date: Sat, 6 Feb 2021 19:48:18 -0500 Subject: [PATCH 03/11] fix(resources/calls): invalid sql syntax --- resources/server/sv_call.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/server/sv_call.ts b/resources/server/sv_call.ts index ee2c683..eb4f31d 100644 --- a/resources/server/sv_call.ts +++ b/resources/server/sv_call.ts @@ -41,9 +41,9 @@ async function saveCall(call: ICall) { await pool.query(query, [call.transmitter, call.receiver, call.start]); } -async function updateCall(call: ICall, isAccepted: boolean, end?: number) { +async function updateCall(call: ICall, isAccepted: boolean, end: number) { const query = - 'UPDATE npwd_calls SET is_accepted, end (?, ?) WHERE identifier = ?'; + 'UPDATE npwd_calls SET is_accepted=?, end=? WHERE identifier = ?'; await pool.query(query, [isAccepted, end, call.identifier]); } @@ -115,7 +115,7 @@ onNet(events.PHONE_ACCEPT_CALL, async (transmitterNumber: string) => { const currentCall = calls.get(transmitterNumber); const channelId = pSource; - await updateCall(currentCall, true); + await updateCall(currentCall, true, null); // player who is being called emitNet( From 1ac3d89f595f2b167d57680abf6554404df4e597 Mon Sep 17 00:00:00 2001 From: Taso Date: Sat, 6 Feb 2021 20:02:40 -0500 Subject: [PATCH 04/11] fix(resources/calls): Fixed save call not saving identifier --- resources/server/sv_call.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/server/sv_call.ts b/resources/server/sv_call.ts index eb4f31d..cdcdb83 100644 --- a/resources/server/sv_call.ts +++ b/resources/server/sv_call.ts @@ -37,8 +37,13 @@ async function getPlayerFromIdentifier(identifier: string): Promise { async function saveCall(call: ICall) { const query = - 'INSERT INTO npwd_calls (transmitter, receiver, start) VALUES (?, ?, ?)'; - await pool.query(query, [call.transmitter, call.receiver, call.start]); + 'INSERT INTO npwd_calls (identifier, transmitter, receiver, start) VALUES (?, ?, ?, ?)'; + await pool.query(query, [ + call.identifier, + call.transmitter, + call.receiver, + call.start, + ]); } async function updateCall(call: ICall, isAccepted: boolean, end: number) { From 80e43f6f64ca940f09b15d82e9ad2d8e857025ba Mon Sep 17 00:00:00 2001 From: Christopher Date: Sun, 7 Feb 2021 02:40:23 +0100 Subject: [PATCH 05/11] tweak(ui/callTimer): resolved timer issue --- phone/src/modal/components/CallTimer.tsx | 50 +++++++++++++----------- phone/src/modal/hooks/state.ts | 2 +- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/phone/src/modal/components/CallTimer.tsx b/phone/src/modal/components/CallTimer.tsx index 724dca8..2b6414b 100644 --- a/phone/src/modal/components/CallTimer.tsx +++ b/phone/src/modal/components/CallTimer.tsx @@ -1,36 +1,42 @@ -import React, { useCallback, useEffect, useRef } from 'react'; +import React, { useEffect, useRef } from 'react'; import { useDuration } from '../hooks/useDuration'; + +const runTimer = (updatedTime, setDuration) => { + let newTime = { ...updatedTime.current }; + if (newTime.m >= 60) { + newTime = { ...newTime, h: newTime.h + 1, m: 0 }; + } + if (newTime.s >= 60) { + newTime = { ...newTime, m: newTime.m + 1, s: 0 }; + } + if (newTime.ms >= 100) { + newTime = { ...newTime, s: newTime.s + 1, ms: 0 }; + } + + newTime = { ...newTime, ms: newTime.ms + 1 }; + updatedTime.current = newTime; + setDuration(newTime); +} + function CallTimer({ isAccepted }) { const { duration, setDuration } = useDuration(); const updatedTime = useRef({ ms: 0, s: 0, m: 0, h: 0 }); + const timer = useRef(null) - const run = useCallback(() => { - let newTime = { ...updatedTime.current }; - if (newTime.m >= 60) { - newTime = { ...newTime, h: newTime.h + 1, m: 0 }; - } - if (newTime.s >= 60) { - newTime = { ...newTime, m: newTime.m + 1, s: 0 }; - } - if (newTime.ms >= 100) { - newTime = { ...newTime, s: newTime.s + 1, ms: 0 }; - } - - newTime = { ...newTime, ms: newTime.ms + 1 }; - updatedTime.current = newTime; - setDuration(newTime); - }, [setDuration]); useEffect(() => { - let timer; if (isAccepted) { - run(); - timer = setInterval(run, 10); + runTimer(updatedTime, setDuration) + timer.current = setInterval(() => { + runTimer(updatedTime, setDuration) + }, 10); } else { - clearInterval(timer); + clearInterval(timer.current); + timer.current = null; } - }, [isAccepted, run]); + return () => clearInterval(timer.current) + }, [isAccepted, setDuration]); if (!duration) return null; diff --git a/phone/src/modal/hooks/state.ts b/phone/src/modal/hooks/state.ts index ea43d96..674eacc 100644 --- a/phone/src/modal/hooks/state.ts +++ b/phone/src/modal/hooks/state.ts @@ -7,7 +7,7 @@ export const callerState = { }), callModal: atom({ key: 'callingModal', - default: false + default: true }), callDuration: atom({ key: 'callDuration', From 4e8dbf5667007c0751e3d5ad6252e027cb149dd8 Mon Sep 17 00:00:00 2001 From: Christopher Date: Sun, 7 Feb 2021 02:44:46 +0100 Subject: [PATCH 06/11] fix(state) --- phone/src/modal/hooks/state.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phone/src/modal/hooks/state.ts b/phone/src/modal/hooks/state.ts index 674eacc..ea43d96 100644 --- a/phone/src/modal/hooks/state.ts +++ b/phone/src/modal/hooks/state.ts @@ -7,7 +7,7 @@ export const callerState = { }), callModal: atom({ key: 'callingModal', - default: true + default: false }), callDuration: atom({ key: 'callDuration', From 332b1323522cf73eec98d58fce11d9bc745db5f9 Mon Sep 17 00:00:00 2001 From: J Francisco Rader Date: Sat, 6 Feb 2021 20:54:46 -0500 Subject: [PATCH 07/11] Fix new message --- .../src/apps/messages/components/MessagesApp.tsx | 16 ++++++++++++++-- .../messages/components/list/MessagesList.tsx | 2 -- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/phone/src/apps/messages/components/MessagesApp.tsx b/phone/src/apps/messages/components/MessagesApp.tsx index 8b1b67f..2790cfa 100644 --- a/phone/src/apps/messages/components/MessagesApp.tsx +++ b/phone/src/apps/messages/components/MessagesApp.tsx @@ -7,9 +7,10 @@ import { useApp } from '../../../os/apps/hooks/useApps'; import AlertBar from './AlertBar'; import MessageGroupModal from './modal/MessageGroupModal'; import MessagesList from './list/MessagesList'; -import { Route, Switch } from 'react-router-dom'; +import { Route, Switch, useHistory } from 'react-router-dom'; import { MessageModal } from './modal/MessageModal'; import InjectDebugData from '../../../os/debug/InjectDebugData'; +import NewMessageGroupButton from './buttons/NewMessageGroupButton'; InjectDebugData([ { @@ -47,6 +48,7 @@ InjectDebugData([ export const MessagesApp = () => { const messages = useApp('MESSAGES'); + const history = useHistory(); return ( @@ -59,7 +61,17 @@ export const MessagesApp = () => { /> - + ( + <> + + history.push('/messages/new')} + /> + + )} + /> diff --git a/phone/src/apps/messages/components/list/MessagesList.tsx b/phone/src/apps/messages/components/list/MessagesList.tsx index c7b09cf..1f7df94 100644 --- a/phone/src/apps/messages/components/list/MessagesList.tsx +++ b/phone/src/apps/messages/components/list/MessagesList.tsx @@ -8,7 +8,6 @@ import MessageSearch from './MessageSearch'; import MessageGroupItem from './MessageGroupItem'; import useStyles from './list.styles'; import { useHistory } from 'react-router-dom'; -import NewMessageGroupButton from '../buttons/NewMessageGroupButton'; const MessagesList = (): any => { const classes = useStyles(); @@ -61,7 +60,6 @@ const MessagesList = (): any => { /> ))} - history.push('/messages/new')} /> ); }; From 6fc469c4a364bc6059f35acf356581f41c655edd Mon Sep 17 00:00:00 2001 From: Christopher Date: Sun, 7 Feb 2021 04:13:00 +0100 Subject: [PATCH 08/11] feat(events): photo uploaded successful --- resources/utils/events.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/utils/events.ts b/resources/utils/events.ts index 956b520..5bb8631 100644 --- a/resources/utils/events.ts +++ b/resources/utils/events.ts @@ -88,6 +88,7 @@ export default { // camera CAMERA_TAKE_PHOTO: 'phone:TakePhoto', CAMERA_UPLOAD_PHOTO: 'phone:UploadPhoto', + CAMERA_UPLOAD_PHOTO_SUCCESS: 'phone:UploadPhotoSuccess', CAMERA_FETCH_PHOTOS: 'phone:FetchPhotos', CAMERA_SEND_PHOTOS: 'phone:SendPhotos', CAMERA_DELETE_PHOTO: 'photo:deletePhoto', From 1e771e87af673b42c5679c911903d50cdada8fae Mon Sep 17 00:00:00 2001 From: Christopher Date: Sun, 7 Feb 2021 04:14:00 +0100 Subject: [PATCH 09/11] feat(photo/client|sever): fetch photo on upload --- resources/client/cl_photo.ts | 4 ++++ resources/server/sv_photo.ts | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/resources/client/cl_photo.ts b/resources/client/cl_photo.ts index 8652caf..6bc00e4 100644 --- a/resources/client/cl_photo.ts +++ b/resources/client/cl_photo.ts @@ -127,6 +127,10 @@ function takePhoto() { ); } +onNet(events.CAMERA_UPLOAD_PHOTO_SUCCESS, () => { + emitNet(events.CAMERA_FETCH_PHOTOS); +}) + // delete photo RegisterNuiCallbackType(events.CAMERA_DELETE_PHOTO); diff --git a/resources/server/sv_photo.ts b/resources/server/sv_photo.ts index 2314e7d..a98db9f 100644 --- a/resources/server/sv_photo.ts +++ b/resources/server/sv_photo.ts @@ -26,8 +26,14 @@ async function deletePhoto(photo: IPhoto, identifier: string) { } onNet(events.CAMERA_UPLOAD_PHOTO, async (image: string) => { - const identifier = await useIdentifier(); - await uploadPhoto(identifier, image); + try { + const pSource = (global as any).source; + const identifier = await useIdentifier(); + await uploadPhoto(identifier, image); + emitNet(events.CAMERA_UPLOAD_PHOTO_SUCCESS, pSource); + } catch (error) { + console.dir(error) + } }); onNet(events.CAMERA_FETCH_PHOTOS, async () => { From 640643e086a034e4ab42c08afee95678ada6975d Mon Sep 17 00:00:00 2001 From: Christopher Date: Sun, 7 Feb 2021 04:14:36 +0100 Subject: [PATCH 10/11] cleanup(GalleryGrid): remove unused variables --- phone/src/apps/camera/components/grid/GalleryGrid.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phone/src/apps/camera/components/grid/GalleryGrid.tsx b/phone/src/apps/camera/components/grid/GalleryGrid.tsx index b18d049..8cee9b5 100644 --- a/phone/src/apps/camera/components/grid/GalleryGrid.tsx +++ b/phone/src/apps/camera/components/grid/GalleryGrid.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useEffect} from 'react'; import { Box, Button } from '@material-ui/core'; import useStyles from './grid.styles'; import { usePhotos } from '../../hooks/usePhotos'; From 4e1d85b35ffed1c6fca670fd943ce3eb1a8180f7 Mon Sep 17 00:00:00 2001 From: Christopher Date: Sun, 7 Feb 2021 04:16:15 +0100 Subject: [PATCH 11/11] feat(phone/useApps): startup event for apps | remove onClick --- phone/src/os/apps/hooks/useApps.tsx | 42 ++++++++++++++++++++--------- phone/src/ui/components/AppIcon.tsx | 6 +---- 2 files changed, 31 insertions(+), 17 deletions(-) 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 ( -