1
- import React , { useState , useRef } from 'react'
1
+ import React
2
+ // { useState, useRef } TODO comment back in
3
+ from 'react'
2
4
import PropTypes from 'prop-types'
3
- import {
5
+ import {
4
6
// Button,
5
7
// CloseButton,
6
8
// Form,
7
9
// InputGroup,
8
10
// ListGroup,
9
11
Offcanvas ,
10
12
Tab ,
11
- Tabs } from 'react-bootstrap'
13
+ Tabs ,
14
+ } from 'react-bootstrap'
12
15
// import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
13
16
import FilesTable from '../../../components/FilesTable/FilesTable'
14
17
// import { apiV2CompatibleStrings, convertToBase64 } from '../../../resources/utilityFunctions'
15
18
16
19
const ViewFiles = ( { initialFiles, handleClose, show } ) => {
17
- // TODO(summercook):
20
+ // TODO(summercook):
18
21
// - comment back in the following 2 lines & above imports once posting messages/attachments is working
19
22
// const fileRef = useRef(null)
20
23
// const [files, setFiles] = useState([])
21
24
const documentTabs = [
22
25
{
23
26
eventKey : 'files' ,
24
27
title : 'Attachments' ,
25
- status : 'Other File'
28
+ status : 'Other File' ,
26
29
} ,
27
30
{
28
31
eventKey : 'status-updates' ,
29
32
title : 'Status Updates' ,
30
- status : 'Status Update'
33
+ status : 'Status Update' ,
31
34
} ,
32
35
{
33
36
eventKey : 'payment-status-files' ,
34
37
title : 'Payment Status Files' ,
35
38
// TODO(@summer-cook): fill this in when Sherman adds a file of this type
36
- status : 'TODO:FILL THIS IN'
39
+ status : 'TODO:FILL THIS IN' ,
37
40
} ,
38
41
]
39
42
40
- // TODO(summercook):
43
+ // TODO(summercook):
41
44
// - comment back in the following 3 methods once posting messages/attachments is working
42
45
// may need to use the handleSendingMessagesOrFiles to post
43
46
// const handleSubmit = (event) => {
@@ -60,20 +63,19 @@ const ViewFiles = ({ initialFiles, handleClose, show }) => {
60
63
// throw new Error(error)
61
64
// }
62
65
// }
63
-
66
+
64
67
// const handleDeleteFile = (file) => {
65
68
// const remainingFiles = files.filter((obj) => obj !== file)
66
69
// setFiles(remainingFiles)
67
70
// }
68
-
69
71
return (
70
- < Offcanvas show = { show } onHide = { handleClose } placement = 'end' scroll = 'true' >
71
- < Offcanvas . Header className = 'd-flex border-bottom px-3 py-2 bg-light' closeButton >
72
- < Offcanvas . Title > Documents</ Offcanvas . Title >
73
- </ Offcanvas . Header >
74
- < Offcanvas . Body className = 'border rounded p-2 m-3' >
75
- { /* TODO(summercook): see above comment */ }
76
- { /* <Form>
72
+ < Offcanvas show = { show } onHide = { handleClose } placement = 'end' scroll = 'true' >
73
+ < Offcanvas . Header className = 'd-flex border-bottom px-3 py-2 bg-light' closeButton >
74
+ < Offcanvas . Title > Documents</ Offcanvas . Title >
75
+ </ Offcanvas . Header >
76
+ < Offcanvas . Body className = 'border rounded p-2 m-3' >
77
+ { /* TODO(summercook): see above comment */ }
78
+ { /* <Form>
77
79
<h6 className='mt-3'>Upload Additional Documents</h6>
78
80
<InputGroup controlId='attachments' className='mb-3'>
79
81
<Form.Control
@@ -82,7 +84,7 @@ const ViewFiles = ({ initialFiles, handleClose, show }) => {
82
84
onChange={handleAddFile}
83
85
ref={fileRef}
84
86
/>
85
- <Button
87
+ <Button
86
88
variant='outline-primary'
87
89
onClick={handleSubmit}
88
90
type='submit'
@@ -103,33 +105,36 @@ const ViewFiles = ({ initialFiles, handleClose, show }) => {
103
105
)
104
106
}) }
105
107
</ListGroup> */ }
106
- < Tabs defaultActiveKey = "files" id = "document-tabs" >
107
- { documentTabs && documentTabs . map ( tab => {
108
- const { eventKey, title, status } = tab
109
- let filteredFiles = initialFiles . filter ( f => ( status === f . status ) || ( status === 'Other File' && f . status === null ) )
110
- return (
111
- < Tab eventKey = { eventKey } title = { title } className = 'p-2' >
112
- < FilesTable
113
- files = { filteredFiles }
114
- status = { status }
115
- // TODO(summercook): see above comment
116
- // handleDeleteFile={handleDeleteFile}
117
- />
118
- </ Tab >
119
- )
120
- } ) }
121
- </ Tabs >
122
- </ Offcanvas . Body >
123
- </ Offcanvas >
108
+ < Tabs defaultActiveKey = 'files' id = 'document-tabs' >
109
+ { documentTabs && documentTabs . map ( ( tab ) => {
110
+ const { eventKey, title, status } = tab
111
+ const filteredFiles = initialFiles . filter ( ( f ) => ( status === f . status ) || ( status === 'Other File' && f . status === null ) )
112
+ return (
113
+ < Tab
114
+ eventKey = { eventKey }
115
+ title = { title }
116
+ className = 'p-2'
117
+ key = { eventKey }
118
+ >
119
+ < FilesTable
120
+ files = { filteredFiles }
121
+ status = { status }
122
+ // TODO(summercook): see above comment
123
+ // handleDeleteFile={handleDeleteFile}
124
+ />
125
+ </ Tab >
126
+ )
127
+ } ) }
128
+ </ Tabs >
129
+ </ Offcanvas . Body >
130
+ </ Offcanvas >
124
131
)
125
132
}
126
133
127
134
ViewFiles . propTypes = {
128
- addClass : PropTypes . string ,
129
- }
130
-
131
- ViewFiles . defaultProps = {
132
- addClass : '' ,
135
+ initialFiles : PropTypes . shapeOf ( [ '' ] ) . isRequired ,
136
+ handleClose : PropTypes . func . isRequired ,
137
+ show : PropTypes . bool . isRequired ,
133
138
}
134
139
135
140
export default ViewFiles
0 commit comments