From 4b7a6280fd56f102cb3bf7e2dd36f1425048aaed Mon Sep 17 00:00:00 2001 From: Taso Date: Mon, 19 Apr 2021 13:15:55 -0400 Subject: [PATCH] fix(phone/notes): Fixed slide transition with notes modal --- phone/src/apps/notes/NotesApp.tsx | 8 +++----- phone/src/apps/notes/list/NoteList.tsx | 6 +----- phone/src/apps/notes/modal/NoteModal.tsx | 12 ++---------- 3 files changed, 6 insertions(+), 20 deletions(-) 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 227e595..32fbafe 100644 --- a/phone/src/apps/notes/modal/NoteModal.tsx +++ b/phone/src/apps/notes/modal/NoteModal.tsx @@ -14,28 +14,22 @@ 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 = () => { @@ -44,18 +38,16 @@ export const NoteModal = () => { id, }); setDetail(null); - onClose(); }; const handleUpdateNote = () => { Nui.send(NotesEvents.UPDATE_NOTE, detail); setDetail(null); - onClose(); }; return ( - - + + {!detail ? ( ) : (