diff --git a/phone/src/Phone.test.tsx b/phone/src/Phone.test.tsx
index a08e424..8f94b70 100644
--- a/phone/src/Phone.test.tsx
+++ b/phone/src/Phone.test.tsx
@@ -1,12 +1,12 @@
import React from 'react';
import { RecoilRoot } from 'recoil';
import { shallow } from 'enzyme';
-import { PhoneContainer } from './PhoneContainer';
+import { PhoneProviders } from './PhoneProviders';
it('renders Phone', () => {
shallow(
-
+
,
);
});
diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx
index f7e292b..2c3f2d8 100644
--- a/phone/src/Phone.tsx
+++ b/phone/src/Phone.tsx
@@ -4,7 +4,7 @@ import './i18n';
import { Route } from 'react-router-dom';
import { CallModal } from './os/call/components/CallModal';
import { HomeApp } from './apps/home/components/Home';
-import { Box, Paper, Slide, Typography } from '@material-ui/core';
+import { Box, Paper, Typography } from '@material-ui/core';
import { NotificationBar } from './os/notifications/components/NotificationBar';
import { Navigation } from './os/navigation-bar/components/Navigation';
import { useSimcardService } from './os/simcard/hooks/useSimcardService';
@@ -23,7 +23,6 @@ import { isSettingsSchemaValid, useSettings } from './apps/settings/hooks/useSet
import { useCallService } from './os/call/hooks/useCallService';
import { useDialService } from './apps/dialer/hooks/useDialService';
import InjectDebugData from './os/debug/InjectDebugData';
-import { usePhoneVisibility } from './os/phone/hooks/usePhoneVisibility';
import { PhoneSnackbar } from './ui/components/PhoneSnackbar';
import { NotificationAlert } from './os/notifications/components/NotificationAlert';
import { useCallModal } from './os/call/hooks/useCallModal';
@@ -33,8 +32,8 @@ import { useTranslation } from 'react-i18next';
import { useSnackbar } from './ui/hooks/useSnackbar';
import { PhoneEvents } from '../../typings/phone';
import dayjs from 'dayjs';
-import { isDefaultWallpaper } from './apps/settings/utils/isDefaultWallpaper';
import { useKeyboardService } from './os/keyboard/hooks/useKeyboardService';
+import PhoneWrapper from './PhoneWrapper';
function Phone() {
const { t, i18n } = useTranslation();
@@ -78,74 +77,45 @@ function Phone() {
useDialService();
const { modal: callModal } = useCallModal();
- const { bottom, visibility } = usePhoneVisibility();
const { isPhoneReady } = usePhone();
return (
-
-
-
-
-
- {isPhoneReady ? (
- <>
-
-
- <>
-
- {callModal &&
}
- {apps.map((App) => (
-
- ))}
- >
-
-
-
-
- >
- ) : (
-
-
- NPWD {t('INITIALIZING')}
-
- {t('GENERIC_WAIT')}
-
- )}
+
+ {isPhoneReady ? (
+ <>
+
+
+ <>
+
+ {callModal &&
}
+ {apps.map((App) => (
+
+ ))}
+ >
+
+
-
-
-
+
+ >
+ ) : (
+
+
+ NPWD {t('INITIALIZING')}
+
+ {t('GENERIC_WAIT')}
+
+ )}
+
);
}
diff --git a/phone/src/PhoneContainer.tsx b/phone/src/PhoneProviders.tsx
similarity index 95%
rename from phone/src/PhoneContainer.tsx
rename to phone/src/PhoneProviders.tsx
index db7c7cb..36424b4 100644
--- a/phone/src/PhoneContainer.tsx
+++ b/phone/src/PhoneProviders.tsx
@@ -7,7 +7,7 @@ import Phone from './Phone';
import { NuiProvider } from 'fivem-nui-react-lib';
import { SoundProvider } from './os/sound/providers/SoundProvider';
-export const PhoneContainer = () => {
+export const PhoneProviders = () => {
const currentTheme = usePhoneTheme();
return (
diff --git a/phone/src/PhoneWrapper.tsx b/phone/src/PhoneWrapper.tsx
new file mode 100644
index 0000000..d02d566
--- /dev/null
+++ b/phone/src/PhoneWrapper.tsx
@@ -0,0 +1,46 @@
+import React from 'react';
+import { isDefaultWallpaper } from './apps/settings/utils/isDefaultWallpaper';
+import { useSettings } from './apps/settings/hooks/useSettings';
+import { usePhoneVisibility } from './os/phone/hooks/usePhoneVisibility';
+import { Slide } from '@material-ui/core';
+
+const PhoneWrapper: React.FC = ({ children }) => {
+ const [settings] = useSettings();
+ const { bottom, visibility } = usePhoneVisibility();
+
+ return (
+
+
+
+ );
+};
+
+export default PhoneWrapper;
diff --git a/phone/src/apps/notes/NotesApp.tsx b/phone/src/apps/notes/NotesApp.tsx
index 5f66819..85d7c50 100644
--- a/phone/src/apps/notes/NotesApp.tsx
+++ b/phone/src/apps/notes/NotesApp.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { AppWrapper } from '../../ui/components/AppWrapper';
+import { AppWrapper } from '../../ui/components';
import { AppContent } from '../../ui/components/AppContent';
import { AppTitle } from '../../ui/components/AppTitle';
import { useApp } from '../../os/apps/hooks/useApps';
@@ -11,25 +11,23 @@ import { useNoteDetail } from './hooks/useNoteDetail';
import useStyles from './notes.styles';
import InjectDebugData from '../../os/debug/InjectDebugData';
import { NotesThemeProvider } from './providers/NotesThemeProvider';
-import { Route, useHistory } from 'react-router-dom';
+import { Route } from 'react-router-dom';
import { NotesEvents } from '../../../../typings/notes';
export const NotesApp = () => {
const classes = useStyles();
- const history = useHistory();
const notesApp = useApp('NOTES');
const { setDetail } = useNoteDetail();
const onClickCreate = () => {
setDetail({ title: '', content: '' });
- history.push('/notes/detail');
};
return (
-
+
diff --git a/phone/src/apps/notes/list/NoteList.tsx b/phone/src/apps/notes/list/NoteList.tsx
index 088cc40..cfe8259 100644
--- a/phone/src/apps/notes/list/NoteList.tsx
+++ b/phone/src/apps/notes/list/NoteList.tsx
@@ -2,18 +2,14 @@ import React from 'react';
import { List, ListItem, ListItemText } from '@material-ui/core';
import { useNoteDetail } from '../hooks/useNoteDetail';
import { useNotes } from '../hooks/useNotes';
-import { useHistory } from 'react-router-dom';
-// add search bar later
-// TODO: Add interface for note
+// TODO: add search bar later
const NoteList = () => {
- const history = useHistory();
const { notes } = useNotes();
const { setDetail } = useNoteDetail();
const handleNoteModal = (note) => {
setDetail(note);
- history.push('/notes/detail');
};
return (
diff --git a/phone/src/apps/notes/modal/NoteModal.tsx b/phone/src/apps/notes/modal/NoteModal.tsx
index a684e8f..35dbf52 100644
--- a/phone/src/apps/notes/modal/NoteModal.tsx
+++ b/phone/src/apps/notes/modal/NoteModal.tsx
@@ -14,46 +14,38 @@ import { useNoteDetail } from '../hooks/useNoteDetail';
import useStyles from './modal.styles';
import { useNuiRequest } from 'fivem-nui-react-lib';
import { useTranslation } from 'react-i18next';
-import { useHistory } from 'react-router-dom';
import { StatusButton } from '../../../ui/components/StatusButton';
import { NotesEvents } from '../../../../../typings/notes';
export const NoteModal = () => {
const Nui = useNuiRequest();
const classes = useStyles();
- const history = useHistory();
const { t } = useTranslation();
const { detail, setDetail } = useNoteDetail();
- const onClose = () => history.goBack();
-
const _handleClose = () => {
setDetail(null);
- onClose();
};
const handleNoteSave = () => {
Nui.send(NotesEvents.ADD_NOTE, detail);
setDetail(null);
- onClose();
};
const handleDeleteNote = () => {
const id = detail.id;
Nui.send(NotesEvents.DELETE_NOTE, id);
setDetail(null);
- onClose();
};
const handleUpdateNote = () => {
Nui.send(NotesEvents.UPDATE_NOTE, detail);
setDetail(null);
- onClose();
};
return (
-
-
+
+
{!detail ? (
) : (
diff --git a/phone/src/index.tsx b/phone/src/index.tsx
index 8899b52..4594604 100644
--- a/phone/src/index.tsx
+++ b/phone/src/index.tsx
@@ -7,7 +7,7 @@ import * as Sentry from '@sentry/react';
import { Integrations } from '@sentry/tracing';
import './main.css';
import PhoneConfig from './config/default.json';
-import { PhoneContainer } from './PhoneContainer';
+import { PhoneProviders } from './PhoneProviders';
import attachMockNuiEvent from './os/debug/AttachMockNuiEvent';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
@@ -34,7 +34,7 @@ if (process.env.NODE_ENV === 'development') attachMockNuiEvent();
ReactDOM.render(
-
+
,
document.getElementById('root'),