@@ -2,10 +2,13 @@ import React, { useState } from 'react'
2
2
import PropTypes from 'prop-types'
3
3
import { ListGroup } from 'react-bootstrap'
4
4
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
5
- import SendMessage from './actions/SendMessage'
5
+ // import SendMessage from './actions/SendMessage'
6
+ import ViewFiles from './actions/ViewFiles'
7
+ import { allowNull } from '../../resources/utilityFunctions'
6
8
import './actions-group.scss'
7
9
8
- const ActionsGroup = ( { handleSendingMessages } ) => {
10
+ // TODO: add back handleSendingMessagesOrFiles into the props, removing for now to avoid console error. see below TODO.
11
+ const ActionsGroup = ( { initialFiles } ) => {
9
12
const [ show , setShow ] = useState ( false )
10
13
const [ action , setAction ] = useState ( null )
11
14
@@ -18,28 +21,59 @@ const ActionsGroup = ({ handleSendingMessages }) => {
18
21
setAction ( null )
19
22
setShow ( false )
20
23
}
21
-
22
24
return (
23
25
< >
24
26
< ListGroup className = 'actions-group' >
25
- < ListGroup . Item action variant = 'primary' onClick = { ( ) => handleShow ( 'SendMessage' ) } >
27
+ { /* TODO(@summercook): return this and the below commented code
28
+ once we are able to refactor posting messages & attachments */ }
29
+ { /* <ListGroup.Item action variant='primary' onClick={() => handleShow('SendMessage')}>
26
30
<FontAwesomeIcon icon='fa-envelope' />
27
31
Send Message
32
+ </ListGroup.Item> */ }
33
+ < ListGroup . Item
34
+ action
35
+ variant = 'primary'
36
+ onClick = { ( ) => handleShow ( 'ViewFiles' ) }
37
+ role = 'presentation'
38
+ >
39
+ < FontAwesomeIcon icon = 'fa-file-lines' />
40
+ View Files
28
41
</ ListGroup . Item >
29
42
</ ListGroup >
30
- { ( action === 'SendMessage' && show )
43
+ { /* { (action === 'SendMessage' && show)
31
44
&& (
32
45
<SendMessage
33
46
handleClose={handleClose}
34
- onSubmit = { handleSendingMessages }
47
+ onSubmit={handleSendingMessagesOrFiles}
48
+ />
49
+ )} */ }
50
+ { ( action === 'ViewFiles' && show )
51
+ && (
52
+ < ViewFiles
53
+ handleClose = { handleClose }
54
+ initialFiles = { initialFiles }
55
+ // onSubmit={handleSendingMessagesOrFiles}
35
56
/>
36
57
) }
37
58
</ >
38
59
)
39
60
}
40
61
41
62
ActionsGroup . propTypes = {
42
- handleSendingMessages : PropTypes . func . isRequired ,
63
+ handleSendingMessagesOrFiles : PropTypes . func . isRequired ,
64
+ initialFiles : PropTypes . arrayOf (
65
+ PropTypes . shape ( {
66
+ contentLength : PropTypes . string . isRequired ,
67
+ contentType : PropTypes . string . isRequired ,
68
+ createdAt : PropTypes . string . isRequired ,
69
+ download : PropTypes . string . isRequired ,
70
+ fileName : PropTypes . string . isRequired ,
71
+ href : PropTypes . string . isRequired ,
72
+ status : allowNull ( PropTypes . string . isRequired ) ,
73
+ uploadedBy : PropTypes . string . isRequired ,
74
+ uuid : PropTypes . string . isRequired ,
75
+ } ) ,
76
+ ) . isRequired ,
43
77
}
44
78
45
79
export default ActionsGroup
0 commit comments