Skip to content

Commit 5b7ef55

Browse files
committed
linting
1 parent 2367d66 commit 5b7ef55

File tree

3 files changed

+100
-85
lines changed

3 files changed

+100
-85
lines changed

src/components/FilesTable/FilesTable.jsx

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,64 @@
11
import React from 'react'
22
import PropTypes from 'prop-types'
3-
import { Button, Table } from 'react-bootstrap'
3+
import {
4+
// Button,
5+
Table,
6+
} from 'react-bootstrap'
47

5-
6-
const FilesTable = ({addClass, files, handleDeleteFile}) => {
8+
// TODO(summer-cook):
9+
// add back handleDeleteFile to props once posting attachments/messages is working/during the work for this ticket:
10+
// https://github.com/scientist-softserv/webstore-component-library/issues/152*/
11+
const FilesTable = ({ addClass, files }) => {
712
if (files.length === 0) {
813
return (
914
<h6 className='mt-3'>You do not have this type of document yet.</h6>
1015
)
11-
} else {
12-
return (
13-
<Table striped bordered hover size='sm' className={`${addClass}`}>
14-
<thead>
15-
<tr>
16-
<th>File Name</th>
17-
<th>Uploaded By</th>
18-
<th>Size</th>
19-
<th>Created At</th>
20-
{/* TODO(summer-cook):
21-
- comment this back in once posting attachments/messages is working/during the work for this ticket: https://github.com/scientist-softserv/webstore-component-library/issues/152*/}
22-
{/* <th> </th> */}
23-
</tr>
24-
</thead>
25-
<tbody>
26-
{files.map((file) => {
27-
const { uuid, filename, uploadedBy, contentLength, createdAt } = file
28-
return (
29-
<tr key={uuid} className='small'>
30-
<td>{filename}</td>
31-
<td>{uploadedBy}</td>
32-
<td>{contentLength}</td>
33-
<td>{createdAt}</td>
34-
{/* TODO(summer-cook):
16+
}
17+
return (
18+
<Table striped bordered hover size='sm' className={`${addClass}`}>
19+
<thead>
20+
<tr>
21+
<th>File Name</th>
22+
<th>Uploaded By</th>
23+
<th>Size</th>
24+
<th>Created At</th>
25+
{/* TODO(summer-cook):
26+
- comment this back in, see comment above */}
27+
{/* <th> </th> */}
28+
</tr>
29+
</thead>
30+
<tbody>
31+
{files.map((file) => {
32+
const { uuid, filename, uploadedBy, contentLength, createdAt } = file
33+
return (
34+
<tr key={uuid} className='small'>
35+
<td>{filename}</td>
36+
<td>{uploadedBy}</td>
37+
<td>{contentLength}</td>
38+
<td>{createdAt}</td>
39+
{/* TODO(summer-cook):
3540
- comment this back in (see above comment)
3641
- add an X icon here instead of remove text, make sure the handleDeleteFile is working */}
37-
{/* <td>
38-
<Button
42+
{/* <td>
43+
<Button
3944
primary
4045
onClick={handleDeleteFile}>
4146
Remove
4247
</Button>
4348
</td> */}
44-
</tr>
45-
)
46-
})}
47-
</tbody>
48-
</Table>
49-
)
50-
}}
49+
</tr>
50+
)
51+
})}
52+
</tbody>
53+
</Table>
54+
)
55+
}
5156

5257
FilesTable.propTypes = {
5358
addClass: PropTypes.string,
59+
files: PropTypes.shapeOf(['']).isRequired,
60+
// TODO(summer-cook): add this back in. see comment above.
61+
// handleDeleteFile: PropTypes.func.isRequired,
5462
}
5563

