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