mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
tweak(notes/nui): clean up in NoteModal
This commit is contained in:
1 parent
a157ef0baa
commit
4d76c1bfe9
1 file changed
+22
-5
@@ -14,15 +14,15 @@ import '../NotesApp.css'
|
||||
import Nui from '../../../os/nui-events/utils/Nui';
|
||||
|
||||
export const NoteModal = (note): any => {
|
||||
const { noteModal, setNoteModal } = useNoteModal();
|
||||
const { detail, setDetail } = useNoteDetail();
|
||||
|
||||
const notes = useNotes();
|
||||
const [title, setTitle] = useState('');
|
||||
const [content, setContent] = useState('');
|
||||
|
||||
const classes = useStyles();
|
||||
|
||||
const { noteModal, setNoteModal } = useNoteModal();
|
||||
const { detail, setDetail } = useNoteDetail();
|
||||
|
||||
const _handleClose = () => {
|
||||
setNoteModal(false);
|
||||
console.log(note.title)
|
||||
@@ -33,6 +33,8 @@ export const NoteModal = (note): any => {
|
||||
const handleNoteSave = () => {
|
||||
console.log(detail)
|
||||
console.log(title, content)
|
||||
setNoteModal(false);
|
||||
setDetail(null)
|
||||
Nui.send('phone:addNote', {
|
||||
title,
|
||||
content
|
||||
@@ -49,6 +51,21 @@ export const NoteModal = (note): any => {
|
||||
setDetail(null)
|
||||
}
|
||||
|
||||
//const handleUpdateNote = () => {
|
||||
// const id = detail.id;
|
||||
// const detailTitle = detail.title;
|
||||
// const detailContent = detail.content
|
||||
// console.log("NOTE", detailTitle, detailContent)
|
||||
//
|
||||
// Nui.send('pone:updateNote', {
|
||||
// id,
|
||||
// detailTitle,
|
||||
// detailContent
|
||||
// })
|
||||
// setNoteModal(false);
|
||||
// setDetail(null)
|
||||
//}
|
||||
|
||||
return (
|
||||
<div className={noteModal ? classes.modalRoot : classes.modalHide}>
|
||||
<Slide direction="left" in={noteModal}>
|
||||
@@ -78,8 +95,8 @@ export const NoteModal = (note): any => {
|
||||
value={detail ? detail.content : content}
|
||||
onChange={detail ? e => setDetail(e.target.value) : e => setContent(e.target.value)}
|
||||
/>
|
||||
<Button className={classes.saveButton} onClick={handleNoteSave}>Save</Button>
|
||||
<Button className={detail ? classes.deleteButton : undefined} onClick={handleDeleteNote}>{detail ? "Delete" : null}</Button>
|
||||
{detail ? null : <Button className={classes.saveButton} onClick={handleNoteSave}>Save</Button>}
|
||||
{detail ? <Button className={classes.deleteButton} onClick={handleDeleteNote}>Delete</Button> : null}
|
||||
</div>
|
||||
</div>
|
||||
</Slide>
|
||||
|
||||
Reference in new issue
Block a user