From a3e63a40b52d22a5640a1c20484c8d648373e885 Mon Sep 17 00:00:00 2001 From: chip Date: Fri, 30 Oct 2020 00:04:50 +0100 Subject: [PATCH] feat(notes/nui): NoteModal with values in textfields WIP --- phone/src/apps/notes/modal/NoteModal.tsx | 88 ++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 phone/src/apps/notes/modal/NoteModal.tsx diff --git a/phone/src/apps/notes/modal/NoteModal.tsx b/phone/src/apps/notes/modal/NoteModal.tsx new file mode 100644 index 0000000..4841420 --- /dev/null +++ b/phone/src/apps/notes/modal/NoteModal.tsx @@ -0,0 +1,88 @@ +import { Button, List, ListItem, TextField, Slide, Paper } from '@material-ui/core'; +import React, { useState } from 'react' +import ArrowBackIcon from '@material-ui/icons/ArrowBack'; + +import { useNoteModal } from '../hooks/useNoteModal'; +import { useNoteDetail } from '../hooks/useNoteDetail'; + +import useStyles from './modal.styles'; + +import { useNotes } from '../hooks/useNotes'; + + +import '../NotesApp.css' +import Nui from '../../../os/nui-events/utils/Nui'; + +export const NoteModal = (note): any => { + 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) + setDetail(null) + console.log(detail) + } + + const handleNoteSave = () => { + console.log(detail) + console.log(title, content) + Nui.send('phone:addNote', { + title, + content + }) + } + + const handleDeleteNote = () => { + const id = detail.id + setNoteModal(false); + console.log("NoteID: " + id) + Nui.send('phone:deleteNote', { + id + }) + setDetail(null) + } + + return ( +
+ +
+ +
+ setDetail(e.target.value) : e => setTitle(e.target.value)} + /> + setDetail(e.target.value) : e => setContent(e.target.value)} + /> + + +
+
+
+
+ ) +}