@@ -12,14 +12,19 @@ import type { Dispatch, SetStateAction } from 'react'
12
12
13
13
export function Notes ( {
14
14
notes,
15
+ noteStatus,
16
+ setNoteStatus,
15
17
setShowNotes,
16
18
setErrorText
17
19
} : {
18
20
notes ?: NoteEdge [ ]
21
+ noteStatus ?: string | undefined
22
+ setNoteStatus : Dispatch < SetStateAction < string | undefined > >
19
23
setErrorText : Dispatch < SetStateAction < string | undefined > >
20
24
setShowNotes : Dispatch < SetStateAction < boolean > >
21
25
} ) {
22
26
const textRef = useRef < HTMLTextAreaElement | null > ( null )
27
+
23
28
const handleAddNote = ( ) => {
24
29
// Get the value of our textarea
25
30
if ( ! textRef . current ) return
@@ -31,17 +36,22 @@ export function Notes({
31
36
return setErrorText ( 'Text is require to create a note' )
32
37
}
33
38
34
- void sendMessage ( { action : EXT_ACTIONS . ADD_NOTE_REQUEST , noteData : { docMarkdown } } )
35
39
textRef . current . value = ''
40
+ setNoteStatus ( 'saving note' )
41
+ void sendMessage ( { action : EXT_ACTIONS . ADD_NOTE_REQUEST , noteData : { docMarkdown } } )
36
42
}
37
43
38
44
return (
39
45
< div >
40
46
< div className = { style . container } >
41
47
< NotesList notes = { notes } />
42
- < NotesAdd textRef = { textRef } setErrorText = { setErrorText } />
48
+ < NotesAdd noteStatus = { noteStatus } textRef = { textRef } setErrorText = { setErrorText } />
43
49
</ div >
44
- < NotesFooter setShowNotes = { setShowNotes } handleAddNote = { handleAddNote } />
50
+ < NotesFooter
51
+ noteStatus = { noteStatus }
52
+ setShowNotes = { setShowNotes }
53
+ handleAddNote = { handleAddNote }
54
+ />
45
55
</ div >
46
56
)
47
57
}
0 commit comments