docbrown/app/javascript/chat/RequestManager/ChannelRequestSection.jsx
Katie Davis 76453b41fb
Updates ESLint rules to error on default imports (#12512)
* add rule

* add named imports

* more missed files

* so many files
2021-02-02 10:24:03 -05:00

48 lines
1.3 KiB
JavaScript

import { h } from 'preact';
import PropTypes from 'prop-types';
import { RequestListItem } from './RequestListItem';
export const ChannelRequestSection = ({
channelRequests,
handleRequestApproval,
handleRequestRejection,
}) => {
if (channelRequests.length < 0) {
return null;
}
return (
<div
data-testid="chat-channel-joining-request"
data-active-count={channelRequests ? channelRequests.length : 0}
>
{channelRequests &&
channelRequests.map((channelPendingRequest) => {
return (
<RequestListItem
request={channelPendingRequest}
handleRequestApproval={handleRequestApproval}
handleRequestRejection={handleRequestRejection}
/>
);
})}
</div>
);
};
ChannelRequestSection.propTypes = {
channelRequests: PropTypes.arrayOf(
PropTypes.shape({
name: PropTypes.string.isRequired,
membership_id: PropTypes.number.isRequired,
user_id: PropTypes.number.isRequired,
role: PropTypes.string.isRequired,
image: PropTypes.string.isRequired,
username: PropTypes.string.isRequired,
status: PropTypes.string.isRequired,
channel_name: PropTypes.string.isRequired,
}),
).isRequired,
handleRequestApproval: PropTypes.func.isRequired,
handleRequestRejection: PropTypes.func.isRequired,
};