mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
feat(notes/nui): use notes alert
This commit is contained in:
1 parent
59973fcf9e
commit
4d92847163
2 files changed
+14
-6
No files matched your search
@@ -15,6 +15,7 @@ import { useNoteDetail } from './hooks/useNoteDetail';
|
||||
|
||||
import useStyles from './notes.styles';
|
||||
import InjectDebugData from '../../os/debug/InjectDebugData';
|
||||
import { NotesAlert } from './alert/NotesAlert';
|
||||
|
||||
InjectDebugData([
|
||||
{
|
||||
@@ -32,7 +33,7 @@ InjectDebugData([
|
||||
content: 'Hello, this is another shitty note',
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
]);
|
||||
|
||||
export const NotesApp = () => {
|
||||
@@ -65,6 +66,7 @@ export const NotesApp = () => {
|
||||
<AddIcon />
|
||||
</Fab>
|
||||
</AppContent>
|
||||
<NotesAlert />
|
||||
</AppWrapper>
|
||||
);
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button, TextField, Slide } from '@material-ui/core';
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||
|
||||
import { useNoteModal } from '../hooks/useNoteModal';
|
||||
@@ -14,11 +14,12 @@ import Nui from '../../../os/nui-events/utils/Nui';
|
||||
export const NoteModal = () => {
|
||||
const { noteModal, setNoteModal } = useNoteModal();
|
||||
const { detail, setDetail } = useNoteDetail();
|
||||
console.log(detail);
|
||||
const [title, setTitle] = useState(detail ? detail.title : '');
|
||||
const [content, setContent] = useState(detail ? detail.content : '');
|
||||
|
||||
const classes = useStyles();
|
||||
const classes = useStyles()
|
||||
|
||||
|
||||
|
||||
const _handleClose = () => {
|
||||
setNoteModal(false);
|
||||
@@ -26,12 +27,14 @@ export const NoteModal = () => {
|
||||
};
|
||||
|
||||
const handleNoteSave = () => {
|
||||
|
||||
setNoteModal(false);
|
||||
setDetail(null);
|
||||
Nui.send('phone:addNote', {
|
||||
title,
|
||||
content,
|
||||
});
|
||||
setDetail(null)
|
||||
};
|
||||
|
||||
const handleDeleteNote = () => {
|
||||
@@ -63,6 +66,7 @@ export const NoteModal = () => {
|
||||
<div id='notes-modal' className={classes.noteContainer}>
|
||||
<TextField
|
||||
className={classes.input}
|
||||
rowsMax={1}
|
||||
placeholder='Title'
|
||||
inputProps={{
|
||||
className: classes.inputPropsTitle,
|
||||
@@ -75,6 +79,7 @@ export const NoteModal = () => {
|
||||
className={classes.input}
|
||||
inputProps={{
|
||||
className: classes.inputPropsContent,
|
||||
maxLength: 250,
|
||||
}}
|
||||
placeholder='Content'
|
||||
multiline
|
||||
@@ -84,8 +89,9 @@ export const NoteModal = () => {
|
||||
value={content}
|
||||
onChange={(e) => setContent(e.target.value)}
|
||||
/>
|
||||
{!detail && (
|
||||
<Button className={classes.saveButton} onClick={handleNoteSave}>
|
||||
<p style={{ color: "#fff" }}>{content.length}/250</p>
|
||||
{!detail &&(
|
||||
<Button disabled={title.length > 0 ? false : true} className={classes.saveButton} onClick={handleNoteSave}>
|
||||
Save
|
||||
</Button>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user