5664
FilesTable.defaultProps = {

src/compounds/ActionsGroup/ActionsGroup.jsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import React, { useState } from 'react'
22
import PropTypes from 'prop-types'
33
import { ListGroup } from 'react-bootstrap'
44
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
5-
import SendMessage from './actions/SendMessage'
5+
// import SendMessage from './actions/SendMessage'
66
import ViewFiles from './actions/ViewFiles'
77
import './actions-group.scss'
88

9-
const ActionsGroup = ({ initialFiles, handleSendingMessagesOrFiles }) => {
9+
// TODO: add back handleSendingMessagesOrFiles into the props. see below TODO.
10+
const ActionsGroup = ({ initialFiles }) => {
11+
console.log('initialfiles', initialFiles)
1012
const [show, setShow] = useState(false)
1113
const [action, setAction] = useState(null)
1214

@@ -23,8 +25,7 @@ const ActionsGroup = ({ initialFiles, handleSendingMessagesOrFiles }) => {
2325
<>
2426
<ListGroup className='actions-group'>
2527
{/* TODO(@summercook): return the this and the below commented code
26-
once the direction of https://github.com/scientist-softserv/webstore/issues/156
27-
has been decided */}
28+
once we are able to refactor posting messages & attachments */}
2829
{/* <ListGroup.Item action variant='primary' onClick={() => handleShow('SendMessage')}>
2930
<FontAwesomeIcon icon='fa-envelope' />
3031
Send Message
@@ -52,15 +53,16 @@ const ActionsGroup = ({ initialFiles, handleSendingMessagesOrFiles }) => {
5253
show={show}
5354
handleClose={handleClose}
5455
initialFiles={initialFiles}
55-
//onSubmit={handleSendingMessagesOrFiles}
56+
// onSubmit={handleSendingMessagesOrFiles}
5657
/>
5758
)}
5859
</>
5960
)
6061
}
6162

62-
// ActionsGroup.propTypes = {
63-
//handleSendingMessages: PropTypes.func.isRequired,
64-
// }
63+
ActionsGroup.propTypes = {
64+
// handleSendingMessagesOrFiles: PropTypes.func.isRequired,
65+
initialFiles: PropTypes.shapeOf(['']).isRequired,
66+
}
6567

6668
export default ActionsGroup
Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,46 @@
1-
import React, { useState, useRef } from 'react'
1+
import React
2+
// { useState, useRef } TODO comment back in
3+
from 'react'
24
import PropTypes from 'prop-types'
3-
import {
5+
import {
46
// Button,
57
// CloseButton,
68
// Form,
79
// InputGroup,
810
// ListGroup,
911
Offcanvas,
1012
Tab,
11-
Tabs } from 'react-bootstrap'
13+
Tabs,
14+
} from 'react-bootstrap'
1215
// import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
1316
import FilesTable from '../../../components/FilesTable/FilesTable'
1417
// import { apiV2CompatibleStrings, convertToBase64 } from '../../../resources/utilityFunctions'
1518

1619
const ViewFiles = ({ initialFiles, handleClose, show }) => {
17-
// TODO(summercook):
20+
// TODO(summercook):
1821
// - comment back in the following 2 lines & above imports once posting messages/attachments is working
1922
// const fileRef = useRef(null)
2023
// const [files, setFiles] = useState([])
2124
const documentTabs = [
2225
{
2326
eventKey: 'files',
2427
title: 'Attachments',
25-
status: 'Other File'
28+
status: 'Other File',
2629
},
2730
{
2831
eventKey: 'status-updates',
2932
title: 'Status Updates',
30-
status: 'Status Update'
33+
status: 'Status Update',
3134
},
3235
{
3336
eventKey: 'payment-status-files',
3437
title: 'Payment Status Files',
3538
// 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',
3740
},
3841
]
3942

40-
// TODO(summercook):
43+
// TODO(summercook):
4144
// - comment back in the following 3 methods once posting messages/attachments is working
4245
// may need to use the handleSendingMessagesOrFiles to post
4346
// const handleSubmit = (event) => {
@@ -60,20 +63,19 @@ const ViewFiles = ({ initialFiles, handleClose, show }) => {
6063
// throw new Error(error)
6164
// }
6265
// }
63-
66+
6467
// const handleDeleteFile = (file) => {
6568
// const remainingFiles = files.filter((obj) => obj !== file)
6669
// setFiles(remainingFiles)
6770
// }
68-
6971
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>
7779
<h6 className='mt-3'>Upload Additional Documents</h6>
7880
<InputGroup controlId='attachments' className='mb-3'>
7981
<Form.Control
@@ -82,7 +84,7 @@ const ViewFiles = ({ initialFiles, handleClose, show }) => {
8284
onChange={handleAddFile}
8385
ref={fileRef}
8486
/>
85-
<Button
87+
<Button
8688
variant='outline-primary'
8789
onClick={handleSubmit}
8890
type='submit'
@@ -103,33 +105,36 @@ const ViewFiles = ({ initialFiles, handleClose, show }) => {
103105
)
104106
})}
105107
</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>
124131
)
125132
}
126133

127134
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,
133138
}
134139

135140
export default ViewFiles

0 commit comments

Comments
 (0)