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 Nui from '../../../os/nui-events/utils/Nui'; import { useTranslation } from 'react-i18next'; import { useHistory } from 'react-router-dom'; import { StatusButton } from '../../../ui/components/StatusButton'; export const NoteModal = () => { 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('phone:addNote', detail); setDetail(null); onClose(); }; const handleDeleteNote = () => { const id = detail.id; Nui.send('phone:deleteNote', { id, }); setDetail(null); onClose(); }; const handleUpdateNote = () => { Nui.send('phone:updateNote', detail); setDetail(null); onClose(); }; 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')} )} )} ); };