fix(phone/notes): Fixed slide transition with notes modal

This commit is contained in:
Taso committed 2021-04-19 13:15:55 -04:00
1 parent ec4ebdc54d
commit 4b7a6280fd
3 files changed
+6 -20

No files matched your search

+3 -5
View File
@@ -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 (
<NotesThemeProvider>
<AppWrapper id="notes-app">
<AppTitle app={notesApp} />
<Route path="/notes/detail" component={NoteModal} />
<NoteModal />
<AppContent>
<Route path="/notes" component={NoteList} />
<Fab className={classes.absolute} onClick={onClickCreate} color="primary">
+1 -5
View File
@@ -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 (
+2 -10
View File
@@ -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 (
<Slide direction="left" in={!!detail}>
<Paper className={classes.modalRoot}>
<Slide direction="left" in={!!detail} mountOnEnter unmountOnExit>
<Paper className={classes.modalRoot} square>
{!detail ? (
<CircularProgress />
) : (