import { Button, TextField, Slide, Paper, Typography, Container, CircularProgress, Box, } from '@material-ui/core'; import React from 'react'; import ArrowBackIcon from '@material-ui/icons/ArrowBack'; import { useNoteDetail } from '../hooks/useNoteDetail'; import useStyles from './modal.styles'; import { useNuiRequest } from 'fivem-nui-react-lib'; import { useTranslation } from 'react-i18next'; import { StatusButton } from '../../../ui/components/StatusButton'; import { NotesEvents } from '../../../../../typings/notes'; export const NoteModal = () => { const Nui = useNuiRequest(); const classes = useStyles(); const { t } = useTranslation(); const { detail, setDetail } = useNoteDetail(); const _handleClose = () => { setDetail(null); }; const handleNoteSave = () => { Nui.send(NotesEvents.ADD_NOTE, detail); setDetail(null); }; const handleDeleteNote = () => { const id = detail.id; Nui.send(NotesEvents.DELETE_NOTE, id); setDetail(null); }; const handleUpdateNote = () => { Nui.send(NotesEvents.UPDATE_NOTE, detail); setDetail(null); }; return ( {!detail ? ( ) : ( setDetail((d) => ({ ...d, title: e.target.value }))} /> setDetail((d) => ({ ...d, content: e.target.value }))} /> {detail.content.length}/250 {!detail.id ? ( <> {t('GENERIC_CANCEL')} ) : ( <> {t('GENERIC_DELETE')} )} )} ); };