Skip to content

Commit 4d80a55

Browse files
committed
delete commented code and move into branch 152-request-attachments
1 parent 6d19662 commit 4d80a55

File tree

3 files changed

+2
-94
lines changed

3 files changed

+2
-94
lines changed

src/components/FilesTable/FilesTable.jsx

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ import {
66
} from 'react-bootstrap'
77
import { allowNull } from '../../resources/utilityFunctions'
88

9-
// TODO(summer-cook):
10-
// add back handleDeleteFile to props once posting attachments/messages is working/during the work for this ticket:
11-
// https://github.com/scientist-softserv/webstore-component-library/issues/152*/
129
const FilesTable = ({ addClass, files }) => {
1310
if (files.length === 0) {
1411
return (
@@ -24,9 +21,6 @@ const FilesTable = ({ addClass, files }) => {
2421
<th>Uploaded By</th>
2522
<th>Size</th>
2623
<th>Created At</th>
27-
{/* TODO(summer-cook):
28-
- comment this back in, see comment above */}
29-
{/* <th> </th> */}
3024
</tr>
3125
</thead>
3226
<tbody>
@@ -38,16 +32,6 @@ const FilesTable = ({ addClass, files }) => {
3832
<td>{uploadedBy}</td>
3933
<td>{contentLength}</td>
4034
<td>{createdAt}</td>
41-
{/* TODO(summer-cook):
42-
- comment this back in (see above comment)
43-
- add an X icon here instead of remove text, make sure the handleDeleteFile is working */}
44-
{/* <td>
45-
<Button
46-
primary
47-
onClick={handleDeleteFile}>
48-
Remove
49-
</Button>
50-
</td> */}
5135
</tr>
5236
)
5337
})}
@@ -71,8 +55,6 @@ FilesTable.propTypes = {
7155
uuid: PropTypes.string.isRequired,
7256
}),
7357
).isRequired,
74-
// TODO(summer-cook): add this back in. see comment above.
75-
// handleDeleteFile: PropTypes.func.isRequired,
7658
}
7759

7860
FilesTable.defaultProps = {

src/compounds/ActionsGroup/ActionsGroup.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { allowNull } from '../../resources/utilityFunctions'
88
import './actions-group.scss'
99

1010
// TODO: add back handleSendingMessagesOrFiles into the props. see below TODO.
11-
const ActionsGroup = ({ initialFiles }) => {
11+
const ActionsGroup = ({ initialFiles, handleSendingMessagesOrFiles }) => {
1212
const [show, setShow] = useState(false)
1313
const [action, setAction] = useState(null)
1414

@@ -60,7 +60,7 @@ const ActionsGroup = ({ initialFiles }) => {
6060
}
6161

6262
ActionsGroup.propTypes = {
63-
// handleSendingMessagesOrFiles: PropTypes.func.isRequired,
63+
handleSendingMessagesOrFiles: PropTypes.func.isRequired,
6464
initialFiles: PropTypes.arrayOf(
6565
PropTypes.shape({
6666
contentLength: PropTypes.string.isRequired,

src/compounds/ActionsGroup/actions/ViewFiles.jsx

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
11
import React
2-
// { useState, useRef } TODO comment back in
32
from 'react'
43
import PropTypes from 'prop-types'
54
import {
6-
// Button,
7-
// CloseButton,
8-
// Form,
9-
// InputGroup,
10-
// ListGroup,
115
Offcanvas,
126
Tab,
137
Tabs,
148
} from 'react-bootstrap'
15-
// import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
169
import FilesTable from '../../../components/FilesTable/FilesTable'
17-
// import { apiV2CompatibleStrings, convertToBase64 } from '../../../resources/utilityFunctions'
1810
import { allowNull } from '../../../resources/utilityFunctions'
1911

2012
const ViewFiles = ({ initialFiles, handleClose }) => {
21-
// TODO(summercook):
22-
// - comment back in the following 2 lines & above imports once posting messages/attachments is working
23-
// const fileRef = useRef(null)
24-
// const [files, setFiles] = useState([])
25-
2613
const documentTabs = [
2714
{
2815
eventKey: 'files',
@@ -36,71 +23,12 @@ const ViewFiles = ({ initialFiles, handleClose }) => {
3623
},
3724
]
3825

39-
// TODO(summercook):
40-
// - comment back in the following 3 methods once posting messages/attachments is working
41-
// may need to use the handleSendingMessagesOrFiles to post
42-
// const handleSubmit = (event) => {
43-
// event.preventDefault()
44-
// onSubmit({ files: apiV2CompatibleStrings(files) })
45-
// }
46-
47-
// const handleAddFile = async (event) => {
48-
// event.preventDefault()
49-
// try {
50-
// // "event.target.files" returns a FileList, which looks like an array but does not respond to array methods
51-
// // except "length". we are using the spread syntax to set "files" to be an iterable array
52-
// const fileArray = [...event.target.files]
53-
// const newBase64Files = await Promise.all(convertToBase64(fileArray))
54-
// const newFiles = fileArray.map((file, index) => ({ [file.name]: newBase64Files[index] }))
55-
56-
// setFiles([...files, ...newFiles])
57-
// fileRef.current.value = ''
58-
// } catch (error) {
59-
// throw new Error(error)
60-
// }
61-
// }
62-
63-
// const handleDeleteFile = (file) => {
64-
// const remainingFiles = files.filter((obj) => obj !== file)
65-
// setFiles(remainingFiles)
66-
// }
6726
return (
6827
<Offcanvas show onHide={handleClose} placement='end' scroll='true'>
6928
<Offcanvas.Header className='d-flex border-bottom px-3 py-2 bg-light' closeButton>
7029
<Offcanvas.Title>Documents</Offcanvas.Title>
7130
</Offcanvas.Header>
7231
<Offcanvas.Body className='border rounded p-2 m-3'>
73-
{/* TODO(summercook): see above comment */}
74-
{/* <Form>
75-
<h6 className='mt-3'>Upload Additional Documents</h6>
76-
<InputGroup controlId='attachments' className='mb-3'>
77-
<Form.Control
78-
multiple
79-
type='file'
80-
onChange={handleAddFile}
81-
ref={fileRef}
82-
/>
83-
<Button
84-
variant='outline-primary'
85-
onClick={handleSubmit}
86-
type='submit'
87-
>
88-
<FontAwesomeIcon icon='fa-upload' />
89-
</Button>
90-
</InputGroup>
91-
</Form>
92-
<ListGroup variant='flush'>
93-
{files.map((file) => {
94-
const fileName = Object.keys(file)[0]
95-
96-
return (
97-
<ListGroup.Item key={fileName} className='d-flex align-items-center'>
98-
<span>{fileName}</span>
99-
<CloseButton onClick={() => handleDeleteFile(file)} className='ms-auto' />
100-
</ListGroup.Item>
101-
)
102-
})}
103-
</ListGroup> */}
10432
<Tabs defaultActiveKey='files' id='document-tabs' justify fill>
10533
{documentTabs && documentTabs.map((tab) => {
10634
const { eventKey, title, status } = tab
@@ -115,8 +43,6 @@ const ViewFiles = ({ initialFiles, handleClose }) => {
11543
<FilesTable
11644
files={filteredFiles}
11745
status={status}
118-
// TODO(summercook): see above comment
119-
// handleDeleteFile={handleDeleteFile}
12046
/>
12147
</Tab>
12248
)

0 commit comments

Comments
 (0)